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

Commit 7c1f22f

Browse files
author
Jefersson Nathan
committed
Avoid usage of leading \ on imported functions
Signed-off-by: Jefersson Nathan <[email protected]>
1 parent aea63ce commit 7c1f22f

File tree

3 files changed

+10
-13
lines changed

3 files changed

+10
-13
lines changed

src/AbstractFactory/ConfigAbstractFactory.php

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,20 @@
1919

2020
final class ConfigAbstractFactory implements AbstractFactoryInterface
2121
{
22-
2322
/**
2423
* Factory can create the service if there is a key for it in the config
2524
*
2625
* {@inheritdoc}
2726
*/
2827
public function canCreate(\Interop\Container\ContainerInterface $container, $requestedName)
2928
{
30-
if (! $container->has('config') || ! \array_key_exists(self::class, $container->get('config'))) {
29+
if (! $container->has('config') || ! array_key_exists(self::class, $container->get('config'))) {
3130
return false;
3231
}
3332
$config = $container->get('config');
3433
$dependencies = $config[self::class];
3534

36-
return \is_array($dependencies) && \array_key_exists($requestedName, $dependencies);
35+
return is_array($dependencies) && array_key_exists($requestedName, $dependencies);
3736
}
3837

3938
/**
@@ -47,31 +46,31 @@ public function __invoke(\Interop\Container\ContainerInterface $container, $requ
4746

4847
$config = $container->get('config');
4948

50-
if (! (\is_array($config) || $config instanceof ArrayObject)) {
49+
if (! (is_array($config) || $config instanceof ArrayObject)) {
5150
throw new ServiceNotCreatedException('Config must be an array or an instance of ArrayObject');
5251
}
5352

54-
if (! \array_key_exists(self::class, $config)) {
53+
if (! array_key_exists(self::class, $config)) {
5554
throw new ServiceNotCreatedException('Cannot find a `' . self::class . '` key in the config array');
5655
}
5756

5857
$dependencies = $config[self::class];
5958

60-
if (! \is_array($dependencies)
61-
|| ! \array_key_exists($requestedName, $dependencies)
62-
|| ! \is_array($dependencies[$requestedName])
59+
if (! is_array($dependencies)
60+
|| ! array_key_exists($requestedName, $dependencies)
61+
|| ! is_array($dependencies[$requestedName])
6362
) {
6463
throw new ServiceNotCreatedException('Dependencies config must exist and be an array');
6564
}
6665

6766
$serviceDependencies = $dependencies[$requestedName];
6867

69-
if ($serviceDependencies !== \array_values(\array_map('strval', $serviceDependencies))) {
70-
$problem = \json_encode(\array_map('gettype', $serviceDependencies));
68+
if ($serviceDependencies !== array_values(array_map('\strval', $serviceDependencies))) {
69+
$problem = json_encode(array_map('\gettype', $serviceDependencies));
7170
throw new ServiceNotCreatedException('Service message must be an array of strings, ' . $problem . ' given');
7271
}
7372

74-
$arguments = \array_map([$container, 'get'], $serviceDependencies);
73+
$arguments = array_map([$container, 'get'], $serviceDependencies);
7574

7675
return new $requestedName(...$arguments);
7776
}

src/Tool/ConfigDumperCommand.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313
use function array_shift;
1414
use function class_exists;
15-
use function count;
1615
use function dirname;
1716
use function file_exists;
1817
use function file_put_contents;

src/Tool/FactoryCreatorCommand.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313
use function array_shift;
1414
use function class_exists;
15-
use function count;
1615
use function in_array;
1716
use function sprintf;
1817

0 commit comments

Comments
 (0)