-
Notifications
You must be signed in to change notification settings - Fork 519
Fix args are mistakenly handled as immediately-invoked #4145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+309
−3
Merged
Changes from 17 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
b8bbcc0
Fix args are mistakenly handled as immediately-invoked
staabm 58edcdb
Update missing-exception-function-throws.php
staabm a6530cf
test impurePoints
staabm a6b5e73
more pureness tests for all code paths
staabm 8369e59
Update PureFunctionRuleTest.php
staabm 1238402
Don't handle native functions as immediately-invoked by default
staabm 381d078
Added regression test
staabm 1b1325f
added regression test
staabm e1cce58
fix
staabm 068adb8
Update core.stub
staabm bec39e5
Update core.stub
staabm 8119947
Update core.stub
staabm b2822bd
Update core.stub
staabm d11ab42
Update core.stub
staabm 9b938c3
Added regression test
staabm fde93f8
Update bug-13307.php
staabm cd46553
address feedback
staabm 588f78c
lazier
staabm 6414dc5
Added regression test
staabm 255a863
Update phpstan-baseline.neon
staabm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,11 @@ | ||
<?php // lint >= 8.1 | ||
|
||
namespace Bug13288; | ||
|
||
function error_to_exception(int $errno, string $errstr, string $errfile = 'unknown', int $errline = 0): never { | ||
throw new \ErrorException($errstr, $errno, $errno, $errfile, $errline); | ||
} | ||
|
||
set_error_handler(error_to_exception(...)); | ||
|
||
echo 'ok'; |
This file contains hidden or 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,24 @@ | ||
<?php | ||
|
||
namespace Bug13307; | ||
|
||
function dd(): never { | ||
exit(1); | ||
} | ||
|
||
class HelloWorld | ||
{ | ||
public function testMethod(): string | ||
{ | ||
var_dump("\Bug13307\dd"); | ||
|
||
return "test"; | ||
} | ||
|
||
public function testMethod2(): string | ||
{ | ||
var_dump("\Bug13307\DD"); | ||
|
||
return "test"; | ||
} | ||
} |
This file contains hidden or 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,14 @@ | ||
<?php | ||
|
||
namespace Bug13311; | ||
|
||
use Exception; | ||
|
||
$error_handler = static function () { throw new Exception(); }; | ||
set_error_handler($error_handler, \E_NOTICE | \E_WARNING); | ||
|
||
try { | ||
$out = iconv($from, $to . $iconv_options, $str); | ||
} catch (Throwable $e) { | ||
$out = false; | ||
} |
This file contains hidden or 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,12 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace Bug13331; | ||
|
||
$signalHandler = function () { | ||
exit(); | ||
}; | ||
|
||
pcntl_async_signals(true); | ||
pcntl_signal(SIGINT, $signalHandler); | ||
pcntl_signal(SIGQUIT, $signalHandler); | ||
pcntl_signal(SIGTERM, $signalHandler); |
This file contains hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need to go into intersections. Once one of the intersected types is callable, the whole type is callable.