Skip to content

Commit

Permalink
Merge pull request #952 from msmakouz/fix-psalm-issues
Browse files Browse the repository at this point in the history
  • Loading branch information
spiralbot committed Jul 18, 2023
1 parent de0abb0 commit 7d5e0e6
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 8 deletions.
2 changes: 0 additions & 2 deletions src/AbstractLocator.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,6 @@ protected function classReflection(string $class): \ReflectionClass
*
* @param class-string $enum
*
* @return \ReflectionEnum
*
* @throws LocatorException
*/
protected function enumReflection(string $enum): \ReflectionEnum
Expand Down
4 changes: 0 additions & 4 deletions src/Bootloader/TokenizerBootloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
1 change: 0 additions & 1 deletion src/Bootloader/TokenizerListenerBootloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ private function loadInterfaces(
}

/**
* @param ListenerInvoker $invoker
* @param callable(): array<class-string, \ReflectionClass> $reflections
* @param callable(TokenizationListenerInterface): bool $loader
*/
Expand Down
3 changes: 2 additions & 1 deletion src/EnumLocator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down

0 comments on commit 7d5e0e6

Please sign in to comment.