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

Commit b8a7b6b

Browse files
committed
CS fixes per new phpcs rules
1 parent cefe38f commit b8a7b6b

File tree

5 files changed

+24
-18
lines changed

5 files changed

+24
-18
lines changed

phpcs.xml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,21 @@
99
<!-- inherit rules from: -->
1010
<rule ref="PSR2"/>
1111
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
12+
<rule ref="Generic.Formatting.SpaceAfterNot"/>
13+
<rule ref="Squiz.WhiteSpace.OperatorSpacing">
14+
<properties>
15+
<property name="ignoreNewlines" value="true"/>
16+
</properties>
17+
</rule>
1218
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace">
1319
<properties>
1420
<property name="ignoreBlankLines" value="false"/>
1521
</properties>
1622
</rule>
1723

1824
<!-- Paths to check -->
25+
<file>bin</file>
1926
<file>src</file>
2027
<file>test</file>
21-
<file>bin</file>
2228
<exclude-pattern>*/test/log/*</exclude-pattern>
2329
</ruleset>

src/AbstractFactory/ConfigAbstractFactory.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ final class ConfigAbstractFactory implements AbstractFactoryInterface
2222
*/
2323
public function canCreate(\Interop\Container\ContainerInterface $container, $requestedName)
2424
{
25-
if (!$container->has('config') || !array_key_exists(self::class, $container->get('config'))) {
25+
if (! $container->has('config') || ! array_key_exists(self::class, $container->get('config'))) {
2626
return false;
2727
}
2828
$config = $container->get('config');
@@ -36,25 +36,25 @@ public function canCreate(\Interop\Container\ContainerInterface $container, $req
3636
*/
3737
public function __invoke(\Interop\Container\ContainerInterface $container, $requestedName, array $options = null)
3838
{
39-
if (!$container->has('config')) {
39+
if (! $container->has('config')) {
4040
throw new ServiceNotCreatedException('Cannot find a config array in the container');
4141
}
4242

4343
$config = $container->get('config');
4444

45-
if (!is_array($config)) {
45+
if (! is_array($config)) {
4646
throw new ServiceNotCreatedException('Config must be an array');
4747
}
4848

49-
if (!array_key_exists(self::class, $config)) {
49+
if (! array_key_exists(self::class, $config)) {
5050
throw new ServiceNotCreatedException('Cannot find a `' . self::class . '` key in the config array');
5151
}
5252

5353
$dependencies = $config[self::class];
5454

55-
if (!is_array($dependencies)
56-
|| !array_key_exists($requestedName, $dependencies)
57-
|| !is_array($dependencies[$requestedName])
55+
if (! is_array($dependencies)
56+
|| ! array_key_exists($requestedName, $dependencies)
57+
|| ! is_array($dependencies[$requestedName])
5858
) {
5959
throw new ServiceNotCreatedException('Dependencies config must exist and be an array');
6060
}

src/Config.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ private function merge(array $a, array $b)
111111
$a[$key] = $value;
112112
}
113113
} else {
114-
if (!$value instanceof MergeRemoveKey) {
114+
if (! $value instanceof MergeRemoveKey) {
115115
$a[$key] = $value;
116116
}
117117
}

src/ServiceManager.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ private function resolveAbstractFactories(array $abstractFactories)
520520
foreach ($abstractFactories as $abstractFactory) {
521521
if (is_string($abstractFactory) && class_exists($abstractFactory)) {
522522
//Cached string
523-
if (!isset($this->cachedAbstractFactories[$abstractFactory])) {
523+
if (! isset($this->cachedAbstractFactories[$abstractFactory])) {
524524
$this->cachedAbstractFactories[$abstractFactory] = new $abstractFactory();
525525
}
526526

@@ -754,7 +754,7 @@ private function createDelegatorFromName($name, array $options = null)
754754
private function doCreate($resolvedName, array $options = null)
755755
{
756756
try {
757-
if (!isset($this->delegators[$resolvedName])) {
757+
if (! isset($this->delegators[$resolvedName])) {
758758
// Let's create the service by fetching the factory
759759
$factory = $this->getFactory($resolvedName);
760760
$object = $factory($this->creationContext, $resolvedName, $options);
@@ -889,7 +889,7 @@ private function createFactoriesForInvokables(array $invokables)
889889
*/
890890
private function validateOverrides(array $config)
891891
{
892-
if ($this->allowOverride || !$this->configured) {
892+
if ($this->allowOverride || ! $this->configured) {
893893
return;
894894
}
895895

src/Tool/CliTool.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ public static function createDependencyConfig(array $config, $className)
2525
self::validateClassName($className);
2626

2727
$reflectionClass = new \ReflectionClass($className);
28-
if (!$reflectionClass->getConstructor()) {
28+
if (! $reflectionClass->getConstructor()) {
2929
return $config;
3030
}
3131

3232
$constructorArguments = $reflectionClass->getConstructor()->getParameters();
3333
$constructorArguments = array_filter(
3434
$constructorArguments,
3535
function (\ReflectionParameter $argument) {
36-
return !$argument->isOptional();
36+
return ! $argument->isOptional();
3737
}
3838
);
3939

@@ -64,22 +64,22 @@ function (\ReflectionParameter $argument) {
6464
*/
6565
private static function validateClassName($className)
6666
{
67-
if (!is_string($className)) {
67+
if (! is_string($className)) {
6868
throw new InvalidArgumentException('Class name must be a string, ' . gettype($className) . ' given');
6969
}
7070

71-
if (!class_exists($className)) {
71+
if (! class_exists($className)) {
7272
throw new InvalidArgumentException('Cannot find class with name ' . $className);
7373
}
7474
}
7575

7676
public static function createFactoryMappingsFromConfig(array $config)
7777
{
78-
if (!array_key_exists(ConfigAbstractFactory::class, $config)) {
78+
if (! array_key_exists(ConfigAbstractFactory::class, $config)) {
7979
return $config;
8080
}
8181

82-
if (!is_array($config[ConfigAbstractFactory::class])) {
82+
if (! is_array($config[ConfigAbstractFactory::class])) {
8383
throw new InvalidArgumentException(
8484
'Config key for ' . ConfigAbstractFactory::class . ' should be an array, ' . gettype(
8585
$config[ConfigAbstractFactory::class]

0 commit comments

Comments
 (0)