Skip to content

Commit a39a670

Browse files
committed
chore: Add test with default value
1 parent c2ed4b1 commit a39a670

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

tests/src/integration/interface/interface.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99

1010
final class Test extends Exception implements ExtPhpRs\Interface\EmptyObjectInterface
1111
{
12+
public function __construct()
13+
{
14+
}
15+
1216
public static function void(): void
1317
{
1418
}
@@ -24,6 +28,10 @@ public function refToLikeThisClass(
2428
): string {
2529
return sprintf('%s | %s', $this->nonStatic($data), $other->nonStatic($data));
2630
}
31+
32+
public function setValue(?int $value = 0) {
33+
34+
}
2735
}
2836
$f = new Test();
2937

tests/src/integration/interface/mod.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use ext_php_rs::types::ZendClassObject;
22
use ext_php_rs::zend::ce;
3-
use ext_php_rs::{php_class, php_impl, php_interface};
4-
use ext_php_rs::{php_module, prelude::ModuleBuilder};
3+
use ext_php_rs::php_interface;
4+
use ext_php_rs::prelude::ModuleBuilder;
55

66
#[php_interface]
77
#[php(extends(ce = ce::throwable, stub = "\\Throwable"))]
@@ -20,6 +20,9 @@ pub trait EmptyObjectTrait {
2020
data: String,
2121
other: &ZendClassObject<PhpInterfaceEmptyObjectTrait>,
2222
) -> String;
23+
24+
#[php(defaults(value = 0))]
25+
fn set_value(&mut self, value: i32);
2326
}
2427

2528
pub fn build_module(builder: ModuleBuilder) -> ModuleBuilder {

0 commit comments

Comments
 (0)