@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | 'w-h-p-t-u-' . |
51 | 51 | uniqid() . |
52 | 52 | DIRECTORY_SEPARATOR; |
53 | - $this->tmpDir = $this->baseTmpDir . |
|
53 | + $this->tmpDir = $this->baseTmpDir . |
|
54 | 54 | uniqid() . |
55 | 55 | DIRECTORY_SEPARATOR; |
56 | 56 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | |
60 | 60 | protected function tearDown(): void |
61 | 61 | { |
62 | - if (! file_exists($this->baseTmpDir)) { |
|
62 | + if (!file_exists($this->baseTmpDir)) { |
|
63 | 63 | return; |
64 | 64 | } |
65 | 65 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | $directory = new FilesystemIterator($dir); |
88 | 88 | |
89 | 89 | foreach ($directory as $node) { |
90 | - if (! $node instanceof SplFileInfo) { |
|
90 | + if (!$node instanceof SplFileInfo) { |
|
91 | 91 | continue; |
92 | 92 | } |
93 | 93 | |
@@ -96,23 +96,23 @@ discard block |
||
96 | 96 | continue; |
97 | 97 | } |
98 | 98 | |
99 | - if (! is_file($node->getPathname())) { |
|
99 | + if (!is_file($node->getPathname())) { |
|
100 | 100 | continue; |
101 | 101 | } |
102 | 102 | |
103 | - if (! unlink($node->getPathname())) { |
|
103 | + if (!unlink($node->getPathname())) { |
|
104 | 104 | throw ErrorExceptionFactory::create('Error deleting file: ' . $node->getPathname()); |
105 | 105 | } |
106 | 106 | } |
107 | 107 | |
108 | - if (! @rmdir($dir)) { |
|
108 | + if (!@rmdir($dir)) { |
|
109 | 109 | throw ErrorExceptionFactory::create('Error deleting directory: ' . $dir); |
110 | 110 | } |
111 | 111 | } |
112 | 112 | |
113 | 113 | final protected function getTmpDir(): string |
114 | 114 | { |
115 | - if (! file_exists($this->tmpDir) && ! @mkdir($this->tmpDir, self::DEFAULT_MODE, true)) { |
|
115 | + if (!file_exists($this->tmpDir) && !@mkdir($this->tmpDir, self::DEFAULT_MODE, true)) { |
|
116 | 116 | throw ErrorExceptionFactory::create('Error creating directory: ' . $this->tmpDir); |
117 | 117 | } |
118 | 118 | |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | $directory = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)); |
134 | 134 | |
135 | 135 | foreach ($directory as $node) { |
136 | - if (! is_file($node->getPathname())) { |
|
136 | + if (!is_file($node->getPathname())) { |
|
137 | 137 | continue; |
138 | 138 | } |
139 | 139 |
@@ -64,25 +64,25 @@ discard block |
||
64 | 64 | public static function findEventListeners(Event $event): void |
65 | 65 | { |
66 | 66 | $rootPackagePath = dirname(self::getVendorDir($event->getComposer())) . DIRECTORY_SEPARATOR; |
67 | - if (! file_exists($rootPackagePath . '/composer.json')) { |
|
67 | + if (!file_exists($rootPackagePath . '/composer.json')) { |
|
68 | 68 | return; |
69 | 69 | } |
70 | 70 | |
71 | 71 | $jsonRaw = file_get_contents($rootPackagePath . '/composer.json'); |
72 | - if (! is_string($jsonRaw)) { |
|
72 | + if (!is_string($jsonRaw)) { |
|
73 | 73 | return; |
74 | 74 | } |
75 | 75 | |
76 | 76 | $json = json_decode($jsonRaw, true); |
77 | - if (! is_array($json)) { |
|
77 | + if (!is_array($json)) { |
|
78 | 78 | return; |
79 | 79 | } |
80 | 80 | |
81 | - if (! array_key_exists('require-dev', $json)) { |
|
81 | + if (!array_key_exists('require-dev', $json)) { |
|
82 | 82 | return; |
83 | 83 | } |
84 | 84 | |
85 | - if (! is_array($json['require-dev'])) { |
|
85 | + if (!is_array($json['require-dev'])) { |
|
86 | 86 | return; |
87 | 87 | } |
88 | 88 | |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | } |
95 | 95 | } |
96 | 96 | |
97 | - if (! $hasMakefiles) { |
|
97 | + if (!$hasMakefiles) { |
|
98 | 98 | return; |
99 | 99 | } |
100 | 100 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | } |
108 | 108 | |
109 | 109 | foreach (['require', 'require-dev'] as $key) { |
110 | - if (! is_array($json[$key])) { |
|
110 | + if (!is_array($json[$key])) { |
|
111 | 111 | continue; |
112 | 112 | } |
113 | 113 | |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | { |
137 | 137 | $io->write('<info>wyrihaximus/test-utilities:</info> Adding <fg=cyan>make on-install-or-update || true</> to scripts'); |
138 | 138 | $composerJsonString = file_get_contents($rootPackagePath . '/composer.json'); |
139 | - if (! is_string($composerJsonString)) { |
|
139 | + if (!is_string($composerJsonString)) { |
|
140 | 140 | $io->write('<error>wyrihaximus/test-utilities:</error> Unable to read <fg=cyan>composer.json</> aborting'); |
141 | 141 | |
142 | 142 | return; |
@@ -145,17 +145,17 @@ discard block |
||
145 | 145 | $composerJson = json_decode($composerJsonString, true); |
146 | 146 | $composerJsonHash = hash('sha512', (string) json_encode($composerJson, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT)); |
147 | 147 | if (is_array($composerJson)) { |
148 | - if (! (array_key_exists('scripts', $composerJson) && is_array($composerJson['scripts']))) { |
|
148 | + if (!(array_key_exists('scripts', $composerJson) && is_array($composerJson['scripts']))) { |
|
149 | 149 | $composerJson['scripts'] = []; |
150 | 150 | } |
151 | 151 | |
152 | - if (! array_key_exists('post-install-cmd', $composerJson['scripts'])) { |
|
152 | + if (!array_key_exists('post-install-cmd', $composerJson['scripts'])) { |
|
153 | 153 | $composerJson['scripts']['post-install-cmd'] = []; |
154 | 154 | } |
155 | 155 | |
156 | 156 | $composerJson['scripts']['post-install-cmd'] = self::addMakeOnInstallOrUpdateToScriptsSectionAndRemoveCommandsItReplaces($composerJson['scripts']['post-install-cmd']); |
157 | 157 | |
158 | - if (! array_key_exists('post-update-cmd', $composerJson['scripts'])) { |
|
158 | + if (!array_key_exists('post-update-cmd', $composerJson['scripts'])) { |
|
159 | 159 | $composerJson['scripts']['post-update-cmd'] = []; |
160 | 160 | } |
161 | 161 | |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | $replacementComposerJsonString = json_encode($composerJson, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT); |
166 | 166 | if (is_string($replacementComposerJsonString)) { |
167 | 167 | $replacementComposerJsonHash = hash('sha512', $replacementComposerJsonString); |
168 | - if (! hash_equals($composerJsonHash, $replacementComposerJsonHash)) { |
|
168 | + if (!hash_equals($composerJsonHash, $replacementComposerJsonHash)) { |
|
169 | 169 | $replacementComposerJsonString = preg_replace('/^( +?)\\1(?=[^ ])/m', '$1', $replacementComposerJsonString); |
170 | 170 | if (is_string($replacementComposerJsonString)) { |
171 | 171 | $io->write('<info>wyrihaximus/test-utilities:</info> Writing new <fg=cyan>composer.json</>'); |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | $replacementComposerJsonString = json_encode($composerJson, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT); |
188 | 188 | if (is_string($replacementComposerJsonString)) { |
189 | 189 | $replacementComposerJsonHash = hash('sha512', $replacementComposerJsonString); |
190 | - if (! hash_equals($composerJsonHash, $replacementComposerJsonHash)) { |
|
190 | + if (!hash_equals($composerJsonHash, $replacementComposerJsonHash)) { |
|
191 | 191 | $replacementComposerJsonString = preg_replace('/^( +?)\\1(?=[^ ])/m', '$1', $replacementComposerJsonString); |
192 | 192 | if (is_string($replacementComposerJsonString)) { |
193 | 193 | $io->write('<info>wyrihaximus/test-utilities:</info> Writing new <fg=cyan>composer.json</>'); |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | private static function getVendorDir(Composer $composer): string |
231 | 231 | { |
232 | 232 | $vendorDir = $composer->getConfig()->get('vendor-dir'); |
233 | - if ($vendorDir === '' || ! file_exists($vendorDir)) { |
|
233 | + if ($vendorDir === '' || !file_exists($vendorDir)) { |
|
234 | 234 | throw new Exception('vendor-dir must be a string'); |
235 | 235 | } |
236 | 236 |