From 8cd57e880a60372f333610b77a3ecdf54fe162e5 Mon Sep 17 00:00:00 2001 From: "Alexander M. Turek" Date: Wed, 5 Oct 2022 23:44:27 +0200 Subject: [PATCH] Doctrine CS 10 --- composer.json | 2 +- .../Common/Annotations/Annotation.php | 4 +- .../Annotations/AnnotationException.php | 8 +-- .../Common/Annotations/CachedReader.php | 4 +- lib/Doctrine/Common/Annotations/DocParser.php | 4 +- .../Common/Annotations/TokenParser.php | 4 +- phpcs.xml.dist | 5 ++ .../Common/Annotations/DocParserTest.php | 50 +++++++++---------- 8 files changed, 37 insertions(+), 44 deletions(-) diff --git a/composer.json b/composer.json index b5839c84a..47971b5cc 100644 --- a/composer.json +++ b/composer.json @@ -39,7 +39,7 @@ }, "require-dev": { "doctrine/cache": "^1.11 || ^2.0", - "doctrine/coding-standard": "^9", + "doctrine/coding-standard": "^9 || ^10", "phpstan/phpstan": "~1.4.10 || ^1.8.0", "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", "symfony/cache": "^4.4 || ^5.4 || ^6", diff --git a/lib/Doctrine/Common/Annotations/Annotation.php b/lib/Doctrine/Common/Annotations/Annotation.php index 750270e42..9cae3dacd 100644 --- a/lib/Doctrine/Common/Annotations/Annotation.php +++ b/lib/Doctrine/Common/Annotations/Annotation.php @@ -18,9 +18,7 @@ class Annotation */ public $value; - /** - * @param array $data Key-value for properties to be defined in this class. - */ + /** @param array $data Key-value for properties to be defined in this class. */ final public function __construct(array $data) { foreach ($data as $key => $value) { diff --git a/lib/Doctrine/Common/Annotations/AnnotationException.php b/lib/Doctrine/Common/Annotations/AnnotationException.php index 600bddf4d..dcdfe4df6 100644 --- a/lib/Doctrine/Common/Annotations/AnnotationException.php +++ b/lib/Doctrine/Common/Annotations/AnnotationException.php @@ -149,9 +149,7 @@ public static function enumeratorError($attributeName, $annotationName, $context )); } - /** - * @return AnnotationException - */ + /** @return AnnotationException */ public static function optimizerPlusSaveComments() { return new self( @@ -159,9 +157,7 @@ public static function optimizerPlusSaveComments() ); } - /** - * @return AnnotationException - */ + /** @return AnnotationException */ public static function optimizerPlusLoadComments() { return new self( diff --git a/lib/Doctrine/Common/Annotations/CachedReader.php b/lib/Doctrine/Common/Annotations/CachedReader.php index c036b2dab..85dbefab5 100644 --- a/lib/Doctrine/Common/Annotations/CachedReader.php +++ b/lib/Doctrine/Common/Annotations/CachedReader.php @@ -38,9 +38,7 @@ final class CachedReader implements Reader /** @var int[] */ private $loadedFilemtimes = []; - /** - * @param bool $debug - */ + /** @param bool $debug */ public function __construct(Reader $reader, Cache $cache, $debug = false) { $this->delegate = $reader; diff --git a/lib/Doctrine/Common/Annotations/DocParser.php b/lib/Doctrine/Common/Annotations/DocParser.php index eda440abd..4133fe5f4 100644 --- a/lib/Doctrine/Common/Annotations/DocParser.php +++ b/lib/Doctrine/Common/Annotations/DocParser.php @@ -1166,9 +1166,7 @@ private function identifierEndsWithClassConstant(string $identifier): bool return $this->getClassConstantPositionInIdentifier($identifier) === strlen($identifier) - strlen('::class'); } - /** - * @return int|false - */ + /** @return int|false */ private function getClassConstantPositionInIdentifier(string $identifier) { return stripos($identifier, '::class'); diff --git a/lib/Doctrine/Common/Annotations/TokenParser.php b/lib/Doctrine/Common/Annotations/TokenParser.php index 9605fb8dd..69259fccf 100644 --- a/lib/Doctrine/Common/Annotations/TokenParser.php +++ b/lib/Doctrine/Common/Annotations/TokenParser.php @@ -46,9 +46,7 @@ class TokenParser */ private $pointer = 0; - /** - * @param string $contents - */ + /** @param string $contents */ public function __construct($contents) { $this->tokens = token_get_all($contents); diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 0a170cdf1..eeadabad2 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -148,4 +148,9 @@ */tests/Doctrine/Tests/Common/Annotations/Fixtures/functions.php + + + + */tests + diff --git a/tests/Doctrine/Tests/Common/Annotations/DocParserTest.php b/tests/Doctrine/Tests/Common/Annotations/DocParserTest.php index 5e6f35cb2..297d7e90c 100644 --- a/tests/Doctrine/Tests/Common/Annotations/DocParserTest.php +++ b/tests/Doctrine/Tests/Common/Annotations/DocParserTest.php @@ -130,7 +130,7 @@ public function testBasicAnnotations(): void self::assertEquals('value2', $annot->value[1]['key2']); // Complete docblock - $docblock = <<setIgnoreNotImportedAnnotations(true); - $docblock = <<createTestParser(); - $docblock = <<createTestParser(); - $docblock = <<data); self::assertEquals($annot->data, 'Some data'); - $docblock = <<name, 'Some Name'); self::assertEquals($annot->data, 'Some data'); - $docblock = <<data, 'Some data'); self::assertNull($annot->name); - $docblock = <<name, 'Some name'); self::assertNull($annot->data); - $docblock = <<data, 'Some data'); self::assertNull($annot->name); - $docblock = <<name, 'Some name'); self::assertEquals($annot->data, 'Some data'); - $docblock = <<name, 'Some name'); self::assertEquals($annot->data, 'Some data'); - $docblock = <<createTestParser(); - $docblock = <<createTestParser(); - $docblock = <<createTestParser(); $context = 'class SomeClassName'; - $docblock = <<createTestParser(); $context = 'class SomeClassName'; - $docblock = <<createTestParser(); $context = 'class SomeClassName'; - $docblock = <<createTestParser(); - $docblock = <<markTestSkipped('This test requires mbstring function overloading is turned on'); } - $docblock = <<