@@ -68,11 +68,19 @@ public function findSpecifiedType(
68
68
if ($ node ->isFirstClassCallable ()) {
69
69
return null ;
70
70
}
71
- $ argsCount = count ($ node ->getArgs ());
71
+ $ args = $ node ->getArgs ();
72
+ $ argsCount = count ($ args );
73
+
74
+ foreach ($ args as $ arg ) {
75
+ if ($ arg ->value instanceof Expr \Assign) {
76
+ return null ;
77
+ }
78
+ }
79
+
72
80
if ($ node ->name instanceof Node \Name) {
73
81
$ functionName = strtolower ((string ) $ node ->name );
74
82
if ($ functionName === 'assert ' && $ argsCount >= 1 ) {
75
- $ arg = $ node -> getArgs () [0 ]->value ;
83
+ $ arg = $ args [0 ]->value ;
76
84
$ assertValue = ($ this ->treatPhpDocTypesAsCertain ? $ scope ->getType ($ arg ) : $ scope ->getNativeType ($ arg ))->toBoolean ();
77
85
$ assertValueIsTrue = $ assertValue ->isTrue ()->yes ();
78
86
if (! $ assertValueIsTrue && ! $ assertValue ->isFalse ()->yes ()) {
@@ -96,7 +104,7 @@ public function findSpecifiedType(
96
104
} elseif ($ functionName === 'array_search ' ) {
97
105
return null ;
98
106
} elseif ($ functionName === 'in_array ' && $ argsCount >= 2 ) {
99
- $ haystackArg = $ node -> getArgs () [1 ]->value ;
107
+ $ haystackArg = $ args [1 ]->value ;
100
108
$ haystackType = ($ this ->treatPhpDocTypesAsCertain ? $ scope ->getType ($ haystackArg ) : $ scope ->getNativeType ($ haystackArg ));
101
109
if ($ haystackType instanceof MixedType) {
102
110
return null ;
@@ -106,12 +114,12 @@ public function findSpecifiedType(
106
114
return null ;
107
115
}
108
116
109
- $ needleArg = $ node -> getArgs () [0 ]->value ;
117
+ $ needleArg = $ args [0 ]->value ;
110
118
$ needleType = ($ this ->treatPhpDocTypesAsCertain ? $ scope ->getType ($ needleArg ) : $ scope ->getNativeType ($ needleArg ));
111
119
112
120
$ isStrictComparison = false ;
113
121
if ($ argsCount >= 3 ) {
114
- $ strictNodeType = $ scope ->getType ($ node -> getArgs () [2 ]->value );
122
+ $ strictNodeType = $ scope ->getType ($ args [2 ]->value );
115
123
$ isStrictComparison = $ strictNodeType ->isTrue ()->yes ();
116
124
}
117
125
@@ -192,7 +200,7 @@ public function findSpecifiedType(
192
200
}
193
201
}
194
202
} elseif ($ functionName === 'method_exists ' && $ argsCount >= 2 ) {
195
- $ objectArg = $ node -> getArgs () [0 ]->value ;
203
+ $ objectArg = $ args [0 ]->value ;
196
204
$ objectType = ($ this ->treatPhpDocTypesAsCertain ? $ scope ->getType ($ objectArg ) : $ scope ->getNativeType ($ objectArg ));
197
205
198
206
if ($ objectType instanceof ConstantStringType
@@ -201,7 +209,7 @@ public function findSpecifiedType(
201
209
return false ;
202
210
}
203
211
204
- $ methodArg = $ node -> getArgs () [1 ]->value ;
212
+ $ methodArg = $ args [1 ]->value ;
205
213
$ methodType = ($ this ->treatPhpDocTypesAsCertain ? $ scope ->getType ($ methodArg ) : $ scope ->getNativeType ($ methodArg ));
206
214
207
215
if ($ methodType instanceof ConstantStringType) {
0 commit comments