From 36f151b1bd12a693db80dc71a951da00aec814a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=B6ller?= Date: Mon, 3 Dec 2018 08:30:04 +0100 Subject: [PATCH] Fix: Wording of error messages --- CHANGELOG.md | 1 + src/Classes/AbstractOrFinalRule.php | 2 +- src/Classes/FinalRule.php | 2 +- .../NoNullableReturnTypeDeclarationRule.php | 2 +- .../NoParameterWithNullDefaultValueRule.php | 2 +- ...arameterWithNullableTypeDeclarationRule.php | 2 +- .../NoNullableReturnTypeDeclarationRule.php | 2 +- .../NoParameterWithNullDefaultValueRule.php | 6 +++--- ...arameterWithNullableTypeDeclarationRule.php | 6 +++--- .../NoNullableReturnTypeDeclarationRule.php | 4 ++-- .../NoParameterWithNullDefaultValueRule.php | 12 ++++++------ ...arameterWithNullableTypeDeclarationRule.php | 12 ++++++------ .../Classes/AbstractOrFinalRuleTest.php | 2 +- test/Integration/Classes/FinalRuleTest.php | 4 ++-- ...NoNullableReturnTypeDeclarationRuleTest.php | 2 +- ...NoParameterWithNullDefaultValueRuleTest.php | 6 +++--- ...eterWithNullableTypeDeclarationRuleTest.php | 2 +- ...NoNullableReturnTypeDeclarationRuleTest.php | 2 +- ...NoParameterWithNullDefaultValueRuleTest.php | 6 +++--- ...eterWithNullableTypeDeclarationRuleTest.php | 2 +- ...NoNullableReturnTypeDeclarationRuleTest.php | 6 +++--- ...NoParameterWithNullDefaultValueRuleTest.php | 18 +++++++++--------- ...eterWithNullableTypeDeclarationRuleTest.php | 6 +++--- 23 files changed, 55 insertions(+), 54 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 46b48f6d..33bdf6b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ For a full diff see [`0.3.0...0.4.0`](https://github.com/localheinz/phpstan-rule ### Changed * Removed double-quotes from error messages to be more consistent with error messages generated by `phpstan/phstan` ([#39](https://github.com/localheinz/phpstan-rules/pull/39)), by [@localheinz](https://github.com/localheinz) +* Modified wording and placement of method, function, and parameter names in error messages to be more consistent with error messages generated by `phpstan/phstan` ([#42](https://github.com/localheinz/phpstan-rules/pull/42)), by [@localheinz](https://github.com/localheinz) ## [`0.3.0`](https://github.com/localheinz/phpstan-rules/releases/tag/0.3.0) diff --git a/src/Classes/AbstractOrFinalRule.php b/src/Classes/AbstractOrFinalRule.php index afa90469..4a6edac0 100644 --- a/src/Classes/AbstractOrFinalRule.php +++ b/src/Classes/AbstractOrFinalRule.php @@ -57,7 +57,7 @@ public function processNode(Node $node, Scope $scope): array return [ \sprintf( - 'Class %s should be marked as abstract or final.', + 'Class %s is neither abstract nor final.', $node->namespacedName ), ]; diff --git a/src/Classes/FinalRule.php b/src/Classes/FinalRule.php index e5730269..66e90815 100644 --- a/src/Classes/FinalRule.php +++ b/src/Classes/FinalRule.php @@ -56,7 +56,7 @@ public function processNode(Node $node, Scope $scope): array return [ \sprintf( - 'Class %s should be marked as final.', + 'Class %s is not final.', $node->namespacedName ), ]; diff --git a/src/Closures/NoNullableReturnTypeDeclarationRule.php b/src/Closures/NoNullableReturnTypeDeclarationRule.php index 36309f23..a58f68da 100644 --- a/src/Closures/NoNullableReturnTypeDeclarationRule.php +++ b/src/Closures/NoNullableReturnTypeDeclarationRule.php @@ -37,7 +37,7 @@ public function processNode(Node $node, Scope $scope): array } return [ - 'Closure should not have a nullable return type declaration.', + 'Closure has a nullable return type declaration.', ]; } } diff --git a/src/Closures/NoParameterWithNullDefaultValueRule.php b/src/Closures/NoParameterWithNullDefaultValueRule.php index f38a2d38..67a62074 100644 --- a/src/Closures/NoParameterWithNullDefaultValueRule.php +++ b/src/Closures/NoParameterWithNullDefaultValueRule.php @@ -56,7 +56,7 @@ public function processNode(Node $node, Scope $scope): array $parameterName = $variable->name; return \sprintf( - 'Parameter $%s of closure should not have null as default value.', + 'Closure has parameter $%s with null as default value.', $parameterName ); }, $params); diff --git a/src/Closures/NoParameterWithNullableTypeDeclarationRule.php b/src/Closures/NoParameterWithNullableTypeDeclarationRule.php index ac5cc419..de0ea553 100644 --- a/src/Closures/NoParameterWithNullableTypeDeclarationRule.php +++ b/src/Closures/NoParameterWithNullableTypeDeclarationRule.php @@ -52,7 +52,7 @@ public function processNode(Node $node, Scope $scope): array $parameterName = $variable->name; return \sprintf( - 'Parameter $%s of closure should not have a nullable type declaration.', + 'Closure has parameter $%s with a nullable type declaration.', $parameterName ); }, $params); diff --git a/src/Functions/NoNullableReturnTypeDeclarationRule.php b/src/Functions/NoNullableReturnTypeDeclarationRule.php index c6b04f55..2303d64e 100644 --- a/src/Functions/NoNullableReturnTypeDeclarationRule.php +++ b/src/Functions/NoNullableReturnTypeDeclarationRule.php @@ -38,7 +38,7 @@ public function processNode(Node $node, Scope $scope): array return [ \sprintf( - 'Function %s() should not have a nullable return type declaration.', + 'Function %s() has a nullable return type declaration.', $node->namespacedName ), ]; diff --git a/src/Functions/NoParameterWithNullDefaultValueRule.php b/src/Functions/NoParameterWithNullDefaultValueRule.php index 6fcc8e5f..0acf6101 100644 --- a/src/Functions/NoParameterWithNullDefaultValueRule.php +++ b/src/Functions/NoParameterWithNullDefaultValueRule.php @@ -58,9 +58,9 @@ public function processNode(Node $node, Scope $scope): array $parameterName = $variable->name; return \sprintf( - 'Parameter $%s of function %s() should not have null as default value.', - $parameterName, - $functionName + 'Function %s() has parameter $%s with null as default value.', + $functionName, + $parameterName ); }, $params); } diff --git a/src/Functions/NoParameterWithNullableTypeDeclarationRule.php b/src/Functions/NoParameterWithNullableTypeDeclarationRule.php index 43c462e1..96ec4931 100644 --- a/src/Functions/NoParameterWithNullableTypeDeclarationRule.php +++ b/src/Functions/NoParameterWithNullableTypeDeclarationRule.php @@ -54,9 +54,9 @@ public function processNode(Node $node, Scope $scope): array $parameterName = $variable->name; return \sprintf( - 'Parameter $%s of function "%s()" should not have a nullable type declaration.', - $parameterName, - $functionName + 'Function %s() has parameter $%s with a nullable type declaration.', + $functionName, + $parameterName ); }, $params); } diff --git a/src/Methods/NoNullableReturnTypeDeclarationRule.php b/src/Methods/NoNullableReturnTypeDeclarationRule.php index 19a64e42..b3e54320 100644 --- a/src/Methods/NoNullableReturnTypeDeclarationRule.php +++ b/src/Methods/NoNullableReturnTypeDeclarationRule.php @@ -45,7 +45,7 @@ public function processNode(Node $node, Scope $scope): array if ($classReflection->isAnonymous()) { return [ \sprintf( - 'Method %s() in anonymous class should not have a nullable return type declaration.', + 'Method %s() in anonymous class has a nullable return type declaration.', $node->name->name ), ]; @@ -53,7 +53,7 @@ public function processNode(Node $node, Scope $scope): array return [ \sprintf( - 'Method %s::%s() should not have a nullable return type declaration.', + 'Method %s::%s() has a nullable return type declaration.', $classReflection->getName(), $node->name->name ), diff --git a/src/Methods/NoParameterWithNullDefaultValueRule.php b/src/Methods/NoParameterWithNullDefaultValueRule.php index 62c8efba..58f3a8e2 100644 --- a/src/Methods/NoParameterWithNullDefaultValueRule.php +++ b/src/Methods/NoParameterWithNullDefaultValueRule.php @@ -63,9 +63,9 @@ public function processNode(Node $node, Scope $scope): array $parameterName = $variable->name; return \sprintf( - 'Parameter $%s of method %s() in anonymous class should not have null as default value.', - $parameterName, - $methodName + 'Method %s() in anonymous class has parameter $%s with null as default value.', + $methodName, + $parameterName ); }, $params); } @@ -80,10 +80,10 @@ public function processNode(Node $node, Scope $scope): array $parameterName = $variable->name; return \sprintf( - 'Parameter $%s of method %s::%s() should not have null as default value.', - $parameterName, + 'Method %s::%s() has parameter $%s with null as default value.', $className, - $methodName + $methodName, + $parameterName ); }, $params); } diff --git a/src/Methods/NoParameterWithNullableTypeDeclarationRule.php b/src/Methods/NoParameterWithNullableTypeDeclarationRule.php index 3aebaa59..9bf40808 100644 --- a/src/Methods/NoParameterWithNullableTypeDeclarationRule.php +++ b/src/Methods/NoParameterWithNullableTypeDeclarationRule.php @@ -59,9 +59,9 @@ public function processNode(Node $node, Scope $scope): array $parameterName = $variable->name; return \sprintf( - 'Parameter $%s of method %s() in anonymous class should not have a nullable type declaration.', - $parameterName, - $methodName + 'Method %s() in anonymous class has parameter $%s with a nullable type declaration.', + $methodName, + $parameterName ); }, $params); } @@ -76,10 +76,10 @@ public function processNode(Node $node, Scope $scope): array $parameterName = $variable->name; return \sprintf( - 'Parameter $%s of method %s::%s() should not have a nullable type declaration.', - $parameterName, + 'Method %s::%s() has parameter $%s with a nullable type declaration.', $className, - $methodName + $methodName, + $parameterName ); }, $params); } diff --git a/test/Integration/Classes/AbstractOrFinalRuleTest.php b/test/Integration/Classes/AbstractOrFinalRuleTest.php index d6ef2a45..cec6f489 100644 --- a/test/Integration/Classes/AbstractOrFinalRuleTest.php +++ b/test/Integration/Classes/AbstractOrFinalRuleTest.php @@ -50,7 +50,7 @@ public function providerAnalysisFails(): \Generator __DIR__ . '/../../Fixture/Classes/AbstractOrFinalRule/Failure/NeitherAbstractNorFinalClass.php', [ \sprintf( - 'Class %s should be marked as abstract or final.', + 'Class %s is neither abstract nor final.', Fixture\Classes\AbstractOrFinalRule\Failure\NeitherAbstractNorFinalClass::class ), 7, diff --git a/test/Integration/Classes/FinalRuleTest.php b/test/Integration/Classes/FinalRuleTest.php index 88a65505..8c7e0e78 100644 --- a/test/Integration/Classes/FinalRuleTest.php +++ b/test/Integration/Classes/FinalRuleTest.php @@ -49,7 +49,7 @@ public function providerAnalysisFails(): \Generator __DIR__ . '/../../Fixture/Classes/FinalRule/Failure/AbstractClass.php', [ \sprintf( - 'Class %s should be marked as final.', + 'Class %s is not final.', Fixture\Classes\FinalRule\Failure\AbstractClass::class ), 7, @@ -59,7 +59,7 @@ public function providerAnalysisFails(): \Generator __DIR__ . '/../../Fixture/Classes/FinalRule/Failure/NeitherAbstractNorFinalClass.php', [ \sprintf( - 'Class %s should be marked as final.', + 'Class %s is not final.', Fixture\Classes\FinalRule\Failure\NeitherAbstractNorFinalClass::class ), 7, diff --git a/test/Integration/Closures/NoNullableReturnTypeDeclarationRuleTest.php b/test/Integration/Closures/NoNullableReturnTypeDeclarationRuleTest.php index 388dfd0d..8be19f90 100644 --- a/test/Integration/Closures/NoNullableReturnTypeDeclarationRuleTest.php +++ b/test/Integration/Closures/NoNullableReturnTypeDeclarationRuleTest.php @@ -42,7 +42,7 @@ public function providerAnalysisFails(): \Generator 'closure-with-nullable-return-type-declaration' => [ __DIR__ . '/../../Fixture/Closures/NoNullableReturnTypeDeclarationRule/Failure/closure-with-nullable-return-type-declaration.php', [ - 'Closure should not have a nullable return type declaration.', + 'Closure has a nullable return type declaration.', 7, ], ], diff --git a/test/Integration/Closures/NoParameterWithNullDefaultValueRuleTest.php b/test/Integration/Closures/NoParameterWithNullDefaultValueRuleTest.php index 3ec76118..c5369289 100644 --- a/test/Integration/Closures/NoParameterWithNullDefaultValueRuleTest.php +++ b/test/Integration/Closures/NoParameterWithNullDefaultValueRuleTest.php @@ -43,21 +43,21 @@ public function providerAnalysisFails(): \Generator 'closure-with-parameter-with-null-default-value' => [ __DIR__ . '/../../Fixture/Closures/NoParameterWithNullDefaultValueRule/Failure/closure-with-parameter-with-null-default-value.php', [ - 'Parameter $bar of closure should not have null as default value.', + 'Closure has parameter $bar with null as default value.', 7, ], ], 'closure-with-parameter-with-root-namespace-referenced-null-default-value' => [ __DIR__ . '/../../Fixture/Closures/NoParameterWithNullDefaultValueRule/Failure/closure-with-parameter-with-root-namespace-referenced-null-default-value.php', [ - 'Parameter $bar of closure should not have null as default value.', + 'Closure has parameter $bar with null as default value.', 7, ], ], 'closure-with-parameter-with-wrongly-capitalized-null-default-value' => [ __DIR__ . '/../../Fixture/Closures/NoParameterWithNullDefaultValueRule/Failure/closure-with-parameter-with-wrongly-capitalized-null-default-value.php', [ - 'Parameter $bar of closure should not have null as default value.', + 'Closure has parameter $bar with null as default value.', 7, ], ], diff --git a/test/Integration/Closures/NoParameterWithNullableTypeDeclarationRuleTest.php b/test/Integration/Closures/NoParameterWithNullableTypeDeclarationRuleTest.php index 8436f562..4afb55a4 100644 --- a/test/Integration/Closures/NoParameterWithNullableTypeDeclarationRuleTest.php +++ b/test/Integration/Closures/NoParameterWithNullableTypeDeclarationRuleTest.php @@ -43,7 +43,7 @@ public function providerAnalysisFails(): \Generator 'closure-with-parameter-with-nullable-type-declaration' => [ __DIR__ . '/../../Fixture/Closures/NoParameterWithNullableTypeDeclarationRule/Failure/closure-with-parameter-with-nullable-type-declaration.php', [ - 'Parameter $bar of closure should not have a nullable type declaration.', + 'Closure has parameter $bar with a nullable type declaration.', 7, ], ], diff --git a/test/Integration/Functions/NoNullableReturnTypeDeclarationRuleTest.php b/test/Integration/Functions/NoNullableReturnTypeDeclarationRuleTest.php index 2f90fa80..f7a16d27 100644 --- a/test/Integration/Functions/NoNullableReturnTypeDeclarationRuleTest.php +++ b/test/Integration/Functions/NoNullableReturnTypeDeclarationRuleTest.php @@ -42,7 +42,7 @@ public function providerAnalysisFails(): \Generator 'function-with-nullable-return-type-declaration' => [ __DIR__ . '/../../Fixture/Functions/NoNullableReturnTypeDeclarationRule/Failure/function-with-nullable-return-type-declaration.php', [ - 'Function Localheinz\PHPStan\Rules\Test\Fixture\Functions\NoNullableReturnTypeDeclarationRule\Failure\foo() should not have a nullable return type declaration.', + 'Function Localheinz\PHPStan\Rules\Test\Fixture\Functions\NoNullableReturnTypeDeclarationRule\Failure\foo() has a nullable return type declaration.', 7, ], ], diff --git a/test/Integration/Functions/NoParameterWithNullDefaultValueRuleTest.php b/test/Integration/Functions/NoParameterWithNullDefaultValueRuleTest.php index 33535943..7d41bd9e 100644 --- a/test/Integration/Functions/NoParameterWithNullDefaultValueRuleTest.php +++ b/test/Integration/Functions/NoParameterWithNullDefaultValueRuleTest.php @@ -43,21 +43,21 @@ public function providerAnalysisFails(): \Generator 'function-with-parameter-with-null-default-value' => [ __DIR__ . '/../../Fixture/Functions/NoParameterWithNullDefaultValueRule/Failure/function-with-parameter-with-null-default-value.php', [ - 'Parameter $bar of function Localheinz\PHPStan\Rules\Test\Fixture\Functions\NoParameterWithNullDefaultValueRule\Failure\foo() should not have null as default value.', + 'Function Localheinz\PHPStan\Rules\Test\Fixture\Functions\NoParameterWithNullDefaultValueRule\Failure\foo() has parameter $bar with null as default value.', 7, ], ], 'function-with-parameter-with-root-namespace-referenced-null-default-value' => [ __DIR__ . '/../../Fixture/Functions/NoParameterWithNullDefaultValueRule/Failure/function-with-parameter-with-root-namespace-referenced-null-default-value.php', [ - 'Parameter $bar of function Localheinz\PHPStan\Rules\Test\Fixture\Functions\NoParameterWithNullDefaultValueRule\Failure\foo() should not have null as default value.', + 'Function Localheinz\PHPStan\Rules\Test\Fixture\Functions\NoParameterWithNullDefaultValueRule\Failure\foo() has parameter $bar with null as default value.', 7, ], ], 'function-with-parameter-with-wrongly-capitalized-null-default-value' => [ __DIR__ . '/../../Fixture/Functions/NoParameterWithNullDefaultValueRule/Failure/function-with-parameter-with-wrongly-capitalized-null-default-value.php', [ - 'Parameter $bar of function Localheinz\PHPStan\Rules\Test\Fixture\Functions\NoParameterWithNullDefaultValueRule\Failure\foo() should not have null as default value.', + 'Function Localheinz\PHPStan\Rules\Test\Fixture\Functions\NoParameterWithNullDefaultValueRule\Failure\foo() has parameter $bar with null as default value.', 7, ], ], diff --git a/test/Integration/Functions/NoParameterWithNullableTypeDeclarationRuleTest.php b/test/Integration/Functions/NoParameterWithNullableTypeDeclarationRuleTest.php index e74defee..011dd757 100644 --- a/test/Integration/Functions/NoParameterWithNullableTypeDeclarationRuleTest.php +++ b/test/Integration/Functions/NoParameterWithNullableTypeDeclarationRuleTest.php @@ -43,7 +43,7 @@ public function providerAnalysisFails(): \Generator 'function-with-parameter-with-nullable-type-declaration' => [ __DIR__ . '/../../Fixture/Functions/NoParameterWithNullableTypeDeclarationRule/Failure/function-with-parameter-with-nullable-type-declaration.php', [ - 'Parameter $bar of function "Localheinz\PHPStan\Rules\Test\Fixture\Functions\NoParameterWithNullableTypeDeclarationRule\Failure\foo()" should not have a nullable type declaration.', + 'Function Localheinz\PHPStan\Rules\Test\Fixture\Functions\NoParameterWithNullableTypeDeclarationRule\Failure\foo() has parameter $bar with a nullable type declaration.', 7, ], ], diff --git a/test/Integration/Methods/NoNullableReturnTypeDeclarationRuleTest.php b/test/Integration/Methods/NoNullableReturnTypeDeclarationRuleTest.php index 20497375..dde0bd0c 100644 --- a/test/Integration/Methods/NoNullableReturnTypeDeclarationRuleTest.php +++ b/test/Integration/Methods/NoNullableReturnTypeDeclarationRuleTest.php @@ -51,7 +51,7 @@ public function providerAnalysisFails(): \Generator 'method-in-anonymous-class-with-nullable-return-type-declaration' => [ __DIR__ . '/../../Fixture/Methods/NoNullableReturnTypeDeclarationRule/Failure/MethodInAnonymousClassWithNullableReturnTypeDeclaration.php', [ - 'Method toString() in anonymous class should not have a nullable return type declaration.', + 'Method toString() in anonymous class has a nullable return type declaration.', 12, ], ], @@ -59,7 +59,7 @@ public function providerAnalysisFails(): \Generator __DIR__ . '/../../Fixture/Methods/NoNullableReturnTypeDeclarationRule/Failure/MethodInClassWithNullableReturnTypeDeclaration.php', [ \sprintf( - 'Method %s::toString() should not have a nullable return type declaration.', + 'Method %s::toString() has a nullable return type declaration.', Fixture\Methods\NoNullableReturnTypeDeclarationRule\Failure\MethodInClassWithNullableReturnTypeDeclaration::class ), 9, @@ -69,7 +69,7 @@ public function providerAnalysisFails(): \Generator __DIR__ . '/../../Fixture/Methods/NoNullableReturnTypeDeclarationRule/Failure/MethodInInterfaceWithNullableReturnTypeDeclaration.php', [ \sprintf( - 'Method %s::toString() should not have a nullable return type declaration.', + 'Method %s::toString() has a nullable return type declaration.', Fixture\Methods\NoNullableReturnTypeDeclarationRule\Failure\MethodInInterfaceWithNullableReturnTypeDeclaration::class ), 9, diff --git a/test/Integration/Methods/NoParameterWithNullDefaultValueRuleTest.php b/test/Integration/Methods/NoParameterWithNullDefaultValueRuleTest.php index b1220c8f..e4c9edf1 100644 --- a/test/Integration/Methods/NoParameterWithNullDefaultValueRuleTest.php +++ b/test/Integration/Methods/NoParameterWithNullDefaultValueRuleTest.php @@ -57,21 +57,21 @@ public function providerAnalysisFails(): \Generator 'method-in-anonymous-class-with-parameter-with-null-default-value' => [ __DIR__ . '/../../Fixture/Methods/NoParameterWithNullDefaultValueRule/Failure/method-in-anonymous-class-with-parameter-with-null-default-value.php', [ - 'Parameter $bar of method foo() in anonymous class should not have null as default value.', + 'Method foo() in anonymous class has parameter $bar with null as default value.', 8, ], ], 'method-in-anonymous-class-with-parameter-with-root-namespace-referenced-null-default-value' => [ __DIR__ . '/../../Fixture/Methods/NoParameterWithNullDefaultValueRule/Failure/method-in-anonymous-class-with-parameter-with-root-namespace-referenced-null-default-value.php', [ - 'Parameter $bar of method foo() in anonymous class should not have null as default value.', + 'Method foo() in anonymous class has parameter $bar with null as default value.', 8, ], ], 'method-in-anonymous-class-with-parameter-with-wrongly-capitalized-null-default-value' => [ __DIR__ . '/../../Fixture/Methods/NoParameterWithNullDefaultValueRule/Failure/method-in-anonymous-class-with-parameter-with-wrongly-capitalized-null-default-value.php', [ - 'Parameter $bar of method foo() in anonymous class should not have null as default value.', + 'Method foo() in anonymous class has parameter $bar with null as default value.', 8, ], ], @@ -79,7 +79,7 @@ public function providerAnalysisFails(): \Generator __DIR__ . '/../../Fixture/Methods/NoParameterWithNullDefaultValueRule/Failure/MethodInClassWithParameterWithNullDefaultValue.php', [ \sprintf( - 'Parameter $bar of method %s::foo() should not have null as default value.', + 'Method %s::foo() has parameter $bar with null as default value.', Fixture\Methods\NoParameterWithNullDefaultValueRule\Failure\MethodInClassWithParameterWithNullDefaultValue::class ), 9, @@ -89,7 +89,7 @@ public function providerAnalysisFails(): \Generator __DIR__ . '/../../Fixture/Methods/NoParameterWithNullDefaultValueRule/Failure/MethodInClassWithParameterWithRootNamespaceReferencedNullDefaultValue.php', [ \sprintf( - 'Parameter $bar of method %s::foo() should not have null as default value.', + 'Method %s::foo() has parameter $bar with null as default value.', Fixture\Methods\NoParameterWithNullDefaultValueRule\Failure\MethodInClassWithParameterWithRootNamespaceReferencedNullDefaultValue::class ), 9, @@ -99,7 +99,7 @@ public function providerAnalysisFails(): \Generator __DIR__ . '/../../Fixture/Methods/NoParameterWithNullDefaultValueRule/Failure/MethodInClassWithParameterWithWronglyCapitalizedNullDefaultValue.php', [ \sprintf( - 'Parameter $bar of method %s::foo() should not have null as default value.', + 'Method %s::foo() has parameter $bar with null as default value.', Fixture\Methods\NoParameterWithNullDefaultValueRule\Failure\MethodInClassWithParameterWithWronglyCapitalizedNullDefaultValue::class ), 9, @@ -109,7 +109,7 @@ public function providerAnalysisFails(): \Generator __DIR__ . '/../../Fixture/Methods/NoParameterWithNullDefaultValueRule/Failure/MethodInInterfaceWithParameterWithNullDefaultValue.php', [ \sprintf( - 'Parameter $bar of method %s::foo() should not have null as default value.', + 'Method %s::foo() has parameter $bar with null as default value.', Fixture\Methods\NoParameterWithNullDefaultValueRule\Failure\MethodInInterfaceWithParameterWithNullDefaultValue::class ), 9, @@ -119,7 +119,7 @@ public function providerAnalysisFails(): \Generator __DIR__ . '/../../Fixture/Methods/NoParameterWithNullDefaultValueRule/Failure/MethodInInterfaceWithParameterWithRootNamespaceReferencedNullDefaultValue.php', [ \sprintf( - 'Parameter $bar of method %s::foo() should not have null as default value.', + 'Method %s::foo() has parameter $bar with null as default value.', Fixture\Methods\NoParameterWithNullDefaultValueRule\Failure\MethodInInterfaceWithParameterWithRootNamespaceReferencedNullDefaultValue::class ), 9, @@ -129,7 +129,7 @@ public function providerAnalysisFails(): \Generator __DIR__ . '/../../Fixture/Methods/NoParameterWithNullDefaultValueRule/Failure/MethodInInterfaceWithParameterWithWronlgyCapitalizedNullDefaultValue.php', [ \sprintf( - 'Parameter $bar of method %s::foo() should not have null as default value.', + 'Method %s::foo() has parameter $bar with null as default value.', Fixture\Methods\NoParameterWithNullDefaultValueRule\Failure\MethodInInterfaceWithParameterWithWronlgyCapitalizedNullDefaultValue::class ), 9, diff --git a/test/Integration/Methods/NoParameterWithNullableTypeDeclarationRuleTest.php b/test/Integration/Methods/NoParameterWithNullableTypeDeclarationRuleTest.php index ae5562ef..b0b413c8 100644 --- a/test/Integration/Methods/NoParameterWithNullableTypeDeclarationRuleTest.php +++ b/test/Integration/Methods/NoParameterWithNullableTypeDeclarationRuleTest.php @@ -54,7 +54,7 @@ public function providerAnalysisFails(): \Generator 'method-in-anonymous-class-with-parameter-with-nullable-type-declaration' => [ __DIR__ . '/../../Fixture/Methods/NoParameterWithNullableTypeDeclarationRule/Failure/method-in-anonymous-class-with-parameter-with-nullable-type-declaration.php', [ - 'Parameter $bar of method foo() in anonymous class should not have a nullable type declaration.', + 'Method foo() in anonymous class has parameter $bar with a nullable type declaration.', 8, ], ], @@ -62,7 +62,7 @@ public function providerAnalysisFails(): \Generator __DIR__ . '/../../Fixture/Methods/NoParameterWithNullableTypeDeclarationRule/Failure/MethodInClassWithParameterWithNullableTypeDeclaration.php', [ \sprintf( - 'Parameter $bar of method %s::foo() should not have a nullable type declaration.', + 'Method %s::foo() has parameter $bar with a nullable type declaration.', Fixture\Methods\NoParameterWithNullableTypeDeclarationRule\Failure\MethodInClassWithParameterWithNullableTypeDeclaration::class ), 9, @@ -72,7 +72,7 @@ public function providerAnalysisFails(): \Generator __DIR__ . '/../../Fixture/Methods/NoParameterWithNullableTypeDeclarationRule/Failure/MethodInInterfaceWithParameterWithNullableTypeDeclaration.php', [ \sprintf( - 'Parameter $bar of method %s::foo() should not have a nullable type declaration.', + 'Method %s::foo() has parameter $bar with a nullable type declaration.', Fixture\Methods\NoParameterWithNullableTypeDeclarationRule\Failure\MethodInInterfaceWithParameterWithNullableTypeDeclaration::class ), 9,