Skip to content
This repository was archived by the owner on Dec 2, 2023. It is now read-only.

Commit b4c6fbd

Browse files
committed
Fix cs
1 parent 65a41df commit b4c6fbd

15 files changed

+130
-136
lines changed

AutoMapper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,4 @@ public function map($value, string $target, array $options = [])
6161

6262
return $mapper->map($value);
6363
}
64-
}
64+
}

Compiler/Access.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function getWriteExpression(Expr\Variable $output, Expr $value): Expr
4949
{
5050
if ($this->type === self::TYPE_METHOD || $this->type === self::TYPE_ADDER_AND_REMOVER) {
5151
return new Expr\MethodCall($output, $this->name, [
52-
new Arg($value)
52+
new Arg($value),
5353
]);
5454
}
5555

@@ -59,4 +59,4 @@ public function getWriteExpression(Expr\Variable $output, Expr $value): Expr
5959

6060
throw new \RuntimeException('Invalid accessor for read expression');
6161
}
62-
}
62+
}

Compiler/Accessor.php

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ public function getReadAccessor(string $class, string $property): Access
1111
$reflClass = new \ReflectionClass($class);
1212
$hasProperty = $reflClass->hasProperty($property);
1313
$camelProp = Inflector::camelize($property);
14-
$getter = 'get'.$camelProp;
14+
$getter = 'get' . $camelProp;
1515
$getsetter = lcfirst($camelProp); // jQuery style, e.g. read: last(), write: last($item)
16-
$isser = 'is'.$camelProp;
17-
$hasser = 'has'.$camelProp;
16+
$isser = 'is' . $camelProp;
17+
$hasser = 'has' . $camelProp;
1818
$accessRef = false;
1919

