-
-
Notifications
You must be signed in to change notification settings - Fork 497
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
UuidInterface generates deprecated message with PHP 8.1 #399
Comments
possible fix Add to UuidInterface
|
This will require a major version bump, since it's a change to an interface. 😕 |
@ramsey maybe this ticket should be closed and new one should be opened with 'Php 8.1 compatibility' subject? |
I'm not following. Why does this need a new ticket? |
Seems to me a lot of things will be changed to be compatible with PHP 8.1. Not only interface fixing but also the phpdocs for phpstan. That’s why I’ve suggested a new ticket.
Of course everything could be done in this ticket :)
Best regards,
Dmytro Kovalenko
***@***.***
18 янв. 2022 г., 23:25 +0100, Ben Ramsey ***@***.***>, писал:
… I'm not following. Why does this need a new ticket?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Hi @ramsey Wouldn't using Edit: nevermind, initially I assumed it was because the return types, I see now is tied to the |
The request is to add it to
|
@jokaorgua probably this can be fixed only in PHPUnit (which generates mock implementation without Introducing new methods to the interface would be the wrong choice. |
I'm going to close this issue, since I don't think there's anything that can be done about it in version 4.x of ramsey/uuid. |
I've found a convenient way to make "autoload-dev": {
"psr-4": {
<...>
},
"exclude-from-classmap": ["vendor/ramsey/uuid/src/UuidInterface.php"],
"files": ["src/overrides/ramsey/uuid/UuidInterface.php"]
} Then copy the original public function __serialize(): array;
public function __unserialize(array $data): void; Do not forget to call |
My stance on this matter is that there is no need to mock a UUID. If you need the UUID to have a fixed value, you can create one using |
@ramsey Agree with you. Unfortunately, I need to do this override, because my project have too many (thousands) test-cases that uses mocked UuidInterface :( |
Can't you just bulk replace |
Sure, it's possible. But first you need to set up a rule so that other developers do not write in the old way. P.S. Random values in test-cases? ))) |
UuidInterface generates deprecated messasge when using in PHP 8.1
Description
Current UuidInterface implementation is
and it generates deprecation message
Steps to reproduce
Mock an UuidInterface with phpunit mock
Expected behavior
No deprecation message
Environment details
php: 8.1.1
OS: Linux
Arch: Arm
The text was updated successfully, but these errors were encountered: