5
5
use unittest \{Assert , Test , Values , Action };
6
6
7
7
class ParameterTest extends EmittingTest {
8
+ use NullableSupport;
8
9
9
10
/**
10
11
* Helper to declare a type and return a parameter reflection object
@@ -49,12 +50,12 @@ public function value_typed() {
49
50
50
51
#[Test]
51
52
public function value_type_with_null () {
52
- Assert::equals (new XPClass (Value::class), $ this ->param ('Value $param= null ' )->getType ());
53
+ Assert::equals ($ this -> nullable ( new XPClass (Value::class) ), $ this ->param ('Value $param= null ' )->getType ());
53
54
}
54
55
55
56
#[Test]
56
57
public function nullable_value_type () {
57
- Assert::equals (new XPClass (Value::class), $ this ->param ('?Value $param ' )->getType ());
58
+ Assert::equals ($ this -> nullable ( new XPClass (Value::class) ), $ this ->param ('?Value $param ' )->getType ());
58
59
}
59
60
60
61
#[Test]
@@ -64,17 +65,17 @@ public function string_typed() {
64
65
65
66
#[Test]
66
67
public function string_typed_with_null () {
67
- Assert::equals (Primitive::$ STRING , $ this ->param ('string $param= null ' )->getType ());
68
+ Assert::equals ($ this -> nullable ( Primitive::$ STRING ) , $ this ->param ('string $param= null ' )->getType ());
68
69
}
69
70
70
71
#[Test]
71
72
public function nullable_string_type () {
72
- Assert::equals (Primitive::$ STRING , $ this ->param ('?string $param ' )->getType ());
73
+ Assert::equals ($ this -> nullable ( Primitive::$ STRING ) , $ this ->param ('?string $param ' )->getType ());
73
74
}
74
75
75
76
#[Test, Action(eval: 'new RuntimeVersion(">=7.1") ' )]
76
77
public function nullable_string_type_restriction () {
77
- Assert::equals (Primitive::$ STRING , $ this ->param ('?string $param ' )->getTypeRestriction ());
78
+ Assert::equals ($ this -> nullable ( Primitive::$ STRING ) , $ this ->param ('?string $param ' )->getTypeRestriction ());
78
79
}
79
80
80
81
#[Test]
0 commit comments