Degraded closures in constant arrays are now reported by `checkMissingCallableSignature: true`
Bug report
Since closures are now degraded in constant arrays by phpstan/phpstan-src#4684, the resulting degraded callable is now a common callable, causing checkMissingCallableSignature: true to report missing signature.
I cannot reproduce in the playground because the flag is not on by default there but pasting here the code snippet instead.
<?php declare(strict_types=1); use PhpParser\Node; use PHPStan\Analyser\Scope; final class ExpectationMethodResolver { /** * @var array{ * hasMethod: \Closure(Scope, Node\Arg, Node\Arg): Node\Expr, * hasProperty: \Closure(Scope, Node\Arg, Node\Arg): Node\Expr, * isArray: \Closure(Scope, Node\Arg): Node\Expr, * isBool: \Closure(Scope, Node\Arg): Node\Expr, * isCallable: \Closure(Scope, Node\Arg): Node\Expr, * isCountable: \Closure(Scope, Node\Arg): Node\Expr, * isFalse: \Closure(Scope, Node\Arg): Node\Expr, * isFloat: \Closure(Scope, Node\Arg): Node\Expr, * isInstanceOf: \Closure(Scope, Node\Arg, Node\Arg): Node\Expr, * isInt: \Closure(Scope, Node\Arg): Node\Expr, * isIterable: \Closure(Scope, Node\Arg): Node\Expr, * isList: \Closure(Scope, Node\Arg): Node\Expr, * isMap: \Closure(Scope, Node\Arg): Node\Expr, * isNaturalInt: \Closure(Scope, Node\Arg): Node\Expr, * isNegativeInt: \Closure(Scope, Node\Arg): Node\Expr, * isNonEmptyString: \Closure(Scope, Node\Arg): Node\Expr, * isNull: \Closure(Scope, Node\Arg): Node\Expr, * isNumeric: \Closure(Scope, Node\Arg): Node\Expr, * isObject: \Closure(Scope, Node\Arg): Node\Expr, * isPositiveInt: \Closure(Scope, Node\Arg): Node\Expr, * isResource: \Closure(Scope, Node\Arg): Node\Expr, * isSameAs: \Closure(Scope, Node\Arg, Node\Arg): Node\Expr, * isScalar: \Closure(Scope, Node\Arg): Node\Expr, * isString: \Closure(Scope, Node\Arg): Node\Expr, * isTrue: \Closure(Scope, Node\Arg): Node\Expr, * } */ public static array $resolvers = []; // @phpstan-ignore property.defaultValue }
Code snippet that reproduces the problem
No response
Expected output
I understand the performance gains brought by this change, but I expect at least maybe the parameters and/or return are generalised or simplified in the resulting callable, not just null for both.
Did PHPStan help you today? Did it make you happy in any way?
Yes, as always.