From 0e46023b3a78b2266ff1924dea50abef86d4273d Mon Sep 17 00:00:00 2001 From: Geert Eltink Date: Mon, 3 Jun 2019 20:48:07 +0200 Subject: [PATCH 1/2] Update webimpress/coding-standard to a stable version --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index f8ab01ea..0757a682 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ "dealerdirect/phpcodesniffer-composer-installer": "^0.5.0", "slevomat/coding-standard": "^4.8.0", "squizlabs/php_codesniffer": "^3.4.0", - "webimpress/coding-standard": "dev-master" + "webimpress/coding-standard": "^1.0.3" }, "extra": { "branch-alias": { From 927045f00688cb49710fe4f515c77dcda89b604c Mon Sep 17 00:00:00 2001 From: Geert Eltink Date: Mon, 3 Jun 2019 21:12:29 +0200 Subject: [PATCH 2/2] Update to slevomat/coding-standard v5 --- composer.json | 6 ++++-- docs/book/v2/coding-style-guide.md | 2 +- docs/book/v2/ruleset.md | 2 +- src/ZendCodingStandard/ruleset.xml | 4 ++-- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/composer.json b/composer.json index 0757a682..ecac3374 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,7 @@ "require": { "php": "^7.1", "dealerdirect/phpcodesniffer-composer-installer": "^0.5.0", - "slevomat/coding-standard": "^4.8.0", + "slevomat/coding-standard": "^5.0.4", "squizlabs/php_codesniffer": "^3.4.0", "webimpress/coding-standard": "^1.0.3" }, @@ -41,12 +41,14 @@ }, "scripts": { "check": [ + "@test-clean", "@test-prepare", "@test-fix", "@test-diff" ], "create-report": "phpcs $(find test/fixable/* | sort) --report=summary --report-file=test/expected-report.txt", - "test-prepare": "rm -rf test/fix/; cp -R test/fixable/ test/fix/;", + "test-clean": "rm -rf test/fix/", + "test-prepare": "cp -R test/fixable/ test/fix/", "test-fix": "phpcbf test/fix > /dev/null || true", "test-diff": "diff test/fix test/fixed" } diff --git a/docs/book/v2/coding-style-guide.md b/docs/book/v2/coding-style-guide.md index 777896bf..9507f08b 100644 --- a/docs/book/v2/coding-style-guide.md +++ b/docs/book/v2/coding-style-guide.md @@ -361,7 +361,7 @@ $instance = new class extends Foo implements - Constructors should be named `__construct`, not after the class. [*](ruleset.md#genericnamingconventionsconstructorname) - The opening PHP tag should be the first item in the file. [*](ruleset.md#genericphpcharacterbeforephpopeningtag) - Strings should not be concatenated together unless used in multiline for readability. [*](ruleset.md#genericstringsunnecessarystringconcat) -- Loose `==` and `!=` comparison operators should not be used. Use `===` and `!==` instead. [*](ruleset.md#slevomatcodingstandardcontrolstructuresdisallowequaloperators) +- Loose `==` and `!=` comparison operators should not be used. Use `===` and `!==` instead. [*](ruleset.md#slevomatcodingOperatorsdisallowequaloperators) - Language constructs must be used without parentheses where possible. [*](ruleset.md#slevomatcodingstandardcontrolstructureslanguageconstructwithparentheses) - Short list syntax `[...]` should be used instead of `list(...)`. [*](ruleset.md#slevomatcodingstandardphpshortlist) - Short form of type keywords must be used. i.e. `bool` instead of `boolean`, `int` instead of `integer`, etc. diff --git a/docs/book/v2/ruleset.md b/docs/book/v2/ruleset.md index 7b4b830d..6ad2d68c 100644 --- a/docs/book/v2/ruleset.md +++ b/docs/book/v2/ruleset.md @@ -412,7 +412,7 @@ private $foo; private $foo; ``` -### SlevomatCodingStandard.ControlStructures.DisallowEqualOperators +### SlevomatCodingStandard.Operators.DisallowEqualOperators Loose `==` and `!=` comparison operators should not be used. Use strict comparison `===` and `!==` instead, they are much more secure and predictable. diff --git a/src/ZendCodingStandard/ruleset.xml b/src/ZendCodingStandard/ruleset.xml index 16473ebd..31ea01ca 100644 --- a/src/ZendCodingStandard/ruleset.xml +++ b/src/ZendCodingStandard/ruleset.xml @@ -268,8 +268,6 @@ - - @@ -298,6 +296,8 @@ + +