Q: Phpstan fails with "Syntax error, unexpected T_STRING, expecting ';' " in definition of function 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!

A: I have no idea what happened here, but the code is completely wrong. It's supposed to be an array definition, not a function. From the source code at https://github.com/asm89/stack-cors/blob/master/src/Cors.php, the definition should be
 private $defaultOptions = [
        'allowedHeaders'         => [],
        'allowedMethods'         => [],
        'allowedOrigins'         => [],
        'allowedOriginsPatterns' => [],
        'exposedHeaders'         => [],
        'maxAge'                 => 0,
        'supportsCredentials'    => false,
    ];

If this file is in the vendor folder, set it back to the original and do not change it. Anything in the vendor folder should be managed by the developers, since the next time you run composer update and there's a new version, it will overwrite any changes you've made. If there's an issue with a library you've included or is part of the original package, contact the developers instead.
