-
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.
Fix missing "Optional parameter before required" deprecation on union…
… null type The check would only work for the ?type syntax, but not type|null. Switch to a check during type compilation instead. Fixes GH-11488 Closes GH-11497
- Loading branch information
Showing
3 changed files
with
59 additions
and
25 deletions.
There are no files selected for viewing
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
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,21 @@ | ||
--TEST-- | ||
GH-11488: "Optional parameter before required" warning for union nullable type | ||
--FILE-- | ||
<?php | ||
function a( | ||
string|null $a = null, | ||
$b, | ||
) {} | ||
function b( | ||
Foo&Bar $c = null, | ||
$d, | ||
) {} | ||
function c( | ||
(Foo&Bar)|null $e = null, | ||
$f, | ||
) {} | ||
?> | ||
--EXPECTF-- | ||
Deprecated: Optional parameter $a declared before required parameter $b is implicitly treated as a required parameter in %s on line %d | ||
|
||
Deprecated: Optional parameter $e declared before required parameter $f is implicitly treated as a required parameter 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