-
Notifications
You must be signed in to change notification settings - Fork 494
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "assert a invalid constant turns into mixed"
This reverts commit 42307ceab4c12bf1b0c83f8b13be26ea7951b565.
- Loading branch information
Showing
2 changed files
with
1 addition
and
8 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 |
---|---|---|
@@ -1,11 +1,5 @@ | ||
<?php | ||
|
||
use function PHPStan\Testing\assertType; | ||
|
||
function doFoo(mixed $filter): void { | ||
assertType('non-falsy-string|false', filter_var("no", FILTER_VALIDATE_REGEXP)); | ||
|
||
// if FILTER_SANITIZE_MAGIC_QUOTES would contain a valid value, the following line would yield "string|false". | ||
// but since in phpstan bootstrap file the constant was miss-defined with a invalid value, PHPStan does not know the constant and returns "mixed", like for regular unknown constants. | ||
assertType('mixed', filter_var($filter, FILTER_SANITIZE_MAGIC_QUOTES)); | ||
\PHPStan\Testing\assertType('non-falsy-string|false', filter_var("no", FILTER_VALIDATE_REGEXP)); | ||
} |