laravel-acl
laravel-acl copied to clipboard
HasRole won't work on PHP 7.1
This piece of code will not work on PHP 7.1 and Laravel 5.3:
$laravel = app();
if (version_compare($laravel::VERSION, '5.3', '<')) {
trait HasRole
{
use HasRoleImplementation {
hasRole as is;
}
}
} else {
trait HasRole
{
use HasRoleImplementation;
}
}
Even with the if PHP will "validate" the code with the first trait, and so, will throw the exception:
hasRole($slug, $operator = NULL) should be compatible with Illuminate\Database\Eloquent\Model::is(Illuminate\Database\Eloquent\Model $model)
Just works if i remove the ìf`.
hmm i have to test it locally, can
Welp, not sure if this could be a PHP issue too, i'm using PHP 7.1.0 RC5. That change is not documented(PHP and it's way to document things not documenting).
well
Illuminate\Database\Eloquent\Model::is(Illuminate\Database\Eloquent\Model $model)
method is() is reserved for Eloquent's implementation of it. I recommend to rename the method to something more explicit to avoid this conflict.
Maybe: hasRole()