Skip to content
/ boot Public

Commit c005508

Browse files
committed
Merge pull request #1208: Apply risky Code Style rules
1 parent fdacb1c commit c005508

File tree

8 files changed

+23
-23
lines changed

8 files changed

+23
-23
lines changed

src/helpers.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
use Spiral\Core\ContainerScope;
1010
use Spiral\Core\Exception\ScopeException;
1111

12-
if (!function_exists('spiral')) {
12+
if (!\function_exists('spiral')) {
1313
/**
1414
* Resolve given alias in current IoC scope.
1515
*
@@ -34,7 +34,7 @@ function spiral(string $alias): mixed
3434
}
3535
}
3636

37-
if (!function_exists('directory')) {
37+
if (!\function_exists('directory')) {
3838
/**
3939
* Get directory alias value. Uses application core from the current global scope.
4040
*
@@ -49,7 +49,7 @@ function directory(string $alias): string
4949
}
5050
}
5151

52-
if (!function_exists('env')) {
52+
if (!\function_exists('env')) {
5353
/**
5454
* Gets the value of an environment variable. Uses application core from the current global scope.
5555
*

tests/DirectoriesTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public function testGetException(): void
9393

9494
private function assertDir($path, $value): void
9595
{
96-
$path = str_replace(['\\', '//'], '/', $path);
97-
self::assertSame(rtrim($path, '/') . '/', $value);
96+
$path = \str_replace(['\\', '//'], '/', $path);
97+
self::assertSame(\rtrim($path, '/') . '/', $value);
9898
}
9999
}

tests/FinalizerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public function testFinalize(): void
1414
$f = new Finalizer();
1515

1616
$value = 1;
17-
$f->addFinalizer(function () use (&$value): void {
17+
$f->addFinalizer(static function () use (&$value): void {
1818
$value = 2;
1919
});
2020

tests/Fixtures/BrokenCore.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ protected function mapDirectories(array $directories): array
2727
$directories['app'] = $directories['root'] . '/app/';
2828
}
2929

30-
return array_merge([
30+
return \array_merge([
3131
// public root
3232
'public' => $directories['root'] . '/public/',
3333

tests/Fixtures/ConfigBootloader.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,22 @@ class ConfigBootloader extends Bootloader
1818

1919
public function init(Container $container, AbstractKernel $kernel): void
2020
{
21-
$kernel->booting(static function (AbstractKernel $kernel) use ($container) {
21+
$kernel->booting(static function (AbstractKernel $kernel) use ($container): void {
2222
$container->bind('hij', 'foo');
2323

24-
$kernel->booting(static function () use ($container) {
24+
$kernel->booting(static function () use ($container): void {
2525
$container->bind('ijk', 'foo');
2626
});
2727
});
2828

29-
$kernel->booted(function (AbstractKernel $kernel) use ($container) {
29+
$kernel->booted(static function (AbstractKernel $kernel) use ($container): void {
3030
$container->bind('jkl', 'foo');
3131

32-
$kernel->booting(function () use ($container) {
32+
$kernel->booting(static function () use ($container): void {
3333
$container->bind('klm', 'foo');
3434
});
3535

36-
$kernel->booted(function () use ($container) {
36+
$kernel->booted(static function () use ($container): void {
3737
$container->bind('lmn', 'foo');
3838
});
3939
});
@@ -44,11 +44,11 @@ public function init(Container $container, AbstractKernel $kernel): void
4444
public function boot(ConfigurationBootloader $configuration, AbstractKernel $kernel, Container $container): void
4545
{
4646
// won't be executed
47-
$kernel->booting(function (AbstractKernel $kernel) use ($container) {
47+
$kernel->booting(static function (AbstractKernel $kernel) use ($container): void {
4848
$container->bind('ghi', 'foo');
4949
});
5050

51-
$kernel->booted(function (AbstractKernel $kernel) use ($container) {
51+
$kernel->booted(static function (AbstractKernel $kernel) use ($container): void {
5252
$container->bind('mno', 'foo');
5353
});
5454

tests/Fixtures/TestCore.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ protected function mapDirectories(array $directories): array
4646
$directories['app'] = $directories['root'] . '/app/';
4747
}
4848

49-
return array_merge([
49+
return \array_merge([
5050
// public root
5151
'public' => $directories['root'] . '/public/',
5252

tests/FunctionsTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function testSpiral(): void
2424
/** @var ContainerInterface $c */
2525
$c = $core->getContainer();
2626

27-
ContainerScope::runScope($c, function (): void {
27+
ContainerScope::runScope($c, static function (): void {
2828
self::assertSame(['key' => 'value'], spiral(TestConfig::class)->toArray());
2929
});
3030
}
@@ -41,7 +41,7 @@ public function testEnv(): void
4141
/** @var ContainerInterface $c */
4242
$c = $core->getContainer();
4343

44-
ContainerScope::runScope($c, function (): void {
44+
ContainerScope::runScope($c, static function (): void {
4545
self::assertTrue(env('key'));
4646
});
4747
}
@@ -80,7 +80,7 @@ public function testSpiralException2(): void
8080
/** @var ContainerInterface $c */
8181
$c = $core->getContainer();
8282

83-
ContainerScope::runScope($c, function (): void {
83+
ContainerScope::runScope($c, static function (): void {
8484
spiral(Invalid::class);
8585
});
8686
}
@@ -101,7 +101,7 @@ public function testDirectoryException(): void
101101

102102
private function assertDir($path, $value): void
103103
{
104-
$path = str_replace(['\\', '//'], '/', $path);
105-
self::assertSame(rtrim($path, '/') . '/', $value);
104+
$path = \str_replace(['\\', '//'], '/', $path);
105+
self::assertSame(\rtrim($path, '/') . '/', $value);
106106
}
107107
}

tests/MemoryTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function testMemory(): void
2424
self::assertFileExists(__DIR__ . '/cache/test.php');
2525
self::assertSame('data', $memory->loadData('test'));
2626

27-
unlink(__DIR__ . '/cache/test.php');
27+
\unlink(__DIR__ . '/cache/test.php');
2828
self::assertNull($memory->loadData('test'));
2929
}
3030

@@ -38,10 +38,10 @@ public function testBroken(): void
3838
/** @var MemoryInterface $memory */
3939
$memory = $core->getContainer()->get(MemoryInterface::class);
4040

41-
file_put_contents(__DIR__ . '/cache/test.php', '<?php broken');
41+
\file_put_contents(__DIR__ . '/cache/test.php', '<?php broken');
4242
self::assertNull($memory->loadData('test'));
4343

44-
unlink(__DIR__ . '/cache/test.php');
44+
\unlink(__DIR__ . '/cache/test.php');
4545
self::assertNull($memory->loadData('test'));
4646
}
4747
}

0 commit comments

Comments
 (0)