Skip to content
This repository was archived by the owner on Feb 6, 2020. It is now read-only.

Commit f313da4

Browse files
committed
CS fixes
- Switches to phpcs for CS checks. - Fixes several CS issues, including long lines.
1 parent 5912eee commit f313da4

File tree

6 files changed

+35
-53
lines changed

6 files changed

+35
-53
lines changed

.php_cs

Lines changed: 0 additions & 45 deletions
This file was deleted.

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
},
2020
"require-dev": {
2121
"phpunit/phpunit": "~4.6",
22-
"fabpot/php-cs-fixer": "1.7.*",
23-
"ocramius/proxy-manager": "~1.0"
22+
"ocramius/proxy-manager": "~1.0",
23+
"squizlabs/php_codesniffer": "^2.0@dev"
2424
},
2525
"suggest": {
2626
"ocramius/proxy-manager": "ProxyManager 1.* to handle lazy initialization of services"

phpcs.xml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="Zend Framework coding standard">
3+
<description>Zend Framework coding standard</description>
4+
5+
<!-- display progress -->
6+
<arg value="p"/>
7+
<arg name="colors"/>
8+
9+
<!-- inherit rules from: -->
10+
<rule ref="PSR2"/>
11+
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
12+
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace">
13+
<properties>
14+
<property name="ignoreBlankLines" value="false"/>
15+
</properties>
16+
</rule>
17+
18+
<!-- Paths to check -->
19+
<file>src</file>
20+
<file>test</file>
21+
</ruleset>

src/PluginManagerInterface.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ interface PluginManagerInterface extends ServiceLocatorInterface
2323
*
2424
* @param object $instance
2525
* @return void
26-
* @throws InvalidServiceException If created instance does not respect the constraint on type imposed by the plugin manager
26+
* @throws InvalidServiceException If created instance does not respect the
27+
* constraint on type imposed by the plugin manager
2728
*/
2829
public function validate($instance);
2930
}

src/ServiceManager.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,12 +185,17 @@ public function has($name, $checkAbstractFactories = false)
185185
protected function configure(array $config)
186186
{
187187
$this->factories = (isset($config['factories']) ? $config['factories'] : []) + $this->factories;
188-
$this->delegators = array_merge_recursive($this->delegators, isset($config['delegators']) ? $config['delegators'] : []);
188+
$this->delegators = array_merge_recursive($this->delegators, isset($config['delegators'])
189+
? $config['delegators']
190+
: []);
189191
$this->shared = (isset($config['shared']) ? $config['shared'] : []) + $this->shared;
190192
$this->aliases = (isset($config['aliases']) ? $config['aliases'] : []) + $this->aliases;
191-
$this->sharedByDefault = isset($config['shared_by_default']) ? $config['shared_by_default'] : $this->sharedByDefault;
193+
$this->sharedByDefault = isset($config['shared_by_default'])
194+
? $config['shared_by_default']
195+
: $this->sharedByDefault;
192196

193-
// For abstract factories and initializers, we always directly instantiate them to avoid checks during construction
197+
// For abstract factories and initializers, we always directly
198+
// instantiate them to avoid checks during construction
194199
if (isset($config['abstract_factories'])) {
195200
foreach ($config['abstract_factories'] as $abstractFactory) {
196201
if (is_string($abstractFactory)) {
@@ -297,7 +302,7 @@ private function createDelegatorFromName($name, array $options = [])
297302
return $factory($this->creationContext, $name, $options);
298303
};
299304

300-
for ($i = 0 ; $i < $delegatorsCount ; ++$i) {
305+
for ($i = 0; $i < $delegatorsCount; ++$i) {
301306
$delegatorFactory = $this->delegators[$name][$i];
302307

303308
if (is_string($delegatorFactory)) {

test/TestAsset/FailingFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ public function __invoke(ContainerInterface $container, $requestedName, array $o
2121
{
2222
throw new \RuntimeException('There is an error');
2323
}
24-
}
24+
}

0 commit comments

Comments
 (0)