@@ -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
@@ -177,9 +175,6 @@ private function doProcessNode(Node\Expr $node, Scope $scope, string $keyChecked
177
175
} elseif ($ type instanceof ClosureType) {
178
176
if ($ scope ->isInClass ()) {
179
177
$ classReflection = $ scope ->getClassReflection ();
180
- if ($ classReflection === null ) {
181
- throw new \PHPStan \ShouldNotHappenException ();
182
- }
183
178
$ classType = new ObjectType ($ classReflection ->getName ());
184
179
$ formType = new ObjectType ('\Drupal\Core\Form\FormInterface ' );
185
180
if ($ formType ->isSuperTypeOf ($ classType )->yes ()) {
@@ -247,7 +242,7 @@ private function getType(Node\Expr $node, Scope $scope): Type
247
242
}
248
243
// @see \PHPStan\Type\Constant\ConstantStringType::isCallable
249
244
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 );
250
- if ($ matches !== null && count ($ matches ) > 0 ) {
245
+ if (count ($ matches ) > 0 ) {
251
246
return new ConstantArrayType (
252
247
[new ConstantIntegerType (0 ), new ConstantIntegerType (1 )],
253
248
[
0 commit comments