-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improved error message for typed class properties with null as defaul…
…t value Closes GH-6396.
- Loading branch information
1 parent
94938e4
commit 6d6fade
Showing
2 changed files
with
20 additions
and
2 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
Zend/tests/nullable_types/union_nullable_property_fails.phpt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--TEST-- | ||
Nullable default property error message | ||
--FILE-- | ||
<?php | ||
|
||
class A { | ||
public string|int $b = null; | ||
} | ||
|
||
$t = new A; | ||
$t->b; | ||
|
||
?> | ||
--EXPECTF-- | ||
Fatal error: Default value for property of type string|int may not be null. Use the nullable type string|int|null to allow null default value in %s on line %d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters