-
Notifications
You must be signed in to change notification settings - Fork 482
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix checking overriden method signature when method-level generics ar…
…e involved
- Loading branch information
1 parent
3a57521
commit 1c2b727
Showing
6 changed files
with
227 additions
and
6 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,40 @@ | ||
<?php | ||
|
||
namespace Bug4017; | ||
|
||
/** | ||
* @template T | ||
*/ | ||
interface DoctrineEntityRepository | ||
{ | ||
|
||
} | ||
|
||
interface DoctrineEntityManagerInterface | ||
{ | ||
/** | ||
* @template T | ||
* @param class-string<T> $className | ||
* @return DoctrineEntityRepository<T> | ||
*/ | ||
public function getRepository(string $className): DoctrineEntityRepository; | ||
} | ||
|
||
|
||
/** | ||
* @phpstan-template TEntityClass | ||
* @phpstan-extends DoctrineEntityRepository<TEntityClass> | ||
*/ | ||
interface MyEntityRepositoryInterface extends DoctrineEntityRepository | ||
{ | ||
} | ||
|
||
interface MyEntityManagerInterface extends DoctrineEntityManagerInterface | ||
{ | ||
/** | ||
* @template T | ||
* @param class-string<T> $className | ||
* @return MyEntityRepositoryInterface<T> | ||
*/ | ||
public function getRepository(string $className): MyEntityRepositoryInterface; | ||
} |
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,56 @@ | ||
<?php | ||
|
||
namespace Bug4017_2; | ||
|
||
class Foo | ||
{ | ||
|
||
} | ||
|
||
/** | ||
* @template T | ||
*/ | ||
class Bar | ||
{ | ||
|
||
/** | ||
* @param T $a | ||
*/ | ||
public function doFoo($a) | ||
{ | ||
|
||
} | ||
|
||
} | ||
|
||
/** | ||
* @extends Bar<Foo> | ||
*/ | ||
class Baz extends Bar | ||
{ | ||
|
||
/** | ||
* @param Foo $a | ||
*/ | ||
public function doFoo($a) | ||
{ | ||
|
||
} | ||
|
||
} | ||
|
||
/** | ||
* @extends Bar<\stdClass> | ||
*/ | ||
class Lorem extends Bar | ||
{ | ||
|
||
/** | ||
* @param Foo $a | ||
*/ | ||
public function doFoo($a) | ||
{ | ||
|
||
} | ||
|
||
} |
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,50 @@ | ||
<?php | ||
|
||
namespace Bug4017_3; | ||
|
||
class Foo | ||
{ | ||
|
||
} | ||
|
||
class Bar | ||
{ | ||
|
||
/** | ||
* @template T of Foo | ||
* @param T $a | ||
*/ | ||
public function doFoo($a) | ||
{ | ||
|
||
} | ||
|
||
} | ||
|
||
class Baz extends Bar | ||
{ | ||
|
||
/** | ||
* @template T of Foo | ||
* @param T $a | ||
*/ | ||
public function doFoo($a) | ||
{ | ||
|
||
} | ||
|
||
} | ||
|
||
class Lorem extends Bar | ||
{ | ||
|
||
/** | ||
* @template T of \stdClass | ||
* @param T $a | ||
*/ | ||
public function doFoo($a) | ||
{ | ||
|
||
} | ||
|
||
} |
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,30 @@ | ||
<?php | ||
|
||
namespace Bug4023; | ||
|
||
interface A | ||
{ | ||
/** | ||
* @template T of object | ||
* | ||
* @param mixed[]|T $data | ||
* | ||
* @return T | ||
*/ | ||
public function x($data): object; | ||
} | ||
|
||
final class B implements A | ||
{ | ||
/** | ||
* @template T of object | ||
* | ||
* @param mixed[]|T $data | ||
* | ||
* @return T | ||
*/ | ||
public function x($data): object | ||
{ | ||
throw new \Exception(); | ||
} | ||
} |