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 166
166
use PHPStan \Type \Constant \ConstantArrayTypeBuilder ;
167
167
use PHPStan \Type \Constant \ConstantBooleanType ;
168
168
use PHPStan \Type \Constant \ConstantIntegerType ;
169
+ use PHPStan \Type \Constant \ConstantStringType ;
170
+ use PHPStan \Type \ConstantTypeHelper ;
169
171
use PHPStan \Type \ErrorType ;
170
172
use PHPStan \Type \FileTypeMapper ;
171
173
use PHPStan \Type \GeneralizePrecision ;
@@ -5496,13 +5498,10 @@ private function processAssignVar(
5496
5498
}
5497
5499
5498
5500
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
+ ) {
5506
5505
$ scope = $ scope ->assignExpression (
5507
5506
$ originalVar ,
5508
5507
$ originalValueToWrite ,
You can’t perform that action at this time.
0 commit comments