mirror of
https://github.com/danog/psalm.git
synced 2024-11-27 04:45:20 +01:00
Allow assignment to numeric string via assertion
This commit is contained in:
parent
dbc0e6dfcb
commit
8e90334428
@ -110,6 +110,9 @@ abstract class Atomic
|
|||||||
case 'class-string':
|
case 'class-string':
|
||||||
return new TClassString();
|
return new TClassString();
|
||||||
|
|
||||||
|
case 'numeric-string':
|
||||||
|
return new TNumericString();
|
||||||
|
|
||||||
case '$this':
|
case '$this':
|
||||||
return new TNamedObject('static');
|
return new TNamedObject('static');
|
||||||
|
|
||||||
|
@ -775,6 +775,17 @@ class TypeReconciliationTest extends TestCase
|
|||||||
return false;
|
return false;
|
||||||
}',
|
}',
|
||||||
],
|
],
|
||||||
|
'numericStringAssertion' => [
|
||||||
|
'<?php
|
||||||
|
/**
|
||||||
|
* @param mixed $a
|
||||||
|
*/
|
||||||
|
function foo($a, string $b) : void {
|
||||||
|
if (is_numeric($b) && $a === $b) {
|
||||||
|
echo $a;
|
||||||
|
}
|
||||||
|
}'
|
||||||
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user