,error_levels?:string[]}>
*/
public function providerValidCodeParse(): iterable
{
return [
'newVarInIf' => [
' [
' [
' 0;
if ($a) {
echo $matches[1];
}',
],
'functionExists' => [
' [
'foo) {
echo $a;
}',
],
'globalReturn' => [
' [
' [
' 1 && is_string($a)) {
throw new \Exception("bad");
}',
'assertions' => [
'$a' => 'null|string',
],
],
'repeatAssertionWithOther' => [
' 1 || is_string($a)) {
if (is_string($a)) {
echo strpos($a, "e");
}
}',
'assertions' => [
'$a' => 'null|string',
],
'error_levels' => ['PossiblyFalseArgument'],
],
'refineOredType' => [
' [
' [
' [
'value)) {
$this->value = ["x", "y"];
echo count($this->value) - 2;
}',
'assertions' => [],
'error_levels' => ['MixedPropertyAssignment', 'MixedArgument'],
],
'typedStatic' => [
' [
'
= $this->getMessage() ?>
',
],
'psalmVarThisInTemplate' => [
'
= $this->getMessage() ?>
',
],
'psalmVarThisAbsoluteClassInTemplate' => [
'
= $this->getMessage() ?>
',
],
];
}
/**
* @return iterable
*/
public function providerInvalidCodeParse(): iterable
{
return [
'possiblyUndefinedVarInIf' => [
' 'PossiblyUndefinedGlobalVariable - src' . DIRECTORY_SEPARATOR . 'somefile.php:6:26 - Possibly undefined global '
. 'variable $b, first seen on line 3',
],
'possiblyUndefinedArrayInIf' => [
' 'PossiblyUndefinedGlobalVariable - src' . DIRECTORY_SEPARATOR . 'somefile.php:3:25 - Possibly undefined global '
. 'variable $array, first seen on line 3',
],
'invalidGlobal' => [
' 'InvalidGlobal',
],
'thisInStatic' => [
' 'InvalidScope',
],
'static' => [
' 'MixedReturnStatement',
],
'staticNullRef' => [
' 'DocblockTypeContradiction',
],
'typedStaticCannotHaveNullDefault' => [
' 'ReferenceConstraintViolation',
],
'typedStaticCannotBeAssignedInt' => [
' 'ReferenceConstraintViolation',
],
'typedStaticCannotBeAssignedNull' => [
' 'ReferenceConstraintViolation',
],
];
}
}