| @@ -33,21 +33,21 @@ | ||
| 33 | 33 | */ | 
| 34 | 34 | public function format(FeatureNode $feature) | 
| 35 | 35 |      { | 
| 36 | - $shortDesc = $feature->getKeyword() . ': ' . $feature->getTitle() . "\n"; | |
| 36 | + $shortDesc = $feature->getKeyword().': '.$feature->getTitle()."\n"; | |
| 37 | 37 | |
| 38 | -        if (! $feature->hasDescription()) { | |
| 38 | +        if (!$feature->hasDescription()) { | |
| 39 | 39 | return rtrim($shortDesc); | 
| 40 | 40 | } | 
| 41 | 41 | |
| 42 | 42 | $longDesc = implode( | 
| 43 | 43 | array_map( | 
| 44 | -                function ($descriptionLine) { | |
| 45 | - return $this->indent() . trim($descriptionLine) . "\n"; | |
| 44 | +                function($descriptionLine) { | |
| 45 | + return $this->indent().trim($descriptionLine)."\n"; | |
| 46 | 46 | }, | 
| 47 | 47 |                  explode("\n", $feature->getDescription()) | 
| 48 | 48 | ) | 
| 49 | 49 | ); | 
| 50 | 50 | |
| 51 | - return $shortDesc . rtrim($longDesc); | |
| 51 | + return $shortDesc.rtrim($longDesc); | |
| 52 | 52 | } | 
| 53 | 53 | } | 
| @@ -33,7 +33,7 @@ discard block | ||
| 33 | 33 | */ | 
| 34 | 34 | public function format(OutlineNode $scenario) | 
| 35 | 35 |      { | 
| 36 | -        if (! $scenario->hasExamples()) { | |
| 36 | +        if (!$scenario->hasExamples()) { | |
| 37 | 37 | return; | 
| 38 | 38 | } | 
| 39 | 39 | |
| @@ -41,11 +41,11 @@ discard block | ||
| 41 | 41 | return implode( | 
| 42 | 42 | array_merge( | 
| 43 | 43 | [ | 
| 44 | - $this->indent(self::INDENTATION * 2) . rtrim($scenario->getExampleTable()->getKeyword()) . ":\n", | |
| 44 | + $this->indent(self::INDENTATION * 2).rtrim($scenario->getExampleTable()->getKeyword()).":\n", | |
| 45 | 45 | ], | 
| 46 | 46 | array_map( | 
| 47 | -                    function ($arguments) { | |
| 48 | - return $this->indent(self::INDENTATION * 2 + 2) . trim($arguments) . "\n"; | |
| 47 | +                    function($arguments) { | |
| 48 | + return $this->indent(self::INDENTATION * 2 + 2).trim($arguments)."\n"; | |
| 49 | 49 | }, | 
| 50 | 50 |                      explode("\n", $scenario->getExampleTable()->getTableAsString()) | 
| 51 | 51 | ) | 
| @@ -34,8 +34,8 @@ | ||
| 34 | 34 | return implode( | 
| 35 | 35 | ' ', | 
| 36 | 36 | array_map( | 
| 37 | -                function ($tag) { | |
| 38 | - return '@' . trim($tag); | |
| 37 | +                function($tag) { | |
| 38 | + return '@'.trim($tag); | |
| 39 | 39 | }, | 
| 40 | 40 | $tags | 
| 41 | 41 | ) | 
| @@ -46,7 +46,7 @@ discard block | ||
| 46 | 46 |      { | 
| 47 | 47 | return rtrim(implode( | 
| 48 | 48 | array_map( | 
| 49 | -                function (ScenarioInterface $scenario) { | |
| 49 | +                function(ScenarioInterface $scenario) { | |
| 50 | 50 | return $this->getTags($scenario) | 
| 51 | 51 | . $this->getScenarioDescription($scenario) | 
| 52 | 52 | . $this->getSteps($scenario) | 
| @@ -54,7 +54,7 @@ discard block | ||
| 54 | 54 | }, | 
| 55 | 55 | $scenarios | 
| 56 | 56 | ) | 
| 57 | - )) . "\n"; | |
| 57 | + ))."\n"; | |
| 58 | 58 | } | 
| 59 | 59 | |
| 60 | 60 | /** | 
| @@ -64,11 +64,11 @@ discard block | ||
| 64 | 64 | */ | 
| 65 | 65 | private function getTags(ScenarioInterface $scenario) | 
| 66 | 66 |      { | 
| 67 | -        if (! $scenario->hasTags()) { | |
| 67 | +        if (!$scenario->hasTags()) { | |
| 68 | 68 | return $this->indent(); | 
| 69 | 69 | } | 
| 70 | 70 | |
| 71 | - return $this->indent() . (new Tags())->format($scenario->getTags()) . "\n"; | |
| 71 | + return $this->indent().(new Tags())->format($scenario->getTags())."\n"; | |
| 72 | 72 | } | 
| 73 | 73 | |
| 74 | 74 | /** | 
| @@ -79,19 +79,19 @@ discard block | ||
| 79 | 79 | private function getScenarioDescription(ScenarioInterface $scenario) | 
| 80 | 80 |      { | 
| 81 | 81 | $titleLines = $this->getTitleLines($scenario); | 
| 82 | - $scenarioTitle = trim($scenario->getKeyword() . ': ' . array_shift($titleLines)); | |
| 82 | + $scenarioTitle = trim($scenario->getKeyword().': '.array_shift($titleLines)); | |
| 83 | 83 | |
| 84 | 84 |          if ($scenario->hasTags()) { | 
| 85 | - $scenarioTitle = $this->indent() . $scenarioTitle; | |
| 85 | + $scenarioTitle = $this->indent().$scenarioTitle; | |
| 86 | 86 | } | 
| 87 | 87 | |
| 88 | 88 | return implode( | 
| 89 | - "\n" . $this->indent(12), | |
| 89 | + "\n".$this->indent(12), | |
| 90 | 90 | array_merge( | 
| 91 | 91 | [$scenarioTitle], | 
| 92 | 92 | $titleLines | 
| 93 | 93 | ) | 
| 94 | - ) . "\n"; | |
| 94 | + )."\n"; | |
| 95 | 95 | } | 
| 96 | 96 | |
| 97 | 97 | /** | 
| @@ -101,13 +101,13 @@ discard block | ||
| 101 | 101 | */ | 
| 102 | 102 | private function getSteps(ScenarioInterface $scenario) | 
| 103 | 103 |      { | 
| 104 | -        if (! $scenario->hasSteps()) { | |
| 104 | +        if (!$scenario->hasSteps()) { | |
| 105 | 105 | return; | 
| 106 | 106 | } | 
| 107 | 107 | |
| 108 | 108 | $step = new Step($this->align); | 
| 109 | 109 | |
| 110 | - return $step->format($scenario->getSteps()) . "\n"; | |
| 110 | + return $step->format($scenario->getSteps())."\n"; | |
| 111 | 111 | } | 
| 112 | 112 | |
| 113 | 113 | /** | 
| @@ -117,7 +117,7 @@ discard block | ||
| 117 | 117 | */ | 
| 118 | 118 | private function getExamples($scenario) | 
| 119 | 119 |      { | 
| 120 | -        if (! $scenario instanceof OutlineNode) { | |
| 120 | +        if (!$scenario instanceof OutlineNode) { | |
| 121 | 121 | return; | 
| 122 | 122 | } | 
| 123 | 123 | |
| @@ -52,8 +52,8 @@ discard block | ||
| 52 | 52 |      { | 
| 53 | 53 | return implode( | 
| 54 | 54 | array_map( | 
| 55 | -                function (StepNode $step) { | |
| 56 | - return $this->getStepText($step) . $this->getArguments($step); | |
| 55 | +                function(StepNode $step) { | |
| 56 | + return $this->getStepText($step).$this->getArguments($step); | |
| 57 | 57 | }, | 
| 58 | 58 | $steps | 
| 59 | 59 | ) | 
| @@ -88,7 +88,7 @@ discard block | ||
| 88 | 88 | $this->indent($spacesQuantity + self::INDENTATION), | 
| 89 | 89 | trim($step->getKeyword()), | 
| 90 | 90 | trim($step->getText()) | 
| 91 | - )) . "\n"; | |
| 91 | + ))."\n"; | |
| 92 | 92 | |
| 93 | 93 | } | 
| 94 | 94 | |
| @@ -99,18 +99,18 @@ discard block | ||
| 99 | 99 | */ | 
| 100 | 100 | private function getArguments(StepNode $step) | 
| 101 | 101 |      { | 
| 102 | -        if (! $step->hasArguments()) { | |
| 102 | +        if (!$step->hasArguments()) { | |
| 103 | 103 | return; | 
| 104 | 104 | } | 
| 105 | 105 | |
| 106 | 106 | return implode( | 
| 107 | 107 | array_map( | 
| 108 | -                function (ArgumentInterface $argument) { | |
| 108 | +                function(ArgumentInterface $argument) { | |
| 109 | 109 |                      if (in_array($argument->getNodeType(), ['Table', 'ExampleTable'])) { | 
| 110 | 110 | return implode( | 
| 111 | 111 | array_map( | 
| 112 | -                                function ($arguments) { | |
| 113 | - return $this->indent(self::INDENTATION * 2 + 4) . trim($arguments) . "\n"; | |
| 112 | +                                function($arguments) { | |
| 113 | + return $this->indent(self::INDENTATION * 2 + 4).trim($arguments)."\n"; | |
| 114 | 114 | }, | 
| 115 | 115 |                                  explode("\n", $argument->getTableAsString()) | 
| 116 | 116 | ) | 
| @@ -121,8 +121,8 @@ discard block | ||
| 121 | 121 | return $this->encapsulateAsPyString( | 
| 122 | 122 | implode( | 
| 123 | 123 | array_map( | 
| 124 | -                                    function ($arguments) { | |
| 125 | - return rtrim($this->indent(self::INDENTATION * 2 + 2) . trim($arguments)) . "\n"; | |
| 124 | +                                    function($arguments) { | |
| 125 | + return rtrim($this->indent(self::INDENTATION * 2 + 2).trim($arguments))."\n"; | |
| 126 | 126 | }, | 
| 127 | 127 | $argument->getStrings() | 
| 128 | 128 | ) | 
| @@ -142,6 +142,6 @@ discard block | ||
| 142 | 142 | */ | 
| 143 | 143 | private function encapsulateAsPyString($string) | 
| 144 | 144 |      { | 
| 145 | -        return sprintf('%s%s%1$s', $this->indent(8) . '"""' . "\n", $string); | |
| 145 | +        return sprintf('%s%s%1$s', $this->indent(8).'"""'."\n", $string); | |
| 146 | 146 | } | 
| 147 | 147 | } | 
| @@ -43,12 +43,12 @@ | ||
| 43 | 43 | */ | 
| 44 | 44 | public function format(BackgroundNode $background) | 
| 45 | 45 |      { | 
| 46 | - $shortDesc = $this->getBackgroundShortDescription($background) . "\n"; | |
| 46 | + $shortDesc = $this->getBackgroundShortDescription($background)."\n"; | |
| 47 | 47 | |
| 48 | 48 | $step = new Step($this->align); | 
| 49 | 49 | $steps = $step->format($background->getSteps()); | 
| 50 | 50 | |
| 51 | - return $this->indent() . $shortDesc . $steps; | |
| 51 | + return $this->indent().$shortDesc.$steps; | |
| 52 | 52 | } | 
| 53 | 53 | |
| 54 | 54 | /** | 
| @@ -63,10 +63,10 @@ | ||
| 63 | 63 | |
| 64 | 64 | public function __invoke($feature) | 
| 65 | 65 |      { | 
| 66 | - $formatted = $feature->getLanguage() && $feature->getLanguage() !== 'en' ? '# language: ' . trim($feature->getLanguage()) . "\n" : ''; | |
| 67 | - $formatted .= $feature->hasTags() ? $this->tags->format($feature->getTags()) . "\n" : ''; | |
| 68 | - $formatted .= $this->featureDescription->format($feature) . "\n\n"; | |
| 69 | - $formatted .= $feature->hasBackground() ? $this->background->format($feature->getBackground()) . "\n" : ''; | |
| 66 | + $formatted = $feature->getLanguage() && $feature->getLanguage() !== 'en' ? '# language: '.trim($feature->getLanguage())."\n" : ''; | |
| 67 | + $formatted .= $feature->hasTags() ? $this->tags->format($feature->getTags())."\n" : ''; | |
| 68 | + $formatted .= $this->featureDescription->format($feature)."\n\n"; | |
| 69 | + $formatted .= $feature->hasBackground() ? $this->background->format($feature->getBackground())."\n" : ''; | |
| 70 | 70 | $formatted .= $feature->hasScenarios() ? $this->scenario->format($feature->getScenarios()) : ''; | 
| 71 | 71 | |
| 72 | 72 | return $formatted; | 
| @@ -89,7 +89,7 @@ discard block | ||
| 89 | 89 |          $directory = $input->getArgument('directory'); | 
| 90 | 90 | $finder = (new FeatureResolve($directory))->__invoke(); | 
| 91 | 91 | |
| 92 | -        $output->writeln("\nFinding files on <info>" . $directory . "</info>\n"); | |
| 92 | +        $output->writeln("\nFinding files on <info>".$directory."</info>\n"); | |
| 93 | 93 | |
| 94 | 94 | /* @var $file \Symfony\Component\Finder\SplFileInfo */ | 
| 95 | 95 |          foreach ($finder as $file) { | 
| @@ -108,7 +108,7 @@ discard block | ||
| 108 | 108 |              $filePointer = $file->openFile('w'); | 
| 109 | 109 | $filePointer->fwrite($formatted); | 
| 110 | 110 | |
| 111 | -            $output->writeln('<info>' . $file->getRealPath() . '</info>'); | |
| 111 | +            $output->writeln('<info>'.$file->getRealPath().'</info>'); | |
| 112 | 112 | } | 
| 113 | 113 | } | 
| 114 | 114 | } | 
| @@ -94,7 +94,7 @@ discard block | ||
| 94 | 94 |          $directory = $input->getArgument('directory'); | 
| 95 | 95 | $finder = (new FeatureResolve($directory))->__invoke(); | 
| 96 | 96 | |
| 97 | -        $output->writeln("\nFinding files on <info>" . $directory . "</info>\n"); | |
| 97 | +        $output->writeln("\nFinding files on <info>".$directory."</info>\n"); | |
| 98 | 98 | |
| 99 | 99 | /* @var $file \Symfony\Component\Finder\SplFileInfo */ | 
| 100 | 100 |          foreach ($finder as $file) { | 
| @@ -113,13 +113,13 @@ discard block | ||
| 113 | 113 | |
| 114 | 114 |              if ($formatted !== $contentWithoutComments) { | 
| 115 | 115 | |
| 116 | -                if (! defined('FAILED')) { | |
| 116 | +                if (!defined('FAILED')) { | |
| 117 | 117 |                      define('FAILED', true); | 
| 118 | 118 | } | 
| 119 | 119 | |
| 120 | 120 |                  $diff = new Differ("--- Original\n+++ Expected\n", false); | 
| 121 | 121 | |
| 122 | -                $output->writeln('<error>Wrong style: ' . $file->getRealPath() . '</error>'); | |
| 122 | +                $output->writeln('<error>Wrong style: '.$file->getRealPath().'</error>'); | |
| 123 | 123 | $output->writeln($diff->diff($contentWithoutComments, $formatted)); | 
| 124 | 124 | } | 
| 125 | 125 | } | 
| @@ -142,17 +142,17 @@ discard block | ||
| 142 | 142 | implode( | 
| 143 | 143 | array_filter( | 
| 144 | 144 | array_map( | 
| 145 | -                        function ($line) { | |
| 145 | +                        function($line) { | |
| 146 | 146 |                              if (0 === mb_strpos(ltrim($line), '#')) { | 
| 147 | 147 | return ''; | 
| 148 | 148 | } | 
| 149 | 149 | |
| 150 | - return rtrim($line) . "\n"; | |
| 150 | + return rtrim($line)."\n"; | |
| 151 | 151 | }, | 
| 152 | 152 |                          explode("\n", $fileContent) | 
| 153 | 153 | ) | 
| 154 | 154 | ) | 
| 155 | 155 | ) | 
| 156 | - ) . "\n"; | |
| 156 | + )."\n"; | |
| 157 | 157 | } | 
| 158 | 158 | } |