diff --git a/src/LaminasCodingStandard/ruleset.xml b/src/LaminasCodingStandard/ruleset.xml
index f3b2c82..ac1786d 100644
--- a/src/LaminasCodingStandard/ruleset.xml
+++ b/src/LaminasCodingStandard/ruleset.xml
@@ -264,13 +264,17 @@
-
+
-
+
+
+
+
+
-
+
@@ -280,13 +284,23 @@
-
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -787,11 +801,14 @@
-
-
-
-
+
+
+
+
+
+
+
diff --git a/test/expected-report.txt b/test/expected-report.txt
index cade5c8..17a0e2b 100644
--- a/test/expected-report.txt
+++ b/test/expected-report.txt
@@ -7,22 +7,22 @@ test/fixable/2.1.BasicCodingStandard.php 48 1
test/fixable/2.2.Files.php 6 0
test/fixable/2.3.Lines.php 35 0
test/fixable/2.4.IndentingAndSpacing.php 46 0
-test/fixable/2.5.KeywordsAndTypes.php 13 0
+test/fixable/2.5.KeywordsAndTypes.php 8 0
test/fixable/2.6.Variables.php 3 0
test/fixable/2.7.Arrays.php 9 0
-test/fixable/3.DeclareNamespaceAndImport.php 11 0
+test/fixable/3.DeclareNamespaceAndImport.php 12 0
test/fixable/4.1.ExtendsAndImplements.php 5 0
-test/fixable/4.2.UsingTraits.php 4 0
-test/fixable/4.3.PropertiesAndConstants.php 5 0
-test/fixable/4.4.MethodsAndFunctions.php 26 0
+test/fixable/4.2.UsingTraits.php 5 0
+test/fixable/4.3.PropertiesAndConstants.php 7 0
+test/fixable/4.4.MethodsAndFunctions.php 27 0
test/fixable/4.5.MethodAndFunctionArguments.php 66 0
-test/fixable/4.6.AbstractFinalAndStatic.php 4 0
+test/fixable/4.6.AbstractFinalAndStatic.php 5 0
test/fixable/4.7.MethodAndFunctionCalls.php 11 0
-test/fixable/4.ClassesPropertiesAndMethods.php 32 0
-test/fixable/5.1.IfElseifElse.php 15 1
+test/fixable/4.ClassesPropertiesAndMethods.php 34 0
+test/fixable/5.1.IfElseifElse.php 13 1
test/fixable/5.2.SwitchCase.php 11 0
test/fixable/5.3.WhileAndDoWhile.php 12 0
-test/fixable/5.4.ForStructure.php 7 0
+test/fixable/5.4.ForStructure.php 5 0
test/fixable/5.5.ForEachStructure.php 10 0
test/fixable/5.6.TryCatchFinally.php 9 0
test/fixable/5.ControlStructures.php 4 0
@@ -30,13 +30,14 @@ test/fixable/6.1.UnaryOperators.php 6 0
test/fixable/6.2.BinaryOperators.php 35 0
test/fixable/6.3.TernaryOperators.php 13 0
test/fixable/6.Operators.php 97 0
-test/fixable/7.Closures.php 2 0
+test/fixable/7.Closures.php 4 0
test/fixable/8.AnonymousClasses.php 1 0
-test/fixable/9.CommentingAndDocBlocks.php 21 0
+test/fixable/9.CommentingAndDocBlocks.php 17 0
+test/fixable/9.GenericTypeHintSyntax.php 4 0
----------------------------------------------------------------------
-A TOTAL OF 567 ERRORS AND 2 WARNINGS WERE FOUND IN 30 FILES
+A TOTAL OF 568 ERRORS AND 2 WARNINGS WERE FOUND IN 31 FILES
----------------------------------------------------------------------
-PHPCBF CAN FIX 487 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
+PHPCBF CAN FIX 484 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
diff --git a/test/fixable/2.3.Lines.php b/test/fixable/2.3.Lines.php
index eba4062..8f585ea 100644
--- a/test/fixable/2.3.Lines.php
+++ b/test/fixable/2.3.Lines.php
@@ -60,13 +60,13 @@ public function testThereMayNotBeAnyBlankLineFfterOpeningBracesAndBeforeClosingB
// There MAY NOT be any blank line after opening braces and before
// closing braces.
- $noBlankLine = function () use ($noBlankLine) {
+ $noBlankLine = function () use ($noBlankLine): void {
$noBlankLine = 1;
};
- $closure = function () {
+ $closure = function (): void {
$noBlankLine = 1;
diff --git a/test/fixable/2.7.Arrays.php b/test/fixable/2.7.Arrays.php
index 37b141a..0a6240f 100644
--- a/test/fixable/2.7.Arrays.php
+++ b/test/fixable/2.7.Arrays.php
@@ -27,7 +27,7 @@ public function testArrayFormatting(): void
];
$array2 = [
- 'one' => function () {
+ 'one' => function (): void {
$foo = [1, 2, 3];
$barBar = [
1,
diff --git a/test/fixable/4.1.ExtendsAndImplements.php b/test/fixable/4.1.ExtendsAndImplements.php
index 88770ef..46dede2 100644
--- a/test/fixable/4.1.ExtendsAndImplements.php
+++ b/test/fixable/4.1.ExtendsAndImplements.php
@@ -16,7 +16,7 @@ class ExtendsAndImplements
ArrayAccess,
Countable,
Serializable {
- public function testClassDeclaration()
+ public function testClassDeclaration(): void
{
// The extends and implements keywords MUST be declared on the same line
// as the class name.
diff --git a/test/fixable/4.4.MethodsAndFunctions.php b/test/fixable/4.4.MethodsAndFunctions.php
index 820d577..e34bcec 100644
--- a/test/fixable/4.4.MethodsAndFunctions.php
+++ b/test/fixable/4.4.MethodsAndFunctions.php
@@ -19,7 +19,7 @@ public function testMethodsAndFunctions ($arg1, &$arg2, $arg3 = []) {
// NOT be a space after the opening parenthesis, and there MUST NOT be a
// space before the closing parenthesis.
- function fooBar ( $arg1, &$arg2, $arg3 = [] ) {
+ function fooBar ( $arg1, &$arg2, $arg3 = [] ): void {
// function body
}
@@ -27,7 +27,7 @@ function fooBar ( $arg1, &$arg2, $arg3 = [] ) {
- public function testOneSingleLineBetweenMethods()
+ public function testOneSingleLineBetweenMethods(): void
{
// There MUST be a single empty line between methods in a class.
}
diff --git a/test/fixable/4.5.MethodAndFunctionArguments.php b/test/fixable/4.5.MethodAndFunctionArguments.php
index c77b35f..184aa9d 100644
--- a/test/fixable/4.5.MethodAndFunctionArguments.php
+++ b/test/fixable/4.5.MethodAndFunctionArguments.php
@@ -74,7 +74,7 @@ public function testVariadicThreeDotOperator(string $foo, & ... $baz): void
// When combining both the reference operator and the variadic three dot
// operator, there MUST NOT be any space between the two of them.
- function method($a, $b, ... $c) {
+ function method($a, $b, ... $c): void {
if ($a < $b) {
method(... func_get_args());
}
diff --git a/test/fixable/6.Operators.php b/test/fixable/6.Operators.php
index a30933b..f2c7450 100644
--- a/test/fixable/6.Operators.php
+++ b/test/fixable/6.Operators.php
@@ -65,7 +65,7 @@ public function testOperatorSpacing(): void
$result*=4;
}
- public function testObjectOperatorSpacing()
+ public function testObjectOperatorSpacing(): void
{
// There MAY NOT be any white space around the object operator unless
// multilines are used.
diff --git a/test/fixable/7.Closures.php b/test/fixable/7.Closures.php
index 78dd221..96fd3b4 100644
--- a/test/fixable/7.Closures.php
+++ b/test/fixable/7.Closures.php
@@ -37,11 +37,11 @@ public function testClosures(): void
// MUST follow the use list closing parentheses with no spaces between
// the two characters.
- $closureWithArgs = function ($arg1, $arg2) {
+ $closureWithArgs = function ($arg1, $arg2): void {
echo "$arg1, $arg2";
};
- $closureWithArgsAndVars = function ($arg1, $arg2) use ($var1, $var2) {
+ $closureWithArgsAndVars = function ($arg1, $arg2) use ($var1, $var2): void {
echo "$arg1, $arg2, $var1, $var2";
};
diff --git a/test/fixable/9.GenericTypeHintSyntax.php b/test/fixable/9.GenericTypeHintSyntax.php
new file mode 100644
index 0000000..10f4101
--- /dev/null
+++ b/test/fixable/9.GenericTypeHintSyntax.php
@@ -0,0 +1,36 @@
+ */
+ private $bar;
+
+ /**
+ * @param IteratorAggregate $bar
+ */
+ public function __construct(ArrayObject $bar)
+ {
+ $this->bar = $bar;
+ }
+
+ /**
+ * @param array $config
+ */
+ public function doSomethingWithArray(array $config): void
+ {
+ $this->config = $config;
+ }
+}
diff --git a/test/fixed/2.3.Lines.php b/test/fixed/2.3.Lines.php
index 5686a09..3df12dc 100644
--- a/test/fixed/2.3.Lines.php
+++ b/test/fixed/2.3.Lines.php
@@ -50,11 +50,11 @@ public function testThereMayNotBeAnyBlankLineFfterOpeningBracesAndBeforeClosingB
// There MAY NOT be any blank line after opening braces and before
// closing braces.
- $noBlankLine = function () use ($noBlankLine) {
+ $noBlankLine = function () use ($noBlankLine): void {
$noBlankLine = 1;
};
- $closure = function () {
+ $closure = function (): void {
$noBlankLine = 1;
};
diff --git a/test/fixed/2.7.Arrays.php b/test/fixed/2.7.Arrays.php
index aa93e4a..a7f3903 100644
--- a/test/fixed/2.7.Arrays.php
+++ b/test/fixed/2.7.Arrays.php
@@ -27,7 +27,7 @@ public function testArrayFormatting(): void
];
$array2 = [
- 'one' => function () {
+ 'one' => function (): void {
$foo = [1, 2, 3];
$barBar = [
1,
diff --git a/test/fixed/4.1.ExtendsAndImplements.php b/test/fixed/4.1.ExtendsAndImplements.php
index 5a60615..6981cbe 100644
--- a/test/fixed/4.1.ExtendsAndImplements.php
+++ b/test/fixed/4.1.ExtendsAndImplements.php
@@ -14,7 +14,7 @@ class ExtendsAndImplements extends ParentClass implements
Countable,
Serializable
{
- public function testClassDeclaration()
+ public function testClassDeclaration(): void
{
// The extends and implements keywords MUST be declared on the same line
// as the class name.
diff --git a/test/fixed/4.4.MethodsAndFunctions.php b/test/fixed/4.4.MethodsAndFunctions.php
index 186bfe2..fb3b7a1 100644
--- a/test/fixed/4.4.MethodsAndFunctions.php
+++ b/test/fixed/4.4.MethodsAndFunctions.php
@@ -6,7 +6,7 @@
class MethodsAndFunctions
{
- public function testMethodsAndFunctions($arg1, &$arg2, $arg3 = [])
+ public function testMethodsAndFunctions($arg1, &$arg2, $arg3 = []): void
{
// Visibility MUST be declared on all methods.
//
@@ -20,13 +20,13 @@ public function testMethodsAndFunctions($arg1, &$arg2, $arg3 = [])
// NOT be a space after the opening parenthesis, and there MUST NOT be a
// space before the closing parenthesis.
- function fooBar($arg1, &$arg2, $arg3 = [])
+ function fooBar($arg1, &$arg2, $arg3 = []): void
{
// function body
}
}
- public function testOneSingleLineBetweenMethods()
+ public function testOneSingleLineBetweenMethods(): void
{
// There MUST be a single empty line between methods in a class.
}
diff --git a/test/fixed/4.5.MethodAndFunctionArguments.php b/test/fixed/4.5.MethodAndFunctionArguments.php
index ded96d0..9da0d45 100644
--- a/test/fixed/4.5.MethodAndFunctionArguments.php
+++ b/test/fixed/4.5.MethodAndFunctionArguments.php
@@ -74,7 +74,7 @@ public function testVariadicThreeDotOperator(string $foo, &...$baz): void
// When combining both the reference operator and the variadic three dot
// operator, there MUST NOT be any space between the two of them.
- function method($a, $b, ...$c)
+ function method($a, $b, ...$c): void
{
if ($a < $b) {
method(...func_get_args());
diff --git a/test/fixed/6.Operators.php b/test/fixed/6.Operators.php
index 7e111ef..19fb810 100644
--- a/test/fixed/6.Operators.php
+++ b/test/fixed/6.Operators.php
@@ -65,7 +65,7 @@ public function testOperatorSpacing(): void
$result *= 4;
}
- public function testObjectOperatorSpacing()
+ public function testObjectOperatorSpacing(): void
{
// There MAY NOT be any white space around the object operator unless
// multilines are used.
diff --git a/test/fixed/7.Closures.php b/test/fixed/7.Closures.php
index ed05e72..966f2ed 100644
--- a/test/fixed/7.Closures.php
+++ b/test/fixed/7.Closures.php
@@ -37,11 +37,11 @@ public function testClosures(): void
// MUST follow the use list closing parentheses with no spaces between
// the two characters.
- $closureWithArgs = function ($arg1, $arg2) {
+ $closureWithArgs = function ($arg1, $arg2): void {
echo "$arg1, $arg2";
};
- $closureWithArgsAndVars = function ($arg1, $arg2) use ($var1, $var2) {
+ $closureWithArgsAndVars = function ($arg1, $arg2) use ($var1, $var2): void {
echo "$arg1, $arg2, $var1, $var2";
};
@@ -65,7 +65,7 @@ public function testInheritedVariablesMustBeUsed(): void
// Inherited variables passed via `use` MUST be used in closures.
$message = 'world';
- $example = function ($arg) use ($message) {
+ $example = function ($arg) use ($message): void {
echo "$arg $message";
};
$example('hello');
diff --git a/test/fixed/9.GenericTypeHintSyntax.php b/test/fixed/9.GenericTypeHintSyntax.php
new file mode 100644
index 0000000..10f4101
--- /dev/null
+++ b/test/fixed/9.GenericTypeHintSyntax.php
@@ -0,0 +1,36 @@
+ */
+ private $bar;
+
+ /**
+ * @param IteratorAggregate $bar
+ */
+ public function __construct(ArrayObject $bar)
+ {
+ $this->bar = $bar;
+ }
+
+ /**
+ * @param array $config
+ */
+ public function doSomethingWithArray(array $config): void
+ {
+ $this->config = $config;
+ }
+}