|
| 1 | +<?php declare(strict_types = 1); |
| 2 | + |
| 3 | +namespace PHPStan\Rules\Functions; |
| 4 | + |
| 5 | +use PHPStan\Rules\FunctionCallParametersCheck; |
| 6 | +use PHPStan\Rules\NullsafeCheck; |
| 7 | +use PHPStan\Rules\PhpDoc\UnresolvableTypeHelper; |
| 8 | +use PHPStan\Rules\Properties\PropertyReflectionFinder; |
| 9 | +use PHPStan\Rules\Rule; |
| 10 | +use PHPStan\Rules\RuleLevelHelper; |
| 11 | +use PHPStan\Testing\RuleTestCase; |
| 12 | +use PHPUnit\Framework\Attributes\RequiresPhp; |
| 13 | + |
| 14 | +/** |
| 15 | + * @extends RuleTestCase<CallToFunctionParametersRule> |
| 16 | + */ |
| 17 | +class Bug14844Test extends RuleTestCase |
| 18 | +{ |
| 19 | + |
| 20 | + protected function getRule(): Rule |
| 21 | + { |
| 22 | + $broker = self::createReflectionProvider(); |
| 23 | + return new CallToFunctionParametersRule( |
| 24 | + $broker, |
| 25 | + new FunctionCallParametersCheck( |
| 26 | + new RuleLevelHelper( |
| 27 | + $broker, |
| 28 | + checkNullables: true, |
| 29 | + checkThisOnly: false, |
| 30 | + checkUnionTypes: true, |
| 31 | + checkExplicitMixed: true, |
| 32 | + checkImplicitMixed: true, |
| 33 | + checkBenevolentUnionTypes: false, |
| 34 | + discoveringSymbolsTip: true, |
| 35 | + ), |
| 36 | + new NullsafeCheck(), |
| 37 | + new UnresolvableTypeHelper(), |
| 38 | + new PropertyReflectionFinder(), |
| 39 | + $broker, |
| 40 | + checkArgumentTypes: true, |
| 41 | + checkArgumentsPassedByReference: true, |
| 42 | + checkExtraArguments: true, |
| 43 | + checkMissingTypehints: true, |
| 44 | + ), |
| 45 | + ); |
| 46 | + } |
| 47 | + |
| 48 | + #[RequiresPhp('>= 8.1.0')] |
| 49 | + public function testBug14844(): void |
| 50 | + { |
| 51 | + $this->analyse([__DIR__ . '/data/bug-14844.php'], []); |
| 52 | + } |
| 53 | + |
| 54 | + public static function getAdditionalConfigFiles(): array |
| 55 | + { |
| 56 | + return [ |
| 57 | + __DIR__ . '/../../../../conf/bleedingEdge.neon', |
| 58 | + ]; |
| 59 | + } |
| 60 | + |
| 61 | +} |
0 commit comments