vyuldashev / nova-permission

A Laravel Nova tool for Spatie's laravel-permission library
https://novapackages.com/packages/vyuldashev/nova-permission
419 stars 217 forks source link

Fixes typehint errors potentially caused by latest changes #162

Closed argia-andreas closed 3 years ago

argia-andreas commented 3 years ago

Role.php and Permission.php extends Laravel\Nova\Resource.php

161 adds typehints to properties and some methods that are not typehinted in the classes that are extended in Laravel Nova.

public properties $title and $search are not typehinted in Resource.php. But are typehinted as string and array in Role and Permission which causes breakage as for example Nova Resource $title might not always be a string.

Unless I'm completely off, the previous commits should be corrected as they are not typehinted in their parent classes?

I'm now getting the following error on a fresh installation on both PHP 8.0 and PHP 7.4

Symfony\Component\ErrorHandler\Error\FatalError: Type of Vyuldashev\NovaPermission\Role::$title must not be defined (as in class Laravel\Nova\Resource) in file /vendor/vyuldashev/nova-permission/src/Role.php on line 0

Or am I missing something here?

argia-andreas commented 3 years ago

Closing this as it's already discussed in #160