Skip to content

Commit

Permalink
UnionTypeHelper - prevent infinite recursion
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed May 15, 2024
1 parent b8a871d commit bb3da26
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Type/UnionTypeHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,10 @@ public static function sortTypes(array $types): array
return self::compareStrings($a->describe(VerbosityLevel::value()), $b->describe(VerbosityLevel::value()));
}

if ($a->isCallable()->yes() && $b->isCallable()->yes()) {
if (
($a instanceof CallableType || $a instanceof ClosureType)

Check failure on line 113 in src/Type/UnionTypeHelper.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.3)

Doing instanceof PHPStan\Type\CallableType is error-prone and deprecated. Use Type::isCallable() and Type::getCallableParametersAcceptors() instead.

Check failure on line 113 in src/Type/UnionTypeHelper.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.2)

Doing instanceof PHPStan\Type\CallableType is error-prone and deprecated. Use Type::isCallable() and Type::getCallableParametersAcceptors() instead.

Check failure on line 113 in src/Type/UnionTypeHelper.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.1)

Doing instanceof PHPStan\Type\CallableType is error-prone and deprecated. Use Type::isCallable() and Type::getCallableParametersAcceptors() instead.

Check failure on line 113 in src/Type/UnionTypeHelper.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.3, ubuntu-latest)

Doing instanceof PHPStan\Type\CallableType is error-prone and deprecated. Use Type::isCallable() and Type::getCallableParametersAcceptors() instead.

Check failure on line 113 in src/Type/UnionTypeHelper.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.2, ubuntu-latest)

Doing instanceof PHPStan\Type\CallableType is error-prone and deprecated. Use Type::isCallable() and Type::getCallableParametersAcceptors() instead.

Check failure on line 113 in src/Type/UnionTypeHelper.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.0, ubuntu-latest)

Doing instanceof PHPStan\Type\CallableType is error-prone and deprecated. Use Type::isCallable() and Type::getCallableParametersAcceptors() instead.

Check failure on line 113 in src/Type/UnionTypeHelper.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.1, ubuntu-latest)

Doing instanceof PHPStan\Type\CallableType is error-prone and deprecated. Use Type::isCallable() and Type::getCallableParametersAcceptors() instead.

Check failure on line 113 in src/Type/UnionTypeHelper.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.4, ubuntu-latest)

Doing instanceof PHPStan\Type\CallableType is error-prone and deprecated. Use Type::isCallable() and Type::getCallableParametersAcceptors() instead.

Check failure on line 113 in src/Type/UnionTypeHelper.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.3, ubuntu-latest)

Doing instanceof PHPStan\Type\CallableType is error-prone and deprecated. Use Type::isCallable() and Type::getCallableParametersAcceptors() instead.

Check failure on line 113 in src/Type/UnionTypeHelper.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.2, ubuntu-latest)

Doing instanceof PHPStan\Type\CallableType is error-prone and deprecated. Use Type::isCallable() and Type::getCallableParametersAcceptors() instead.

Check failure on line 113 in src/Type/UnionTypeHelper.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.3, windows-latest)

Doing instanceof PHPStan\Type\CallableType is error-prone and deprecated. Use Type::isCallable() and Type::getCallableParametersAcceptors() instead.

Check failure on line 113 in src/Type/UnionTypeHelper.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.1, windows-latest)

Doing instanceof PHPStan\Type\CallableType is error-prone and deprecated. Use Type::isCallable() and Type::getCallableParametersAcceptors() instead.

Check failure on line 113 in src/Type/UnionTypeHelper.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.0, windows-latest)

Doing instanceof PHPStan\Type\CallableType is error-prone and deprecated. Use Type::isCallable() and Type::getCallableParametersAcceptors() instead.

Check failure on line 113 in src/Type/UnionTypeHelper.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.4, windows-latest)

Doing instanceof PHPStan\Type\CallableType is error-prone and deprecated. Use Type::isCallable() and Type::getCallableParametersAcceptors() instead.

Check failure on line 113 in src/Type/UnionTypeHelper.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.3, windows-latest)

Doing instanceof PHPStan\Type\CallableType is error-prone and deprecated. Use Type::isCallable() and Type::getCallableParametersAcceptors() instead.

Check failure on line 113 in src/Type/UnionTypeHelper.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.2, windows-latest)

Doing instanceof PHPStan\Type\CallableType is error-prone and deprecated. Use Type::isCallable() and Type::getCallableParametersAcceptors() instead.

Check failure on line 113 in src/Type/UnionTypeHelper.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.2, windows-latest)

