Skip to content

fix file expression language #159

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Action/Action.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function __invoke(array $config, ActionBuilder $action, RepositoryInterfa
$logger = $compiled->getBuilder()->getNode();
} else {
$logger = new Node\Expr\New_(
new Node\Name\FullyQualified('Psr\\Log\\NullLogger'),
new Node\Name\FullyQualified('Psr\Log\NullLogger'),
);
}

Expand All @@ -45,7 +45,7 @@ public function __invoke(array $config, ActionBuilder $action, RepositoryInterfa
$state = $compiled->getBuilder()->getNode();
} else {
$state = new Node\Expr\New_(
new Node\Name\FullyQualified('Kiboko\\Contract\\Action\\NullState'),
new Node\Name\FullyQualified('Kiboko\Contract\Action\NullState'),
);
}

Expand Down
4 changes: 2 additions & 2 deletions src/Action/ConfigurationApplier.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

final class ConfigurationApplier
{
private ?Satellite\Action\Action $action = null;
private ?Action $action = null;
private array $packages = [];

public function __construct(
Expand All @@ -22,7 +22,7 @@ public function __construct(

public function withAction(): self
{
$this->action = new Satellite\Action\Action($this->plugin, clone $this->interpreter);
$this->action = new Action($this->plugin, clone $this->interpreter);

return $this;
}
Expand Down
6 changes: 3 additions & 3 deletions src/Action/Custom/Factory/Action.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,18 @@ public function validate(array $config): bool
/**
* @throws Configurator\ConfigurationExceptionInterface
*/
public function compile(array $config): Custom\Factory\Repository\Action
public function compile(array $config): Repository\Action
{
$containerName = sprintf('ProjectServiceContainer%s', ByteString::fromRandom(8)->toString());

$builder = new Custom\Builder\Action(
compileValueWhenExpression($this->interpreter, $config['use']),
sprintf('GyroscopsGenerated\\%s', $containerName),
sprintf('GyroscopsGenerated\%s', $containerName),
);

$container = (new SatelliteDependencyInjection(...$this->providers))($config);

$repository = new Custom\Factory\Repository\Action($builder);
$repository = new Repository\Action($builder);

$dumper = new PhpDumper($container);
$repository->addFiles(
Expand Down
5 changes: 2 additions & 3 deletions src/Action/Custom/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace Kiboko\Component\Satellite\Action\Custom;

use Kiboko\Component\Satellite\Action\Custom;
use Kiboko\Component\Satellite\ExpressionLanguage as Satellite;
use Kiboko\Contract\Configurator;
use Symfony\Component\Config\Definition\Exception as Symfony;
Expand All @@ -26,7 +25,7 @@ public function __construct(
private ExpressionLanguage $interpreter = new Satellite\ExpressionLanguage()
) {
$this->processor = new Processor();
$this->configuration = new Custom\Configuration();
$this->configuration = new Configuration();
}

public function interpreter(): ExpressionLanguage
Expand Down Expand Up @@ -78,7 +77,7 @@ public function compile(array $config): Configurator\RepositoryInterface
}
}

$actionFactory = new Custom\Factory\Action($this->interpreter);
$actionFactory = new Factory\Action($this->interpreter);

return $actionFactory->compile($config);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Action/SFTP/Builder/Action.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function withState(Node\Expr $state): self
public function getNode(): Node
{
return new Node\Expr\New_(
class: new Node\Name\FullyQualified('Kiboko\\Component\\Action\\Flow\\SFTP\\UploadFile'),
class: new Node\Name\FullyQualified('Kiboko\Component\Action\Flow\SFTP\UploadFile'),
args: [
new Node\Arg(
value: $this->host,
Expand Down
2 changes: 1 addition & 1 deletion src/Adapter/ComposerFailureException.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

final class ComposerFailureException extends \RuntimeException
{
public function __construct(private readonly string $command = '', string $message = '', int $code = 0, \Throwable $previous = null)
public function __construct(private readonly string $command = '', string $message = '', int $code = 0, ?\Throwable $previous = null)
{
parent::__construct($message, $code, $previous);
}
Expand Down
10 changes: 5 additions & 5 deletions src/Adapter/Docker/SatelliteBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ final class SatelliteBuilder implements Configurator\SatelliteBuilderInterface
private iterable $command = [];
/** @var iterable<string> */
private iterable $tags = [];
private null|PackagingContract\AssetInterface|PackagingContract\FileInterface $composerJsonFile = null;
private null|PackagingContract\AssetInterface|PackagingContract\FileInterface $composerLockFile = null;
private PackagingContract\AssetInterface|PackagingContract\FileInterface|null $composerJsonFile = null;
private PackagingContract\AssetInterface|PackagingContract\FileInterface|null $composerLockFile = null;
/** @var iterable<array<string, string>> */
private iterable $paths = [];
/** @var \AppendIterator<string,PackagingContract\FileInterface, \Iterator<string,PackagingContract\FileInterface>> */
Expand Down Expand Up @@ -67,7 +67,7 @@ public function withComposerRequire(string ...$package): self

public function withComposerFile(
PackagingContract\AssetInterface|PackagingContract\FileInterface $composerJsonFile,
PackagingContract\AssetInterface|PackagingContract\FileInterface $composerLockFile = null
PackagingContract\AssetInterface|PackagingContract\FileInterface|null $composerLockFile = null
): self {
$this->composerJsonFile = $composerJsonFile;
$this->composerLockFile = $composerLockFile;
Expand All @@ -77,7 +77,7 @@ public function withComposerFile(

public function withFile(
PackagingContract\AssetInterface|PackagingContract\FileInterface $source,
string $destinationPath = null
?string $destinationPath = null
): self {
if (!$source instanceof PackagingContract\FileInterface) {
$source = new Packaging\VirtualFile($source);
Expand All @@ -92,7 +92,7 @@ public function withFile(
return $this;
}

public function withDirectory(PackagingContract\DirectoryInterface $source, string $destinationPath = null): self
public function withDirectory(PackagingContract\DirectoryInterface $source, ?string $destinationPath = null): self
{
$this->paths[] = [$source->getPath(), $destinationPath ?? $source->getPath()];

Expand Down
4 changes: 2 additions & 2 deletions src/Adapter/FactoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

trigger_deprecation('php-etl/satellite', '0.4', 'The "%s" interface is deprecated, use "%s" instead.', 'Kiboko\\Component\\Satellite\\Adapter\\FactoryInterface', Kiboko\Contract\Configurator\Adapter\FactoryInterface::class);
trigger_deprecation('php-etl/satellite', '0.4', 'The "%s" interface is deprecated, use "%s" instead.', 'Kiboko\Component\Satellite\Adapter\FactoryInterface', Kiboko\Contract\Configurator\Adapter\FactoryInterface::class);

/*
* @deprecated since Satellite 0.4, use Kiboko\Contract\Configurator\Adapter\FactoryInterface instead.
*/
class_alias(Kiboko\Contract\Configurator\Adapter\FactoryInterface::class, 'Kiboko\\Component\\Satellite\\Adapter\\FactoryInterface');
class_alias(Kiboko\Contract\Configurator\Adapter\FactoryInterface::class, 'Kiboko\Component\Satellite\Adapter\FactoryInterface');
10 changes: 5 additions & 5 deletions src/Adapter/Filesystem/SatelliteBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ final class SatelliteBuilder implements Configurator\SatelliteBuilderInterface
];
private array $authenticationTokens = [];
private array $repositories = [];
private null|PackagingContract\AssetInterface|PackagingContract\FileInterface $composerJsonFile = null;
private null|PackagingContract\AssetInterface|PackagingContract\FileInterface $composerLockFile = null;
private PackagingContract\AssetInterface|PackagingContract\FileInterface|null $composerJsonFile = null;
private PackagingContract\AssetInterface|PackagingContract\FileInterface|null $composerLockFile = null;
/** @var iterable<array<string, string>> */
private iterable $paths = [];
/** @var \AppendIterator<string,PackagingContract\FileInterface, \Iterator<string,PackagingContract\FileInterface>> */
Expand Down Expand Up @@ -55,7 +55,7 @@ public function withComposerRequire(string ...$package): self

public function withComposerFile(
PackagingContract\AssetInterface|PackagingContract\FileInterface $composerJsonFile,
PackagingContract\AssetInterface|PackagingContract\FileInterface $composerLockFile = null
PackagingContract\AssetInterface|PackagingContract\FileInterface|null $composerLockFile = null
): self {
$this->composerJsonFile = $composerJsonFile;
$this->composerLockFile = $composerLockFile;
Expand All @@ -65,7 +65,7 @@ public function withComposerFile(

public function withFile(
PackagingContract\AssetInterface|PackagingContract\FileInterface $source,
string $destinationPath = null
?string $destinationPath = null
): self {
if (!$source instanceof PackagingContract\FileInterface) {
$source = new Packaging\VirtualFile($source);
Expand All @@ -80,7 +80,7 @@ public function withFile(
return $this;
}

public function withDirectory(PackagingContract\DirectoryInterface $source, string $destinationPath = null): self
public function withDirectory(PackagingContract\DirectoryInterface $source, ?string $destinationPath = null): self
{
$this->paths[] = [$source->getPath(), $destinationPath ?? $source->getPath()];

Expand Down
10 changes: 5 additions & 5 deletions src/Adapter/Tar/SatelliteBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ final class SatelliteBuilder implements Configurator\SatelliteBuilderInterface
{
/** @var iterable<string> */
private iterable $composerRequire = [];
private null|PackagingContract\AssetInterface|PackagingContract\FileInterface $composerJsonFile = null;
private null|PackagingContract\AssetInterface|PackagingContract\FileInterface $composerLockFile = null;
private PackagingContract\AssetInterface|PackagingContract\FileInterface|null $composerJsonFile = null;
private PackagingContract\AssetInterface|PackagingContract\FileInterface|null $composerLockFile = null;
/** @var \AppendIterator<string,PackagingContract\FileInterface, \Iterator<string,PackagingContract\FileInterface>> */
private readonly iterable $files;
/** @var array<string, array<string, string>> */
Expand Down Expand Up @@ -48,7 +48,7 @@ public function withComposerRequire(string ...$package): self

public function withComposerFile(
PackagingContract\AssetInterface|PackagingContract\FileInterface $composerJsonFile,
PackagingContract\AssetInterface|PackagingContract\FileInterface $composerLockFile = null
PackagingContract\AssetInterface|PackagingContract\FileInterface|null $composerLockFile = null
): self {
$this->composerJsonFile = $composerJsonFile;
$this->composerLockFile = $composerLockFile;
Expand All @@ -58,7 +58,7 @@ public function withComposerFile(

public function withFile(
PackagingContract\AssetInterface|PackagingContract\FileInterface $source,
string $destinationPath = null
?string $destinationPath = null
): self {
if (!$source instanceof PackagingContract\FileInterface) {
$source = new Packaging\VirtualFile($source);
Expand All @@ -71,7 +71,7 @@ public function withFile(
return $this;
}

public function withDirectory(PackagingContract\DirectoryInterface $source, string $destinationPath = null): self
public function withDirectory(PackagingContract\DirectoryInterface $source, ?string $destinationPath = null): self
{
$this->files->append(new \RecursiveIteratorIterator($source, \RecursiveIteratorIterator::SELF_FIRST));

Expand Down
8 changes: 4 additions & 4 deletions src/Builder/API/APIRuntime.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ final class APIRuntime
public function getNode(): Node\Expr
{
return new Node\Expr\New_(
class: new Node\Name\FullyQualified('Kiboko\\Component\\Runtime\\API\\APIRuntime'),
class: new Node\Name\FullyQualified('Kiboko\Component\Runtime\API\APIRuntime'),
args: [
new Node\Arg(
value: new Node\Expr\New_(
class: new Node\Name\FullyQualified('Kiboko\\Component\\Pipeline\\Pipeline'),
class: new Node\Name\FullyQualified('Kiboko\Component\Pipeline\Pipeline'),
args: [
new Node\Arg(
value: new Node\Expr\New_(
class: new Node\Name\FullyQualified('Kiboko\\Component\\Pipeline\\PipelineRunner'),
class: new Node\Name\FullyQualified('Kiboko\Component\Pipeline\PipelineRunner'),
args: [
new Node\Arg(
value: new Node\Expr\New_(
class: new Node\Name\FullyQualified('Psr\\Log\\NullLogger')
class: new Node\Name\FullyQualified('Psr\Log\NullLogger')
)
),
]
Expand Down
2 changes: 1 addition & 1 deletion src/Builder/API/PipelineBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function getNode(): Node\Expr
'params' => [
new Node\Param(
var: new Node\Expr\Variable('runtime'),
type: new Node\Name\FullyQualified('Kiboko\\Component\\Runtime\\Hook\\HookRuntimeInterface'),
type: new Node\Name\FullyQualified('Kiboko\Component\Runtime\Hook\HookRuntimeInterface'),
),
],
'stmts' => [
Expand Down
8 changes: 4 additions & 4 deletions src/Builder/Hook/HookRuntime.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ final class HookRuntime
public function getNode(): Node\Expr
{
return new Node\Expr\New_(
class: new Node\Name\FullyQualified('Kiboko\\Component\\Runtime\\Hook\\HookRuntime'),
class: new Node\Name\FullyQualified('Kiboko\Component\Runtime\Hook\HookRuntime'),
args: [
new Node\Arg(
value: new Node\Expr\New_(
class: new Node\Name\FullyQualified('Kiboko\\Component\\Pipeline\\Pipeline'),
class: new Node\Name\FullyQualified('Kiboko\Component\Pipeline\Pipeline'),
args: [
new Node\Arg(
value: new Node\Expr\New_(
class: new Node\Name\FullyQualified('Kiboko\\Component\\Pipeline\\PipelineRunner'),
class: new Node\Name\FullyQualified('Kiboko\Component\Pipeline\PipelineRunner'),
args: [
new Node\Arg(
value: new Node\Expr\New_(
class: new Node\Name\FullyQualified('Psr\\Log\\NullLogger')
class: new Node\Name\FullyQualified('Psr\Log\NullLogger')
)
),
]
Expand Down
2 changes: 1 addition & 1 deletion src/Builder/Hook/PipelineBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function getNode(): Node\Expr
'params' => [
new Node\Param(
var: new Node\Expr\Variable('runtime'),
type: new Node\Name\FullyQualified('Kiboko\\Component\\Runtime\\Hook\\HookRuntimeInterface'),
type: new Node\Name\FullyQualified('Kiboko\Component\Runtime\Hook\HookRuntimeInterface'),
),
],
'stmts' => [
Expand Down
10 changes: 5 additions & 5 deletions src/Builder/Pipeline/ConsoleRuntime.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,24 @@ final class ConsoleRuntime implements Builder
public function getNode(): Node\Expr
{
return new Node\Expr\New_(
class: new Node\Name\FullyQualified('Kiboko\\Component\\Runtime\\Pipeline\\Console'),
class: new Node\Name\FullyQualified('Kiboko\Component\Runtime\Pipeline\Console'),
args: [
new Node\Arg(
value: new Node\Expr\New_(
class: new Node\Name\FullyQualified('Symfony\\Component\\Console\\Output\\ConsoleOutput'),
class: new Node\Name\FullyQualified('Symfony\Component\Console\Output\ConsoleOutput'),
)
),
new Node\Arg(
value: new Node\Expr\New_(
class: new Node\Name\FullyQualified('Kiboko\\Component\\Pipeline\\Pipeline'),
class: new Node\Name\FullyQualified('Kiboko\Component\Pipeline\Pipeline'),
args: [
new Node\Arg(
new Node\Expr\New_(
class: new Node\Name\FullyQualified('Kiboko\\Component\\Pipeline\\PipelineRunner'),
class: new Node\Name\FullyQualified('Kiboko\Component\Pipeline\PipelineRunner'),
args: [
new Node\Arg(
value: new Node\Expr\New_(
class: new Node\Name\FullyQualified('Psr\\Log\\NullLogger'),
class: new Node\Name\FullyQualified('Psr\Log\NullLogger'),
)
),
],
Expand Down
8 changes: 4 additions & 4 deletions src/Builder/Workflow.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function addPipeline(string $code, string $pipelineFilename): self
args: [
new Node\Arg(
new Node\Expr\StaticCall(
new Node\Name\FullyQualified('Kiboko\\Component\\Workflow\\JobCode'),
new Node\Name\FullyQualified('Kiboko\Component\Workflow\JobCode'),
new Node\Identifier('fromString'),
[
new Node\Arg(new Node\Scalar\String_($code)),
Expand All @@ -38,7 +38,7 @@ public function addPipeline(string $code, string $pipelineFilename): self
args: [
new Node\Arg(
new Node\Expr\StaticCall(
new Node\Name\FullyQualified('Kiboko\\Component\\Workflow\\JobCode'),
new Node\Name\FullyQualified('Kiboko\Component\Workflow\JobCode'),
new Node\Identifier('fromString'),
[
new Node\Arg(new Node\Scalar\String_($code)),
Expand Down Expand Up @@ -73,7 +73,7 @@ public function addAction(string $code, string $pipelineFilename): self
args: [
new Node\Arg(
new Node\Expr\StaticCall(
new Node\Name\FullyQualified('Kiboko\\Component\\Workflow\\JobCode'),
new Node\Name\FullyQualified('Kiboko\Component\Workflow\JobCode'),
new Node\Identifier('fromString'),
[
new Node\Arg(new Node\Scalar\String_($code)),
Expand All @@ -87,7 +87,7 @@ public function addAction(string $code, string $pipelineFilename): self
args: [
new Node\Arg(
new Node\Expr\StaticCall(
new Node\Name\FullyQualified('Kiboko\\Component\\Workflow\\JobCode'),
new Node\Name\FullyQualified('Kiboko\Component\Workflow\JobCode'),
new Node\Identifier('fromString'),
[
new Node\Arg(new Node\Scalar\String_($code)),
Expand Down
2 changes: 1 addition & 1 deletion src/Builder/Workflow/ActionBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function getNode(): Node\Expr
'params' => [
new Node\Param(
var: new Node\Expr\Variable('runtime'),
type: new Node\Name\FullyQualified('Kiboko\\Component\\Runtime\\Action\\ActionRuntimeInterface'),
type: new Node\Name\FullyQualified('Kiboko\Component\Runtime\Action\ActionRuntimeInterface'),
),
],
'stmts' => [
Expand Down
Loading