From 6d4511b356135f558a20415463c08b2c1806460e Mon Sep 17 00:00:00 2001 From: Patrick Jahns Date: Sun, 17 Mar 2019 16:21:50 +0100 Subject: [PATCH] Updated doctrine/coding-standard to 6.0 Signed-off-by: Patrick Jahns --- composer.json | 2 +- composer.lock | 123 ++++++++++++------ .../Collections/AbstractLazyCollection.php | 26 ++++ .../Common/Collections/ArrayCollection.php | 1 + .../Expr/ClosureExpressionVisitor.php | 5 +- .../Collections/Expr/ExpressionVisitor.php | 3 - 6 files changed, 115 insertions(+), 45 deletions(-) diff --git a/composer.json b/composer.json index e553d8a0b..aa9c30abf 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ }, "require-dev": { "phpunit/phpunit": "^7.0", - "doctrine/coding-standard": "^5.0", + "doctrine/coding-standard": "^6.0", "phpstan/phpstan-shim": "^0.9.2" }, "autoload": { diff --git a/composer.lock b/composer.lock index 429ef0779..7a9c341b7 100644 --- a/composer.lock +++ b/composer.lock @@ -4,34 +4,32 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "d76c6f591a02e23f51133593b922be4f", + "content-hash": "3110654c561f87d0733ed1cc2af09006", "packages": [], "packages-dev": [ { "name": "dealerdirect/phpcodesniffer-composer-installer", - "version": "v0.4.4", + "version": "v0.5.0", "source": { "type": "git", "url": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer.git", - "reference": "2e41850d5f7797cbb1af7b030d245b3b24e63a08" + "reference": "e749410375ff6fb7a040a68878c656c2e610b132" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/2e41850d5f7797cbb1af7b030d245b3b24e63a08", - "reference": "2e41850d5f7797cbb1af7b030d245b3b24e63a08", + "url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/e749410375ff6fb7a040a68878c656c2e610b132", + "reference": "e749410375ff6fb7a040a68878c656c2e610b132", "shasum": "" }, "require": { "composer-plugin-api": "^1.0", "php": "^5.3|^7", - "squizlabs/php_codesniffer": "*" + "squizlabs/php_codesniffer": "^2|^3" }, "require-dev": { "composer/composer": "*", - "wimg/php-compatibility": "^8.0" - }, - "suggest": { - "dealerdirect/qa-tools": "All the PHP QA tools you'll need" + "phpcompatibility/php-compatibility": "^9.0", + "sensiolabs/security-checker": "^4.1.0" }, "type": "composer-plugin", "extra": { @@ -49,13 +47,13 @@ "authors": [ { "name": "Franck Nijhof", - "email": "f.nijhof@dealerdirect.nl", - "homepage": "http://workingatdealerdirect.eu", - "role": "Developer" + "email": "franck.nijhof@dealerdirect.com", + "homepage": "http://www.frenck.nl", + "role": "Developer / IT Manager" } ], "description": "PHP_CodeSniffer Standards Composer Installer Plugin", - "homepage": "http://workingatdealerdirect.eu", + "homepage": "http://www.dealerdirect.com", "keywords": [ "PHPCodeSniffer", "PHP_CodeSniffer", @@ -73,32 +71,32 @@ "stylecheck", "tests" ], - "time": "2017-12-06T16:27:17+00:00" + "time": "2018-10-26T13:21:45+00:00" }, { "name": "doctrine/coding-standard", - "version": "5.0.0", + "version": "6.0.0", "source": { "type": "git", "url": "https://github.com/doctrine/coding-standard.git", - "reference": "bb8de042a25c4fb59a2c55c350dc55cc00227a8c" + "reference": "d33f69eb98b25aa51ffe3a909f0ec77000af4701" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/coding-standard/zipball/bb8de042a25c4fb59a2c55c350dc55cc00227a8c", - "reference": "bb8de042a25c4fb59a2c55c350dc55cc00227a8c", + "url": "https://api.github.com/repos/doctrine/coding-standard/zipball/d33f69eb98b25aa51ffe3a909f0ec77000af4701", + "reference": "d33f69eb98b25aa51ffe3a909f0ec77000af4701", "shasum": "" }, "require": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.4.4", + "dealerdirect/phpcodesniffer-composer-installer": "^0.5.0", "php": "^7.1", - "slevomat/coding-standard": "^4.8.0", - "squizlabs/php_codesniffer": "^3.3.2" + "slevomat/coding-standard": "^5.0", + "squizlabs/php_codesniffer": "^3.4.0" }, "type": "phpcodesniffer-standard", "extra": { "branch-alias": { - "dev-master": "5.0.x-dev" + "dev-master": "6.0.x-dev" } }, "autoload": { @@ -134,7 +132,7 @@ "standard", "style" ], - "time": "2018-09-24T19:08:56+00:00" + "time": "2019-03-15T12:45:47+00:00" }, { "name": "doctrine/instantiator", @@ -552,6 +550,52 @@ ], "time": "2018-02-19T10:16:54+00:00" }, + { + "name": "phpstan/phpdoc-parser", + "version": "0.3.1", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpdoc-parser.git", + "reference": "2cc49f47c69b023eaf05b48e6529389893b13d74" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/2cc49f47c69b023eaf05b48e6529389893b13d74", + "reference": "2cc49f47c69b023eaf05b48e6529389893b13d74", + "shasum": "" + }, + "require": { + "php": "~7.1" + }, + "require-dev": { + "consistence/coding-standard": "^2.0.0", + "jakub-onderka/php-parallel-lint": "^0.9.2", + "phing/phing": "^2.16.0", + "phpstan/phpstan": "^0.10", + "phpunit/phpunit": "^6.3", + "slevomat/coding-standard": "^3.3.0", + "symfony/process": "^3.4 || ^4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "0.3-dev" + } + }, + "autoload": { + "psr-4": { + "PHPStan\\PhpDocParser\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPDoc parser with support for nullable, intersection and generic types", + "time": "2019-01-14T12:26:23+00:00" + }, { "name": "phpstan/phpstan-shim", "version": "0.9.2", @@ -1539,29 +1583,30 @@ }, { "name": "slevomat/coding-standard", - "version": "4.8.2", + "version": "5.0.2", "source": { "type": "git", "url": "https://github.com/slevomat/coding-standard.git", - "reference": "5e878708a16a75ed11a7d9aa02f50c257065d4fe" + "reference": "223f02b6193fe47b7b483bfa5bf75693535482dd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/5e878708a16a75ed11a7d9aa02f50c257065d4fe", - "reference": "5e878708a16a75ed11a7d9aa02f50c257065d4fe", + "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/223f02b6193fe47b7b483bfa5bf75693535482dd", + "reference": "223f02b6193fe47b7b483bfa5bf75693535482dd", "shasum": "" }, "require": { "php": "^7.1", - "squizlabs/php_codesniffer": "^3.3.0" + "phpstan/phpdoc-parser": "^0.3.1", + "squizlabs/php_codesniffer": "^3.4.0" }, "require-dev": { "jakub-onderka/php-parallel-lint": "1.0.0", "phing/phing": "2.16.1", - "phpstan/phpstan": "0.9.2", - "phpstan/phpstan-phpunit": "0.9.4", - "phpstan/phpstan-strict-rules": "0.9", - "phpunit/phpunit": "7.3.5" + "phpstan/phpstan": "0.11.1", + "phpstan/phpstan-phpunit": "0.11", + "phpstan/phpstan-strict-rules": "0.11", + "phpunit/phpunit": "8.0.0" }, "type": "phpcodesniffer-standard", "autoload": { @@ -1574,20 +1619,20 @@ "MIT" ], "description": "Slevomat Coding Standard for PHP_CodeSniffer complements Consistence Coding Standard by providing sniffs with additional checks.", - "time": "2018-09-25T06:49:15+00:00" + "time": "2019-03-12T20:26:36+00:00" }, { "name": "squizlabs/php_codesniffer", - "version": "3.3.2", + "version": "3.4.0", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "6ad28354c04b364c3c71a34e4a18b629cc3b231e" + "reference": "379deb987e26c7cd103a7b387aea178baec96e48" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/6ad28354c04b364c3c71a34e4a18b629cc3b231e", - "reference": "6ad28354c04b364c3c71a34e4a18b629cc3b231e", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/379deb987e26c7cd103a7b387aea178baec96e48", + "reference": "379deb987e26c7cd103a7b387aea178baec96e48", "shasum": "" }, "require": { @@ -1625,7 +1670,7 @@ "phpcs", "standards" ], - "time": "2018-09-23T23:08:17+00:00" + "time": "2018-12-19T23:57:18+00:00" }, { "name": "theseer/tokenizer", diff --git a/lib/Doctrine/Common/Collections/AbstractLazyCollection.php b/lib/Doctrine/Common/Collections/AbstractLazyCollection.php index e6358dd53..50fcf93a4 100644 --- a/lib/Doctrine/Common/Collections/AbstractLazyCollection.php +++ b/lib/Doctrine/Common/Collections/AbstractLazyCollection.php @@ -25,6 +25,7 @@ abstract class AbstractLazyCollection implements Collection public function count() { $this->initialize(); + return $this->collection->count(); } @@ -34,6 +35,7 @@ public function count() public function add($element) { $this->initialize(); + return $this->collection->add($element); } @@ -52,6 +54,7 @@ public function clear() public function contains($element) { $this->initialize(); + return $this->collection->contains($element); } @@ -61,6 +64,7 @@ public function contains($element) public function isEmpty() { $this->initialize(); + return $this->collection->isEmpty(); } @@ -70,6 +74,7 @@ public function isEmpty() public function remove($key) { $this->initialize(); + return $this->collection->remove($key); } @@ -79,6 +84,7 @@ public function remove($key) public function removeElement($element) { $this->initialize(); + return $this->collection->removeElement($element); } @@ -88,6 +94,7 @@ public function removeElement($element) public function containsKey($key) { $this->initialize(); + return $this->collection->containsKey($key); } @@ -97,6 +104,7 @@ public function containsKey($key) public function get($key) { $this->initialize(); + return $this->collection->get($key); } @@ -106,6 +114,7 @@ public function get($key) public function getKeys() { $this->initialize(); + return $this->collection->getKeys(); } @@ -115,6 +124,7 @@ public function getKeys() public function getValues() { $this->initialize(); + return $this->collection->getValues(); } @@ -133,6 +143,7 @@ public function set($key, $value) public function toArray() { $this->initialize(); + return $this->collection->toArray(); } @@ -142,6 +153,7 @@ public function toArray() public function first() { $this->initialize(); + return $this->collection->first(); } @@ -151,6 +163,7 @@ public function first() public function last() { $this->initialize(); + return $this->collection->last(); } @@ -160,6 +173,7 @@ public function last() public function key() { $this->initialize(); + return $this->collection->key(); } @@ -169,6 +183,7 @@ public function key() public function current() { $this->initialize(); + return $this->collection->current(); } @@ -178,6 +193,7 @@ public function current() public function next() { $this->initialize(); + return $this->collection->next(); } @@ -187,6 +203,7 @@ public function next() public function exists(Closure $p) { $this->initialize(); + return $this->collection->exists($p); } @@ -196,6 +213,7 @@ public function exists(Closure $p) public function filter(Closure $p) { $this->initialize(); + return $this->collection->filter($p); } @@ -205,6 +223,7 @@ public function filter(Closure $p) public function forAll(Closure $p) { $this->initialize(); + return $this->collection->forAll($p); } @@ -214,6 +233,7 @@ public function forAll(Closure $p) public function map(Closure $func) { $this->initialize(); + return $this->collection->map($func); } @@ -223,6 +243,7 @@ public function map(Closure $func) public function partition(Closure $p) { $this->initialize(); + return $this->collection->partition($p); } @@ -232,6 +253,7 @@ public function partition(Closure $p) public function indexOf($element) { $this->initialize(); + return $this->collection->indexOf($element); } @@ -241,6 +263,7 @@ public function indexOf($element) public function slice($offset, $length = null) { $this->initialize(); + return $this->collection->slice($offset, $length); } @@ -250,6 +273,7 @@ public function slice($offset, $length = null) public function getIterator() { $this->initialize(); + return $this->collection->getIterator(); } @@ -259,6 +283,7 @@ public function getIterator() public function offsetExists($offset) { $this->initialize(); + return $this->collection->offsetExists($offset); } @@ -268,6 +293,7 @@ public function offsetExists($offset) public function offsetGet($offset) { $this->initialize(); + return $this->collection->offsetGet($offset); } diff --git a/lib/Doctrine/Common/Collections/ArrayCollection.php b/lib/Doctrine/Common/Collections/ArrayCollection.php index 0eef7a24e..f423c7883 100644 --- a/lib/Doctrine/Common/Collections/ArrayCollection.php +++ b/lib/Doctrine/Common/Collections/ArrayCollection.php @@ -174,6 +174,7 @@ public function offsetSet($offset, $value) { if (! isset($offset)) { $this->add($value); + return; } diff --git a/lib/Doctrine/Common/Collections/Expr/ClosureExpressionVisitor.php b/lib/Doctrine/Common/Collections/Expr/ClosureExpressionVisitor.php index 2d6542f56..43e5cf106 100644 --- a/lib/Doctrine/Common/Collections/Expr/ClosureExpressionVisitor.php +++ b/lib/Doctrine/Common/Collections/Expr/ClosureExpressionVisitor.php @@ -103,6 +103,7 @@ public static function sortByField($name, $orientation = 1, ?Closure $next = nul return static function ($a, $b) use ($name, $next, $orientation) : int { $aValue = ClosureExpressionVisitor::getObjectFieldValue($a, $name); + $bValue = ClosureExpressionVisitor::getObjectFieldValue($b, $name); if ($aValue === $bValue) { @@ -170,9 +171,11 @@ public function walkComparison(Comparison $comparison) case Comparison::MEMBER_OF: return static function ($object) use ($field, $value) : bool { $fieldValues = ClosureExpressionVisitor::getObjectFieldValue($object, $field); + if (! is_array($fieldValues)) { $fieldValues = iterator_to_array($fieldValues); } + return in_array($value, $fieldValues, true); }; @@ -213,10 +216,8 @@ public function walkCompositeExpression(CompositeExpression $expr) switch ($expr->getType()) { case CompositeExpression::TYPE_AND: return $this->andExpressions($expressionList); - case CompositeExpression::TYPE_OR: return $this->orExpressions($expressionList); - default: throw new RuntimeException('Unknown composite ' . $expr->getType()); } diff --git a/lib/Doctrine/Common/Collections/Expr/ExpressionVisitor.php b/lib/Doctrine/Common/Collections/Expr/ExpressionVisitor.php index c61cd515f..baf1ea8f6 100644 --- a/lib/Doctrine/Common/Collections/Expr/ExpressionVisitor.php +++ b/lib/Doctrine/Common/Collections/Expr/ExpressionVisitor.php @@ -44,13 +44,10 @@ public function dispatch(Expression $expr) switch (true) { case $expr instanceof Comparison: return $this->walkComparison($expr); - case $expr instanceof Value: return $this->walkValue($expr); - case $expr instanceof CompositeExpression: return $this->walkCompositeExpression($expr); - default: throw new RuntimeException('Unknown Expression ' . get_class($expr)); }