inpsyde / wp-app-container

DI Container and related tools to be used at website level.
GNU General Public License v2.0
38 stars 2 forks source link

Fix invalid type in ServiceProviders #6

Closed szepeviktor closed 3 years ago

szepeviktor commented 3 years ago

props. @phpstan

gmazzap commented 3 years ago

Sorry @szepeviktor, that is a perfectly valid type in Psalm (which has a more powerful type system than PHPStan).

See how thanks to that annotation Psalm can find wrong types attached to a SplStorage: https://psalm.dev/r/aae4b7470c

szepeviktor commented 3 years ago

Okay. Suspected.

ondrejmirtes commented 3 years ago

PHPStan has a generic stub for SplObjectStorage compatible with Psalm's so don't know what the issue here is: https://github.com/phpstan/phpstan-src/blob/master/stubs/SplObjectStorage.stub

ondrejmirtes commented 3 years ago

Oh, I just noticed the SplObjectStorage stub wasn't registered, fixed: https://github.com/phpstan/phpstan-src/commit/143741c9c68edcc96845926b551d40eeed2af0d5

szepeviktor commented 3 years ago

@ondrejmirtes Thank you.

gmazzap commented 3 years ago

Thanks for explaination @ondrejmirtes I guess it's a while I don't use PHPStan.

Can I ask you a question? The type system compatible with Psalm, is a separate implementation or you're using Psalm type system implementation somehow?

ondrejmirtes commented 3 years ago

Psalm and PHPStan don't share any implementation details. To check out how PHPStan's typesystem is implemented, see: https://github.com/phpstan/phpstan-src/tree/master/src/Type