mirror of
https://github.com/danog/psalm.git
synced 2024-11-30 04:39:00 +01:00
Ensure that explode($d, lowercase-string)
produces list<lowercase-string>
types
This specific distinction seems to be very important for Psalm, as `explode()` and `lowercase-string` are used aggressively across the codebase. Also, this change expands the baseline by a few entries, since some of the code locations instide Psalm itself have un-checked list destructuring operations, as well as array access calls on potentially undefined array keys produced by `explode()`, which were previously just `list<string>`, and are now `array{0: string, 1?: string}`, which is a bit more precise.
This commit is contained in:
parent
04999b172a
commit
bfded43614
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<files psalm-version="dev-master@6fc9e50b9765d573db796e81522af759bc6987a5">
|
<files psalm-version="dev-master@dbcfe62c5224603912c94c1eab5d7c31841ada82">
|
||||||
<file src="examples/TemplateChecker.php">
|
<file src="examples/TemplateChecker.php">
|
||||||
<PossiblyUndefinedIntArrayOffset>
|
<PossiblyUndefinedIntArrayOffset>
|
||||||
<code>$comment_block->tags['variablesfrom'][0]</code>
|
<code>$comment_block->tags['variablesfrom'][0]</code>
|
||||||
@ -296,6 +296,12 @@
|
|||||||
<code>$b[$y]</code>
|
<code>$b[$y]</code>
|
||||||
</InvalidArrayOffset>
|
</InvalidArrayOffset>
|
||||||
</file>
|
</file>
|
||||||
|
<file src="src/Psalm/Internal/ExecutionEnvironment/GitInfoCollector.php">
|
||||||
|
<PossiblyUndefinedArrayOffset>
|
||||||
|
<code>$exploded[1]</code>
|
||||||
|
<code>$url</code>
|
||||||
|
</PossiblyUndefinedArrayOffset>
|
||||||
|
</file>
|
||||||
<file src="src/Psalm/Internal/FileManipulation/PropertyDocblockManipulator.php">
|
<file src="src/Psalm/Internal/FileManipulation/PropertyDocblockManipulator.php">
|
||||||
<PossiblyUndefinedIntArrayOffset>
|
<PossiblyUndefinedIntArrayOffset>
|
||||||
<code>$stmt->props[0]</code>
|
<code>$stmt->props[0]</code>
|
||||||
@ -379,9 +385,9 @@
|
|||||||
<PossiblyInvalidArrayOffset>
|
<PossiblyInvalidArrayOffset>
|
||||||
<code>$fixed_type_tokens[$i - 1]</code>
|
<code>$fixed_type_tokens[$i - 1]</code>
|
||||||
</PossiblyInvalidArrayOffset>
|
</PossiblyInvalidArrayOffset>
|
||||||
<PossiblyUndefinedIntArrayOffset>
|
<PossiblyUndefinedArrayOffset>
|
||||||
<code>$source_param_string</code>
|
<code>$source_param_string</code>
|
||||||
</PossiblyUndefinedIntArrayOffset>
|
</PossiblyUndefinedArrayOffset>
|
||||||
</file>
|
</file>
|
||||||
<file src="src/Psalm/Internal/PhpVisitor/Reflector/FunctionLikeNodeScanner.php">
|
<file src="src/Psalm/Internal/PhpVisitor/Reflector/FunctionLikeNodeScanner.php">
|
||||||
<PossiblyUndefinedIntArrayOffset>
|
<PossiblyUndefinedIntArrayOffset>
|
||||||
@ -695,6 +701,8 @@
|
|||||||
<PossiblyUnusedMethod>
|
<PossiblyUnusedMethod>
|
||||||
<code>allFloatLiterals</code>
|
<code>allFloatLiterals</code>
|
||||||
<code>allFloatLiterals</code>
|
<code>allFloatLiterals</code>
|
||||||
|
<code>hasLowercaseString</code>
|
||||||
|
<code>hasLowercaseString</code>
|
||||||
</PossiblyUnusedMethod>
|
</PossiblyUnusedMethod>
|
||||||
</file>
|
</file>
|
||||||
<file src="tests/Internal/Codebase/InternalCallMapHandlerTest.php">
|
<file src="tests/Internal/Codebase/InternalCallMapHandlerTest.php">
|
||||||
|
@ -728,6 +728,25 @@ function join($separator, array $array = []): string
|
|||||||
* @param non-empty-string $separator
|
* @param non-empty-string $separator
|
||||||
*
|
*
|
||||||
* @return (
|
* @return (
|
||||||
|
* $string is lowercase-string
|
||||||
|
* ? (
|
||||||
|
* $limit is int<min, -2>
|
||||||
|
* ? array<empty, empty>
|
||||||
|
* : (
|
||||||
|
* $limit is int<0, 1>
|
||||||
|
* ? array{lowercase-string}
|
||||||
|
* : (
|
||||||
|
* $limit is 2
|
||||||
|
* ? array{0: lowercase-string, 1?: lowercase-string}
|
||||||
|
* : (
|
||||||
|
* $limit is 3
|
||||||
|
* ? array{0: lowercase-string, 1?: lowercase-string, 2?: lowercase-string}
|
||||||
|
* : non-empty-list<lowercase-string>
|
||||||
|
* )
|
||||||
|
* )
|
||||||
|
* )
|
||||||
|
* )
|
||||||
|
* : (
|
||||||
* $limit is int<min, -2>
|
* $limit is int<min, -2>
|
||||||
* ? array<empty, empty>
|
* ? array<empty, empty>
|
||||||
* : (
|
* : (
|
||||||
@ -744,6 +763,7 @@ function join($separator, array $array = []): string
|
|||||||
* )
|
* )
|
||||||
* )
|
* )
|
||||||
* )
|
* )
|
||||||
|
* )
|
||||||
*
|
*
|
||||||
* @psalm-flow ($string) -(array-assignment)-> return
|
* @psalm-flow ($string) -(array-assignment)-> return
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user