File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed
Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change 166166use PHPStan \Type \Constant \ConstantArrayTypeBuilder ;
167167use PHPStan \Type \Constant \ConstantBooleanType ;
168168use PHPStan \Type \Constant \ConstantIntegerType ;
169+ use PHPStan \Type \Constant \ConstantStringType ;
170+ use PHPStan \Type \ConstantTypeHelper ;
169171use PHPStan \Type \ErrorType ;
170172use PHPStan \Type \FileTypeMapper ;
171173use PHPStan \Type \GeneralizePrecision ;
@@ -5496,13 +5498,10 @@ private function processAssignVar(
54965498 }
54975499
54985500 if ($ originalVar ->dim instanceof Variable || $ originalVar ->dim instanceof Node \Scalar) {
5499- $ type = $ this ->treatPhpDocTypesAsCertain
5500- ? $ scope ->getType ($ originalVar ->var )
5501- : $ scope ->getNativeType ($ originalVar ->var );
5502- $ dimType = $ this ->treatPhpDocTypesAsCertain
5503- ? $ scope ->getType ($ originalVar ->dim )
5504- : $ scope ->getNativeType ($ originalVar ->dim );
5505- if (!$ type ->hasOffsetValueType ($ dimType )->yes ()) {
5501+ $ currentVarType = $ scope ->getNativeType ($ originalVar );
5502+ if (
5503+ !$ originalNativeValueToWrite ->isSuperTypeOf ($ currentVarType )->yes ()
5504+ ) {
55065505 $ scope = $ scope ->assignExpression (
55075506 $ originalVar ,
55085507 $ originalValueToWrite ,
You can’t perform that action at this time.
0 commit comments