Skip to content

Commit

Permalink
Change to 5.4 array syntax and make most properties private
Browse files Browse the repository at this point in the history
  • Loading branch information
henrikbjorn committed Jul 14, 2014
1 parent fa1c711 commit ca5fcf9
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 24 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
},

"require" : {
"php" : ">=5.3.3",
"php" : "~5.4",
"symfony/config" : "~2.3"
},

"require-dev" : {
"pimple/pimple" : "2.1.x-dev",
"pimple/pimple" : "~2.1",
"symfony/yaml" : "~2.4"
},

Expand Down
2 changes: 1 addition & 1 deletion src/Configurator.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

class Configurator
{
protected $loader;
private $loader;

public function __construct(LoaderInterface $loader)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Loader/AbstractLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
*/
abstract class AbstractLoader extends FileLoader
{
protected $resources;
protected $locator;
private $resources;

public function __construct(
FileLocatorInterface $locator,
Expand All @@ -39,7 +39,7 @@ protected function parse(array $parameters, $resource)
}

$imports = (array) $parameters['@import'];
$inherited = array();
$inherited = [];

unset($parameters['@import']);

Expand Down
8 changes: 4 additions & 4 deletions src/Loader/CacheLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
*/
class CacheLoader extends \Symfony\Component\Config\Loader\Loader
{
protected $loader;
protected $resources;
protected $debug = false;
protected $cacheDir;
private $loader;
private $resources;
private $debug = false;
private $cacheDir;

public function __construct(LoaderInterface $loader, ResourceCollection $resources)
{
Expand Down
8 changes: 4 additions & 4 deletions src/Loader/NormalizerLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

class NormalizerLoader extends \Symfony\Component\Config\Loader\Loader
{
protected $normalizer;
protected $loader;
private $normalizer;
private $loader;

public function __construct(LoaderInterface $loader, Normalizer $normalizer)
{
Expand All @@ -20,7 +20,7 @@ public function load($resource, $type = null)
{
$parameters = $this->loader->load($resource, $type);

return array_map(array($this, 'normalize'), $parameters);
return array_map([$this, 'normalize'], $parameters);
}

public function supports($resource, $type = null)
Expand All @@ -31,7 +31,7 @@ public function supports($resource, $type = null)
private function normalize($value)
{
if (is_array($value)) {
return array_map(array($this, 'normalize'), $value);
return array_map([$this, 'normalize'], $value);
}

return $this->normalizer->normalize($value);
Expand Down
6 changes: 3 additions & 3 deletions src/Normalizer/ChainNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
*/
class ChainNormalizer implements \Tacker\Normalizer
{
protected $normalizers = array();
private $normalizers = [];

/**
* @param array $normalizers
*/
public function __construct(array $normalizers = array())
public function __construct(array $normalizers = [])
{
array_map(array($this, 'add'), $normalizers);
array_map([$this, 'add'], $normalizers);
}

/**
Expand Down
8 changes: 4 additions & 4 deletions src/Normalizer/EnvfileNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

class EnvfileNormalizer extends EnvironmentNormalizer
{
protected $env;
protected $locator;
private $env;
private $locator;

public function __construct(FileLocatorInterface $locator)
{
Expand Down Expand Up @@ -39,13 +39,13 @@ protected function load()
return;
}

$this->env = parse_ini_file($file, false, INI_SCANNER_RAW) ?: array();
$this->env = parse_ini_file($file, false, INI_SCANNER_RAW) ?: [];
$this->env = array_change_key_case($this->env, CASE_UPPER);
}

protected function locate()
{
foreach (array('Envfile', 'Envfile.dist') as $i => $file) {
foreach (['Envfile', 'Envfile.dist'] as $i => $file) {
try {
return $this->locator->locate($file);
} catch (\InvalidArgumentException $e) {
Expand Down
2 changes: 1 addition & 1 deletion src/Normalizer/EnvironmentNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class EnvironmentNormalizer implements \Tacker\Normalizer
*/
public function normalize($value)
{
$result = preg_replace_callback('{##|#([A-Z0-9_]+)#}', array($this, 'callback'), $value, -1, $count);
$result = preg_replace_callback('{##|#([A-Z0-9_]+)#}', [$this, 'callback'], $value, -1, $count);

return $count ? $result : $value;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Normalizer/PimpleNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/
class PimpleNormalizer implements \Tacker\Normalizer
{
protected $pimple;
private $pimple;

/**
* @param Container $pimple
Expand All @@ -29,7 +29,7 @@ public function normalize($value)
return isset($this->pimple[$match[1]]) ? $this->pimple[$match[1]] : $match[0];
}

$result = preg_replace_callback('{%%|%([a-z0-9_.]+)%}', array($this, 'callback'), $value, -1, $count);
$result = preg_replace_callback('{%%|%([a-z0-9_.]+)%}', [$this, 'callback'], $value, -1, $count);

return $count ? $result : $value;
}
Expand Down
2 changes: 1 addition & 1 deletion src/ResourceCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class ResourceCollection
{
protected $resources = array();
private $resources = [];

public function add(ResourceInterface $resource)
{
Expand Down

0 comments on commit ca5fcf9

Please sign in to comment.