Skip to content

Commit 37c5a71

Browse files
committed
Ran php-cs-fixer
1 parent 3dac288 commit 37c5a71

30 files changed

+186
-215
lines changed

src/CompiledMapper.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
namespace Kiboko\Component\FastMap;
46

@@ -16,14 +18,14 @@ final class CompiledMapper implements MapperInterface
1618
public function __construct(
1719
private Compiler $compiler,
1820
private CompilationContextInterface $compilationContext,
19-
MapperInterface... $mappers
21+
MapperInterface ...$mappers
2022
) {
2123
$this->mappers = $mappers;
2224
}
2325

2426
public function __invoke($input, $output, PropertyPathInterface $outputPath)
2527
{
26-
if ($this->compiledMapper === null) {
28+
if (null === $this->compiledMapper) {
2729
$this->compiledMapper = $this->compiler->compile(
2830
$this->compilationContext,
2931
...$this->mappers

src/Compiler/Builder/ArrayInitialisationPreconditionBuilder.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
namespace Kiboko\Component\FastMap\Compiler\Builder;
46

@@ -26,10 +28,10 @@ public function getNode(): Node
2628
new Node\Expr\Assign(
2729
$this->pathNode,
2830
new Node\Expr\Array_([], [
29-
'kind' => Node\Expr\Array_::KIND_SHORT
31+
'kind' => Node\Expr\Array_::KIND_SHORT,
3032
])
3133
)
32-
)
34+
),
3335
],
3436
]
3537
);

src/Compiler/Builder/CompositeInitialisationPreconditionBuilder.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
namespace Kiboko\Component\FastMap\Compiler\Builder;
46

@@ -27,7 +29,7 @@ public function getNode(): Node
2729
if ($iterator->isIndex()) {
2830
$pathNode = new Node\Expr\ArrayDimFetch(
2931
$pathNode,
30-
is_int($item) ? new Node\Scalar\LNumber($item) : new Node\Scalar\String_($item)
32+
\is_int($item) ? new Node\Scalar\LNumber($item) : new Node\Scalar\String_($item)
3133
);
3234

3335
continue;
@@ -36,7 +38,7 @@ public function getNode(): Node
3638
if ($iterator->isProperty()) {
3739
$pathNode = new Node\Expr\PropertyFetch(
3840
$pathNode,
39-
is_int($item) ? new Node\Scalar\LNumber($item) : new Node\Name($item)
41+
\is_int($item) ? new Node\Scalar\LNumber($item) : new Node\Name($item)
4042
);
4143

4244
continue;
@@ -55,10 +57,10 @@ public function getNode(): Node
5557
new Node\Expr\Assign(
5658
$this->pathNode,
5759
new Node\Expr\Array_([], [
58-
'kind' => Node\Expr\Array_::KIND_SHORT
60+
'kind' => Node\Expr\Array_::KIND_SHORT,
5961
])
6062
)
61-
)
63+
),
6264
],
6365
]
6466
);
@@ -67,13 +69,13 @@ public function getNode(): Node
6769
private function propertyFetch(
6870
PropertyPathIteratorInterface $iterator,
6971
Node\Expr $pathNode
70-
) {
72+
): void {
7173
while ($iterator->valid() && $iterator->isProperty()) {
7274
$item = $iterator->current();
7375

7476
$pathNode = new Node\Expr\PropertyFetch(
7577
$pathNode,
76-
is_int($item) ? new Node\Scalar\LNumber($item) : new Node\Name($item)
78+
\is_int($item) ? new Node\Scalar\LNumber($item) : new Node\Name($item)
7779
);
7880

7981
$iterator->next();

src/Compiler/Builder/ConstantValueBuilder.php

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
namespace Kiboko\Component\FastMap\Compiler\Builder;
46

@@ -18,25 +20,20 @@ public function getNode(): Node
1820

1921
private function asNode($value)
2022
{
21-
if (is_string($this->value)) {
23+
if (\is_string($this->value)) {
2224
return new Node\Scalar\String_($value);
2325
}
24-
if (is_integer($this->value)) {
26+
if (\is_int($this->value)) {
2527
return new Node\Scalar\LNumber($value);
2628
}
27-
if (is_double($this->value)) {
29+
if (\is_float($this->value)) {
2830
return new Node\Scalar\DNumber($value);
2931
}
30-
if (is_array($this->value)) {
32+
if (\is_array($this->value)) {
3133
return new Node\Expr\Array_(iterator_to_array($this->asArrayItemNodes($value)));
3234
}
3335

34-
throw new \RuntimeException(strtr(
35-
'Could not handle static value of type %type%, only string, double, integer and array are supported.',
36-
[
37-
'%type%' => is_object($value) ? get_class($value) : gettype($value),
38-
]
39-
));
36+
throw new \RuntimeException(strtr('Could not handle static value of type %type%, only string, double, integer and array are supported.', ['%type%' => \is_object($value) ? $value::class : \gettype($value)]));
4037
}
4138

4239
private function asArrayItemNodes(array $value): \Iterator

src/Compiler/Builder/ExpressionLanguageToPhpParserBuilder.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
namespace Kiboko\Component\FastMap\Compiler\Builder;
46

@@ -27,7 +29,8 @@ public function getNode(): Node\Expr
2729

2830
$inputNodes = (new ParserFactory())
2931
->create(ParserFactory::PREFER_PHP7, null)
30-
->parse('<?php ' . $this->interpreter->compile($expression, array_merge($this->variables, ['input', 'output'])) . ';');
32+
->parse('<?php '.$this->interpreter->compile($expression, array_merge($this->variables, ['input', 'output'])).';')
33+
;
3134

3235
return $inputNodes[0]->expr;
3336
}

src/Compiler/Builder/ObjectInitialisationPreconditionBuilder.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
namespace Kiboko\Component\FastMap\Compiler\Builder;
46

@@ -31,7 +33,7 @@ public function getNode(): Node
3133
new Node\Name($this->metadata->getName())
3234
)
3335
)
34-
)
36+
),
3537
],
3638
]
3739
);