Doing instanceof PHPStan\Type\CallableType is error-prone and deprecated. Use Type::isCallable() and Type::getCallableParametersAcceptors() instead.
&& ($b instanceof CallableType || $b instanceof ClosureType)

Check failure on line 114 in src/Type/UnionTypeHelper.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.3)

Doing instanceof PHPStan\Type\CallableType is error-prone and deprecated. Use Type::isCallable() and Type::getCallableParametersAcceptors() instead.

Check failure on line 114 in src/Type/UnionTypeHelper.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.2)

Doing instanceof PHPStan\Type\CallableType is error-prone and deprecated. Use Type::isCallable() and Type::getCallableParametersAcceptors() instead.

Check failure on line 114 in src/Type/UnionTypeHelper.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.1)

Doing instanceof PHPStan\Type\CallableType is error-prone and deprecated. Use Type::isCallable() and Type::getCallableParametersAcceptors() instead.

Check failure on line 114 in src/Type/UnionTypeHelper.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.3, ubuntu-latest)

Doing instanceof PHPStan\Type\CallableType is error-prone and deprecated. Use Type::isCallable() and Type::getCallableParametersAcceptors() instead.

Check failure on line 114 in src/Type/UnionTypeHelper.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.2, ubuntu-latest)

Doing instanceof PHPStan\Type\CallableType is error-prone and deprecated. Use Type::isCallable() and Type::getCallableParametersAcceptors() instead.

Check failure on line 114 in src/Type/UnionTypeHelper.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.0, ubuntu-latest)

Doing instanceof PHPStan\Type\CallableType is error-prone and deprecated. Use Type::isCallable() and Type::getCallableParametersAcceptors() instead.

Check failure on line 114 in src/Type/UnionTypeHelper.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.1, ubuntu-latest)

Doing instanceof PHPStan\Type\CallableType is error-prone and deprecated. Use Type::isCallable() and Type::getCallableParametersAcceptors() instead.

Check failure on line 114 in src/Type/UnionTypeHelper.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.4, ubuntu-latest)

Doing instanceof PHPStan\Type\CallableType is error-prone and deprecated. Use Type::isCallable() and Type::getCallableParametersAcceptors() instead.

Check failure on line 114 in src/Type/UnionTypeHelper.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.3, ubuntu-latest)

Doing instanceof PHPStan\Type\CallableType is error-prone and deprecated. Use Type::isCallable() and Type::getCallableParametersAcceptors() instead.

Check failure on line 114 in src/Type/UnionTypeHelper.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.2, ubuntu-latest)

Doing instanceof PHPStan\Type\CallableType is error-prone and deprecated. Use Type::isCallable() and Type::getCallableParametersAcceptors() instead.

Check failure on line 114 in src/Type/UnionTypeHelper.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.3, windows-latest)

Doing instanceof PHPStan\Type\CallableType is error-prone and deprecated. Use Type::isCallable() and Type::getCallableParametersAcceptors() instead.

Check failure on line 114 in src/Type/UnionTypeHelper.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.1, windows-latest)

Doing instanceof PHPStan\Type\CallableType is error-prone and deprecated. Use Type::isCallable() and Type::getCallableParametersAcceptors() instead.

Check failure on line 114 in src/Type/UnionTypeHelper.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.0, windows-latest)

Doing instanceof PHPStan\Type\CallableType is error-prone and deprecated. Use Type::isCallable() and Type::getCallableParametersAcceptors() instead.

Check failure on line 114 in src/Type/UnionTypeHelper.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.4, windows-latest)

Doing instanceof PHPStan\Type\CallableType is error-prone and deprecated. Use Type::isCallable() and Type::getCallableParametersAcceptors() instead.

Check failure on line 114 in src/Type/UnionTypeHelper.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.3, windows-latest)

Doing instanceof PHPStan\Type\CallableType is error-prone and deprecated. Use Type::isCallable() and Type::getCallableParametersAcceptors() instead.

Check failure on line 114 in src/Type/UnionTypeHelper.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.2, windows-latest)

Doing instanceof PHPStan\Type\CallableType is error-prone and deprecated. Use Type::isCallable() and Type::getCallableParametersAcceptors() instead.

Check failure on line 114 in src/Type/UnionTypeHelper.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.2, windows-latest)

Doing instanceof PHPStan\Type\CallableType is error-prone and deprecated. Use Type::isCallable() and Type::getCallableParametersAcceptors() instead.
) {
return self::compareStrings($a->describe(VerbosityLevel::value()), $b->describe(VerbosityLevel::value()));
}

Expand Down

0 comments on commit bb3da26

Please sign in to comment.