Uh oh!
There was an error while loading. Please reload this page.
Propose stricter types por SplFileInfo - #4794
Conversation
Those methods can return an empty string, but only if the instance is created with an empty string. I propose these changes in bleeding edge, as it would break the compatibility in the constructor.
VincentLanglet
commented
Jan 23, 2026
Technically that doesn't forbid passing a empty string to the constructor no (?) |
devnix
commented
Jan 23, 2026
Yeah, that's my dichotomy: if static analysis "forbids" or "prevents" you from calling the constructor with an empty string, we could consider "safe" to infer that the functions should return a That's how it works in userland anyway: if you ignore the SAT warning in the constructor, the getters will have an invalid value at runtime. |
VincentLanglet
commented
Jan 23, 2026
Which warning ? I dont get one with |
devnix
commented
Jan 23, 2026
I mean the error message that PHPStan would throw because of this line: https://github.com/phpstan/phpstan-src/pull/4794/changes#diff-cf5b76484540219ae620db261e215bda6b16a613fdb72eede0befb5c55fec466R6 |
VincentLanglet
commented
Feb 1, 2026
Yes why would PHPStan introduce such error when it's permitted by PHP itself ? |
Those methods can return an empty string, but only if the instance is created with an empty string.
I propose these changes in bleeding edge, as it would break the compatibility in the constructor.