-
Notifications
You must be signed in to change notification settings - Fork 426
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not infer anything when context is falsy
- Loading branch information
1 parent
a355aaa
commit 86f84ce
Showing
3 changed files
with
58 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace Comparison\Bug6891; | ||
|
||
class HelloWorld | ||
{ | ||
|
||
/** | ||
* @param mixed $context | ||
*/ | ||
public function sayHello($context): bool | ||
{ | ||
if (is_subclass_of($context, HelloWorld::class)) { | ||
return true; | ||
} | ||
|
||
return HelloWorld::class === $context; | ||
} | ||
|
||
/** | ||
* @param mixed $context | ||
*/ | ||
public function sayHello2($context): bool | ||
{ | ||
if (is_subclass_of($context, HelloWorld::class)) { | ||
return true; | ||
} | ||
|
||
return HelloWorld::class === $context::class; | ||
} | ||
|
||
public function sayHello3(object $context): bool | ||
{ | ||
if (is_subclass_of($context, HelloWorld::class)) { | ||
return true; | ||
} | ||
|
||
return HelloWorld::class === $context::class; | ||
} | ||
|
||
public function sayHello4(string $context): bool | ||
{ | ||
if (is_subclass_of($context, HelloWorld::class)) { | ||
return true; | ||
} | ||
|
||
return HelloWorld::class === $context; | ||
} | ||
} |