php-standard-library / psalm-plugin

Psalm integration for the PHP Standard Library
MIT License
24 stars 6 forks source link

Remove usages of deprecated TList types #15

Closed danog closed 10 months ago

danog commented 10 months ago

Btw @azjezz could you merge and tag a release? This is kind of breaking our end to end tests on Psalm :)

veewee commented 10 months ago

Thanks for th PR.

I Just ran these changes against PSL 2.8 and got following errors:

ERROR: InvalidReturnType - ../src/Psl/Str/Byte/split.php:18:12 - The declared return type 'list<string>' for Psl\Str\Byte\split is incorrect, got 'list{0?: string, ...<string>}' (see https://psalm.dev/011)
 * @return list<string>

ERROR: InvalidReturnStatement - ../src/Psl/Str/Byte/split.php:26:20 - The inferred type 'list<string>' does not match the declared return type 'list<string>' for Psl\Str\Byte\split (see https://psalm.dev/128)
            return chunk($string);

ERROR: InvalidReturnType - ../src/Psl/Str/split.php:18:12 - The declared return type 'list<string>' for Psl\Str\split is incorrect, got 'list{0?: string, ...<string>}' (see https://psalm.dev/011)
 * @return list<string>

ERROR: InvalidReturnStatement - ../src/Psl/Str/split.php:26:20 - The inferred type 'list<string>' does not match the declared return type 'list<string>' for Psl\Str\split (see https://psalm.dev/128)
            return chunk($string, 1, $encoding);

Can you take a look at what is going wrong exactly? The TList seems to be deprecated for a while now indeed. Do we need to bump the minimum version in composer.json or is this change cross version compatible?

It's currently at:

"vimeo/psalm": "^5.0"

FYI: I added a Github action to validate against PSL and rebased your branch. Now you get realtime feedback of what I am seeing ;)

danog commented 10 months ago

My bad @veewee, should be all fixed now! Bumped psalm too, to avoid issues with bugs in old versions.

veewee commented 10 months ago

That works better. Thanks!