Symfony-coding-standard icon indicating copy to clipboard operation
Symfony-coding-standard copied to clipboard

BlankLineBeforeReturn should not sniff one-line returns

Open soullivaneuh opened this issue 7 years ago • 1 comments

The fixed is producing this kind of diff:

diff --git a/src/Config/RepositoryConfiguration.php b/src/Config/RepositoryConfiguration.php
index a4c735b..eb7ebce 100644
--- a/src/Config/RepositoryConfiguration.php
+++ b/src/Config/RepositoryConfiguration.php
@@ -63,7 +63,8 @@ final class RepositoryConfiguration implements ConfigurationInterface
         }
 
         $node->validate()
-            ->ifTrue(static function (array $services) { return 0 === \count($services); })
+            ->ifTrue(static function (array $services) {
+                return 0 === \count($services); })
             ->thenInvalid('You must enable at least one service.')
         ;
 
@@ -87,7 +88,8 @@ final class RepositoryConfiguration implements ConfigurationInterface
                     ->beforeNormalization()->castToArray()->end()
                     ->scalarPrototype()
                         ->validate()
-                        ->ifTrue(static function ($path) { return !\is_string($path); })
+                        ->ifTrue(static function ($path) {
+                            return !\is_string($path); })
                             ->thenInvalid("Invalid path '%s'. It must be a string.")
                         ->end()
                     ->end()
@@ -100,7 +102,8 @@ final class RepositoryConfiguration implements ConfigurationInterface
                 ->scalarNode('path')
                     ->defaultValue('.')
                     ->validate()
-                    ->ifTrue(static function ($path) { return !\is_string($path); })
+                    ->ifTrue(static function ($path) {
+                        return !\is_string($path); })
                         ->thenInvalid("Invalid path '%s'. It must be a string.")
                     ->end()
                 ->end()

Single line closure should not be fixed like that, it's out Symfony coding standard AFAIK. BTW, php-cs-fixer ignores this part.

soullivaneuh avatar Feb 17 '18 11:02 soullivaneuh

Maybe related to #122. Is the name of the rule changed?

soullivaneuh avatar Feb 17 '18 11:02 soullivaneuh