@@ -68,8 +68,6 @@ public function processNode(Node $node, Scope $scope): array
68
68
if ($ keyChecked === '#lazy_builder ' ) {
69
69
if ($ scope ->isInClass ()) {
70
70
$ classReflection = $ scope ->getClassReflection ();
71
- // @todo why doesn't isInClass assert this isn't null?
72
- assert ($ classReflection !== null );
73
71
$ classType = new ObjectType ($ classReflection ->getName ());
74
72
// These classes use #lazy_builder in array_intersect_key. With
75
73
// PHPStan 1.6, nodes do not track their parent/next/prev which
@@ -175,9 +173,6 @@ private function doProcessNode(Node\Expr $node, Scope $scope, string $keyChecked
175
173
} elseif ($ type instanceof ClosureType) {
176
174
if ($ scope ->isInClass ()) {
177
175
$ classReflection = $ scope ->getClassReflection ();
178
- if ($ classReflection === null ) {
179
- throw new \PHPStan \ShouldNotHappenException ();
180
- }
181
176
$ classType = new ObjectType ($ classReflection ->getName ());
182
177
$ formType = new ObjectType ('\Drupal\Core\Form\FormInterface ' );
183
178
if ($ formType ->isSuperTypeOf ($ classType )->yes ()) {
@@ -245,7 +240,7 @@ private function getType(Node\Expr $node, Scope $scope): Type
245
240
}
246
241
// @see \PHPStan\Type\Constant\ConstantStringType::isCallable
247
242
preg_match ('#^([a-zA-Z_ \\x7f- \\xff \\\\][a-zA-Z0-9_ \\x7f- \\xff \\\\]*)::([a-zA-Z_ \\x7f- \\xff][a-zA-Z0-9_ \\x7f- \\xff]*) \\z# ' , $ type ->getValue (), $ matches );
248
- if ($ matches !== null && count ($ matches ) > 0 ) {
243
+ if (count ($ matches ) > 0 ) {
249
244
return new ConstantArrayType (
250
245
[new ConstantIntegerType (0 ), new ConstantIntegerType (1 )],
251
246
[
0 commit comments