@@ -10,11 +10,11 @@ |
||
10 | 10 | |
11 | 11 | // Please run "run-test.sh", and not this file directly. |
12 | 12 | |
13 | -(function () { |
|
13 | +(function() { |
|
14 | 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 |
@@ -16,8 +16,8 @@ |
||
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, |
@@ -25,7 +25,7 @@ |
||
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 |
@@ -11,18 +11,18 @@ |
||
11 | 11 | $packageDir = dirname($composerJsonPath); |
12 | 12 | |
13 | 13 | $vendorDirs = array_values(array_map( |
14 | - function (string $vendorName) use ($packageDir) { |
|
14 | + function(string $vendorName) use ($packageDir) { |
|
15 | 15 | return $packageDir . '/vendor/' . $vendorName; |
16 | 16 | }, |
17 | - array_keys(json_decode(file_get_contents($composerJsonPath), true)['require'] ?? []) |
|
17 | + array_keys(json_decode(file_get_contents($composerJsonPath), true)['require'] ? ? []) |
|
18 | 18 | )); |
19 | 19 | |
20 | 20 | foreach ($vendorDirs as $vendorDir) { |
21 | - if (! file_exists($vendorDir . '/composer.json')) { |
|
21 | + if (!file_exists($vendorDir . '/composer.json')) { |
|
22 | 22 | continue; |
23 | 23 | } |
24 | 24 | |
25 | - yield from (new LocateComposerPackageSourceFiles())->__invoke($vendorDir . '/composer.json'); |
|
25 | + yield from(new LocateComposerPackageSourceFiles())->__invoke($vendorDir . '/composer.json'); |
|
26 | 26 | } |
27 | 27 | } |
28 | 28 | } |
@@ -12,23 +12,23 @@ discard block |
||
12 | 12 | $composerData = json_decode(file_get_contents($composerJsonPath), true); |
13 | 13 | |
14 | 14 | yield from $this->locateFilesInClassmapDefinitions( |
15 | - $this->getFilePaths($composerData['autoload']['classmap'] ?? [], $packageDir) |
|
15 | + $this->getFilePaths($composerData['autoload']['classmap'] ? ? [], $packageDir) |
|
16 | 16 | ); |
17 | 17 | yield from $this->locateFilesInFilesInFilesDefinitions( |
18 | - $this->getFilePaths($composerData['autoload']['files'] ?? [], $packageDir) |
|
18 | + $this->getFilePaths($composerData['autoload']['files'] ? ? [], $packageDir) |
|
19 | 19 | ); |
20 | 20 | yield from $this->locateFilesInPsr0Definitions( |
21 | - $this->getFilePaths($composerData['autoload']['psr-0'] ?? [], $packageDir) |
|
21 | + $this->getFilePaths($composerData['autoload']['psr-0'] ? ? [], $packageDir) |
|
22 | 22 | ); |
23 | 23 | yield from $this->locateFilesInPsr4Definitions( |
24 | - $this->getFilePaths($composerData['autoload']['psr-4'] ?? [], $packageDir) |
|
24 | + $this->getFilePaths($composerData['autoload']['psr-4'] ? ? [], $packageDir) |
|
25 | 25 | ); |
26 | 26 | } |
27 | 27 | |
28 | 28 | private function getFilePaths(array $sourceDirs, string $packageDir) : array |
29 | 29 | { |
30 | 30 | return array_values(array_map( |
31 | - function (string $sourceDir) use ($packageDir) { |
|
31 | + function(string $sourceDir) use ($packageDir) { |
|
32 | 32 | return $packageDir . '/' . ltrim($sourceDir, '/'); |
33 | 33 | }, |
34 | 34 | $sourceDirs |
@@ -63,6 +63,6 @@ discard block |
||
63 | 63 | |
64 | 64 | private function extractFilesFromDirectory(string $directory) : Generator |
65 | 65 | { |
66 | - yield from (new LocateAllFilesByExtension())->__invoke(new \ArrayIterator([$directory]), '.php'); |
|
66 | + yield from(new LocateAllFilesByExtension())->__invoke(new \ArrayIterator([$directory]), '.php'); |
|
67 | 67 | } |
68 | 68 | } |
@@ -90,7 +90,7 @@ |
||
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?', |
@@ -113,7 +113,7 @@ |
||
113 | 113 | |
114 | 114 | private function recordTraitUsage(Node $node) |
115 | 115 | { |
116 | - if (! $node instanceof Node\Stmt\TraitUse) { |
|
116 | + if (!$node instanceof Node\Stmt\TraitUse) { |
|
117 | 117 | return; |
118 | 118 | } |
119 | 119 |
@@ -8,7 +8,7 @@ |
||
8 | 8 | |
9 | 9 | public function __invoke(string $composerJson, array $phpCoreExtensions = []) : array |
10 | 10 | { |
11 | - $requires = json_decode(file_get_contents($composerJson), true)['require'] ?? []; |
|
11 | + $requires = json_decode(file_get_contents($composerJson), true)['require'] ? ? []; |
|
12 | 12 | |
13 | 13 | $extensions = []; |
14 | 14 | foreach ($requires as $require => $version) { |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Created by PhpStorm. |
|
4 | - * User: matthias |
|
5 | - * Date: 28.11.15 |
|
6 | - * Time: 16:16 |
|
7 | - */ |
|
3 | + * Created by PhpStorm. |
|
4 | + * User: matthias |
|
5 | + * Date: 28.11.15 |
|
6 | + * Time: 16:16 |
|
7 | + */ |
|
8 | 8 | |
9 | 9 | namespace ComposerRequireChecker\Cli; |
10 | 10 |
@@ -21,7 +21,6 @@ |
||
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; |
@@ -52,7 +52,7 @@ discard block |
||
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 |
||
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 |
||
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,16 +109,16 @@ discard block |
||
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)) { |
|
116 | + if (!is_readable($fileName)) { |
|
117 | 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) { |
|
121 | + if (false === $jsonData) { |
|
122 | 122 | throw new \Exception('error parsing the config file: ' . json_last_error_msg()); |
123 | 123 | } |
124 | 124 | |
@@ -133,11 +133,11 @@ discard block |
||
133 | 133 | */ |
134 | 134 | private function checkJsonFile(string $jsonFile) |
135 | 135 | { |
136 | - if(!is_readable($jsonFile)) { |
|
136 | + if (!is_readable($jsonFile)) { |
|
137 | 137 | throw new InvalidInputFileException('cannot read ' . $jsonFile); |
138 | 138 | } |
139 | 139 | |
140 | - if(false == json_decode(file_get_contents($jsonFile))) { |
|
140 | + if (false == json_decode(file_get_contents($jsonFile))) { |
|
141 | 141 | throw new InvalidInputFileException('error parsing ' . $jsonFile . ': ' . json_last_error_msg()); |
142 | 142 | } |
143 | 143 |