This simple method causes an ERROR:
/**
* Validates the param checking if it is accepted in one of the allowed sections.
*
* This is useful to inform the developer that were passed a parameter that is not supported at all.
*
* @param string $param
*/
private function validateParam(string $param)
{
static $aggregatedParams = null;
if (null === $aggregatedParams) {
$aggregatedParams = array_merge(self::CONFIG_ACCESS, self::CONFIG_KIND, self::CONFIG_SETTINGS);
}
if (false === array_key_exists($param, $aggregatedParams)) {
throw new \InvalidArgumentException(sprintf(
'The parameter "%s" you passed is not supported in any section of a RemoteConfig. Allowed parameters in each section are: Kind => %s; Access => %s; Settings => %s.',
$param,
implode(', ', self::CONFIG_KIND),
implode(', ', self::CONFIG_ACCESS),
implode(', ', self::CONFIG_SETTINGS)
));
}
}
The error is this:
[ERROR] Could not process
"/Users/Aerendir/Documents/JooServer/_Projects/SerendipityHQ/Bundles/bundle-my/src/Service/MyClass.php" file by "Rector\PHPStan\Rector\Assign\PHPStormVarAnnotationRector", due to:
"".
The error is caused by the use of the static keyword: if I remove it, the error disappears.
May be related to #1407
STEPS TO REPRODUCE
I've tried to add a test case in packages/PHPStan/test/Rector/Assign/PHPStormVarAnnotationRector/Fixture/fixture5.php.inc with this content:
<?php
function aFunctionWithStatisVariable() {
static $variable = null;
}
?>
-----
<?php
function aFunctionWithStatisVariable() {
static $variable = null;
}
?>
The test fails with this message:
1) Rector\PHPStan\Tests\Rector\Assign\PHPStormVarAnnotationRector\PHPStormVarAnnotationRectorTest::test
Caused by /Users/Aerendir/Documents/JooServer/_ProjectsIContributeTo/rector/packages/PHPStan/tests/Rector/Assign/PHPStormVarAnnotationRector/Fixture/fixture5.php.inc
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
}\n
\n
?>\n
-'
+ '
This not seem what I'm trying to reproduce.
Another way I found to reproduce the issue is by creating a simple php file with this function inside:
<?php
function aFunctionWithStatisVariable() {
static $variable = null;
}
This file will produce the error I get if I use the static keyword in a method.
This simple method causes an ERROR:
The error is this:
The error is caused by the use of the
statickeyword: if I remove it, the error disappears.May be related to #1407
STEPS TO REPRODUCE
I've tried to add a test case in
packages/PHPStan/test/Rector/Assign/PHPStormVarAnnotationRector/Fixture/fixture5.php.incwith this content:The test fails with this message:
This not seem what I'm trying to reproduce.
Another way I found to reproduce the issue is by creating a simple
phpfile with this function inside:This file will produce the error I get if I use the
statickeyword in a method.