|
| 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 | + |
| 13 | +/** |
| 14 | + * @extends RuleTestCase<CallToFunctionParametersRule> |
| 15 | + */ |
| 16 | +class CallToFunctionParametersRulePhp74Test extends RuleTestCase |
| 17 | +{ |
| 18 | + |
| 19 | + protected function getRule(): Rule |
| 20 | + { |
| 21 | + $broker = self::createReflectionProvider(); |
| 22 | + return new CallToFunctionParametersRule( |
| 23 | + $broker, |
| 24 | + new FunctionCallParametersCheck( |
| 25 | + new RuleLevelHelper( |
| 26 | + $broker, |
| 27 | + checkNullables: true, |
| 28 | + checkThisOnly: false, |
| 29 | + checkUnionTypes: true, |
| 30 | + checkExplicitMixed: true, |
| 31 | + checkImplicitMixed: true, |
| 32 | + checkBenevolentUnionTypes: false, |
| 33 | + discoveringSymbolsTip: true, |
| 34 | + ), |
| 35 | + new NullsafeCheck(), |
| 36 | + new UnresolvableTypeHelper(), |
| 37 | + new PropertyReflectionFinder(), |
| 38 | + $broker, |
| 39 | + checkArgumentTypes: true, |
| 40 | + checkArgumentsPassedByReference: true, |
| 41 | + checkExtraArguments: true, |
| 42 | + checkMissingTypehints: true, |
| 43 | + ), |
| 44 | + ); |
| 45 | + } |
| 46 | + |
| 47 | + public function testBug15139(): void |
| 48 | + { |
| 49 | + $this->analyse([__DIR__ . '/data/bug-15139.php'], []); |
| 50 | + } |
| 51 | + |
| 52 | + public function testBug15141(): void |
| 53 | + { |
| 54 | + $this->analyse([__DIR__ . '/data/bug-15141.php'], []); |
| 55 | + } |
| 56 | + |
| 57 | + public function testBug15185(): void |
| 58 | + { |
| 59 | + $this->analyse([__DIR__ . '/data/bug-15185.php'], []); |
| 60 | + } |
| 61 | + |
| 62 | + public static function getAdditionalConfigFiles(): array |
| 63 | + { |
| 64 | + return [ |
| 65 | + __DIR__ . '/data/call-to-function-php74.neon', |
| 66 | + ]; |
| 67 | + } |
| 68 | + |
| 69 | +} |
0 commit comments