Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ee1b290

Browse filesBrowse files
committed
Address review comments
1 parent 4ac943b commit ee1b290
Copy full SHA for ee1b290

File tree

4 files changed

+21
-9
lines changed
Filter options

4 files changed

+21
-9
lines changed

‎Zend/tests/type_declarations/standalone_null.phpt

Copy file name to clipboardExpand all lines: Zend/tests/type_declarations/standalone_null.phpt
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,5 @@ function test(null $v): null {
1010
var_dump(test(null));
1111

1212
?>
13-
===DONE===
1413
--EXPECT--
1514
NULL
16-
===DONE===

‎Zend/tests/type_declarations/typed_properties_110.phpt

Copy file name to clipboardExpand all lines: Zend/tests/type_declarations/typed_properties_110.phpt
+9-2Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,14 @@ class Foo {
77
}
88

99
$foo = new Foo();
10+
$foo->value = null;
11+
12+
try {
13+
$foo->value = 1;
14+
} catch (\TypeError $e) {
15+
echo $e->getMessage();
16+
}
17+
1018
?>
11-
===DONE===
1219
--EXPECT--
13-
===DONE===
20+
Cannot assign int to property Foo::$value of type null

‎Zend/tests/type_declarations/typed_properties_111.phpt

Copy file name to clipboardExpand all lines: Zend/tests/type_declarations/typed_properties_111.phpt
+9-2Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,14 @@ class Foo {
77
}
88

99
$foo = new Foo();
10+
$foo->value = false;
11+
12+
try {
13+
$foo->value = true;
14+
} catch (\TypeError $e) {
15+
echo $e->getMessage();
16+
}
17+
1018
?>
11-
===DONE===
1219
--EXPECT--
13-
===DONE===
20+
Cannot assign bool to property Foo::$value of type false

‎Zend/zend_compile.c

Copy file name to clipboardExpand all lines: Zend/zend_compile.c
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6188,11 +6188,11 @@ static bool zend_type_contains_traversable(zend_type type) {
61886188
static zend_type zend_compile_typename(
61896189
zend_ast *ast, bool force_allow_null) /* {{{ */
61906190
{
6191-
bool is_marked_nullable = false;
6191+
bool is_marked_nullable = ast->attr & ZEND_TYPE_NULLABLE;
61926192
zend_ast_attr orig_ast_attr = ast->attr;
61936193
zend_type type = ZEND_TYPE_INIT_NONE(0);
6194-
if (ast->attr & ZEND_TYPE_NULLABLE) {
6195-
is_marked_nullable = true;
6194+
6195+
if (is_marked_nullable) {
61966196
ast->attr &= ~ZEND_TYPE_NULLABLE;
61976197
}
61986198

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.