Skip to content

Conversation

@devnix
Copy link
Contributor

@devnix devnix commented Jan 20, 2026

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.

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
Copy link
Contributor

Those methods can return an empty string, but only if the instance is created with an empty string.

Technically that doesn't forbid passing a empty string to the constructor no (?)

@devnix
Copy link
Contributor Author

devnix commented Jan 23, 2026

Technically that doesn't forbid passing a empty string to the constructor no (?)

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 non-empty-string too?

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
Copy link
Contributor

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.

Which warning ?

I dont get one with new SplFileInfo('').
https://onlinephp.io/c/386d9

@devnix
Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants