-
Notifications
You must be signed in to change notification settings - Fork 486
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ObjectType - different priority in iterable key and iterable value
- Loading branch information
1 parent
a0d1248
commit 1256192
Showing
4 changed files
with
72 additions
and
46 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php declare(strict_types = 1); // lint >= 8.0 | ||
|
||
namespace Bug6494; | ||
|
||
use function PHPStan\Testing\assertType; | ||
|
||
// To get rid of warnings about using new static() | ||
interface SomeInterface { | ||
public function __construct(); | ||
} | ||
|
||
class Base implements SomeInterface { | ||
|
||
public function __construct() {} | ||
|
||
/** | ||
* @return \Generator<int, static, void, void> | ||
*/ | ||
public static function instances() { | ||
yield new static(); | ||
} | ||
} | ||
|
||
function (): void { | ||
foreach ((new Base())::instances() as $h) { | ||
assertType(Base::class, $h); | ||
} | ||
}; | ||
|
||
class Extension extends Base { | ||
|
||
} | ||
|
||
function (): void { | ||
foreach ((new Extension())::instances() as $h) { | ||
assertType(Extension::class, $h); | ||
} | ||
}; |