Skip to content

Commit 2d6ac3c

Browse files
committed
improved coding style
1 parent 58ed2d8 commit 2d6ac3c

File tree

77 files changed

+557
-555
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+557
-555
lines changed

src/DI/Compiler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function addExtension($name, CompilerExtension $extension)
6060
public function getExtensions($type = NULL)
6161
{
6262
return $type
63-
? array_filter($this->extensions, function($item) use ($type) { return $item instanceof $type; })
63+
? array_filter($this->extensions, function ($item) use ($type) { return $item instanceof $type; })
6464
: $this->extensions;
6565
}
6666

src/DI/ContainerBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -757,7 +757,7 @@ public function formatStatement(Statement $statement)
757757
*/
758758
public function formatPhp($statement, $args)
759759
{
760-
array_walk_recursive($args, function(& $val) {
760+
array_walk_recursive($args, function (& $val) {
761761
if ($val instanceof Statement) {
762762
$val = self::literal($this->formatStatement($val));
763763

src/DI/ContainerLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function __construct($tempDirectory, $autoRebuild = FALSE)
3333

3434
/**
3535
* @param mixed
36-
* @param callable function(Nette\DI\Compiler $compiler): string|NULL
36+
* @param callable function (Nette\DI\Compiler $compiler): string|NULL
3737
* @return string
3838
*/
3939
public function load($key, $generator)

src/DI/Extensions/DIExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function afterCompile(Nette\PhpGenerator\ClassType $class)
5353
if ($this->debugMode && $this->config['debugger']) {
5454
Nette\Bridges\DITracy\ContainerPanel::$compilationTime = $this->time;
5555
$initialize->addBody($container->formatPhp('?;', [
56-
new Nette\DI\Statement('@Tracy\Bar::addPanel', [new Nette\DI\Statement('Nette\Bridges\DITracy\ContainerPanel')])
56+
new Nette\DI\Statement('@Tracy\Bar::addPanel', [new Nette\DI\Statement('Nette\Bridges\DITracy\ContainerPanel')]),
5757
]));
5858
}
5959

src/DI/Extensions/DecoratorExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function addTags($type, array $tags)
6161
private function findByType($type)
6262
{
6363
$type = ltrim($type, '\\');
64-
return array_filter($this->getContainerBuilder()->getDefinitions(), function($def) use ($type) {
64+
return array_filter($this->getContainerBuilder()->getDefinitions(), function ($def) use ($type) {
6565
return $def->getClass() === $type || is_subclass_of($def->getClass(), $type);
6666
});
6767
}

src/DI/Extensions/InjectExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ private function updateDefinition($def)
6767
*/
6868
public static function getInjectMethods($class)
6969
{
70-
return array_values(array_filter(get_class_methods($class), function($name) {
70+
return array_values(array_filter(get_class_methods($class), function ($name) {
7171
return substr($name, 0, 6) === 'inject';
7272
}));
7373
}

tests/DI/Compiler.addExtension.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ class FooExtension extends DI\CompilerExtension
2020
}
2121

2222

23-
Assert::exception(function() {
23+
Assert::exception(function () {
2424
$compiler = new DI\Compiler;
2525
$compiler->addExtension('foo', new FooExtension);
2626
$container = createContainer($compiler);
2727
}, 'Nette\DeprecatedException', "Extensions 'bar' were added while container was being compiled.");
2828

2929

30-
Assert::exception(function() {
30+
Assert::exception(function () {
3131
$compiler = new DI\Compiler;
3232
$compiler->addExtension('foo', new FooExtension);
3333
$compiler->addExtension('foo', new FooExtension);

tests/DI/Compiler.arguments.phpt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class Lorem
2626

2727
function method()
2828
{
29-
$this->args[] = func_get_args();
29+
$this->args[] = func_get_args();
3030
}
3131

3232
function add($a, $b)
@@ -36,7 +36,7 @@ class Lorem
3636

3737
}
3838

39-
define('MY_CONSTANT_TEST', "one");
39+
define('MY_CONSTANT_TEST', 'one');
4040

4141

4242
Assert::error(function () use (& $container) {
@@ -63,23 +63,23 @@ $lorem = $container->getService('lorem');
6363
$dolor = $container->getService('dolor');
6464

6565
// constants
66-
Assert::same( ['one', Lorem::DOLOR_SIT, 'MY_FAILING_CONSTANT_TEST'], $lorem->args[0] );
67-
Assert::same( [NULL], $dolor->args[0] );
66+
Assert::same(['one', Lorem::DOLOR_SIT, 'MY_FAILING_CONSTANT_TEST'], $lorem->args[0]);
67+
Assert::same([NULL], $dolor->args[0]);
6868

6969
// services
70-
Assert::same( [$lorem, $lorem, $container], $lorem->args[1] );
70+
Assert::same([$lorem, $lorem, $container], $lorem->args[1]);
7171

7272
// statements
73-
Assert::same( [3, ['x' => 'HELLO']], $lorem->args[2] );
73+
Assert::same([3, ['x' => 'HELLO']], $lorem->args[2]);
7474

7575
// non-statements
76-
Assert::same( [['Lorem', 'method'], 'Lorem::add', 'Lorem::add'], $lorem->args[3] );
76+
Assert::same([['Lorem', 'method'], 'Lorem::add', 'Lorem::add'], $lorem->args[3]);
7777

7878
// special
79-
Assert::same( [FALSE], $lorem->args[4] );
79+
Assert::same([FALSE], $lorem->args[4]);
8080

8181
// service variables
82-
Assert::same( [$lorem->var, $lorem->var, $container->parameters], $lorem->args[5] );
82+
Assert::same([$lorem->var, $lorem->var, $container->parameters], $lorem->args[5]);
8383

8484
// service constant
85-
Assert::same( [Lorem::DOLOR_SIT, Lorem::DOLOR_SIT, DI\Container::TAGS], $lorem->args[6] );
85+
Assert::same([Lorem::DOLOR_SIT, Lorem::DOLOR_SIT, DI\Container::TAGS], $lorem->args[6]);

tests/DI/Compiler.extension.defaultServices.phpt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ services:
8181
');
8282

8383

84-
Assert::type( 'Foo', $container->getService('one') );
85-
Assert::type( 'Bar', $container->getService('two') );
86-
Assert::type( 'Lorem', $container->getService('three') );
87-
Assert::type( 'IIpsumFactory', $container->getService('four') );
84+
Assert::type('Foo', $container->getService('one'));
85+
Assert::type('Bar', $container->getService('two'));
86+
Assert::type('Lorem', $container->getService('three'));
87+
Assert::type('IIpsumFactory', $container->getService('four'));
8888

89-
Assert::type( 'FooBar', $container->getByType('IFooBar') );
89+
Assert::type('FooBar', $container->getByType('IFooBar'));

tests/DI/Compiler.extension.getConfig.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ bar:
3737
lorem: ipsum
3838
');
3939

40-
Assert::same( ['lorem' => 'ipsum'], $foo->barConfig );
40+
Assert::same(['lorem' => 'ipsum'], $foo->barConfig);

0 commit comments

Comments
 (0)