I am using Phpstan on a Drupal project that needs to be updated; I have solved all the issues revealed by Phpstan except one and I don´t know the solution to that one.
The error message is:
Line asm89/stack-cors/src/Asm89/Stack/Cors.php
------ -------------------------------------------------------------
32 Syntax error, unexpected T_STRING, expecting ';' on line 32
The code mentionned here is the following function:
private array $defaultOptions void (
'allowedHeaders' => array(),
'allowedMethods' => array(),
'allowedOrigins' => array(),
'allowedOriginsPatterns' => array(),
'exposedHeaders' => false,
'maxAge' => false,
'supportsCredentials' => false,
);
where as line 32 is the following line:
private array $defaultOptions void (
I am absolutely sure about the line numbers and code parts mentionned py Phpstan, however I am not sure about the solution for this problem and hence, any help or hints would be very much appreciated, thanks in advance!
array()or brackets[], not(), and would not have a return type. Functions do not start with a$= [ ... ]or= array( ... )after$defaultOptions. Also,voidis a return type, and is out of place here unless there's some new syntax I'm missing? If you wanted the property as nullable, you could declare it asprivate ?array.