Completed
Pull Request — master (#16)
by Rudolph
02:11
created
DefinedSymbolsLocator/LocateDefinedSymbolsFromExtensions.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,8 +16,8 @@
 block discarded – undo
16 16
     public function __invoke(array $extensionNames) : array
17 17
     {
18 18
         $definedSymbols = [];
19
-        foreach($extensionNames as $extensionName) {
20
-            try{
19
+        foreach ($extensionNames as $extensionName) {
20
+            try {
21 21
                 $extensionReflection = new \ReflectionExtension($extensionName);
22 22
                 $definedSymbols = array_merge(
23 23
                     $definedSymbols,
Please login to merge, or discard this patch.
src/ComposerRequireChecker/NodeVisitor/DefinedSymbolCollector.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@
 block discarded – undo
90 90
      */
91 91
     private function recordDefinitionOf(Node $node)
92 92
     {
93
-        if (! isset($node->namespacedName)) {
93
+        if (!isset($node->namespacedName)) {
94 94
             throw new \UnexpectedValueException(sprintf(
95 95
                 'Given node of type "%s" (defined at line %s)does not have an assigned "namespacedName" property: '
96 96
                 . 'did you pass it through a name resolver visitor?',
Please login to merge, or discard this patch.
src/ComposerRequireChecker/Cli/CheckCommand.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,6 @@
 block discarded – undo
21 21
 use PhpParser\ParserFactory;
22 22
 use Symfony\Component\Console\Command\Command;
23 23
 use Symfony\Component\Console\Helper\Table;
24
-use Symfony\Component\Console\Helper\TableCell;
25 24
 use Symfony\Component\Console\Input\InputArgument;
26 25
 use Symfony\Component\Console\Input\InputInterface;
27 26
 use Symfony\Component\Console\Input\InputOption;
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
     protected function execute(InputInterface $input, OutputInterface $output) : int
53 53
     {
54 54
 
55
-        if(!$output->isQuiet()) {
55
+        if (!$output->isQuiet()) {
56 56
             $output->writeln($this->getApplication()->getLongVersion());
57 57
         }
58 58
 
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 
62 62
         $getPackageSourceFiles = new LocateComposerPackageSourceFiles();
63 63
 
64
-        $sourcesASTs  = new LocateASTFromFiles((new ParserFactory())->create(ParserFactory::PREFER_PHP7));
64
+        $sourcesASTs = new LocateASTFromFiles((new ParserFactory())->create(ParserFactory::PREFER_PHP7));
65 65
 
66 66
         $definedVendorSymbols = (new LocateDefinedSymbolsFromASTRoots())->__invoke($sourcesASTs(
67 67
             (new ComposeGenerators())->__invoke(
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
         $guesser = new DependencyGuesser();
97 97
         foreach ($unknownSymbols as $unknownSymbol) {
98 98
             $guessedDependencies = [];
99
-            foreach($guesser($unknownSymbol) as $guessedDependency) {
99
+            foreach ($guesser($unknownSymbol) as $guessedDependency) {
100 100
                 $guessedDependencies[] = $guessedDependency;
101 101
             }
102 102
             $table->addRow([$unknownSymbol, implode("\n", $guessedDependencies)]);
@@ -109,17 +109,17 @@  discard block
 block discarded – undo
109 109
     private function getCheckOptions(InputInterface $input) : Options
110 110
     {
111 111
         $fileName = $input->getOption('config-file');
112
-        if(!$fileName) {
112
+        if (!$fileName) {
113 113
             return new Options();
114 114
         }
115 115
 
116
-        if(!is_readable($fileName)) {
117
-            throw new \InvalidArgumentException('unable to read ' . $fileName);
116
+        if (!is_readable($fileName)) {
117
+            throw new \InvalidArgumentException('unable to read '.$fileName);
118 118
         }
119 119
 
120 120
         $jsonData = json_decode(file_get_contents($fileName), true);
121
-        if(false === $jsonData) {
122
-            throw new \Exception('error parsing the config file: ' . json_last_error_msg());
121
+        if (false === $jsonData) {
122
+            throw new \Exception('error parsing the config file: '.json_last_error_msg());
123 123
         }
124 124
 
125 125
         return new Options($jsonData);
@@ -133,12 +133,12 @@  discard block
 block discarded – undo
133 133
      */
134 134
     private function checkJsonFile(string $jsonFile)
135 135
     {
136
-        if(!is_readable($jsonFile)) {
137
-            throw new InvalidInputFileException('cannot read ' . $jsonFile);
136
+        if (!is_readable($jsonFile)) {
137
+            throw new InvalidInputFileException('cannot read '.$jsonFile);
138 138
         }
139 139
 
140
-        if(false == json_decode(file_get_contents($jsonFile))) {
141
-            throw new InvalidInputFileException('error parsing ' . $jsonFile . ': ' . json_last_error_msg());
140
+        if (false == json_decode(file_get_contents($jsonFile))) {
141
+            throw new InvalidInputFileException('error parsing '.$jsonFile.': '.json_last_error_msg());
142 142
         }
143 143
 
144 144
     }
Please login to merge, or discard this patch.
src/ComposerRequireChecker/DependencyGuesser/DependencyGuesser.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
 
19 19
     public function __invoke($symbolName) : \Generator
20 20
     {
21
-        foreach($this->guessers as $guesser) {
21
+        foreach ($this->guessers as $guesser) {
22 22
             yield from $guesser($symbolName);
23 23
         }
24 24
     }
Please login to merge, or discard this patch.
example/test.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -10,16 +10,16 @@
 block discarded – undo
10 10
 
11 11
 // Please run "run-test.sh", and not this file directly.
12 12
 
13
-(function () {
14
-    require_once  __DIR__ . '/../vendor/autoload.php';
13
+(function() {
14
+    require_once  __DIR__.'/../vendor/autoload.php';
15 15
 
16 16
     $whitelistSymbols = ['null', 'true', 'false', 'static', 'self', 'parent'];
17
-    $defaultExtensions = ["Core","standard"]; // "bcmath","calendar","ctype","date","filter","hash","iconv","json","mcrypt","SPL","pcre","Reflection","session","standard","mysqlnd","tokenizer","zip","zlib","libxml","dom","PDO","Phar","SimpleXML","xml","wddx","xmlreader","xmlwriter"];
17
+    $defaultExtensions = ["Core", "standard"]; // "bcmath","calendar","ctype","date","filter","hash","iconv","json","mcrypt","SPL","pcre","Reflection","session","standard","mysqlnd","tokenizer","zip","zlib","libxml","dom","PDO","Phar","SimpleXML","xml","wddx","xmlreader","xmlwriter"];
18 18
 
19 19
     $getPackageSourceFiles = new LocateComposerPackageSourceFiles();
20 20
 
21 21
     $sourcesASTs  = new LocateASTFromFiles((new ParserFactory())->create(ParserFactory::PREFER_PHP7));
22
-    $composerJson = __DIR__ . '/test-data/zend-feed/composer.json';
22
+    $composerJson = __DIR__.'/test-data/zend-feed/composer.json';
23 23
 
24 24
     $definedVendorSymbols = (new LocateDefinedSymbolsFromASTRoots())->__invoke($sourcesASTs(
25 25
         (new ComposeGenerators())->__invoke(
Please login to merge, or discard this patch.
src/ComposerRequireChecker/Cli/Application.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -25,17 +25,17 @@
 block discarded – undo
25 25
     {
26 26
         $version = null;
27 27
         $pharFile = \Phar::running();
28
-        if($pharFile) {
28
+        if ($pharFile) {
29 29
             $metadata = (new \Phar($pharFile))->getMetadata();
30 30
             $version = $metadata['version'] ?? null;
31 31
         }
32 32
 
33
-        if(!$version) {
33
+        if (!$version) {
34 34
             $pwd = getcwd();
35
-            chdir(realpath(__DIR__ . '/../../../'));
35
+            chdir(realpath(__DIR__.'/../../../'));
36 36
             $gitVersion = @exec('git describe --tags --dirty=-dev --always 2>&1', $output, $returnValue);
37 37
             chdir($pwd);
38
-            if($returnValue === 0) {
38
+            if ($returnValue === 0) {
39 39
                 $version = $gitVersion;
40 40
             }
41 41
         }
Please login to merge, or discard this patch.
src/ComposerRequireChecker/Cli/Options.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,8 +25,8 @@
 block discarded – undo
25 25
     {
26 26
         foreach ($options as $key => $option) {
27 27
             $methodName = 'set'.$this->getCamelCase($key);
28
-            if(!method_exists($this, $methodName)) {
29
-                throw new \InvalidArgumentException($key . ' is not a known option - there is no method ' . $methodName);
28
+            if (!method_exists($this, $methodName)) {
29
+                throw new \InvalidArgumentException($key.' is not a known option - there is no method '.$methodName);
30 30
             }
31 31
             $this->$methodName($option);
32 32
         }
Please login to merge, or discard this patch.
src/ComposerRequireChecker/DependencyGuesser/GuessFromLoadedExtensions.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
         foreach ($this->loadedExtensions as $extensionName) {
22 22
             $extensionSymbols = $definedSymbolsFromExtensions([$extensionName]);
23 23
             if (in_array($symbolName, $extensionSymbols)) {
24
-                yield 'ext-' . $extensionName;
24
+                yield 'ext-'.$extensionName;
25 25
             }
26 26
         }
27 27
     }
Please login to merge, or discard this patch.
src/ComposerRequireChecker/FileLocator/LocateAllFilesByExtension.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,11 +21,11 @@
 block discarded – undo
21 21
 
22 22
     private function filterFilesByExtension(Traversable $files, string $fileExtension) : Traversable
23 23
     {
24
-        $extensionMatcher = '/.*' . preg_quote($fileExtension) . '$/';
24
+        $extensionMatcher = '/.*'.preg_quote($fileExtension).'$/';
25 25
 
26 26
         /* @var $file \SplFileInfo */
27 27
         foreach ($files as $file) {
28
-            if (! preg_match($extensionMatcher, $file->getBasename())) {
28
+            if (!preg_match($extensionMatcher, $file->getBasename())) {
29 29
                 continue;
30 30
             }
31 31
 
Please login to merge, or discard this patch.