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

Commit b4e2bd2

Browse files
committed
Merge branch 'feature/php-short-array-syntax'
2 parents 435b1e6 + d34ac43 commit b4e2bd2

15 files changed

+151
-150
lines changed

.php_cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ $config->fixers(
3232
'object_operator',
3333
'php_closing_tag',
3434
'remove_lines_between_uses',
35+
'short_array_syntax',
3536
'short_tag',
3637
'standardize_not_equal',
3738
'trailing_spaces',

src/AbstractPluginManager.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ abstract public function validatePlugin($plugin);
9999
* @throws Exception\ServiceNotCreatedException
100100
* @throws Exception\RuntimeException
101101
*/
102-
public function get($name, $options = array(), $usePeeringServiceManagers = true)
102+
public function get($name, $options = [], $usePeeringServiceManagers = true)
103103
{
104104
$isAutoInvokable = false;
105105

@@ -239,7 +239,7 @@ protected function createFromFactory($canonicalName, $requestedName)
239239
}
240240

241241
if ($factory instanceof FactoryInterface) {
242-
$instance = $this->createServiceViaCallback(array($factory, 'createService'), $canonicalName, $requestedName);
242+
$instance = $this->createServiceViaCallback([$factory, 'createService'], $canonicalName, $requestedName);
243243
} elseif (is_callable($factory)) {
244244
$instance = $this->createServiceViaCallback($factory, $canonicalName, $requestedName);
245245
} else {

src/Config.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ class Config implements ConfigInterface
1414
/**
1515
* @var array
1616
*/
17-
protected $config = array();
17+
protected $config = [];
1818

1919
/**
2020
* Constructor
2121
*
2222
* @param array $config
2323
*/
24-
public function __construct($config = array())
24+
public function __construct($config = [])
2525
{
2626
$this->config = $config;
2727
}
@@ -43,7 +43,7 @@ public function getAllowOverride()
4343
*/
4444
public function getFactories()
4545
{
46-
return (isset($this->config['factories'])) ? $this->config['factories'] : array();
46+
return (isset($this->config['factories'])) ? $this->config['factories'] : [];
4747
}
4848

4949
/**
@@ -53,7 +53,7 @@ public function getFactories()
5353
*/
5454
public function getAbstractFactories()
5555
{
56-
return (isset($this->config['abstract_factories'])) ? $this->config['abstract_factories'] : array();
56+
return (isset($this->config['abstract_factories'])) ? $this->config['abstract_factories'] : [];
5757
}
5858

5959
/**
@@ -63,7 +63,7 @@ public function getAbstractFactories()
6363
*/
6464
public function getInvokables()
6565
{
66-
return (isset($this->config['invokables'])) ? $this->config['invokables'] : array();
66+
return (isset($this->config['invokables'])) ? $this->config['invokables'] : [];
6767
}
6868

6969
/**
@@ -73,7 +73,7 @@ public function getInvokables()
7373
*/
7474
public function getServices()
7575
{
76-
return (isset($this->config['services'])) ? $this->config['services'] : array();
76+
return (isset($this->config['services'])) ? $this->config['services'] : [];
7777
}
7878

7979
/**
@@ -83,7 +83,7 @@ public function getServices()
8383
*/
8484
public function getAliases()
8585
{
86-
return (isset($this->config['aliases'])) ? $this->config['aliases'] : array();
86+
return (isset($this->config['aliases'])) ? $this->config['aliases'] : [];
8787
}
8888

8989
/**
@@ -93,7 +93,7 @@ public function getAliases()
9393
*/
9494
public function getInitializers()
9595
{
96-
return (isset($this->config['initializers'])) ? $this->config['initializers'] : array();
96+
return (isset($this->config['initializers'])) ? $this->config['initializers'] : [];
9797
}
9898

9999
/**
@@ -103,7 +103,7 @@ public function getInitializers()
103103
*/
104104
public function getShared()
105105
{
106-
return (isset($this->config['shared'])) ? $this->config['shared'] : array();
106+
return (isset($this->config['shared'])) ? $this->config['shared'] : [];
107107
}
108108

109109
/**
@@ -114,7 +114,7 @@ public function getShared()
114114
*/
115115
public function getDelegators()
116116
{
117-
return (isset($this->config['delegators'])) ? $this->config['delegators'] : array();
117+
return (isset($this->config['delegators'])) ? $this->config['delegators'] : [];
118118
}
119119

120120
/**

src/Di/DiAbstractServiceFactory.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class DiAbstractServiceFactory extends DiServiceFactory implements AbstractFacto
2424
public function __construct(Di $di, $useServiceLocator = self::USE_SL_NONE)
2525
{
2626
$this->di = $di;
27-
if (in_array($useServiceLocator, array(self::USE_SL_BEFORE_DI, self::USE_SL_AFTER_DI, self::USE_SL_NONE))) {
27+
if (in_array($useServiceLocator, [self::USE_SL_BEFORE_DI, self::USE_SL_AFTER_DI, self::USE_SL_NONE])) {
2828
$this->useServiceLocator = $useServiceLocator;
2929
}
3030

@@ -40,10 +40,10 @@ public function createServiceWithName(ServiceLocatorInterface $serviceLocator, $
4040
{
4141
$this->serviceLocator = $serviceLocator;
4242
if ($requestedName) {
43-
return $this->get($requestedName, array());
43+
return $this->get($requestedName, []);
4444
}
4545

46-
return $this->get($name, array());
46+
return $this->get($name, []);
4747
}
4848

4949
/**

src/Di/DiServiceFactory.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class DiServiceFactory extends Di implements FactoryInterface
3838
/**
3939
* @var array
4040
*/
41-
protected $parameters = array();
41+
protected $parameters = [];
4242

4343
/**
4444
* @var string
@@ -58,12 +58,12 @@ class DiServiceFactory extends Di implements FactoryInterface
5858
* @param array $parameters
5959
* @param string $useServiceLocator
6060
*/
61-
public function __construct(Di $di, $name, array $parameters = array(), $useServiceLocator = self::USE_SL_NONE)
61+
public function __construct(Di $di, $name, array $parameters = [], $useServiceLocator = self::USE_SL_NONE)
6262
{
6363
$this->di = $di;
6464
$this->name = $name;
6565
$this->parameters = $parameters;
66-
if (in_array($useServiceLocator, array(self::USE_SL_BEFORE_DI, self::USE_SL_AFTER_DI, self::USE_SL_NONE))) {
66+
if (in_array($useServiceLocator, [self::USE_SL_BEFORE_DI, self::USE_SL_AFTER_DI, self::USE_SL_NONE])) {
6767
$this->useServiceLocator = $useServiceLocator;
6868
}
6969

@@ -92,7 +92,7 @@ public function createService(ServiceLocatorInterface $serviceLocator)
9292
* @return object
9393
* @throws Exception\ServiceNotFoundException
9494
*/
95-
public function get($name, array $params = array())
95+
public function get($name, array $params = [])
9696
{
9797
// allow this di service to get dependencies from the service locator BEFORE trying di
9898
if ($this->useServiceLocator == self::USE_SL_BEFORE_DI && $this->serviceLocator->has($name)) {

src/MutableCreationOptionsTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ trait MutableCreationOptionsTrait
1717
/**
1818
* @var array
1919
*/
20-
protected $creationOptions = array();
20+
protected $creationOptions = [];
2121

2222
/**
2323
* Set creation options

0 commit comments

Comments
 (0)