forked from phan/phan
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add more checks to DuplicateExpressionPlugin
Fixes phan#2691
- Loading branch information
1 parent
6358637
commit 13f3020
Showing
6 changed files
with
107 additions
and
13 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
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
5 changes: 5 additions & 0 deletions
5
tests/plugin_test/expected/118_more_isset_checks.php.expected
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,5 @@ | ||
src/118_more_isset_checks.php:2 PhanUnreferencedFunction Possibly zero references to function \example118() | ||
src/118_more_isset_checks.php:3 PhanPluginDuplicateConditionalNullCoalescing "isset(X) ? X : Y" can usually be simplified to "X ?? Y" in PHP 7. The duplicated expression X was $arg | ||
src/118_more_isset_checks.php:4 PhanPluginDuplicateConditionalNullCoalescing "!is_null(X) ? X : Y" can usually be simplified to "X ?? Y" in PHP 7. The duplicated expression X was $arg | ||
src/118_more_isset_checks.php:5 PhanPluginDuplicateConditionalNullCoalescing "X !== null ? X : Y" can usually be simplified to "X ?? Y" in PHP 7. The duplicated expression X was $arg | ||
src/118_more_isset_checks.php:6 PhanPluginDuplicateConditionalNullCoalescing "null !== X ? X : Y" can usually be simplified to "X ?? Y" in PHP 7. The duplicated expression X was $arg |
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,7 @@ | ||
<?php | ||
function example118(?string $arg) { | ||
echo isset($arg) ? $arg : 'default'; | ||
echo !is_null($arg) ? $arg : 'default'; | ||
echo ($arg !== null) ? $arg : 'default'; | ||
echo (null !== $arg) ? $arg : 'default'; | ||
} |