Skip to content

Commit c2b62ee

Browse files
authored
Merge pull request #78 from cakephp/2.x-cs-cleanup
cleanup CS
2 parents 20d7f1e + 17d521a commit c2b62ee

File tree

5 files changed

+21
-16
lines changed

5 files changed

+21
-16
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
/composer.lock
33
/tools
44
.phpunit.result.cache
5+
.phpcs.cache

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@
4343
"@cs-check",
4444
"@test"
4545
],
46-
"cs-check": "phpcs --colors --parallel=16 -p",
47-
"cs-fix": "phpcbf --colors --parallel=16 -p",
46+
"cs-check": "phpcs",
47+
"cs-fix": "phpcbf",
4848
"phpstan": "tools/phpstan analyse",
4949
"stan": "@phpstan",
5050
"stan-tests": "phpstan.phar analyze -c tests/phpstan.neon",

phpcs.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,8 @@
33
<file>src/</file>
44
<file>tests/</file>
55
<rule ref="CakePHP" />
6+
<arg value="nps"/>
7+
<arg name="colors"/>
8+
<arg name="parallel" value="4"/>
9+
<arg name="cache" value=".phpcs.cache"/>
610
</ruleset>

src/Plugin.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public function postAutoloadDump(Event $event): void
138138
public function findPlugins(
139139
array $packages,
140140
array $pluginDirs = ['plugins'],
141-
string $vendorDir = 'vendor'
141+
string $vendorDir = 'vendor',
142142
): array {
143143
$plugins = [];
144144

@@ -217,7 +217,7 @@ public function writeConfigFile(string $configFile, array $plugins, ?string $roo
217217
$pluginPath = str_replace(
218218
DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR,
219219
DIRECTORY_SEPARATOR,
220-
$pluginPath
220+
$pluginPath,
221221
);
222222

223223
// Namespaced plugins should use /
@@ -248,7 +248,7 @@ public function writeConfigFile(string $configFile, array $plugins, ?string $roo
248248
$root = str_replace(
249249
DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR,
250250
DIRECTORY_SEPARATOR,
251-
$root
251+
$root,
252252
);
253253

254254
// Normalize to *nix paths.
@@ -313,8 +313,8 @@ public function getPrimaryNamespace(PackageInterface $package): string
313313
'Unable to get primary namespace for package %s.' .
314314
"\nEnsure you have added proper 'autoload' section to your plugin's config" .
315315
' as stated in README on https://github.com/cakephp/plugin-installer',
316-
$package->getName()
317-
)
316+
$package->getName(),
317+
),
318318
);
319319
}
320320

tests/TestCase/PluginTest.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public function setUp(): void
8484
$rm = new RepositoryManager(
8585
$this->io,
8686
$config,
87-
$httpDownloader
87+
$httpDownloader,
8888
);
8989
$this->composer->setRepositoryManager($rm);
9090

@@ -302,7 +302,7 @@ public function testFindPlugins()
302302
$return = $this->plugin->findPlugins(
303303
$packages,
304304
[$this->path . '/doesnt-exist'],
305-
$this->path . '/vendor'
305+
$this->path . '/vendor',
306306
);
307307

308308
$expected = [
@@ -314,7 +314,7 @@ public function testFindPlugins()
314314
$return = $this->plugin->findPlugins(
315315
$packages,
316316
[$this->path . '/plugins'],
317-
$this->path . '/vendor'
317+
$this->path . '/vendor',
318318
);
319319

320320
$expected = [
@@ -330,7 +330,7 @@ public function testFindPlugins()
330330
$return = $this->plugin->findPlugins(
331331
$packages,
332332
[$this->path . '/plugins', $this->path . '/app_plugins'],
333-
$this->path . '/vendor'
333+
$this->path . '/vendor',
334334
);
335335

336336
$expected = [
@@ -369,22 +369,22 @@ public function testWriteConfigFile()
369369
$this->assertStringContainsString(
370370
"'Fee' => \$baseDir . '/plugins/Fee/'",
371371
$contents,
372-
'paths should be relative for app-plugins'
372+
'paths should be relative for app-plugins',
373373
);
374374
$this->assertStringContainsString(
375375
"'Princess' => \$baseDir . '/vendor/cakephp/princess/'",
376376
$contents,
377-
'paths should be relative for vendor-plugins'
377+
'paths should be relative for vendor-plugins',
378378
);
379379
$this->assertStringContainsString(
380380
"'OddOneOut' => '/some/other/path/'",
381381
$contents,
382-
'paths should stay absolute if it\'s not under the application root'
382+
'paths should stay absolute if it\'s not under the application root',
383383
);
384384
$this->assertStringContainsString(
385385
"'Vendor/Plugin' => \$baseDir . '/vendor/vendor/plugin/'",
386386
$contents,
387-
'Plugin namespaces should use forward slash'
387+
'Plugin namespaces should use forward slash',
388388
);
389389

390390
// Ensure all plugin paths are slash terminated
@@ -403,7 +403,7 @@ public function testWriteConfigFile()
403403
$this->assertSame(
404404
$expected,
405405
$result,
406-
'The evaluated result should be the same as the input except for namespaced plugin'
406+
'The evaluated result should be the same as the input except for namespaced plugin',
407407
);
408408
}
409409
}

0 commit comments

Comments
 (0)