From 866553467089911a79a63c9b10b0c7641944bdda Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Wed, 16 Jun 2021 23:57:27 +0200 Subject: [PATCH] [PHP 8.0 ] No space annotatation and attributes (#235) --- .../NodeCollector/NodeRepository.php | 4 ++- ...otation_converted_an_keep_docblock.php.inc | 31 +++++++++++++++++++ .../NodeResolver/SwitchExprsResolver.php | 2 +- .../VerifyRectorServiceExistsCompilerPass.php | 14 +++++++-- 4 files changed, 46 insertions(+), 5 deletions(-) create mode 100644 rules-tests/Php80/Rector/Class_/AnnotationToAttributeRector/Fixture/annotation_converted_an_keep_docblock.php.inc diff --git a/packages/NodeCollector/NodeCollector/NodeRepository.php b/packages/NodeCollector/NodeCollector/NodeRepository.php index 82cf68fcf67..d8d9b1867a3 100644 --- a/packages/NodeCollector/NodeCollector/NodeRepository.php +++ b/packages/NodeCollector/NodeCollector/NodeRepository.php @@ -471,7 +471,9 @@ private function collectArray(Array_ $array): void return; } - $this->arrayCallablesByTypeAndMethod[$arrayCallable->getClass()][strtolower($arrayCallable->getMethod())][] = $arrayCallable; + $this->arrayCallablesByTypeAndMethod[$arrayCallable->getClass()][strtolower( + $arrayCallable->getMethod() + )][] = $arrayCallable; } private function addMethod(ClassMethod $classMethod): void diff --git a/rules-tests/Php80/Rector/Class_/AnnotationToAttributeRector/Fixture/annotation_converted_an_keep_docblock.php.inc b/rules-tests/Php80/Rector/Class_/AnnotationToAttributeRector/Fixture/annotation_converted_an_keep_docblock.php.inc new file mode 100644 index 00000000000..56ff6ebf4cd --- /dev/null +++ b/rules-tests/Php80/Rector/Class_/AnnotationToAttributeRector/Fixture/annotation_converted_an_keep_docblock.php.inc @@ -0,0 +1,31 @@ + +----- + diff --git a/rules/Php80/NodeResolver/SwitchExprsResolver.php b/rules/Php80/NodeResolver/SwitchExprsResolver.php index e42579af1ea..19a45483be8 100644 --- a/rules/Php80/NodeResolver/SwitchExprsResolver.php +++ b/rules/Php80/NodeResolver/SwitchExprsResolver.php @@ -22,7 +22,7 @@ final class SwitchExprsResolver */ public function resolve(Switch_ $switch): array { - $condAndExpr = []; + $condAndExpr = []; $collectionEmptyCasesCond = []; foreach ($switch->cases as $key => $case) { diff --git a/src/DependencyInjection/CompilerPass/VerifyRectorServiceExistsCompilerPass.php b/src/DependencyInjection/CompilerPass/VerifyRectorServiceExistsCompilerPass.php index aa27f8546ec..f2e70c69647 100644 --- a/src/DependencyInjection/CompilerPass/VerifyRectorServiceExistsCompilerPass.php +++ b/src/DependencyInjection/CompilerPass/VerifyRectorServiceExistsCompilerPass.php @@ -24,15 +24,23 @@ public function process(ContainerBuilder $containerBuilder): void continue; } - if (!class_exists($class)) { + if (! class_exists($class)) { throw new ShouldNotHappenException( - sprintf('Rector rule "%s" not found, please verify that the class exists and is autoloadable.', $class) + sprintf( + 'Rector rule "%s" not found, please verify that the class exists and is autoloadable.', + $class + ) ); } if (! is_a($class, RectorInterface::class, true)) { throw new ShouldNotHappenException( - sprintf('Rector rule "%s" should extend "%s" or implement "%s".', $class, AbstractRector::class, RectorInterface::class) + sprintf( + 'Rector rule "%s" should extend "%s" or implement "%s".', + $class, + AbstractRector::class, + RectorInterface::class + ) ); } }