-
Notifications
You must be signed in to change notification settings - Fork 55
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
Comments
Hi @acelaya ! Sorry for reply late...
That's sucks :(
It's helpful! Plz make it 😆
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! |
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.
On my way! |
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) |
Thank you! Just tested it and works like a charm. |
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
The text was updated successfully, but these errors were encountered: