From 7d5e0e668cdc7ee796213125c5ebd08fab28c4fd Mon Sep 17 00:00:00 2001 From: spiralbot Date: Tue, 18 Jul 2023 12:14:33 +0000 Subject: [PATCH] Merge pull request #952 from msmakouz/fix-psalm-issues --- src/AbstractLocator.php | 2 -- src/Bootloader/TokenizerBootloader.php | 4 ---- src/Bootloader/TokenizerListenerBootloader.php | 1 - src/EnumLocator.php | 3 ++- 4 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/AbstractLocator.php b/src/AbstractLocator.php index 5dfedeb..f2915a7 100644 --- a/src/AbstractLocator.php +++ b/src/AbstractLocator.php @@ -109,8 +109,6 @@ protected function classReflection(string $class): \ReflectionClass * * @param class-string $enum * - * @return \ReflectionEnum - * * @throws LocatorException */ protected function enumReflection(string $enum): \ReflectionEnum diff --git a/src/Bootloader/TokenizerBootloader.php b/src/Bootloader/TokenizerBootloader.php index ab86a2a..b4ad211 100644 --- a/src/Bootloader/TokenizerBootloader.php +++ b/src/Bootloader/TokenizerBootloader.php @@ -49,13 +49,9 @@ public function __construct( public function init(BinderInterface $binder, DirectoriesInterface $dirs): void { - /** @psalm-suppress InvalidCast https://github.com/vimeo/psalm/issues/8810 */ $binder->bindInjector(ClassLocator::class, ClassLocatorInjector::class); - /** @psalm-suppress InvalidCast https://github.com/vimeo/psalm/issues/8810 */ $binder->bindInjector(EnumLocator::class, EnumLocatorInjector::class); - /** @psalm-suppress InvalidCast https://github.com/vimeo/psalm/issues/8810 */ $binder->bindInjector(InterfaceLocator::class, InterfaceLocatorInjector::class); - /** @psalm-suppress InvalidCast https://github.com/vimeo/psalm/issues/8810 */ $binder->bindInjector(InvocationLocator::class, InvocationLocatorInjector::class); $this->config->setDefaults( diff --git a/src/Bootloader/TokenizerListenerBootloader.php b/src/Bootloader/TokenizerListenerBootloader.php index 9ab9c76..4880253 100644 --- a/src/Bootloader/TokenizerListenerBootloader.php +++ b/src/Bootloader/TokenizerListenerBootloader.php @@ -154,7 +154,6 @@ private function loadInterfaces( } /** - * @param ListenerInvoker $invoker * @param callable(): array $reflections * @param callable(TokenizationListenerInterface): bool $loader */ diff --git a/src/EnumLocator.php b/src/EnumLocator.php index f9d03cd..cae344c 100644 --- a/src/EnumLocator.php +++ b/src/EnumLocator.php @@ -65,12 +65,13 @@ protected function availableEnums(): array */ protected function isTargeted(\ReflectionEnum $enum, \ReflectionClass $target = null): bool { - if (empty($target)) { + if ($target === null) { return true; } if (!$target->isTrait()) { //Target is interface or class + /** @psalm-suppress RedundantCondition https://github.com/vimeo/psalm/issues/9489 */ return $enum->isSubclassOf($target) || $enum->getName() === $target->getName(); }