Skip to content

Commit 7b47aff

Browse files
authored
Merge pull request #44 from cakephp/cs
Fix CS errors
2 parents 3be2ea1 + d656075 commit 7b47aff

3 files changed

Lines changed: 32 additions & 26 deletions

File tree

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"require-dev": {
1313
"composer/composer": "^1.0",
1414
"phpunit/phpunit": "^4.8|^5.7|^6.0",
15-
"cakephp/cakephp-codesniffer": "dev-master"
15+
"cakephp/cakephp-codesniffer": "^3.0"
1616
},
1717
"autoload": {
1818
"psr-4": {

src/Installer/PluginInstaller.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ public function checkUsage(Composer $composer)
5757

5858
$scripts = $composer->getPackage()->getScripts();
5959
$postAutoloadDump = 'Cake\Composer\Installer\PluginInstaller::postAutoloadDump';
60-
if (!isset($scripts['post-autoload-dump']) ||
60+
if (
61+
!isset($scripts['post-autoload-dump']) ||
6162
!in_array($postAutoloadDump, $scripts['post-autoload-dump'])
6263
) {
6364
$this->warnUser(
@@ -331,6 +332,7 @@ public static function primaryNamespace($package)
331332
*
332333
* This installer only supports package of type 'cakephp-plugin'.
333334
*
335+
* @param string $packageType Package type.
334336
* @return bool
335337
*/
336338
public function supports($packageType)
@@ -346,6 +348,7 @@ public function supports($packageType)
346348
*
347349
* @param \Composer\Repository\InstalledRepositoryInterface $repo Repository in which to check.
348350
* @param \Composer\Package\PackageInterface $package Package instance.
351+
* @return void
349352
* @deprecated superceeded by the post-autoload-dump hook
350353
*/
351354
public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
@@ -365,6 +368,7 @@ public function install(InstalledRepositoryInterface $repo, PackageInterface $pa
365368
* @param \Composer\Repository\InstalledRepositoryInterface $repo Repository in which to check.
366369
* @param \Composer\Package\PackageInterface $initial Already installed package version.
367370
* @param \Composer\Package\PackageInterface $target Updated version.
371+
* @return void
368372
* @deprecated superceeded by the post-autoload-dump hook
369373
*
370374
* @throws \InvalidArgumentException if $initial package is not installed
@@ -386,6 +390,7 @@ public function update(InstalledRepositoryInterface $repo, PackageInterface $ini
386390
*
387391
* @param \Composer\Repository\InstalledRepositoryInterface $repo Repository in which to check.
388392
* @param \Composer\Package\PackageInterface $package Package instance.
393+
* @return void
389394
* @deprecated superceeded by the post-autoload-dump hook
390395
*/
391396
public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
@@ -401,6 +406,7 @@ public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $
401406
*
402407
* @param string $name The plugin name being installed.
403408
* @param string $path The path, the plugin is being installed into.
409+
* @return void
404410
*/
405411
public function updateConfig($name, $path)
406412
{

tests/TestCase/Installer/PluginInstallerTest.php

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ public function testPrimaryNamespace()
106106
{
107107
$autoload = [
108108
'psr-4' => [
109-
'FOC\\Authenticate' => ''
110-
]
109+
'FOC\\Authenticate' => '',
110+
],
111111
];
112112
$this->package->setAutoload($autoload);
113113

@@ -117,8 +117,8 @@ public function testPrimaryNamespace()
117117
$autoload = [
118118
'psr-4' => [
119119
'FOC\Acl\Test' => './tests',
120-
'FOC\Acl' => ''
121-
]
120+
'FOC\Acl' => '',
121+
],
122122
];
123123
$this->package->setAutoload($autoload);
124124
$ns = PluginInstaller::primaryNamespace($this->package);
@@ -127,8 +127,8 @@ public function testPrimaryNamespace()
127127
$autoload = [
128128
'psr-4' => [
129129
'Foo\Bar' => 'foo',
130-
'Acme\Plugin' => './src'
131-
]
130+
'Acme\Plugin' => './src',
131+
],
132132
];
133133
$this->package->setAutoload($autoload);
134134
$ns = PluginInstaller::primaryNamespace($this->package);
@@ -137,8 +137,8 @@ public function testPrimaryNamespace()
137137
$autoload = [
138138
'psr-4' => [
139139
'Foo\Bar' => 'bar',
140-
'Foo\\' => ''
141-
]
140+
'Foo\\' => '',
141+
],
142142
];
143143
$this->package->setAutoload($autoload);
144144
$ns = PluginInstaller::primaryNamespace($this->package);
@@ -147,8 +147,8 @@ public function testPrimaryNamespace()
147147
$autoload = [
148148
'psr-4' => [
149149
'Foo\Bar' => 'bar',
150-
'Foo' => '.'
151-
]
150+
'Foo' => '.',
151+
],
152152
];
153153
$this->package->setAutoload($autoload);
154154
$ns = PluginInstaller::primaryNamespace($this->package);
@@ -157,8 +157,8 @@ public function testPrimaryNamespace()
157157
$autoload = [
158158
'psr-4' => [
159159
'Acme\Foo\Bar' => 'bar',
160-
'Acme\Foo\\' => ''
161-
]
160+
'Acme\Foo\\' => '',
161+
],
162162
];
163163
$this->package->setAutoload($autoload);
164164
$ns = PluginInstaller::primaryNamespace($this->package);
@@ -167,8 +167,8 @@ public function testPrimaryNamespace()
167167
$autoload = [
168168
'psr-4' => [
169169
'Acme\Foo\Bar' => '',
170-
'Acme\Foo' => 'src'
171-
]
170+
'Acme\Foo' => 'src',
171+
],
172172
];
173173
$this->package->setAutoload($autoload);
174174
$name = PluginInstaller::primaryNamespace($this->package);
@@ -181,22 +181,22 @@ public function testDeterminePlugins()
181181
$plugin1->setType('cakephp-plugin');
182182
$plugin1->setAutoload([
183183
'psr-4' => [
184-
'TheThing' => 'src/'
185-
]
184+
'TheThing' => 'src/',
185+
],
186186
]);
187187

188188
$plugin2 = new Package('cakephp/princess', '1.0', '1.0');
189189
$plugin2->setType('cakephp-plugin');
190190
$plugin2->setAutoload([
191191
'psr-4' => [
192-
'Princess' => 'src/'
193-
]
192+
'Princess' => 'src/',
193+
],
194194
]);
195195