src/Compiler/Builder/PropertyPathBuilder.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
namespace Kiboko\Component\FastMap\Compiler\Builder;
46

@@ -22,14 +24,14 @@ public function getNode(): Node\Expr
2224
$iterator = $this->propertyPath->getIterator();
2325
if ($this->limit < 0) {
2426
$iterator = new \LimitIterator($iterator, 0, iterator_count($iterator) + $this->limit);
25-
} elseif ($this->limit !== null) {
27+
} elseif (null !== $this->limit) {
2628
$iterator = new \LimitIterator($iterator, 0, $this->limit);
2729
}
2830

2931
try {
3032
foreach ($iterator as $index => $child) {
3133
if ($this->propertyPath->isIndex($index)) {
32-
if (is_int($child)) {
34+
if (\is_int($child)) {
3335
$pathNode = new Node\Expr\ArrayDimFetch(
3436
$pathNode,
3537
new Node\Scalar\LNumber($child)

src/Compiler/Builder/RequiredValuePreconditionBuilder.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
namespace Kiboko\Component\FastMap\Compiler\Builder;
46

@@ -19,7 +21,7 @@ public function getNode(): Node
1921
return new Node\Stmt\If_(
2022
new Node\Expr\BooleanNot(
2123
new Node\Expr\Isset_([
22-
(new PropertyPathBuilder($this->propertyPath, $this->pathNode))->getNode()
24+
(new PropertyPathBuilder($this->propertyPath, $this->pathNode))->getNode(),
2325
])
2426
),
2527
[
@@ -36,7 +38,7 @@ public function getNode(): Node
3638
),
3739
]),
3840
),
39-
]
41+
],
4042
]
4143
);
4244
}

src/Compiler/Builder/ScopedCodeBuilder.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
namespace Kiboko\Component\FastMap\Compiler\Builder;
46

@@ -29,17 +31,17 @@ public function getNode(): Node\Expr
2931
'params' => [
3032
new Node\Param(
3133
var: new Node\Expr\Variable('input'),
32-
)
34+
),
3335
],
3436
'stmts' => [
3537
...$this->stmts,
36-
new Node\Stmt\Return_(new Node\Expr\Variable('output'))
38+
new Node\Stmt\Return_(new Node\Expr\Variable('output')),
3739
],
3840
]),
3941
[
4042
new Node\Arg($this->input),
4143
]
42-
)
44+
),
4345
]
4446
);
4547
}

src/Compiler/Builder/SimpleObjectInitializerBuilder.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
namespace Kiboko\Component\FastMap\Compiler\Builder;
46

0 commit comments

Comments
 (0)