Reputation: 13
I'm having an issue with my PHP Laravel project.
On my remote Linux development server, it works perfectly, however, as I attempted to move it to local today, on my macOS system, I'm experiencing smaller-scale warnings because the code is not standardised. Such examples are:
/**
* @var string[]
*/
protected $defaultIncludes = ['allocations', 'variables'];
/**
* @var array
*/
protected $availableIncludes = ['egg', 'subusers'];
Which are causing Type must be 'array' (as in base class '\League\Fractal\TransformerAbstract')
Or for example:
/**
* Serialize an item.
*
* @param string $resourceKey
*
* @return array
*/
public function item($resourceKey, array $data)
{
return [
'object' => $resourceKey,
'attributes' => $data,
];
}
which is causing Return type declaration must be compatible with ArraySerializer->item(resourceKey: null|string, data: array) : array
Those issues that should just be warnings are now marked as errors on in my IDE and are throwing fatal API responses (500) on API requests...
While I'm aware that I can very easily solve issues above, I have hundreds of them, mainly because project is forked from GitHub Pterodactyl Panel. The mentioned issues do not affect the functionality of the project at all, those are just PHP standard issues that should not be throwing fatal API responses, but just appear in the code as warnings. Is there any way I can get rid of those errors, and possibly convert them just to warnings instead?
Environment:
OS: MacOS Ventura
PHP: 8.1.6 (Laravel Project)
Software: Pterodactyl Panel (you can find all other related project info here)
Upvotes: 0
Views: 117