Skip to content

Commit

Permalink
[BCB] Some constructor parameters are now required
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Sep 24, 2021
1 parent 6568103 commit 1f4062f
Show file tree
Hide file tree
Showing 51 changed files with 66 additions and 59 deletions.
2 changes: 1 addition & 1 deletion src/Command/ErrorFormatter/TableErrorFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class TableErrorFormatter implements ErrorFormatter
public function __construct(
RelativePathHelper $relativePathHelper,
bool $showTipsOfTheDay,
?string $editorUrl = null
?string $editorUrl
)
{
$this->relativePathHelper = $relativePathHelper;
Expand Down
14 changes: 7 additions & 7 deletions src/Reflection/Php/PhpFunctionFromParserNodeReflection.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@ public function __construct(
array $phpDocParameterTypes,
array $realParameterDefaultValues,
Type $realReturnType,
?Type $phpDocReturnType = null,
?Type $throwType = null,
?string $deprecatedDescription = null,
bool $isDeprecated = false,
bool $isInternal = false,
bool $isFinal = false,
?bool $isPure = null
?Type $phpDocReturnType,
?Type $throwType,
?string $deprecatedDescription,
bool $isDeprecated,
bool $isInternal,
bool $isFinal,
?bool $isPure
)
{
$this->functionLike = $functionLike;
Expand Down
2 changes: 1 addition & 1 deletion src/Reflection/Php/PhpFunctionReflection.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function __construct(
bool $isInternal,
bool $isFinal,
?string $filename,
?bool $isPure = null
?bool $isPure
)
{
$this->reflection = $reflection;
Expand Down
2 changes: 1 addition & 1 deletion src/Reflection/Php/PhpMethodFromParserNodeReflection.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function __construct(
bool $isDeprecated,
bool $isInternal,
bool $isFinal,
?bool $isPure = null
?bool $isPure
)
{
$name = strtolower($classMethod->name->name);
Expand Down
2 changes: 1 addition & 1 deletion src/Reflection/Php/PhpMethodReflection.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public function __construct(
bool $isInternal,
bool $isFinal,
?string $stubPhpDocString,
?bool $isPure = null
?bool $isPure
)
{
$this->declaringClass = $declaringClass;
Expand Down
2 changes: 1 addition & 1 deletion src/Rules/ClassCaseSensitivityCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class ClassCaseSensitivityCheck

private bool $checkInternalClassCaseSensitivity;

public function __construct(ReflectionProvider $reflectionProvider, bool $checkInternalClassCaseSensitivity = false)
public function __construct(ReflectionProvider $reflectionProvider, bool $checkInternalClassCaseSensitivity)
{
$this->reflectionProvider = $reflectionProvider;
$this->checkInternalClassCaseSensitivity = $checkInternalClassCaseSensitivity;
Expand Down
2 changes: 1 addition & 1 deletion src/Rules/Generics/GenericAncestorsCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function __construct(
GenericObjectTypeCheck $genericObjectTypeCheck,
VarianceCheck $varianceCheck,
bool $checkGenericClassInNonGenericObjectType,
array $skipCheckGenericClasses = []
array $skipCheckGenericClasses
)
{
$this->reflectionProvider = $reflectionProvider;
Expand Down
2 changes: 1 addition & 1 deletion src/Rules/MissingTypehintCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function __construct(
bool $checkMissingIterableValueType,
bool $checkGenericClassInNonGenericObjectType,
bool $checkMissingCallableSignature,
array $skipCheckGenericClasses = []
array $skipCheckGenericClasses
)
{
$this->reflectionProvider = $reflectionProvider;
Expand Down
2 changes: 1 addition & 1 deletion src/Rules/RuleLevelHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function __construct(
bool $checkNullables,
bool $checkThisOnly,
bool $checkUnionTypes,
bool $checkExplicitMixed = false
bool $checkExplicitMixed
)
{
$this->reflectionProvider = $reflectionProvider;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ private function runPath(string $path, int $expectedStatusCode): string
$memoryLimitFile = self::getContainer()->getParameter('memoryLimitFile');

$relativePathHelper = new FuzzyRelativePathHelper(new NullRelativePathHelper(), __DIR__, [], DIRECTORY_SEPARATOR);
$errorFormatter = new TableErrorFormatter($relativePathHelper, false);
$errorFormatter = new TableErrorFormatter($relativePathHelper, false, null);
$analysisResult = $analyserApplication->analyse(
[$path],
true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public function testFormatErrors(
$relativePathHelper = new FuzzyRelativePathHelper(new NullRelativePathHelper(), self::DIRECTORY_PATH, [], '/');
$formatter = new GithubErrorFormatter(
$relativePathHelper,
new TableErrorFormatter($relativePathHelper, false)
new TableErrorFormatter($relativePathHelper, false, null)
);

$this->assertSame($exitCode, $formatter->formatErrors(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public function testFormatErrors(
string $expected
): void
{
$formatter = new TableErrorFormatter(new FuzzyRelativePathHelper(new NullRelativePathHelper(), self::DIRECTORY_PATH, [], '/'), false);
$formatter = new TableErrorFormatter(new FuzzyRelativePathHelper(new NullRelativePathHelper(), self::DIRECTORY_PATH, [], '/'), false, null);

$this->assertSame($exitCode, $formatter->formatErrors(
$this->getAnalysisResult($numFileErrors, $numGenericErrors),
Expand Down
2 changes: 1 addition & 1 deletion tests/PHPStan/Rules/Classes/ClassAttributesRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ protected function getRule(): Rule
new AttributesCheck(
$reflectionProvider,
new FunctionCallParametersCheck(
new RuleLevelHelper($reflectionProvider, true, false, true),
new RuleLevelHelper($reflectionProvider, true, false, true, false),
new NullsafeCheck(),
new PhpVersion(80000),
new UnresolvableTypeHelper(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ protected function getRule(): Rule
new AttributesCheck(
$reflectionProvider,
new FunctionCallParametersCheck(
new RuleLevelHelper($reflectionProvider, true, false, true),
new RuleLevelHelper($reflectionProvider, true, false, true, false),
new NullsafeCheck(),
new PhpVersion(80000),
new UnresolvableTypeHelper(),
Expand Down
2 changes: 1 addition & 1 deletion tests/PHPStan/Rules/Classes/ClassConstantRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class ClassConstantRuleTest extends \PHPStan\Testing\RuleTestCase
protected function getRule(): Rule
{
$broker = $this->createReflectionProvider();
return new ClassConstantRule($broker, new RuleLevelHelper($broker, true, false, true, false), new ClassCaseSensitivityCheck($broker), new PhpVersion($this->phpVersion));
return new ClassConstantRule($broker, new RuleLevelHelper($broker, true, false, true, false), new ClassCaseSensitivityCheck($broker, true), new PhpVersion($this->phpVersion));
}

public function testClassConstant(): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ protected function getRule(): Rule
{
$broker = $this->createReflectionProvider();
return new ExistingClassInClassExtendsRule(
new ClassCaseSensitivityCheck($broker),
new ClassCaseSensitivityCheck($broker, true),
$broker
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ protected function getRule(): Rule
$broker = $this->createReflectionProvider();
return new ExistingClassInInstanceOfRule(
$broker,
new ClassCaseSensitivityCheck($broker),
new ClassCaseSensitivityCheck($broker, true),
true
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ protected function getRule(): Rule
{
$broker = $this->createReflectionProvider();
return new ExistingClassInTraitUseRule(
new ClassCaseSensitivityCheck($broker),
new ClassCaseSensitivityCheck($broker, true),
$broker
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ protected function getRule(): Rule
{
$broker = $this->createReflectionProvider();
return new ExistingClassesInClassImplementsRule(
new ClassCaseSensitivityCheck($broker),
new ClassCaseSensitivityCheck($broker, true),
$broker
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ protected function getRule(): Rule
{
$broker = $this->createReflectionProvider();
return new ExistingClassesInInterfaceExtendsRule(
new ClassCaseSensitivityCheck($broker),
new ClassCaseSensitivityCheck($broker, true),
$broker
);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/PHPStan/Rules/Classes/InstantiationRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ protected function getRule(): \PHPStan\Rules\Rule
return new InstantiationRule(
$broker,
new FunctionCallParametersCheck(new RuleLevelHelper($broker, true, false, true, false), new NullsafeCheck(), new PhpVersion(80000), new UnresolvableTypeHelper(), true, true, true, true),
new ClassCaseSensitivityCheck($broker)
new ClassCaseSensitivityCheck($broker, true)
);
}

Expand Down
4 changes: 2 additions & 2 deletions tests/PHPStan/Rules/Classes/MixinRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ protected function getRule(): Rule
return new MixinRule(
self::getContainer()->getByType(FileTypeMapper::class),
$reflectionProvider,
new ClassCaseSensitivityCheck($reflectionProvider),
new ClassCaseSensitivityCheck($reflectionProvider, true),
new GenericObjectTypeCheck(),
new MissingTypehintCheck($reflectionProvider, true, true, true),
new MissingTypehintCheck($reflectionProvider, true, true, true, []),
new UnresolvableTypeHelper(),
true
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class MissingClassConstantTypehintRuleTest extends RuleTestCase
protected function getRule(): \PHPStan\Rules\Rule
{
$reflectionProvider = $this->createReflectionProvider();
return new MissingClassConstantTypehintRule(new MissingTypehintCheck($reflectionProvider, true, true, true));
return new MissingClassConstantTypehintRule(new MissingTypehintCheck($reflectionProvider, true, true, true, []));
}

public function testRule(): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ protected function getRule(): \PHPStan\Rules\Rule
$broker = $this->createReflectionProvider();
return new CaughtExceptionExistenceRule(
$broker,
new ClassCaseSensitivityCheck($broker),
new ClassCaseSensitivityCheck($broker, true),
true
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ protected function getRule(): Rule
new AttributesCheck(
$reflectionProvider,
new FunctionCallParametersCheck(
new RuleLevelHelper($reflectionProvider, true, false, true),
new RuleLevelHelper($reflectionProvider, true, false, true, false),
new NullsafeCheck(),
new PhpVersion(80000),
new UnresolvableTypeHelper(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ protected function getRule(): Rule
new AttributesCheck(
$reflectionProvider,
new FunctionCallParametersCheck(
new RuleLevelHelper($reflectionProvider, true, false, true),
new RuleLevelHelper($reflectionProvider, true, false, true, false),
new NullsafeCheck(),
new PhpVersion(80000),
new UnresolvableTypeHelper(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class ExistingClassesInArrowFunctionTypehintsRuleTest extends \PHPStan\Testing\R
protected function getRule(): \PHPStan\Rules\Rule
{
$broker = $this->createReflectionProvider();
return new ExistingClassesInArrowFunctionTypehintsRule(new FunctionDefinitionCheck($broker, new ClassCaseSensitivityCheck($broker), new PhpVersion($this->phpVersionId), true, false));
return new ExistingClassesInArrowFunctionTypehintsRule(new FunctionDefinitionCheck($broker, new ClassCaseSensitivityCheck($broker, true), new PhpVersion($this->phpVersionId), true, false));
}

public function testRule(): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class ExistingClassesInClosureTypehintsRuleTest extends \PHPStan\Testing\RuleTes
protected function getRule(): \PHPStan\Rules\Rule
{
$broker = $this->createReflectionProvider();
return new ExistingClassesInClosureTypehintsRule(new FunctionDefinitionCheck($broker, new ClassCaseSensitivityCheck($broker), new PhpVersion($this->phpVersionId), true, false));
return new ExistingClassesInClosureTypehintsRule(new FunctionDefinitionCheck($broker, new ClassCaseSensitivityCheck($broker, true), new PhpVersion($this->phpVersionId), true, false));
}

public function testExistingClassInTypehint(): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class ExistingClassesInTypehintsRuleTest extends \PHPStan\Testing\RuleTestCase
protected function getRule(): \PHPStan\Rules\Rule
{
$broker = $this->createReflectionProvider();
return new ExistingClassesInTypehintsRule(new FunctionDefinitionCheck($broker, new ClassCaseSensitivityCheck($broker), new PhpVersion($this->phpVersionId), true, false));
return new ExistingClassesInTypehintsRule(new FunctionDefinitionCheck($broker, new ClassCaseSensitivityCheck($broker, true), new PhpVersion($this->phpVersionId), true, false));
}

public function testExistingClassInTypehint(): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ protected function getRule(): Rule
new AttributesCheck(
$reflectionProvider,
new FunctionCallParametersCheck(
new RuleLevelHelper($reflectionProvider, true, false, true),
new RuleLevelHelper($reflectionProvider, true, false, true, false),
new NullsafeCheck(),
new PhpVersion(80000),
new UnresolvableTypeHelper(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class MissingFunctionParameterTypehintRuleTest extends \PHPStan\Testing\RuleTest
protected function getRule(): \PHPStan\Rules\Rule
{
$broker = $this->createReflectionProvider();
return new MissingFunctionParameterTypehintRule(new MissingTypehintCheck($broker, true, true, true));
return new MissingFunctionParameterTypehintRule(new MissingTypehintCheck($broker, true, true, true, []));
}

public function testRule(): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class MissingFunctionReturnTypehintRuleTest extends \PHPStan\Testing\RuleTestCas
protected function getRule(): \PHPStan\Rules\Rule
{
$broker = $this->createReflectionProvider();
return new MissingFunctionReturnTypehintRule(new MissingTypehintCheck($broker, true, true, true));
return new MissingFunctionReturnTypehintRule(new MissingTypehintCheck($broker, true, true, true, []));
}

public function testRule(): void
Expand Down
2 changes: 1 addition & 1 deletion tests/PHPStan/Rules/Functions/ParamAttributesRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ protected function getRule(): Rule
new AttributesCheck(
$reflectionProvider,
new FunctionCallParametersCheck(
new RuleLevelHelper($reflectionProvider, true, false, true),
new RuleLevelHelper($reflectionProvider, true, false, true, false),
new NullsafeCheck(),
new PhpVersion(80000),
new UnresolvableTypeHelper(),
Expand Down
3 changes: 2 additions & 1 deletion tests/PHPStan/Rules/Generics/ClassAncestorsRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ protected function getRule(): Rule
$this->createReflectionProvider(),
new GenericObjectTypeCheck(),
new VarianceCheck(),
true
true,
[]
),
new CrossCheckInterfacesHelper()
);
Expand Down
2 changes: 1 addition & 1 deletion tests/PHPStan/Rules/Generics/ClassTemplateTypeRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ protected function getRule(): Rule
return new ClassTemplateTypeRule(
new TemplateTypeCheck(
$broker,
new ClassCaseSensitivityCheck($broker),
new ClassCaseSensitivityCheck($broker, true),
new GenericObjectTypeCheck(),
$typeAliasResolver,
true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ protected function getRule(): Rule

return new FunctionTemplateTypeRule(
self::getContainer()->getByType(FileTypeMapper::class),
new TemplateTypeCheck($broker, new ClassCaseSensitivityCheck($broker), new GenericObjectTypeCheck(), $typeAliasResolver, true)
new TemplateTypeCheck($broker, new ClassCaseSensitivityCheck($broker, true), new GenericObjectTypeCheck(), $typeAliasResolver, true)
);
}

Expand Down
3 changes: 2 additions & 1 deletion tests/PHPStan/Rules/Generics/InterfaceAncestorsRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ protected function getRule(): Rule
$this->createReflectionProvider(),
new GenericObjectTypeCheck(),
new VarianceCheck(),
true
true,
[]
),
new CrossCheckInterfacesHelper()
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ protected function getRule(): Rule

return new InterfaceTemplateTypeRule(
self::getContainer()->getByType(FileTypeMapper::class),
new TemplateTypeCheck($broker, new ClassCaseSensitivityCheck($broker), new GenericObjectTypeCheck(), $typeAliasResolver, true)
new TemplateTypeCheck($broker, new ClassCaseSensitivityCheck($broker, true), new GenericObjectTypeCheck(), $typeAliasResolver, true)
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ protected function getRule(): Rule

return new MethodTemplateTypeRule(
self::getContainer()->getByType(FileTypeMapper::class),
new TemplateTypeCheck($broker, new ClassCaseSensitivityCheck($broker), new GenericObjectTypeCheck(), $typeAliasResolver, true)
new TemplateTypeCheck($broker, new ClassCaseSensitivityCheck($broker, true), new GenericObjectTypeCheck(), $typeAliasResolver, true)
);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/PHPStan/Rules/Generics/TraitTemplateTypeRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ protected function getRule(): Rule

return new TraitTemplateTypeRule(
self::getContainer()->getByType(FileTypeMapper::class),
new TemplateTypeCheck($broker, new ClassCaseSensitivityCheck($broker), new GenericObjectTypeCheck(), $typeAliasResolver, true)
new TemplateTypeCheck($broker, new ClassCaseSensitivityCheck($broker, true), new GenericObjectTypeCheck(), $typeAliasResolver, true)
);
}

Expand Down
3 changes: 2 additions & 1 deletion tests/PHPStan/Rules/Generics/UsedTraitsRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ protected function getRule(): Rule
$this->createReflectionProvider(),
new GenericObjectTypeCheck(),
new VarianceCheck(),
true
true,
[]
)
);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/PHPStan/Rules/Methods/CallStaticMethodsRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ protected function getRule(): \PHPStan\Rules\Rule
$broker,
new FunctionCallParametersCheck($ruleLevelHelper, new NullsafeCheck(), new PhpVersion(80000), new UnresolvableTypeHelper(), true, true, true, true),
$ruleLevelHelper,
new ClassCaseSensitivityCheck($broker),
new ClassCaseSensitivityCheck($broker, true),
true,
true
);
Expand Down
Loading

0 comments on commit 1f4062f

Please sign in to comment.