@@ -53,12 +53,6 @@ public function processNode(Node $node, Scope $scope): array
53
53
$ keyType = $ scope ->getType ($ node ->key );
54
54
}
55
55
56
- if ($ node ->value === null ) {
57
- $ valueType = new NullType ();
58
- } else {
59
- $ valueType = $ scope ->getType ($ node ->value );
60
- }
61
-
62
56
$ messages = [];
63
57
if (!$ this ->ruleLevelHelper ->accepts ($ returnType ->getIterableKeyType (), $ keyType , $ scope ->isDeclareStrictTypes ())) {
64
58
$ verbosityLevel = VerbosityLevel::getRecommendedLevelByType ($ returnType ->getIterableKeyType (), $ keyType );
@@ -68,6 +62,13 @@ public function processNode(Node $node, Scope $scope): array
68
62
$ keyType ->describe ($ verbosityLevel ),
69
63
))->build ();
70
64
}
65
+
66
+ if ($ node ->value === null ) {
67
+ $ valueType = new NullType ();
68
+ } else {
69
+ $ valueType = $ scope ->getType ($ node ->value );
70
+ }
71
+
71
72
if (!$ this ->ruleLevelHelper ->accepts ($ returnType ->getIterableValueType (), $ valueType , $ scope ->isDeclareStrictTypes ())) {
72
73
$ verbosityLevel = VerbosityLevel::getRecommendedLevelByType ($ returnType ->getIterableValueType (), $ valueType );
73
74
$ messages [] = RuleErrorBuilder::message (sprintf (
@@ -76,7 +77,7 @@ public function processNode(Node $node, Scope $scope): array
76
77
$ valueType ->describe ($ verbosityLevel ),
77
78
))->build ();
78
79
}
79
- if ($ scope ->getType ($ node )->isVoid ()->yes () && ! $ scope -> isInFirstLevelStatement ()) {
80
+ if (! $ scope ->isInFirstLevelStatement () && $ scope -> getType ($ node )->isVoid ()->yes ()) {
80
81
$ messages [] = RuleErrorBuilder::message ('Result of yield (void) is used. ' )->build ();
81
82
}
82
83
0 commit comments