Skip to content

Commit ee059c9

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

File tree

8 files changed

+13
-13
lines changed

8 files changed

+13
-13
lines changed

src/Compiler/Renderer/CoreRenderer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function render(
2828
case $node instanceof Template || $node instanceof Block || $node instanceof Aggregate:
2929
$result->withinContext(
3030
$node->getContext(),
31-
function (Compiler\Result $source) use ($node, $compiler): void {
31+
static function (Compiler\Result $source) use ($node, $compiler): void {
3232
foreach ($node->nodes as $child) {
3333
$compiler->compile($child, $source);
3434
}
@@ -40,7 +40,7 @@ function (Compiler\Result $source) use ($node, $compiler): void {
4040
case $node instanceof Mixin:
4141
$result->withinContext(
4242
$node->getContext(),
43-
function (Compiler\Result $source) use ($node, $compiler): void {
43+
static function (Compiler\Result $source) use ($node, $compiler): void {
4444
foreach ($node->nodes as $child) {
4545
if (\is_string($child)) {
4646
$source->push($child, null);

src/Node/Aggregate.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public function accepts(string $name): ?string
7272
if (isset($conditions['prefix'])) {
7373
$conditions['prefix'] = \rtrim($conditions['prefix'], ' *');
7474
if (\str_starts_with($name, $conditions['prefix'])) {
75-
return substr($name, \strlen($conditions['prefix']));
75+
return \substr($name, \strlen($conditions['prefix']));
7676
}
7777

7878
return null;

src/Transform/Merge/Inject/PHPMixin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ private function parse(string $func): void
138138
if ($level === 0) {
139139
$this->blocks[$name] = [
140140
'start' => $start,
141-
'value' => trim($value),
141+
'value' => \trim($value),
142142
'end' => $position,
143143
];
144144

src/Traverser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ public function traverse(array $nodes, ?VisitorContext $context = null): array
130130

131131
default:
132132
throw new \LogicException(
133-
'leaveNode() returned invalid value of type ' . gettype($result),
133+
'leaveNode() returned invalid value of type ' . \gettype($result),
134134
);
135135
}
136136

tests/Grammar/BaseTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ protected function assertTokens(array $tokens, string $source): void
1616
{
1717
$parsed = $this->tokens($source);
1818

19-
if (count($tokens) !== count($parsed)) {
19+
if (\count($tokens) !== \count($parsed)) {
2020
$this->fail('Token count mismatch');
2121
}
2222

tests/Grammar/RawTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ protected function assertTokens(array $tokens, string $source): void
2626
{
2727
$parsed = $this->tokens($source);
2828

29-
if (count($tokens) !== count($parsed)) {
29+
if (\count($tokens) !== \count($parsed)) {
3030
$this->fail('Token count mismatch');
3131
}
3232

tests/SourcemapTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public function testSimpleLoad(): void
2020
{
2121
$res = $this->getBuilder($this->getFixtureLoader())->compile('bundle-import');
2222

23-
self::assertSame('<a href="abc">cde</a>', trim($res->getContent()));
23+
self::assertSame('<a href="abc">cde</a>', \trim($res->getContent()));
2424
}
2525

2626
public function testGetTemplates(): void
@@ -37,12 +37,12 @@ public function testPHPImportResult(): void
3737
{
3838
$res = $this->getBuilder($this->getFixtureLoader())->compile('import-php');
3939

40-
self::assertSame(preg_replace("/\s+/", '', '
40+
self::assertSame(\preg_replace("/\s+/", '', '
4141
<div>
4242
<?php foreach ([\'a\', \'b\', \'c\'] as $value): ?>
4343
<b><?php echo htmlspecialchars((string) ($value), ENT_QUOTES | ENT_SUBSTITUTE, \'utf-8\'); ?></b>
4444
<?php endforeach; ?>
45-
</div>'), preg_replace("/\s+/", '', $res->getContent()));
45+
</div>'), \preg_replace("/\s+/", '', $res->getContent()));
4646
}
4747

4848
public function testCompress(): void
@@ -51,7 +51,7 @@ public function testCompress(): void
5151

5252
$sm = $res->getSourceMap($this->getFixtureLoader());
5353

54-
$sm2 = unserialize(serialize($sm));
54+
$sm2 = \unserialize(\serialize($sm));
5555

5656
self::assertEquals($sm, $sm2);
5757
}

tests/Transform/DynamicToPHPTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,10 @@ protected function getVisitors(): array
9898

9999
private function eval(string $body): string
100100
{
101-
ob_start();
101+
\ob_start();
102102

103103
eval('?>' . $body);
104104

105-
return ob_get_clean();
105+
return \ob_get_clean();
106106
}
107107
}

0 commit comments

Comments
 (0)