Bug report
I'm migrating a very advanced project from Psalm to PHPStan, so please bear with me and provide whatever feedback you feel will be helpful for me to learn to use PHPStan better.
Casting a value to a string that has a template type that must be of string|int is not allowed from a pure context. The exact error message I'm getting is
Possibly impure call to method stdClass::__toString() in pure function stringIt().
The error id is possiblyImpure.methodCall
Code snippet that reproduces the problem
https://phpstan.org/r/e8d13b04-022c-452e-b291-109187ca9156
Expected output
It should be allowed with no issues because casting an int or a string to a string is pure.
Did PHPStan help you today? Did it make you happy in any way?
I'm amazed how well PHPStan is working overall so far with this migration from Psalm. Very nice feature parity for the most part, with differences that I like. It seems very stable and non-buggy overall. I'm glad both Psalm and PhpStan have existed together and evolved for so long with both teams learning from each other.
Bug report
I'm migrating a very advanced project from Psalm to PHPStan, so please bear with me and provide whatever feedback you feel will be helpful for me to learn to use PHPStan better.
Casting a value to a string that has a template type that must be of
string|intis not allowed from a pure context. The exact error message I'm getting isThe error id is possiblyImpure.methodCall
Code snippet that reproduces the problem
https://phpstan.org/r/e8d13b04-022c-452e-b291-109187ca9156
Expected output
It should be allowed with no issues because casting an int or a string to a string is pure.
Did PHPStan help you today? Did it make you happy in any way?
I'm amazed how well PHPStan is working overall so far with this migration from Psalm. Very nice feature parity for the most part, with differences that I like. It seems very stable and non-buggy overall. I'm glad both Psalm and PhpStan have existed together and evolved for so long with both teams learning from each other.