Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

\Psl\Filesystem\get_extension() can return empty string #349

Closed
dragosprotung opened this issue May 26, 2022 · 2 comments
Closed

\Psl\Filesystem\get_extension() can return empty string #349

dragosprotung opened this issue May 26, 2022 · 2 comments
Assignees
Labels
Type: Bug Inconsistencies or issues which will cause an issue or problem for users or implementors.

Comments

@dragosprotung
Copy link
Contributor

Describe the bug
\Psl\Filesystem\get_extension() can return empty string

To Reproduce

var_dump(\Psl\Filesystem\get_extension('test.')); // string(0) ""

Expected behavior
null to be returned.

Additional context
Not sure how this should be fixed.
One aproach to fix this would be to change the return from non-empty-string|null to string|null.
Personally I would expect null to be returned for a file without an extension but with a . in the name (like in the example above).

I can make a PR once the direction is decided.

@dragosprotung dragosprotung added the Type: Bug Inconsistencies or issues which will cause an issue or problem for users or implementors. label May 26, 2022
@azjezz
Copy link
Owner

azjezz commented May 28, 2022

I'm leaning more toward returning null in this case.

@dragosprotung
Copy link
Contributor Author

Closed by #350

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Inconsistencies or issues which will cause an issue or problem for users or implementors.
Projects
None yet
Development

No branches or pull requests

2 participants