Completed
Pull Request — master (#31)
by
unknown
02:09
created
src/ComposerRequireChecker/Cli/CheckCommand.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -53,19 +53,19 @@  discard block
 block discarded – undo
53 53
     protected function execute(InputInterface $input, OutputInterface $output) : int
54 54
     {
55 55
 
56
-        if(!$output->isQuiet()) {
56
+        if (!$output->isQuiet()) {
57 57
             $output->writeln($this->getApplication()->getLongVersion());
58 58
         }
59 59
 
60 60
         $composerJson = realpath($input->getArgument('composer-json'));
61
-        if(false === $composerJson) {
62
-            throw new \InvalidArgumentException('file not found: [' . $input->getArgument('composer-json') . ']');
61
+        if (false === $composerJson) {
62
+            throw new \InvalidArgumentException('file not found: ['.$input->getArgument('composer-json').']');
63 63
         }
64 64
         $this->checkJsonFile($composerJson);
65 65
 
66 66
         $getPackageSourceFiles = new LocateComposerPackageSourceFiles();
67 67
 
68
-        $sourcesASTs  = new LocateASTFromFiles((new ParserFactory())->create(ParserFactory::PREFER_PHP7));
68
+        $sourcesASTs = new LocateASTFromFiles((new ParserFactory())->create(ParserFactory::PREFER_PHP7));
69 69
 
70 70
         $definedVendorSymbols = (new LocateDefinedSymbolsFromASTRoots())->__invoke($sourcesASTs(
71 71
             (new ComposeGenerators())->__invoke(
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
         $guesser = new DependencyGuesser();
101 101
         foreach ($unknownSymbols as $unknownSymbol) {
102 102
             $guessedDependencies = [];
103
-            foreach($guesser($unknownSymbol) as $guessedDependency) {
103
+            foreach ($guesser($unknownSymbol) as $guessedDependency) {
104 104
                 $guessedDependencies[] = $guessedDependency;
105 105
             }
106 106
             $table->addRow([$unknownSymbol, implode("\n", $guessedDependencies)]);
@@ -113,16 +113,16 @@  discard block
 block discarded – undo
113 113
     private function getCheckOptions(InputInterface $input) : Options
114 114
     {
115 115
         $fileName = $input->getOption('config-file');
116
-        if(!$fileName) {
116
+        if (!$fileName) {
117 117
             return new Options();
118 118
         }
119 119
 
120 120
         $loader = new JsonLoader($fileName);
121 121
         switch ($loader->getErrorCode()) {
122 122
             case JsonLoader::ERROR_NO_READABLE:
123
-                throw new \InvalidArgumentException('unable to read ' . $fileName);
123
+                throw new \InvalidArgumentException('unable to read '.$fileName);
124 124
             case JsonLoader::ERROR_INVALID_JSON:
125
-                throw new \Exception('error parsing the config file: ' . $loader->getErrorMessage());
125
+                throw new \Exception('error parsing the config file: '.$loader->getErrorMessage());
126 126
             default:
127 127
                 return new Options($loader->getData());
128 128
         }
@@ -138,9 +138,9 @@  discard block
 block discarded – undo
138 138
         $loader = new JsonLoader($jsonFile);
139 139
         switch ($loader->getErrorCode()) {
140 140
             case JsonLoader::ERROR_NO_READABLE:
141
-                throw new InvalidInputFileException('cannot read ' . $jsonFile);
141
+                throw new InvalidInputFileException('cannot read '.$jsonFile);
142 142
             case JsonLoader::ERROR_INVALID_JSON:
143
-                throw new InvalidInputFileException('error parsing ' . $jsonFile . ': ' . $loader->getErrorMessage());
143
+                throw new InvalidInputFileException('error parsing '.$jsonFile.': '.$loader->getErrorMessage());
144 144
             default:
145 145
                 break;
146 146
         }
Please login to merge, or discard this patch.
test/ComposerRequireCheckerTest/JsonLoaderTest.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 
11 11
     public function testHasErrorWithWrongPath()
12 12
     {
13
-        $path = __DIR__ . '/wrong/path/non-existing-file.json';
13
+        $path = __DIR__.'/wrong/path/non-existing-file.json';
14 14
         $loader = new JsonLoader($path);
15 15
         $this->assertEquals($loader->getErrorCode(), JsonLoader::ERROR_NO_READABLE);
16 16
         $this->assertEquals($loader->getPath(), $path);
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 
20 20
     public function testHasErrorWithInvalidFile()
21 21
     {
22
-        $path = __DIR__ . '/../fixtures/invalidJson';
22
+        $path = __DIR__.'/../fixtures/invalidJson';
23 23
         $loader = new JsonLoader($path);
24 24
         $this->assertEquals($loader->getErrorCode(), JsonLoader::ERROR_INVALID_JSON);
25 25
         $this->assertEquals($loader->getPath(), $path);
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 
30 30
     public function testHasDataWithValidFile()
31 31
     {
32
-        $path = __DIR__ . '/../fixtures/validJson.json';
32
+        $path = __DIR__.'/../fixtures/validJson.json';
33 33
         $loader = new JsonLoader($path);
34 34
         $this->assertEquals($loader->getErrorCode(), JsonLoader::NO_ERROR);
35 35
         $this->assertEquals($loader->getPath(), $path);
Please login to merge, or discard this patch.