-
Notifications
You must be signed in to change notification settings - Fork 8
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
PHP 8.x Support #33
PHP 8.x Support #33
Conversation
@@ -3,6 +3,7 @@ | |||
namespace Weebly\Mutate\Database; | |||
|
|||
use Closure; | |||
use Illuminate\Contracts\Support\Arrayable; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use
statement got added, but this doesn't seem to be used anywhere in the file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's actually used here
laravel-mutate/src/Database/EloquentBuilder.php
Lines 69 to 72 in aab32b1
public function whereKey($id) | |
{ | |
if (is_array($id) || $id instanceof Arrayable) { | |
$this->whereIn($this->model->getQualifiedKeyName(), $id); |
This is technically a bugfix ;)
*/ | ||
#[\ReturnTypeWillChange] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What behavior are we driving from this? The composer.json
still says php 7.x is OK. On 7, this will be a comment
does that cause a problem?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding this attribute is necessary to prevent these errors in PHPStan (also, PHP will throw an error when executing this code in PHP 8.1 if this attribute is not added or the return type is not set correctly.
------ -------------------------------------------------------------------------------------------------------------------------------------------------------------------
Line src/MutatorProvider.php
------ -------------------------------------------------------------------------------------------------------------------------------------------------------------------
69 Return type mixed of method Weebly\Mutate\MutatorProvider::offsetExists() is not covariant with tentative return type bool of method ArrayAccess::offsetExists().
💡 Make it covariant, or use the #[\ReturnTypeWillChange] attribute to temporarily suppress the error.
89 Return type mixed of method Weebly\Mutate\MutatorProvider::offsetSet() is not covariant with tentative return type void of method ArrayAccess::offsetSet().
💡 Make it covariant, or use the #[\ReturnTypeWillChange] attribute to temporarily suppress the error.
97 Return type mixed of method Weebly\Mutate\MutatorProvider::offsetUnset() is not covariant with tentative return type void of method ArrayAccess::offsetUnset().
💡 Make it covariant, or use the #[\ReturnTypeWillChange] attribute to temporarily suppress the error.
------ -------------------------------------------------------------------------------------------------------------------------------------------------------------------
In older PHP versions, since it is #
prefixed, it will be ignored as a comment and will be perfectly fine, since it doesn't apply anyway.
Makes this package installable on PHP 8.x, and adds PHP 8.1 to the testing matrix.