Skip to content

Commit f8070dc

Browse files
authored
Merge pull request #13 from php-etl/feature/qualityflow-improvments
fix php error
2 parents 0f63e05 + a9c82d1 commit f8070dc

File tree

6 files changed

+31
-21
lines changed

6 files changed

+31
-21
lines changed

src/Builder/ConditionalLoader.php

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,9 @@ public function addAlternative(Node\Expr $condition, AlternativeLoader $lookup):
5252
return $this;
5353
}
5454

55-
/**
56-
* @return array<int, Node>
57-
*/
58-
private function compileAlternative(AlternativeLoader $loader): array
55+
private function compileAlternative(AlternativeLoader $loader): Node
5956
{
60-
return [
61-
$loader->getNode(),
62-
];
57+
return $loader->getNode();
6358
}
6459

6560
public function withBeforeQuery(InitializerQueries $query): self
@@ -117,13 +112,13 @@ class: new Node\Name\FullyQualified(\Kiboko\Component\Flow\SQL\ConditionalLoader
117112
cond: $condition,
118113
subNodes: [
119114
'stmts' => [
120-
...$this->compileAlternative($alternative),
115+
$this->compileAlternative($alternative),
121116
],
122117
'elseifs' => array_map(
123118
fn (Node\Expr $condition, AlternativeLoader $loader) => new Node\Stmt\ElseIf_(
124119
cond: $condition,
125120
stmts: [
126-
...$this->compileAlternative($loader),
121+
$this->compileAlternative($loader),
127122
],
128123
),
129124
array_column($alternatives, 0),

src/Builder/ConditionalLookup.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
namespace Kiboko\Plugin\SQL\Builder;
66

77
use Kiboko\Contract\Configurator\StepBuilderInterface;
8+
use Kiboko\Contract\Mapping\CompiledMapperInterface;
89
use PhpParser\Node;
10+
use Psr\Log\LoggerInterface;
11+
use Psr\Log\NullLogger;
912

1013
final class ConditionalLookup implements StepBuilderInterface
1114
{
@@ -154,7 +157,7 @@ class: new Node\Stmt\Class_(
154157
name: null,
155158
subNodes: [
156159
'implements' => [
157-
new Node\Name\FullyQualified(\Kiboko\Contract\Mapping\CompiledMapperInterface::class),
160+
new Node\Name\FullyQualified(CompiledMapperInterface::class),
158161
],
159162
'stmts' => [
160163
new Node\Stmt\ClassMethod(
@@ -171,7 +174,7 @@ class: new Node\Stmt\Class_(
171174
expr: new Node\Expr\BinaryOp\Coalesce(
172175
left: new Node\Expr\Variable('logger'),
173176
right: new Node\Expr\New_(
174-
class: new Node\Name\FullyQualified(\Psr\Log\NullLogger::class)
177+
class: new Node\Name\FullyQualified(NullLogger::class)
175178
)
176179
)
177180
)
@@ -185,7 +188,7 @@ class: new Node\Name\FullyQualified(\Psr\Log\NullLogger::class)
185188
default: new Node\Expr\ConstFetch(
186189
name: new Node\Name(name: 'null'),
187190
),
188-
type: new Node\Name\FullyQualified(\Psr\Log\LoggerInterface::class)
191+
type: new Node\Name\FullyQualified(LoggerInterface::class)
189192
),
190193
],
191194
],
@@ -231,7 +234,7 @@ class: new Node\Name\FullyQualified(\Psr\Log\NullLogger::class)
231234
new Node\Arg(
232235
value: $this->compileAfterQueries()
233236
),
234-
new Node\Arg(value: $this->logger ?? new Node\Expr\New_(new Node\Name\FullyQualified(\Psr\Log\NullLogger::class))),
237+
new Node\Arg(value: $this->logger ?? new Node\Expr\New_(new Node\Name\FullyQualified(NullLogger::class))),
235238
],
236239
);
237240
}

src/Builder/Connection.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@ final class Connection implements ConnectionBuilderInterface
1010
{
1111
private ?bool $persistentConnection = null;
1212

13-
public function __construct(private readonly Node\Expr $dsn, private ?Node\Expr $username = null, private ?Node\Expr $password = null, private readonly string $generatedNamespace = 'GyroscopsGenerated')
14-
{
13+
public function __construct(
14+
private readonly Node\Expr $dsn,
15+
private ?Node\Expr $username = null,
16+
private ?Node\Expr $password = null,
17+
private readonly string $generatedNamespace = 'GyroscopsGenerated'
18+
) {
1519
}
1620

1721
public function withUsername(Node\Expr $username): self

src/Builder/Loader.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ final class Loader implements StepBuilderInterface
1616
private array $afterQueries = [];
1717
private array $parameters = [];
1818

19-
public function __construct(private readonly Node\Expr $query, private null|Node\Expr|ConnectionBuilderInterface $connection = null)
20-
{
19+
public function __construct(
20+
private readonly Node\Expr $query,
21+
private null|Node\Expr|ConnectionBuilderInterface $connection = null
22+
) {
2123
}
2224

2325
public function withLogger(Node\Expr $logger): StepBuilderInterface

src/Builder/Lookup.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ final class Lookup implements StepBuilderInterface
1515
/** @var array<int, InitializerQueries> */
1616
private array $afterQueries = [];
1717

18-
public function __construct(private readonly AlternativeLookup $alternative, private null|Node\Expr|ConnectionBuilderInterface $connection = null)
19-
{
18+
public function __construct(
19+
private readonly AlternativeLookup $alternative,
20+
private null|Node\Expr|ConnectionBuilderInterface $connection = null
21+
) {
2022
}
2123

2224
public function withLogger(Node\Expr $logger): StepBuilderInterface

src/Builder/SharedConnection.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@ final class SharedConnection implements ConnectionBuilderInterface
1010
{
1111
private ?bool $persistentConnection = null;
1212

13-
public function __construct(private readonly Node\Expr $dsn, private ?Node\Expr $username = null, private ?Node\Expr $password = null, private readonly string $generatedNamespace = 'GyroscopsGenerated')
14-
{
13+
public function __construct(
14+
private readonly Node\Expr $dsn,
15+
private ?Node\Expr $username = null,
16+
private ?Node\Expr $password = null,
17+
private readonly string $generatedNamespace = 'GyroscopsGenerated'
18+
) {
1519
}
1620

1721
public function withUsername(Node\Expr $username): self

0 commit comments

Comments
 (0)