2020
if ($reflClass->hasMethod($getter) && $reflClass->getMethod($getter)->isPublic()) {
@@ -37,10 +37,10 @@ public function getReadAccessor(string $class, string $property): Access
3737
$accessName = $property;
3838
$accessRef = true;
3939
} else {
40-
$methods = array($getter, $getsetter, $isser, $hasser, '__get');
40+
$methods = [$getter, $getsetter, $isser, $hasser, '__get'];
4141

4242
throw new \RuntimeException(sprintf(
43-
'Neither the property "%s" nor one of the methods "%s()" '.
43+
'Neither the property "%s" nor one of the methods "%s()" ' .
4444
'exist and have public access in class "%s".',
4545
$property,
4646
implode('()", "', $methods),
@@ -72,7 +72,7 @@ public function getWriteAccessor(string $class, string $property, bool $isArray)
7272
}
7373

7474
if ($accessType === null) {
75-
$setter = 'set'.$camelized;
75+
$setter = 'set' . $camelized;
7676
$getsetter = lcfirst($camelized); // jQuery style, e.g. read: last(), write: last($item)
7777

7878
if ($this->isMethodAccessible($reflClass, $setter, 1)) {
@@ -89,19 +89,19 @@ public function getWriteAccessor(string $class, string $property, bool $isArray)
8989
$accessName = $property;
9090
} elseif (null !== $methods = $this->findAdderAndRemover($reflClass, $singulars)) {
9191
throw new \RuntimeException(sprintf(
92-
'The property "%s" in class "%s" can be defined with the methods "%s()" but '.
92+
'The property "%s" in class "%s" can be defined with the methods "%s()" but ' .
9393
'the new value must be an array or an instance of \Traversable, ',
9494
$property,
9595
$reflClass->name,
9696
implode('()", "', $methods)
9797
));
9898
} else {
9999
throw new \RuntimeException(sprintf(
100-
'Neither the property "%s" nor one of the methods %s"%s()", "%s()", '.
100+
'Neither the property "%s" nor one of the methods %s"%s()", "%s()", ' .
101101
'"__set()" or "__call()" exist and have public access in class "%s".',
102102
$property,
103103
implode('', array_map(function ($singular) {
104-
return '"add'.$singular.'()"/"remove'.$singular.'()", ';
104+
return '"add' . $singular . '()"/"remove' . $singular . '()", ';
105105
}, $singulars)),
106106
$setter,
107107
$getsetter,
@@ -113,7 +113,6 @@ public function getWriteAccessor(string $class, string $property, bool $isArray)
113113
return new Access($accessType, $accessName, false, $accessRemover);
114114
}
115115

116-
117116
/**
118117
* Searches for add and remove methods.
119118
*
@@ -125,14 +124,14 @@ public function getWriteAccessor(string $class, string $property, bool $isArray)
125124
private function findAdderAndRemover(\ReflectionClass $reflClass, array $singulars): ?array
126125
{
127126
foreach ($singulars as $singular) {
128-
$addMethod = 'add'.$singular;
129-
$removeMethod = 'remove'.$singular;
127+
$addMethod = 'add' . $singular;
128+
$removeMethod = 'remove' . $singular;
130129

131130
$addMethodFound = $this->isMethodAccessible($reflClass, $addMethod, 1);
132131
$removeMethodFound = $this->isMethodAccessible($reflClass, $removeMethod, 1);
133132

134133
if ($addMethodFound && $removeMethodFound) {
135-
return array($addMethod, $removeMethod);
134+
return [$addMethod, $removeMethod];
136135
}
137136
}
138137

@@ -156,4 +155,4 @@ private function isMethodAccessible(\ReflectionClass $class, string $methodName,
156155

157156
return false;
158157
}
159-
}
158+
}

Compiler/Compiler.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public function getMapping($source, $target, array $options = [])
7373
$sourceInput = new Expr\Variable($uniqueVariableScope->getUniqueName('value'));
7474
$result = new Expr\Variable($uniqueVariableScope->getUniqueName('result'));
7575
$statements = [
76-
new Expr\Assign($result, new Expr\New_(new Name($target)))
76+
new Expr\Assign($result, new Expr\New_(new Name($target))),
7777
];
7878

7979
foreach ($mapping as $propertyMapping) {
@@ -98,15 +98,15 @@ public function getMapping($source, $target, array $options = [])
9898
'flags' => Stmt\Class_::MODIFIER_PUBLIC,
9999
'params' => [
100100
new Param($sourceInput->name),
101-
new Param('options', new Expr\Array_(), 'array')
101+
new Param('options', new Expr\Array_(), 'array'),
102102
],
103103
'stmts' => $statements,
104104
]);
105105

106106
return new Stmt\Class_(new Name('Mapper'), [
107107
'flags' => Stmt\Class_::MODIFIER_FINAL,
108108
'extends' => new Name\FullyQualified(Mapper::class),
109-
'stmts' => [$method]
109+
'stmts' => [$method],
110110
]);
111111
}
112-
}
112+
}

Compiler/Transformer/ArrayTransformer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ public function transform(Expr $input, UniqueVariableScope $uniqueVariableScope)
3737

3838
return [$valuesVar, $statements];
3939
}
40-
}
40+
}

Compiler/Transformer/BuiltinTransformer.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,16 @@ class BuiltinTransformer implements TransformerInterface
1212

1313
public const CAST_MAPPING = [
1414
Type::BUILTIN_TYPE_BOOL => [
15-
1615
],
1716
Type::BUILTIN_TYPE_FLOAT => [
18-
1917
],
2018
Type::BUILTIN_TYPE_INT => [
21-
2219
],
2320
Type::BUILTIN_TYPE_ITERABLE => [
24-
2521
],
2622
Type::BUILTIN_TYPE_STRING => [
27-
2823
],
2924
self::BUILTIN_TYPE_MIXED => [
30-
3125
],
3226
Type::BUILTIN_TYPE_CALLABLE => [],
3327
Type::BUILTIN_TYPE_RESOURCE => [],
@@ -52,4 +46,4 @@ public function isArray(): bool
5246
{
5347
return false;
5448
}
55-
}
49+
}

Compiler/Transformer/MultipleTransformer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,4 @@ public function isArray(): bool
7171
{
7272
return false;
7373
}
74-
}
74+
}

Compiler/Transformer/ObjectTransformer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ public function transform(Expr $input, UniqueVariableScope $uniqueVariableScope)
2525
new Arg(new Expr\Variable('options')),
2626
]), []];
2727
}
28-
}
28+
}

Compiler/Transformer/TransformerFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
class TransformerFactory
88
{
99
private const BUILTIN = [
10-
Type::BUILTIN_TYPE_BOOL ,
10+
Type::BUILTIN_TYPE_BOOL,
1111
Type::BUILTIN_TYPE_CALLABLE,
1212
Type::BUILTIN_TYPE_FLOAT,
1313
Type::BUILTIN_TYPE_INT,
@@ -94,4 +94,4 @@ protected function getTargetType(Type $sourceType, array $targetTypes = []): ?Ty
9494

9595
return null;
9696
}
97-
}
97+
}

Compiler/Transformer/TransformerInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ interface TransformerInterface
1111
* @return Expr[]
1212
*/
1313
public function transform(Expr $input, UniqueVariableScope $uniqueVariableScope): array;
14-
}
14+
}

0 commit comments

Comments
 (0)