@@ -70,13 +70,6 @@ public function findSpecifiedType(
7070 }
7171 $ args = $ node ->getArgs ();
7272 $ argsCount = count ($ args );
73-
74- foreach ($ args as $ arg ) {
75- if ($ arg ->value instanceof Expr \Assign) {
76- return null ;
77- }
78- }
79-
8073 if ($ node ->name instanceof Node \Name) {
8174 $ functionName = strtolower ((string ) $ node ->name );
8275 if ($ functionName === 'assert ' && $ argsCount >= 1 ) {
@@ -286,6 +279,16 @@ public function findSpecifiedType(
286279
287280 $ results = [];
288281
282+ $ assignedInCallVars = [];
283+ if ($ node instanceof Expr \CallLike) {
284+ foreach ($ node ->getArgs () as $ arg ) {
285+ if (!$ arg ->value instanceof Expr \Assign) {
286+ continue ;
287+ }
288+
289+ $ assignedInCallVars [] = $ arg ->value ;
290+ }
291+ }
289292 foreach ($ sureTypes as $ sureType ) {
290293 if (self ::isSpecified ($ typeSpecifierScope , $ node , $ sureType [0 ])) {
291294 $ results [] = TrinaryLogic::createMaybe ();
@@ -301,6 +304,14 @@ public function findSpecifiedType(
301304 /** @var Type $resultType */
302305 $ resultType = $ sureType [1 ];
303306
307+ foreach ($ assignedInCallVars as $ assignedInCallVar ) {
308+ if ($ sureType [0 ] !== $ assignedInCallVar ->var ) {
309+ continue ;
310+ }
311+
312+ $ argumentType = $ scope ->getType ($ assignedInCallVar ->expr );
313+ }
314+
304315 $ results [] = $ resultType ->isSuperTypeOf ($ argumentType )->result ;
305316 }
306317
0 commit comments