bezhanSalleh / filament-shield

The easiest and most intuitive way to add access management to your Filament Admin Resources, Pages & Widgets through `spatie/laravel-permission`
MIT License
1.35k stars 166 forks source link

Error on composer update #359

Closed danielschweiger closed 2 months ago

danielschweiger commented 3 months ago

Get this error after update (composer update) to latest version (3.2.4). Current FIlament Version = 3.2.62.

Symfony\Component\ErrorHandler\Error\FatalError

  Declaration of BezhanSalleh\FilamentShield\Traits\HasPageShield::canAccess(): bool must be compatible with Filament\Resources\Pages\Page::canAccess(array $parameters = []): bool

  at vendor/bezhansalleh/filament-shield/src/Traits/HasPageShield.php:75
     71▕     {
     72▕         return static::canView() && parent::shouldRegisterNavigation();
     73▕     }
     74▕ 
  ➜  75▕     public static function canAccess(): bool
     76▕     {
     77▕         return static::canView();
     78▕     }
     79▕ }
gvds commented 3 months ago

Updating vendor/bezhansalleh/filament-shield/src/Traits/HasPageShield.php canAccess() signature to: public static function canAccess(array $parameters = []): bool fixes the problem.

bezhanSalleh commented 2 months ago

the method signature might have changed and then changed back cause right now in the entire filament repo i cannot find the canAccess() method to accept params.

rominronin commented 3 weeks ago

I know this is closed, but I now have the exact same issue with shouldRegisterNavigation - it now expects an argument of array $parameters = []