BruceGitHub /
namespace-protector
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace NamespaceProtector\Rule; |
||
| 6 | |||
| 7 | use NamespaceProtector\Entry\Entry; |
||
| 8 | use NamespaceProtector\Config\Config; |
||
| 9 | use NamespaceProtector\Db\BooleanMatchNameSpace; |
||
| 10 | use NamespaceProtector\Parser\Node\MatchedResult; |
||
| 11 | use NamespaceProtector\Db\MatchCollectionInterface; |
||
| 12 | use NamespaceProtector\Parser\Node\MatchedResultInterface; |
||
| 13 | use NamespaceProtector\Parser\Node\Event\EventProcessNodeInterface; |
||
| 14 | |||
| 15 | class IsInPrivateConfiguredEntries implements RuleInterface |
||
| 16 | { |
||
| 17 | public function __construct(private Config $config) |
||
| 18 | { |
||
| 19 | } |
||
| 20 | |||
| 21 | public function apply(Entry $entry, EventProcessNodeInterface $event): bool |
||
| 22 | { |
||
| 23 | /** @var MatchedResult */ |
||
| 24 | $result = $this->isInPrivateConfiguredEntries($entry, new BooleanMatchNameSpace()); |
||
| 25 | |||
| 26 | if ($result->matched()) { |
||
| 27 | $event->foundError($result->getInfo()); |
||
|
0 ignored issues
–
show
|
|||
| 28 | return true; |
||
| 29 | } |
||
| 30 | |||
| 31 | return false; |
||
| 32 | } |
||
| 33 | |||
| 34 | private function isInPrivateConfiguredEntries(Entry $currentNamespaceAccess, MatchCollectionInterface $macher): MatchedResultInterface |
||
| 35 | { |
||
| 36 | return $macher->evaluate($this->config->getPrivateEntries(), $currentNamespaceAccess); |
||
| 37 | } |
||
| 38 | } |
||
| 39 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.