-
Notifications
You must be signed in to change notification settings - Fork 460
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MethodAssertRule - do not report implicitly inherited assert tags
- Loading branch information
1 parent
d2c30d1
commit 299df51
Showing
6 changed files
with
62 additions
and
8 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
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,35 @@ | ||
<?php | ||
|
||
namespace Bug10573; | ||
|
||
/** | ||
* @template TAttribute of string | ||
* @template TSubject of mixed | ||
*/ | ||
abstract class Voter | ||
{ | ||
/** | ||
* Determines if the attribute and subject are supported by this voter. | ||
* | ||
* @param string $attribute | ||
* @param mixed $subject | ||
* | ||
* @phpstan-assert-if-true TSubject $subject | ||
* @phpstan-assert-if-true TAttribute $attribute | ||
* | ||
* @return bool | ||
*/ | ||
abstract protected function supports(string $attribute, $subject); | ||
} | ||
|
||
class Post {} | ||
|
||
/** | ||
* @extends Voter<string, Post> | ||
*/ | ||
class PostVoter extends Voter { | ||
function supports($attribute, $subject): bool | ||
{ | ||
return $attribute === 'POST_READ' && $subject instanceof Post; | ||
} | ||
} |