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

Deprecation warning when used with PHP 8.4 #31

Closed
acelaya opened this issue Oct 28, 2024 · 5 comments
Closed

Deprecation warning when used with PHP 8.4 #31

acelaya opened this issue Oct 28, 2024 · 5 comments

Comments

@acelaya
Copy link
Contributor

acelaya commented Oct 28, 2024

Detailed description

I noticed a deprecation warning when using this library with PHP 8.4

Hidehalo\Nanoid\Client::__construct(): Implicitly marking parameter $generator as nullable is deprecated, the explicit nullable type must be used instead.

I'm not sure if there are others, but I'm willing to provide a fix for any of those, as well as updating the pipeline to run under PHP 8.4.

Context

This library will not be usable with PHP 8.4 without fixing these warnings.

Possible implementation

Those warnings can be solved by marking the types as nullable. So for the specific warning noticed above, GeneratorInterface $generator = null should become ?GeneratorInterface $generator = null.

The side effect is that no PHP versions older than 7.1 could be supported anymore, but PHP 7.1 is 8 years old, and only PHP >=8.1 is actively supported, so I think that's reasonable.

Your environment

  • Version used: PHP 8.4
  • Operating system and version: Ubuntu 24.04
@hidehalo
Copy link
Owner

hidehalo commented Nov 1, 2024

Hi @acelaya ! Sorry for reply late...

This library will not be usable with PHP 8.4 without fixing these warnings.

That's sucks :(

I'm not sure if there are others, but I'm willing to provide a fix for any of those, as well as updating the pipeline to run under PHP 8.4.

It's helpful! Plz make it 😆

The side effect is that no PHP versions older than 7.1 could be supported anymore

Don't worry about it, we can make a new major version for upcoming BC changes.

Feel free to ask if your need any help, cheers!

@acelaya
Copy link
Contributor Author

acelaya commented Nov 1, 2024

This library will not be usable with PHP 8.4 without fixing these warnings.

That's sucks :(

I admit I may have been a bit dramatic here 😅

The library would be usable for now if those warnings are handled properly, but it's always nice not having to deal with those in userland code.

I'm not sure if there are others, but I'm willing to provide a fix for any of those, as well as updating the pipeline to run under PHP 8.4.

It's helpful! Plz make it 😆

On my way!

@acelaya
Copy link
Contributor Author

acelaya commented Nov 1, 2024

I have just provided a PR for this: #32

@hidehalo
Copy link
Owner

hidehalo commented Nov 4, 2024

I have just provided a PR for this: #32

Great job! cheers 👍

I just released the final commit tag 2.0

branch 2.x no longer supports php versions prior to 7.1 (maybe we can upgrade to a higher version to use the new features in the future, e.g. named parameters, type systems).

For previously released php versions, we should maintain it on branch 1.x (if the community wants it xD)

@hidehalo hidehalo closed this as completed Nov 4, 2024
@acelaya
Copy link
Contributor Author

acelaya commented Nov 4, 2024

I just released the final commit tag 2.0

Thank you! Just tested it and works like a charm.

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

No branches or pull requests

2 participants