Repository navigation
Expand file tree
/
Copy pathBug14844Test.php
More file actions
79 lines (70 loc) · 2.14 KB
/
Copy pathBug14844Test.php
File metadata and controls
79 lines (70 loc) · 2.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php declare(strict_types = 1);
namespace PHPStan\Rules\Functions;
use PHPStan\Rules\FunctionCallParametersCheck;
use PHPStan\Rules\NullsafeCheck;
use PHPStan\Rules\PhpDoc\UnresolvableTypeHelper;
use PHPStan\Rules\Properties\PropertyReflectionFinder;
use PHPStan\Rules\Rule;
use PHPStan\Rules\RuleLevelHelper;
use PHPStan\Testing\RuleTestCase;
use PHPUnit\Framework\Attributes\RequiresPhp;
/**
* @extends RuleTestCase<CallToFunctionParametersRule>
*/
class Bug14844Test extends RuleTestCase
{
protected function getRule(): Rule
{
$broker = self::createReflectionProvider();
return new CallToFunctionParametersRule(
$broker,
new FunctionCallParametersCheck(
new RuleLevelHelper(
$broker,
checkNullables: true,
checkThisOnly: false,
checkUnionTypes: true,
checkExplicitMixed: true,
checkImplicitMixed: true,
checkBenevolentUnionTypes: false,
discoveringSymbolsTip: true,
),
new NullsafeCheck(),
new UnresolvableTypeHelper(),
new PropertyReflectionFinder(),
$broker,
checkArgumentTypes: true,
checkArgumentsPassedByReference: true,
checkExtraArguments: true,
checkMissingTypehints: true,
reportMixedTernaryAndCoalesce: true,
),
);
}
#[RequiresPhp('>= 8.1.0')]
public function testBug14844(): void
{
$this->analyse([__DIR__ . '/../../Analyser/nsrt/bug-14844.php'], []);
}
#[RequiresPhp('>= 8.1.0')]
public function testBug14844ClassConst(): void
{
// Same bug as testBug14844, but the array_map callback fetches a class
// constant (`$type::FOO`) instead of an enum-case property. It also routes
// through mapValueType and must not plant an ErrorType in the sentinel.
$this->analyse([__DIR__ . '/data/bug-14844-class-const.php'], []);
}
#[RequiresPhp('>= 8.1.0')]
public function testBug14844Siblings(): void
{
// Sibling ConstantArrayType operations that also touch the sealed
// `[never, never]` unsealed sentinel must not plant an ErrorType there.
$this->analyse([__DIR__ . '/data/bug-14844-siblings.php'], []);
}
public static function getAdditionalConfigFiles(): array
{
return [
__DIR__ . '/../../../../conf/bleedingEdge.neon',
];
}
}