196196
$packages = [
197197
$plugin1,
198198
new Package('SomethingElse', '1.0', '1.0'),
199-
$plugin2
199+
$plugin2,
200200
];
201201

202202
$return = PluginInstaller::determinePlugins(
@@ -207,7 +207,7 @@ public function testDeterminePlugins()
207207

208208
$expected = [
209209
'Princess' => $this->path . '/vendor/cakephp/princess',
210-
'TheThing' => $this->path . '/vendor/cakephp/the-thing'
210+
'TheThing' => $this->path . '/vendor/cakephp/the-thing',
211211
];
212212
$this->assertSame($expected, $return, 'Only composer-loaded plugins should be listed');
213213

@@ -223,7 +223,7 @@ public function testDeterminePlugins()
223223
'Foo' => $this->path . '/plugins/Foo',
224224
'Fum' => $this->path . '/plugins/Fum',
225225
'Princess' => $this->path . '/vendor/cakephp/princess',
226-
'TheThing' => $this->path . '/vendor/cakephp/the-thing'
226+
'TheThing' => $this->path . '/vendor/cakephp/the-thing',
227227
];
228228
$this->assertSame($expected, $return, 'Composer and application plugins should be listed');
229229

@@ -240,7 +240,7 @@ public function testDeterminePlugins()
240240
'Foo' => $this->path . '/plugins/Foo',
241241
'Fum' => $this->path . '/plugins/Fum',
242242
'Princess' => $this->path . '/vendor/cakephp/princess',
243-
'TheThing' => $this->path . '/vendor/cakephp/the-thing'
243+
'TheThing' => $this->path . '/vendor/cakephp/the-thing',
244244
];
245245
$this->assertSame($expected, $return, 'Composer and application plugins should be listed');
246246
}
@@ -255,7 +255,7 @@ public function testWriteConfigFile()
255255
'OddOneOut' => '/some/other/path',
256256
'Princess' => $this->path . '/vendor/cakephp/princess',
257257
'TheThing' => $this->path . '/vendor/cakephp/the-thing',
258-
'Vendor\Plugin' => $this->path . '/vendor/vendor/plugin'
258+
'Vendor\Plugin' => $this->path . '/vendor/vendor/plugin',
259259
];
260260

261261
$path = $this->path . '/vendor/cakephp-plugins.php';
@@ -295,7 +295,7 @@ public function testWriteConfigFile()
295295

296296
$result = require $path;
297297
$expected = [
298-
'plugins' => $plugins
298+
'plugins' => $plugins,
299299
];
300300
$expected['plugins']['Vendor/Plugin'] = $expected['plugins']['Vendor\Plugin'];
301301
unset($expected['plugins']['Vendor\Plugin']);

0 commit comments

Comments
 (0)