-
Notifications
You must be signed in to change notification settings - Fork 518
use conditional parameter for is_a() via stub #1306
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
Changes from 1 commit
6bbb2a6
b17aa8d
49610a6
49cb07b
6078953
93b4674
b3dd3f3
e569f1e
3460b04
d1155f3
34029c5
7c30478
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Bug4371; | ||
|
||
use function PHPStan\Testing\assertType; | ||
|
||
class HelloWorld | ||
{ | ||
/** | ||
* @param Exception $exception | ||
* @param class-string $classString | ||
*/ | ||
public function sayHello(Exception $exception, $classString, string $s): void | ||
{ | ||
assertType('bool', is_a($exception, $classString)); | ||
assertType('bool', is_a($exception, $classString, true)); | ||
assertType('bool', is_a($exception, $classString, false)); | ||
|
||
$exceptionClass = get_class($exception); | ||
assertType('false', is_a($exceptionClass, $classString)); | ||
assertType('bool', is_a($exceptionClass, $classString, true)); | ||
assertType('false', is_a($exceptionClass, $classString, false)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. with 3e955af I dropped the conditional return type stub again, as I am no longer sure its worth to report about since we already have extensions for |
||
|
||
assertType('false', is_a($exceptionClass, $s)); | ||
assertType('bool', is_a($exceptionClass, $s, true)); | ||
assertType('false', is_a($exceptionClass, $s, false)); | ||
} | ||
} |
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.
stub taken 1:1 from psalm
Uh oh!
There was an error while loading. Please reload this page.
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.
update: psalm was missing the type for $allow_string, which will be added with vimeo/psalm#7951