From c1718536fcd143d57a2084ffa26572a7d5d7936c Mon Sep 17 00:00:00 2001 From: Jonathan Date: Fri, 1 Dec 2023 15:45:42 +0100 Subject: [PATCH 1/7] add a '*' on the rabbitmq repository to force composer to search package with compatibility --- src/Feature/Rejection/Factory/Repository/RabbitMQRepository.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Feature/Rejection/Factory/Repository/RabbitMQRepository.php b/src/Feature/Rejection/Factory/Repository/RabbitMQRepository.php index c2027353..680d6194 100644 --- a/src/Feature/Rejection/Factory/Repository/RabbitMQRepository.php +++ b/src/Feature/Rejection/Factory/Repository/RabbitMQRepository.php @@ -15,7 +15,7 @@ public function __construct(private readonly Rejection\Builder\RabbitMQBuilder $ { $this->files = []; $this->packages = [ - 'php-etl/rabbitmq-flow', + 'php-etl/rabbitmq-flow:*', ]; } From 23bac271d7e5eb9849de9da932495284f9df324e Mon Sep 17 00:00:00 2001 From: Jonathan Date: Fri, 1 Dec 2023 15:54:52 +0100 Subject: [PATCH 2/7] Add a better fix than rector here. --- src/Adapter/Docker/Satellite.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Adapter/Docker/Satellite.php b/src/Adapter/Docker/Satellite.php index f551d427..a2e7bec4 100644 --- a/src/Adapter/Docker/Satellite.php +++ b/src/Adapter/Docker/Satellite.php @@ -73,7 +73,7 @@ public function build( $command = ['docker', 'build', '--rm', '-', ...iterator_to_array($iterator($this->imageTags))]; $process = new Process( - implode (' ', array_map(fn ($part) => escapeshellarg($part), $command)), + implode (' ', array_map(fn (string $part) => escapeshellarg($part), $command)), $this->workdir, ); From 7c6c206fe9b15f1acf4d5a0839c017665f320493 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Fri, 1 Dec 2023 15:59:12 +0100 Subject: [PATCH 3/7] cs-fixer + remove the PHP_CS_FIXER_IGNORE_ENV --- .github/workflows/quality.yaml | 2 +- src/Action/Custom/Factory/Action.php | 4 +- .../Factory/Repository/RepositoryTrait.php | 2 +- src/Action/Custom/Service.php | 4 +- src/Action/SFTP/Factory/Action.php | 6 +- .../SFTP/Factory/Repository/Repository.php | 2 +- src/Action/SFTP/Service.php | 4 +- src/Adapter/Composer.php | 9 +- src/Adapter/Docker/Satellite.php | 13 +- src/Adapter/Docker/SatelliteBuilder.php | 10 +- src/Adapter/Filesystem/Satellite.php | 4 +- src/Adapter/Filesystem/SatelliteBuilder.php | 10 +- src/Adapter/Tar/Satellite.php | 4 +- src/Adapter/Tar/SatelliteBuilder.php | 10 +- src/Builder/Action.php | 4 +- src/Builder/Pipeline.php | 24 +-- src/Builder/Repository/API.php | 2 +- src/Builder/Repository/Action.php | 2 +- src/Builder/Repository/Hook.php | 2 +- src/Builder/Repository/Pipeline.php | 2 +- src/Builder/Repository/Workflow.php | 2 +- src/Builder/Workflow.php | 3 +- src/Cloud/Console/Command/CreateCommand.php | 2 +- src/Cloud/Console/Command/RemoveCommand.php | 2 +- src/Cloud/Console/Command/UpdateCommand.php | 2 +- src/Console/Command/ApiRunCommand.php | 2 +- src/Console/Command/BuildCommand.php | 2 +- src/Console/Command/HookRunCommand.php | 2 +- src/Console/Command/PipelineRunCommand.php | 2 +- src/Console/Command/RunCommand.php | 153 +++++++++--------- src/Console/Command/ValidateCommand.php | 2 +- src/Console/Command/WorkflowRunCommand.php | 2 +- .../Builder/Monolog/ElasticSearchBuilder.php | 2 +- .../Logger/Factory/ElasticSearchFactory.php | 2 +- src/Feature/Logger/Factory/GelfFactory.php | 2 +- src/Feature/Logger/Factory/StreamFactory.php | 2 +- src/Feature/Logger/Factory/SyslogFactory.php | 2 +- src/Feature/Logger/RepositoryTrait.php | 2 +- src/Feature/Logger/Service.php | 4 +- .../Rejection/Factory/RabbitMQFactory.php | 2 +- src/Feature/Rejection/RepositoryTrait.php | 2 +- src/Feature/Rejection/Service.php | 4 +- src/Feature/State/RepositoryTrait.php | 2 +- src/Feature/State/Service.php | 2 +- src/Interpreter.php | 2 +- src/Pipeline/Extractor.php | 7 +- src/Pipeline/Loader.php | 7 +- src/Pipeline/Transformer.php | 7 +- src/Plugin/Batching/Repository.php | 6 +- src/Plugin/Batching/Service.php | 4 +- src/Plugin/Custom/Factory/Extractor.php | 4 +- src/Plugin/Custom/Factory/Loader.php | 4 +- .../Factory/Repository/RepositoryTrait.php | 2 +- src/Plugin/Custom/Factory/Transformer.php | 4 +- src/Plugin/Custom/Service.php | 4 +- src/Plugin/FTP/Factory/Loader.php | 6 +- .../FTP/Factory/Repository/Repository.php | 2 +- src/Plugin/FTP/Factory/Server.php | 6 +- src/Plugin/FTP/Service.php | 4 +- src/Plugin/Filtering/Factory/Drop.php | 4 +- src/Plugin/Filtering/Factory/Reject.php | 4 +- .../Factory/Repository/RepositoryTrait.php | 2 +- src/Plugin/Filtering/Service.php | 4 +- src/Plugin/SFTP/Factory/Extractor.php | 6 +- src/Plugin/SFTP/Factory/Loader.php | 6 +- .../SFTP/Factory/Repository/Repository.php | 2 +- src/Plugin/SFTP/Factory/Server.php | 6 +- src/Plugin/SFTP/Service.php | 4 +- src/Plugin/Stream/Repository.php | 6 +- src/Plugin/Stream/Service.php | 4 +- src/Service.php | 6 +- 71 files changed, 225 insertions(+), 222 deletions(-) diff --git a/.github/workflows/quality.yaml b/.github/workflows/quality.yaml index 81e014bd..75470482 100644 --- a/.github/workflows/quality.yaml +++ b/.github/workflows/quality.yaml @@ -14,7 +14,7 @@ jobs: run: | wget -q https://cs.symfony.com/download/php-cs-fixer-v3.phar -O php-cs-fixer chmod a+x php-cs-fixer - PHP_CS_FIXER_IGNORE_ENV=true ./php-cs-fixer fix src --dry-run + ./php-cs-fixer fix src --dry-run phpstan: runs-on: ubuntu-latest diff --git a/src/Action/Custom/Factory/Action.php b/src/Action/Custom/Factory/Action.php index 29279a9c..eb70c1ec 100644 --- a/src/Action/Custom/Factory/Action.php +++ b/src/Action/Custom/Factory/Action.php @@ -44,7 +44,7 @@ public function normalize(array $config): array { try { return $this->processor->processConfiguration($this->configuration, $config); - } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException $exception) { + } catch (Symfony\InvalidConfigurationException|Symfony\InvalidTypeException $exception) { throw new Configurator\InvalidConfigurationException($exception->getMessage(), 0, $exception); } } @@ -55,7 +55,7 @@ public function validate(array $config): bool $this->processor->processConfiguration($this->configuration, $config); return true; - } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException) { + } catch (Symfony\InvalidConfigurationException|Symfony\InvalidTypeException) { return false; } } diff --git a/src/Action/Custom/Factory/Repository/RepositoryTrait.php b/src/Action/Custom/Factory/Repository/RepositoryTrait.php index 200ef6c0..447d6fa4 100644 --- a/src/Action/Custom/Factory/Repository/RepositoryTrait.php +++ b/src/Action/Custom/Factory/Repository/RepositoryTrait.php @@ -14,7 +14,7 @@ trait RepositoryTrait /** @var string[] */ private array $packages; - public function addFiles(Packaging\FileInterface|Packaging\DirectoryInterface ...$files): Configurator\RepositoryInterface + public function addFiles(Packaging\DirectoryInterface|Packaging\FileInterface ...$files): Configurator\RepositoryInterface { array_push($this->files, ...$files); diff --git a/src/Action/Custom/Service.php b/src/Action/Custom/Service.php index be6c7550..4bd351ca 100644 --- a/src/Action/Custom/Service.php +++ b/src/Action/Custom/Service.php @@ -43,7 +43,7 @@ public function normalize(array $config): array { try { return $this->processor->processConfiguration($this->configuration, $config); - } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException $exception) { + } catch (Symfony\InvalidConfigurationException|Symfony\InvalidTypeException $exception) { throw new Configurator\InvalidConfigurationException($exception->getMessage(), 0, $exception); } } @@ -54,7 +54,7 @@ public function validate(array $config): bool $this->processor->processConfiguration($this->configuration, $config); return true; - } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException) { + } catch (Symfony\InvalidConfigurationException|Symfony\InvalidTypeException) { return false; } } diff --git a/src/Action/SFTP/Factory/Action.php b/src/Action/SFTP/Factory/Action.php index 03a51221..968853a7 100644 --- a/src/Action/SFTP/Factory/Action.php +++ b/src/Action/SFTP/Factory/Action.php @@ -39,7 +39,7 @@ public function normalize(array $config): array { try { return $this->processor->processConfiguration($this->configuration, $config); - } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException $exception) { + } catch (Symfony\InvalidConfigurationException|Symfony\InvalidTypeException $exception) { throw new Configurator\InvalidConfigurationException($exception->getMessage(), 0, $exception); } } @@ -50,7 +50,7 @@ public function validate(array $config): bool $this->normalize($config); return true; - } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException) { + } catch (Symfony\InvalidConfigurationException|Symfony\InvalidTypeException) { return false; } } @@ -68,7 +68,7 @@ public function compile(array $config): Repository try { return new Repository($builder); - } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException $exception) { + } catch (Symfony\InvalidConfigurationException|Symfony\InvalidTypeException $exception) { throw new Configurator\InvalidConfigurationException(message: $exception->getMessage(), previous: $exception); } } diff --git a/src/Action/SFTP/Factory/Repository/Repository.php b/src/Action/SFTP/Factory/Repository/Repository.php index 278c67dd..30614486 100644 --- a/src/Action/SFTP/Factory/Repository/Repository.php +++ b/src/Action/SFTP/Factory/Repository/Repository.php @@ -12,7 +12,7 @@ { public function __construct(private Builder\Action $builder) {} - public function addFiles(Packaging\FileInterface|Packaging\DirectoryInterface ...$files): self + public function addFiles(Packaging\DirectoryInterface|Packaging\FileInterface ...$files): self { return $this; } diff --git a/src/Action/SFTP/Service.php b/src/Action/SFTP/Service.php index 9255277d..53385fa1 100644 --- a/src/Action/SFTP/Service.php +++ b/src/Action/SFTP/Service.php @@ -45,7 +45,7 @@ public function normalize(array $config): array { try { return $this->processor->processConfiguration($this->configuration, $config); - } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException $exception) { + } catch (Symfony\InvalidConfigurationException|Symfony\InvalidTypeException $exception) { throw new Configurator\InvalidConfigurationException($exception->getMessage(), 0, $exception); } } @@ -56,7 +56,7 @@ public function validate(array $config): bool $this->processor->processConfiguration($this->configuration, $config); return true; - } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException) { + } catch (Symfony\InvalidConfigurationException|Symfony\InvalidTypeException) { return false; } } diff --git a/src/Adapter/Composer.php b/src/Adapter/Composer.php index 0760c803..611c5de7 100644 --- a/src/Adapter/Composer.php +++ b/src/Adapter/Composer.php @@ -8,6 +8,7 @@ use Psr\Log\LoggerInterface; use React\ChildProcess\Process; use React\Promise\Deferred; + use function React\Async\await; use function React\Promise\Timer\timeout; @@ -28,16 +29,16 @@ private function execute(Process $process, float $timeout = 300): void { $process->start(); - $process->stdout->on('data', function ($chunk) { + $process->stdout->on('data', function ($chunk): void { $this->logger->debug($chunk); }); - $process->stderr->on('data', function ($chunk) { + $process->stderr->on('data', function ($chunk): void { $this->logger->info($chunk); }); $deferred = new Deferred(); - $process->on('exit', function () use ($deferred) { + $process->on('exit', function () use ($deferred): void { $deferred->resolve(); }); @@ -53,7 +54,7 @@ private function execute(Process $process, float $timeout = 300): void private function command(string ...$command): void { $process = new Process( - implode (' ', array_map(fn ($part) => escapeshellarg($part), $command)), + implode(' ', array_map(fn ($part) => escapeshellarg($part), $command)), $this->workdir, ); diff --git a/src/Adapter/Docker/Satellite.php b/src/Adapter/Docker/Satellite.php index a2e7bec4..81524009 100644 --- a/src/Adapter/Docker/Satellite.php +++ b/src/Adapter/Docker/Satellite.php @@ -13,6 +13,7 @@ use React\ChildProcess\Process; use React\Promise\Deferred; use React\Stream\ReadableResourceStream; + use function React\Async\await; use function React\Promise\Timer\timeout; @@ -27,7 +28,7 @@ final class Satellite implements Configurator\SatelliteInterface public function __construct( private readonly Dockerfile\Dockerfile $dockerfile, private readonly string $workdir, - Packaging\FileInterface|Packaging\DirectoryInterface ...$files + Packaging\DirectoryInterface|Packaging\FileInterface ...$files ) { $this->files = $files; } @@ -39,7 +40,7 @@ public function addTags(string ...$imageTags): self return $this; } - public function withFile(Packaging\FileInterface|Packaging\DirectoryInterface ...$files): self + public function withFile(Packaging\DirectoryInterface|Packaging\FileInterface ...$files): self { array_push($this->files, ...$files); @@ -73,7 +74,7 @@ public function build( $command = ['docker', 'build', '--rm', '-', ...iterator_to_array($iterator($this->imageTags))]; $process = new Process( - implode (' ', array_map(fn (string $part) => escapeshellarg($part), $command)), + implode(' ', array_map(fn (string $part) => escapeshellarg($part), $command)), $this->workdir, ); @@ -95,16 +96,16 @@ private function execute( Process $process, float $timeout = 300 ): void { - $process->stdout->on('data', function ($chunk) use ($logger) { + $process->stdout->on('data', function ($chunk) use ($logger): void { $logger->debug($chunk); }); - $process->stderr->on('data', function ($chunk) use ($logger) { + $process->stderr->on('data', function ($chunk) use ($logger): void { $logger->info($chunk); }); $deferred = new Deferred(); - $process->on('exit', function () use ($deferred) { + $process->on('exit', function () use ($deferred): void { $deferred->resolve(); }); diff --git a/src/Adapter/Docker/SatelliteBuilder.php b/src/Adapter/Docker/SatelliteBuilder.php index a5b71496..1ad2594c 100644 --- a/src/Adapter/Docker/SatelliteBuilder.php +++ b/src/Adapter/Docker/SatelliteBuilder.php @@ -23,8 +23,8 @@ final class SatelliteBuilder implements Configurator\SatelliteBuilderInterface private iterable $command = []; /** @var iterable */ private iterable $tags = []; - private null|PackagingContract\FileInterface|PackagingContract\AssetInterface $composerJsonFile = null; - private null|PackagingContract\FileInterface|PackagingContract\AssetInterface $composerLockFile = null; + private null|PackagingContract\AssetInterface|PackagingContract\FileInterface $composerJsonFile = null; + private null|PackagingContract\AssetInterface|PackagingContract\FileInterface $composerLockFile = null; /** @var iterable> */ private iterable $paths = []; /** @var \AppendIterator> */ @@ -66,8 +66,8 @@ public function withComposerRequire(string ...$package): self } public function withComposerFile( - PackagingContract\FileInterface|PackagingContract\AssetInterface $composerJsonFile, - PackagingContract\FileInterface|PackagingContract\AssetInterface $composerLockFile = null + PackagingContract\AssetInterface|PackagingContract\FileInterface $composerJsonFile, + PackagingContract\AssetInterface|PackagingContract\FileInterface $composerLockFile = null ): self { $this->composerJsonFile = $composerJsonFile; $this->composerLockFile = $composerLockFile; @@ -76,7 +76,7 @@ public function withComposerFile( } public function withFile( - PackagingContract\FileInterface|PackagingContract\AssetInterface $source, + PackagingContract\AssetInterface|PackagingContract\FileInterface $source, string $destinationPath = null ): self { if (!$source instanceof PackagingContract\FileInterface) { diff --git a/src/Adapter/Filesystem/Satellite.php b/src/Adapter/Filesystem/Satellite.php index 092aaadb..d8edbc01 100644 --- a/src/Adapter/Filesystem/Satellite.php +++ b/src/Adapter/Filesystem/Satellite.php @@ -18,12 +18,12 @@ final class Satellite implements Configurator\SatelliteInterface public function __construct( private readonly string $workdir, private readonly Composer $composer, - Packaging\FileInterface|Packaging\DirectoryInterface ...$files + Packaging\DirectoryInterface|Packaging\FileInterface ...$files ) { $this->files = $files; } - public function withFile(Packaging\FileInterface|Packaging\DirectoryInterface ...$files): self + public function withFile(Packaging\DirectoryInterface|Packaging\FileInterface ...$files): self { array_push($this->files, ...$files); diff --git a/src/Adapter/Filesystem/SatelliteBuilder.php b/src/Adapter/Filesystem/SatelliteBuilder.php index a7ce0409..1a400c38 100644 --- a/src/Adapter/Filesystem/SatelliteBuilder.php +++ b/src/Adapter/Filesystem/SatelliteBuilder.php @@ -20,8 +20,8 @@ final class SatelliteBuilder implements Configurator\SatelliteBuilderInterface ]; private array $authenticationTokens = []; private array $repositories = []; - private null|PackagingContract\FileInterface|PackagingContract\AssetInterface $composerJsonFile = null; - private null|PackagingContract\FileInterface|PackagingContract\AssetInterface $composerLockFile = null; + private null|PackagingContract\AssetInterface|PackagingContract\FileInterface $composerJsonFile = null; + private null|PackagingContract\AssetInterface|PackagingContract\FileInterface $composerLockFile = null; /** @var iterable> */ private iterable $paths = []; /** @var \AppendIterator> */ @@ -54,8 +54,8 @@ public function withComposerRequire(string ...$package): self } public function withComposerFile( - PackagingContract\FileInterface|PackagingContract\AssetInterface $composerJsonFile, - PackagingContract\FileInterface|PackagingContract\AssetInterface $composerLockFile = null + PackagingContract\AssetInterface|PackagingContract\FileInterface $composerJsonFile, + PackagingContract\AssetInterface|PackagingContract\FileInterface $composerLockFile = null ): self { $this->composerJsonFile = $composerJsonFile; $this->composerLockFile = $composerLockFile; @@ -64,7 +64,7 @@ public function withComposerFile( } public function withFile( - PackagingContract\FileInterface|PackagingContract\AssetInterface $source, + PackagingContract\AssetInterface|PackagingContract\FileInterface $source, string $destinationPath = null ): self { if (!$source instanceof PackagingContract\FileInterface) { diff --git a/src/Adapter/Tar/Satellite.php b/src/Adapter/Tar/Satellite.php index e80c81b9..2eb47e88 100644 --- a/src/Adapter/Tar/Satellite.php +++ b/src/Adapter/Tar/Satellite.php @@ -19,7 +19,7 @@ final class Satellite implements Configurator\SatelliteInterface public function __construct( private readonly string $outputPath, - Packaging\FileInterface|Packaging\DirectoryInterface ...$files + Packaging\DirectoryInterface|Packaging\FileInterface ...$files ) { $this->files = $files; } @@ -31,7 +31,7 @@ public function addTags(string ...$imageTags): self return $this; } - public function withFile(Packaging\FileInterface|Packaging\DirectoryInterface ...$files): self + public function withFile(Packaging\DirectoryInterface|Packaging\FileInterface ...$files): self { array_push($this->files, ...$files); diff --git a/src/Adapter/Tar/SatelliteBuilder.php b/src/Adapter/Tar/SatelliteBuilder.php index c65ac1c7..68c89afd 100644 --- a/src/Adapter/Tar/SatelliteBuilder.php +++ b/src/Adapter/Tar/SatelliteBuilder.php @@ -13,8 +13,8 @@ final class SatelliteBuilder implements Configurator\SatelliteBuilderInterface { /** @var iterable */ private iterable $composerRequire = []; - private null|PackagingContract\FileInterface|PackagingContract\AssetInterface $composerJsonFile = null; - private null|PackagingContract\FileInterface|PackagingContract\AssetInterface $composerLockFile = null; + private null|PackagingContract\AssetInterface|PackagingContract\FileInterface $composerJsonFile = null; + private null|PackagingContract\AssetInterface|PackagingContract\FileInterface $composerLockFile = null; /** @var \AppendIterator> */ private readonly iterable $files; /** @var array> */ @@ -47,8 +47,8 @@ public function withComposerRequire(string ...$package): self } public function withComposerFile( - PackagingContract\FileInterface|PackagingContract\AssetInterface $composerJsonFile, - PackagingContract\FileInterface|PackagingContract\AssetInterface $composerLockFile = null + PackagingContract\AssetInterface|PackagingContract\FileInterface $composerJsonFile, + PackagingContract\AssetInterface|PackagingContract\FileInterface $composerLockFile = null ): self { $this->composerJsonFile = $composerJsonFile; $this->composerLockFile = $composerLockFile; @@ -57,7 +57,7 @@ public function withComposerFile( } public function withFile( - PackagingContract\FileInterface|PackagingContract\AssetInterface $source, + PackagingContract\AssetInterface|PackagingContract\FileInterface $source, string $destinationPath = null ): self { if (!$source instanceof PackagingContract\FileInterface) { diff --git a/src/Builder/Action.php b/src/Builder/Action.php index fea89225..3bcc2282 100644 --- a/src/Builder/Action.php +++ b/src/Builder/Action.php @@ -16,8 +16,8 @@ public function __construct( ) {} public function addAction( - Node\Expr|Builder $loader, - Node\Expr|Builder $state, + Builder|Node\Expr $loader, + Builder|Node\Expr $state, ): self { $this->action = new Node\Expr\MethodCall( var: $this->runtime, diff --git a/src/Builder/Pipeline.php b/src/Builder/Pipeline.php index bd36e5af..22a90add 100644 --- a/src/Builder/Pipeline.php +++ b/src/Builder/Pipeline.php @@ -16,10 +16,10 @@ public function __construct( ) {} public function addExtractor( - Node\Expr|Builder $code, - Node\Expr|Builder $extractor, - Node\Expr|Builder $rejection, - Node\Expr|Builder $state, + Builder|Node\Expr $code, + Builder|Node\Expr $extractor, + Builder|Node\Expr $rejection, + Builder|Node\Expr $state, ): self { $this->steps[] = fn (Node\Expr $runtime) => new Node\Expr\MethodCall( var: $runtime, @@ -36,10 +36,10 @@ public function addExtractor( } public function addTransformer( - Node\Expr|Builder $code, - Node\Expr|Builder $transformer, - Node\Expr|Builder $rejection, - Node\Expr|Builder $state, + Builder|Node\Expr $code, + Builder|Node\Expr $transformer, + Builder|Node\Expr $rejection, + Builder|Node\Expr $state, ): self { $this->steps[] = fn (Node\Expr $runtime) => new Node\Expr\MethodCall( var: $runtime, @@ -56,10 +56,10 @@ public function addTransformer( } public function addLoader( - Node\Expr|Builder $code, - Node\Expr|Builder $loader, - Node\Expr|Builder $rejection, - Node\Expr|Builder $state, + Builder|Node\Expr $code, + Builder|Node\Expr $loader, + Builder|Node\Expr $rejection, + Builder|Node\Expr $state, ): self { $this->steps[] = fn (Node\Expr $runtime) => new Node\Expr\MethodCall( var: $runtime, diff --git a/src/Builder/Repository/API.php b/src/Builder/Repository/API.php index 6f084207..ec96aca5 100644 --- a/src/Builder/Repository/API.php +++ b/src/Builder/Repository/API.php @@ -17,7 +17,7 @@ final class API implements Configurator\RepositoryInterface public function __construct(private readonly Satellite\Builder\API $builder) {} - public function addFiles(Packaging\FileInterface|Packaging\DirectoryInterface ...$files): Configurator\RepositoryInterface + public function addFiles(Packaging\DirectoryInterface|Packaging\FileInterface ...$files): Configurator\RepositoryInterface { array_push($this->files, ...$files); diff --git a/src/Builder/Repository/Action.php b/src/Builder/Repository/Action.php index 807566ea..be8a0e73 100644 --- a/src/Builder/Repository/Action.php +++ b/src/Builder/Repository/Action.php @@ -17,7 +17,7 @@ final class Action implements Configurator\RepositoryInterface public function __construct(private readonly Satellite\Builder\Action $builder) {} - public function addFiles(Packaging\FileInterface|Packaging\DirectoryInterface ...$files): Configurator\RepositoryInterface + public function addFiles(Packaging\DirectoryInterface|Packaging\FileInterface ...$files): Configurator\RepositoryInterface { array_push($this->files, ...$files); diff --git a/src/Builder/Repository/Hook.php b/src/Builder/Repository/Hook.php index 849f88a6..d7d56b3a 100644 --- a/src/Builder/Repository/Hook.php +++ b/src/Builder/Repository/Hook.php @@ -17,7 +17,7 @@ final class Hook implements Configurator\RepositoryInterface public function __construct(private readonly Satellite\Builder\Hook $builder) {} - public function addFiles(Packaging\FileInterface|Packaging\DirectoryInterface ...$files): Configurator\RepositoryInterface + public function addFiles(Packaging\DirectoryInterface|Packaging\FileInterface ...$files): Configurator\RepositoryInterface { array_push($this->files, ...$files); diff --git a/src/Builder/Repository/Pipeline.php b/src/Builder/Repository/Pipeline.php index ac171e2d..2d82a798 100644 --- a/src/Builder/Repository/Pipeline.php +++ b/src/Builder/Repository/Pipeline.php @@ -17,7 +17,7 @@ final class Pipeline implements Configurator\RepositoryInterface public function __construct(private readonly Satellite\Builder\Pipeline $builder) {} - public function addFiles(Packaging\FileInterface|Packaging\DirectoryInterface ...$files): Configurator\RepositoryInterface + public function addFiles(Packaging\DirectoryInterface|Packaging\FileInterface ...$files): Configurator\RepositoryInterface { array_push($this->files, ...$files); diff --git a/src/Builder/Repository/Workflow.php b/src/Builder/Repository/Workflow.php index 23aac5b6..f4516fe6 100644 --- a/src/Builder/Repository/Workflow.php +++ b/src/Builder/Repository/Workflow.php @@ -17,7 +17,7 @@ final class Workflow implements Configurator\RepositoryInterface public function __construct(private readonly Satellite\Builder\Workflow $builder) {} - public function addFiles(Packaging\FileInterface|Packaging\DirectoryInterface ...$files): Configurator\RepositoryInterface + public function addFiles(Packaging\DirectoryInterface|Packaging\FileInterface ...$files): Configurator\RepositoryInterface { array_push($this->files, ...$files); diff --git a/src/Builder/Workflow.php b/src/Builder/Workflow.php index cf03177d..a815d2ef 100644 --- a/src/Builder/Workflow.php +++ b/src/Builder/Workflow.php @@ -15,7 +15,8 @@ public function __construct( private readonly Node\Expr $runtime ) {} - public function addPipeline(string $code, string $pipelineFilename): self { + public function addPipeline(string $code, string $pipelineFilename): self + { $this->jobs[] = fn (Node\Expr $runtime) => new Node\Expr\MethodCall( var: $runtime, name: new Node\Identifier('job'), diff --git a/src/Cloud/Console/Command/CreateCommand.php b/src/Cloud/Console/Command/CreateCommand.php index 834c6ae9..c3446ba4 100644 --- a/src/Cloud/Console/Command/CreateCommand.php +++ b/src/Cloud/Console/Command/CreateCommand.php @@ -82,7 +82,7 @@ protected function execute(Console\Input\InputInterface $input, Console\Output\O try { $configuration = $service->normalize($configuration); - } catch (Config\Definition\Exception\InvalidTypeException|Config\Definition\Exception\InvalidConfigurationException $exception) { + } catch (Config\Definition\Exception\InvalidConfigurationException|Config\Definition\Exception\InvalidTypeException $exception) { $style->error($exception->getMessage()); return self::FAILURE; diff --git a/src/Cloud/Console/Command/RemoveCommand.php b/src/Cloud/Console/Command/RemoveCommand.php index 6608d1f8..f48e1ae7 100644 --- a/src/Cloud/Console/Command/RemoveCommand.php +++ b/src/Cloud/Console/Command/RemoveCommand.php @@ -82,7 +82,7 @@ protected function execute(Console\Input\InputInterface $input, Console\Output\O try { $configuration = $service->normalize($configuration); - } catch (Config\Definition\Exception\InvalidTypeException|Config\Definition\Exception\InvalidConfigurationException $exception) { + } catch (Config\Definition\Exception\InvalidConfigurationException|Config\Definition\Exception\InvalidTypeException $exception) { $style->error($exception->getMessage()); return self::FAILURE; diff --git a/src/Cloud/Console/Command/UpdateCommand.php b/src/Cloud/Console/Command/UpdateCommand.php index 4fcd5e77..7fb93962 100644 --- a/src/Cloud/Console/Command/UpdateCommand.php +++ b/src/Cloud/Console/Command/UpdateCommand.php @@ -82,7 +82,7 @@ protected function execute(Console\Input\InputInterface $input, Console\Output\O try { $configuration = $service->normalize($configuration); - } catch (Config\Definition\Exception\InvalidTypeException|Config\Definition\Exception\InvalidConfigurationException $exception) { + } catch (Config\Definition\Exception\InvalidConfigurationException|Config\Definition\Exception\InvalidTypeException $exception) { $style->error($exception->getMessage()); return self::FAILURE; diff --git a/src/Console/Command/ApiRunCommand.php b/src/Console/Command/ApiRunCommand.php index 459b71c2..72a4febf 100644 --- a/src/Console/Command/ApiRunCommand.php +++ b/src/Console/Command/ApiRunCommand.php @@ -25,7 +25,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $style->warning([ 'The command "run:hook is deprecated and will be removed in future releases.', - 'Please use the "run" command as a replacement.' + 'Please use the "run" command as a replacement.', ]); return parent::execute($input, $output); diff --git a/src/Console/Command/BuildCommand.php b/src/Console/Command/BuildCommand.php index 5e6ad29c..2d1487b9 100644 --- a/src/Console/Command/BuildCommand.php +++ b/src/Console/Command/BuildCommand.php @@ -67,7 +67,7 @@ protected function execute(Console\Input\InputInterface $input, Console\Output\O try { $configuration = $service->normalize($configuration); - } catch (Config\Definition\Exception\InvalidTypeException|Config\Definition\Exception\InvalidConfigurationException $exception) { + } catch (Config\Definition\Exception\InvalidConfigurationException|Config\Definition\Exception\InvalidTypeException $exception) { $style->error($exception->getMessage()); return 255; diff --git a/src/Console/Command/HookRunCommand.php b/src/Console/Command/HookRunCommand.php index 0def78ba..3a7033f3 100644 --- a/src/Console/Command/HookRunCommand.php +++ b/src/Console/Command/HookRunCommand.php @@ -25,7 +25,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $style->warning([ 'The command "run:hook is deprecated and will be removed in future releases.', - 'Please use the "run" command as a replacement.' + 'Please use the "run" command as a replacement.', ]); return parent::execute($input, $output); diff --git a/src/Console/Command/PipelineRunCommand.php b/src/Console/Command/PipelineRunCommand.php index 85925091..e41eff36 100644 --- a/src/Console/Command/PipelineRunCommand.php +++ b/src/Console/Command/PipelineRunCommand.php @@ -25,7 +25,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $style->warning([ 'The command "run:pipeline is deprecated and will be removed in future releases.', - 'Please use the "run" command as a replacement.' + 'Please use the "run" command as a replacement.', ]); return parent::execute($input, $output); diff --git a/src/Console/Command/RunCommand.php b/src/Console/Command/RunCommand.php index 1a5ac69a..ffaeca5f 100644 --- a/src/Console/Command/RunCommand.php +++ b/src/Console/Command/RunCommand.php @@ -10,6 +10,7 @@ use Symfony\Component\Console; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; + use function React\Async\await; #[Console\Attribute\AsCommand('run', 'Run a data flow satellite (pipeline or workflow).')] @@ -40,16 +41,17 @@ protected function execute(InputInterface $input, OutputInterface $output): int $style->writeln(sprintf('Running pipeline in %s', $input->getArgument('path'))); $process = $this->pipelineWorker($style, $cwd, $input->getArgument('path'), 'pipeline.php'); - } else if (file_exists('workflow.php')) { + } elseif (file_exists('workflow.php')) { $style->writeln(sprintf('Running workflow in %s', $input->getArgument('path'))); $process = $this->workflowWorker($style, $cwd, $input->getArgument('path'), 'workflow.php'); - } else if (file_exists('main.php')) { + } elseif (file_exists('main.php')) { $style->writeln(sprintf('Running API in %s', $input->getArgument('path'))); $process = $this->httpWorker($style, $cwd, $input->getArgument('path'), 'main.php'); } else { $style->error('The provided path does not contain either a workflow or a pipeline satellite, did you mean to run "run:api"?'); + return Console\Command\Command::FAILURE; } @@ -68,49 +70,49 @@ protected function execute(InputInterface $input, OutputInterface $output): int private function pipelineWorker(Console\Style\SymfonyStyle $style, string $cwd, string $path, string $entrypoint): Process { - $source =<<addClassMap([ - /* @phpstan-ignore-next-line */ - \ProjectServiceContainer::class => 'container.php', - ]); - \$autoload->register(); + $source = <<addClassMap([ + /* @phpstan-ignore-next-line */ + \\ProjectServiceContainer::class => 'container.php', + ]); + \$autoload->register(); - \$dotenv = new \Symfony\Component\Dotenv\Dotenv(); - \$dotenv->usePutenv(); - - if (file_exists(\$file = '{$cwd}/.env')) { - \$dotenv->loadEnv(\$file); - } - if (file_exists(\$file = '{$cwd}/{$path}/.env')) { - \$dotenv->loadEnv(\$file); - } + \$dotenv = new \\Symfony\\Component\\Dotenv\\Dotenv(); + \$dotenv->usePutenv(); + + if (file_exists(\$file = '{$cwd}/.env')) { + \$dotenv->loadEnv(\$file); + } + if (file_exists(\$file = '{$cwd}/{$path}/.env')) { + \$dotenv->loadEnv(\$file); + } - \$runtime = new \Kiboko\Component\Runtime\Pipeline\Console( - new \Symfony\Component\Console\Output\ConsoleOutput(), - new \Kiboko\Component\Pipeline\Pipeline( - new \Kiboko\Component\Pipeline\PipelineRunner( - new \Psr\Log\NullLogger() + \$runtime = new \\Kiboko\\Component\\Runtime\\Pipeline\\Console( + new \\Symfony\\Component\\Console\\Output\\ConsoleOutput(), + new \\Kiboko\\Component\\Pipeline\\Pipeline( + new \\Kiboko\\Component\\Pipeline\\PipelineRunner( + new \\Psr\\Log\\NullLogger() + ), + new \\Kiboko\\Contract\\Pipeline\\NullState(), ), - new \Kiboko\Contract\Pipeline\NullState(), - ), - ); + ); - \$satellite = include '{$cwd}/{$path}/$entrypoint'; + \$satellite = include '{$cwd}/{$path}/{$entrypoint}'; - \$satellite(\$runtime); - \$runtime->run(); + \$satellite(\$runtime); + \$runtime->run(); - \$autoload->unregister(); - PHP; + \$autoload->unregister(); + PHP; $stream = fopen('php://temp', 'r+'); fwrite($stream, $source); - fseek($stream, 0, SEEK_SET); + fseek($stream, 0, \SEEK_SET); $input = new ReadableResourceStream($stream); @@ -126,10 +128,10 @@ private function pipelineWorker(Console\Style\SymfonyStyle $style, string $cwd, $process->start(); - $process->stdout->on('data', function ($chunk) use ($style) { + $process->stdout->on('data', function ($chunk) use ($style): void { $style->text($chunk); }); - $process->stderr->on('data', function ($chunk) use ($style) { + $process->stderr->on('data', function ($chunk) use ($style): void { $style->info($chunk); }); @@ -140,46 +142,46 @@ private function pipelineWorker(Console\Style\SymfonyStyle $style, string $cwd, private function workflowWorker(Console\Style\SymfonyStyle $style, string $cwd, string $path, string $entrypoint): Process { - $source =<<addClassMap([ - /* @phpstan-ignore-next-line */ - \ProjectServiceContainer::class => 'container.php', - ]); - \$autoload->register(); + $source = <<addClassMap([ + /* @phpstan-ignore-next-line */ + \\ProjectServiceContainer::class => 'container.php', + ]); + \$autoload->register(); - \$dotenv = new \Symfony\Component\Dotenv\Dotenv(); - \$dotenv->usePutenv(); - - if (file_exists(\$file = '{$cwd}/.env')) { - \$dotenv->loadEnv(\$file); - } - if (file_exists(\$file = '{$cwd}/{$path}/.env')) { - \$dotenv->loadEnv(\$file); - } - - \$runtime = new \Kiboko\Component\Runtime\Workflow\Console( - new \Symfony\Component\Console\Output\ConsoleOutput(), - new \Kiboko\Component\Pipeline\PipelineRunner( - new \Psr\Log\NullLogger() - ), - ); + \$dotenv = new \\Symfony\\Component\\Dotenv\\Dotenv(); + \$dotenv->usePutenv(); + + if (file_exists(\$file = '{$cwd}/.env')) { + \$dotenv->loadEnv(\$file); + } + if (file_exists(\$file = '{$cwd}/{$path}/.env')) { + \$dotenv->loadEnv(\$file); + } + + \$runtime = new \\Kiboko\\Component\\Runtime\\Workflow\\Console( + new \\Symfony\\Component\\Console\\Output\\ConsoleOutput(), + new \\Kiboko\\Component\\Pipeline\\PipelineRunner( + new \\Psr\\Log\\NullLogger() + ), + ); - \$satellite = include '{$cwd}/{$path}/$entrypoint'; + \$satellite = include '{$cwd}/{$path}/{$entrypoint}'; - \$satellite(\$runtime); - \$runtime->run(); + \$satellite(\$runtime); + \$runtime->run(); - \$autoload->unregister(); - PHP; + \$autoload->unregister(); + PHP; $stream = fopen('php://temp', 'r+'); fwrite($stream, $source); - fseek($stream, 0, SEEK_SET); + fseek($stream, 0, \SEEK_SET); $input = new ReadableResourceStream($stream); @@ -195,10 +197,10 @@ private function workflowWorker(Console\Style\SymfonyStyle $style, string $cwd, $process->start(); - $process->stdout->on('data', function ($chunk) use ($style) { + $process->stdout->on('data', function ($chunk) use ($style): void { $style->text($chunk); }); - $process->stderr->on('data', function ($chunk) use ($style) { + $process->stderr->on('data', function ($chunk) use ($style): void { $style->info($chunk); }); @@ -213,7 +215,7 @@ private function httpWorker(Console\Style\SymfonyStyle $style, string $cwd, stri $command = ['php', '-S', 'localhost:8000', $entrypoint]; - $process = new Process(implode (' ', array_map(fn ($part) => escapeshellarg($part), $command)), $cwd.'/'.$path); + $process = new Process(implode(' ', array_map(fn ($part) => escapeshellarg($part), $command)), $cwd.'/'.$path); $process->start(); @@ -262,7 +264,7 @@ private function executeWorker( ): bool { $deferred = new Deferred(); - $process->on('exit', function () use ($deferred) { + $process->on('exit', function () use ($deferred): void { $deferred->resolve(); }); @@ -272,6 +274,7 @@ private function executeWorker( if (0 !== $process->getExitCode()) { $style->error(sprintf('Process exited unexpectedly with exit code %d', $process->getExitCode())); + return false; } diff --git a/src/Console/Command/ValidateCommand.php b/src/Console/Command/ValidateCommand.php index e342d78c..2ae8db02 100644 --- a/src/Console/Command/ValidateCommand.php +++ b/src/Console/Command/ValidateCommand.php @@ -66,7 +66,7 @@ protected function execute(Console\Input\InputInterface $input, Console\Output\O try { $configuration = $service->normalize($configuration); - } catch (Config\Definition\Exception\InvalidTypeException|Config\Definition\Exception\InvalidConfigurationException $exception) { + } catch (Config\Definition\Exception\InvalidConfigurationException|Config\Definition\Exception\InvalidTypeException $exception) { $style->error($exception->getMessage()); return 255; diff --git a/src/Console/Command/WorkflowRunCommand.php b/src/Console/Command/WorkflowRunCommand.php index 75cda29f..9b6d9720 100644 --- a/src/Console/Command/WorkflowRunCommand.php +++ b/src/Console/Command/WorkflowRunCommand.php @@ -25,7 +25,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $style->warning([ 'The command "run:pipeline is deprecated and will be removed in future releases.', - 'Please use the "run" command as a replacement.' + 'Please use the "run" command as a replacement.', ]); return parent::execute($input, $output); diff --git a/src/Feature/Logger/Builder/Monolog/ElasticSearchBuilder.php b/src/Feature/Logger/Builder/Monolog/ElasticSearchBuilder.php index 1bb4018a..be01985f 100644 --- a/src/Feature/Logger/Builder/Monolog/ElasticSearchBuilder.php +++ b/src/Feature/Logger/Builder/Monolog/ElasticSearchBuilder.php @@ -34,7 +34,7 @@ public function withIndex(string $index): self return $this; } - public function withHosts(string|array|Expression ...$hosts): self + public function withHosts(array|Expression|string ...$hosts): self { array_push($this->hosts, ...$hosts); diff --git a/src/Feature/Logger/Factory/ElasticSearchFactory.php b/src/Feature/Logger/Factory/ElasticSearchFactory.php index 366bdcf0..7e265448 100644 --- a/src/Feature/Logger/Factory/ElasticSearchFactory.php +++ b/src/Feature/Logger/Factory/ElasticSearchFactory.php @@ -36,7 +36,7 @@ public function normalize(array $config): array { try { return $this->processor->processConfiguration($this->configuration, $config); - } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException $exception) { + } catch (Symfony\InvalidConfigurationException|Symfony\InvalidTypeException $exception) { throw new Configurator\InvalidConfigurationException($exception->getMessage(), 0, $exception); } } diff --git a/src/Feature/Logger/Factory/GelfFactory.php b/src/Feature/Logger/Factory/GelfFactory.php index 132872ef..c7017afe 100644 --- a/src/Feature/Logger/Factory/GelfFactory.php +++ b/src/Feature/Logger/Factory/GelfFactory.php @@ -33,7 +33,7 @@ public function normalize(array $config): array { try { return $this->processor->processConfiguration($this->configuration, $config); - } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException $exception) { + } catch (Symfony\InvalidConfigurationException|Symfony\InvalidTypeException $exception) { throw new Configurator\InvalidConfigurationException($exception->getMessage(), 0, $exception); } } diff --git a/src/Feature/Logger/Factory/StreamFactory.php b/src/Feature/Logger/Factory/StreamFactory.php index 2886bac7..0048058d 100644 --- a/src/Feature/Logger/Factory/StreamFactory.php +++ b/src/Feature/Logger/Factory/StreamFactory.php @@ -33,7 +33,7 @@ public function normalize(array $config): array { try { return $this->processor->processConfiguration($this->configuration, $config); - } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException $exception) { + } catch (Symfony\InvalidConfigurationException|Symfony\InvalidTypeException $exception) { throw new Configurator\InvalidConfigurationException($exception->getMessage(), 0, $exception); } } diff --git a/src/Feature/Logger/Factory/SyslogFactory.php b/src/Feature/Logger/Factory/SyslogFactory.php index 7bf4b8f5..9d2ad46c 100644 --- a/src/Feature/Logger/Factory/SyslogFactory.php +++ b/src/Feature/Logger/Factory/SyslogFactory.php @@ -33,7 +33,7 @@ public function normalize(array $config): array { try { return $this->processor->processConfiguration($this->configuration, $config); - } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException $exception) { + } catch (Symfony\InvalidConfigurationException|Symfony\InvalidTypeException $exception) { throw new Configurator\InvalidConfigurationException($exception->getMessage(), 0, $exception); } } diff --git a/src/Feature/Logger/RepositoryTrait.php b/src/Feature/Logger/RepositoryTrait.php index ed522a90..f2d6ae88 100644 --- a/src/Feature/Logger/RepositoryTrait.php +++ b/src/Feature/Logger/RepositoryTrait.php @@ -14,7 +14,7 @@ trait RepositoryTrait /** @var string[] */ private array $packages; - public function addFiles(Packaging\FileInterface|Packaging\DirectoryInterface ...$files): self + public function addFiles(Packaging\DirectoryInterface|Packaging\FileInterface ...$files): self { array_push($this->files, ...$files); diff --git a/src/Feature/Logger/Service.php b/src/Feature/Logger/Service.php index 7e1af794..9de85707 100644 --- a/src/Feature/Logger/Service.php +++ b/src/Feature/Logger/Service.php @@ -42,7 +42,7 @@ public function normalize(array $config): array { try { return $this->processor->processConfiguration($this->configuration, $config); - } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException $exception) { + } catch (Symfony\InvalidConfigurationException|Symfony\InvalidTypeException $exception) { throw new Configurator\InvalidConfigurationException($exception->getMessage(), 0, $exception); } } @@ -158,7 +158,7 @@ public function compile(array $config): Repository $builder->withLogger($monologBuilder->getNode()); return $repository; - } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException $exception) { + } catch (Symfony\InvalidConfigurationException|Symfony\InvalidTypeException $exception) { throw new Configurator\InvalidConfigurationException(message: $exception->getMessage(), previous: $exception); } } diff --git a/src/Feature/Rejection/Factory/RabbitMQFactory.php b/src/Feature/Rejection/Factory/RabbitMQFactory.php index 2f785ba9..7de68b4f 100644 --- a/src/Feature/Rejection/Factory/RabbitMQFactory.php +++ b/src/Feature/Rejection/Factory/RabbitMQFactory.php @@ -38,7 +38,7 @@ public function normalize(array $config): array { try { return $this->processor->processConfiguration($this->configuration, $config); - } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException $exception) { + } catch (Symfony\InvalidConfigurationException|Symfony\InvalidTypeException $exception) { throw new Configurator\InvalidConfigurationException($exception->getMessage(), 0, $exception); } } diff --git a/src/Feature/Rejection/RepositoryTrait.php b/src/Feature/Rejection/RepositoryTrait.php index c0545d79..118dc131 100644 --- a/src/Feature/Rejection/RepositoryTrait.php +++ b/src/Feature/Rejection/RepositoryTrait.php @@ -14,7 +14,7 @@ trait RepositoryTrait /** @var string[] */ private array $packages; - public function addFiles(Packaging\FileInterface|Packaging\DirectoryInterface ...$files): self + public function addFiles(Packaging\DirectoryInterface|Packaging\FileInterface ...$files): self { array_push($this->files, ...$files); diff --git a/src/Feature/Rejection/Service.php b/src/Feature/Rejection/Service.php index 9a10e741..3296a24a 100644 --- a/src/Feature/Rejection/Service.php +++ b/src/Feature/Rejection/Service.php @@ -41,7 +41,7 @@ public function normalize(array $config): array { try { return $this->processor->processConfiguration($this->configuration, $config); - } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException $exception) { + } catch (Symfony\InvalidConfigurationException|Symfony\InvalidTypeException $exception) { throw new Configurator\InvalidConfigurationException($exception->getMessage(), 0, $exception); } } @@ -82,7 +82,7 @@ public function compile(array $config): Repository } return $repository; - } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException $exception) { + } catch (Symfony\InvalidConfigurationException|Symfony\InvalidTypeException $exception) { throw new Configurator\InvalidConfigurationException(message: $exception->getMessage(), previous: $exception); } } diff --git a/src/Feature/State/RepositoryTrait.php b/src/Feature/State/RepositoryTrait.php index 1d0943d6..c2f89736 100644 --- a/src/Feature/State/RepositoryTrait.php +++ b/src/Feature/State/RepositoryTrait.php @@ -14,7 +14,7 @@ trait RepositoryTrait /** @var string[] */ private array $packages; - public function addFiles(Packaging\FileInterface|Packaging\DirectoryInterface ...$files): self + public function addFiles(Packaging\DirectoryInterface|Packaging\FileInterface ...$files): self { array_push($this->files, ...$files); diff --git a/src/Feature/State/Service.php b/src/Feature/State/Service.php index 72720cba..7b6cf1b5 100644 --- a/src/Feature/State/Service.php +++ b/src/Feature/State/Service.php @@ -41,7 +41,7 @@ public function normalize(array $config): array { try { return $this->processor->processConfiguration($this->configuration, $config); - } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException $exception) { + } catch (Symfony\InvalidConfigurationException|Symfony\InvalidTypeException $exception) { throw new Configurator\InvalidConfigurationException($exception->getMessage(), 0, $exception); } } diff --git a/src/Interpreter.php b/src/Interpreter.php index 1b98d7f5..87221bfb 100644 --- a/src/Interpreter.php +++ b/src/Interpreter.php @@ -14,7 +14,7 @@ final class Interpreter private readonly array $expressionFunctions; public function __construct( - ExpressionFunctionProviderInterface|ExpressionFunction ...$expressionFunctions + ExpressionFunction|ExpressionFunctionProviderInterface ...$expressionFunctions ) { $this->expressionFunctions = $expressionFunctions; } diff --git a/src/Pipeline/Extractor.php b/src/Pipeline/Extractor.php index 67cfb976..075a7f6d 100644 --- a/src/Pipeline/Extractor.php +++ b/src/Pipeline/Extractor.php @@ -19,8 +19,7 @@ public function __construct( private ?string $plugin, private ?string $key, private ExpressionLanguage $interpreter = new Satellite\ExpressionLanguage() - ) { - } + ) {} public function __invoke(array $config, Pipeline $pipeline, StepRepositoryInterface $repository): void { @@ -66,7 +65,7 @@ public function __invoke(array $config, Pipeline $pipeline, StepRepositoryInterf ); } - if (array_key_exists('code', $config)) { + if (\array_key_exists('code', $config)) { $code = $config['code']; } else { $code = sprintf('%s.%s', $this->plugin, $this->key); @@ -77,7 +76,7 @@ public function __invoke(array $config, Pipeline $pipeline, StepRepositoryInterf new Node\Name\FullyQualified('Kiboko\\Component\\Pipeline\\StepCode'), new Node\Identifier('fromString'), [ - new Node\Arg(new Node\Scalar\String_($code)) + new Node\Arg(new Node\Scalar\String_($code)), ] ), $repository->getBuilder() diff --git a/src/Pipeline/Loader.php b/src/Pipeline/Loader.php index 50726e6b..26235559 100644 --- a/src/Pipeline/Loader.php +++ b/src/Pipeline/Loader.php @@ -19,8 +19,7 @@ public function __construct( private ?string $plugin, private ?string $key, private ExpressionLanguage $interpreter = new Satellite\ExpressionLanguage() - ) { - } + ) {} public function __invoke(array $config, Pipeline $pipeline, StepRepositoryInterface $repository): void { @@ -66,7 +65,7 @@ public function __invoke(array $config, Pipeline $pipeline, StepRepositoryInterf ); } - if (array_key_exists('code', $config)) { + if (\array_key_exists('code', $config)) { $code = $config['code']; } else { $code = sprintf('%s.%s', $this->plugin, $this->key); @@ -77,7 +76,7 @@ public function __invoke(array $config, Pipeline $pipeline, StepRepositoryInterf new Node\Name\FullyQualified('Kiboko\\Component\\Pipeline\\StepCode'), new Node\Identifier('fromString'), [ - new Node\Arg(new Node\Scalar\String_($code)) + new Node\Arg(new Node\Scalar\String_($code)), ] ), $repository->getBuilder() diff --git a/src/Pipeline/Transformer.php b/src/Pipeline/Transformer.php index 7420f7d0..26fcfa0e 100644 --- a/src/Pipeline/Transformer.php +++ b/src/Pipeline/Transformer.php @@ -19,8 +19,7 @@ public function __construct( private ?string $plugin, private ?string $key, private ExpressionLanguage $interpreter = new Satellite\ExpressionLanguage() - ) { - } + ) {} public function __invoke(array $config, Pipeline $pipeline, StepRepositoryInterface $repository): void { @@ -66,7 +65,7 @@ public function __invoke(array $config, Pipeline $pipeline, StepRepositoryInterf ); } - if (array_key_exists('code', $config)) { + if (\array_key_exists('code', $config)) { $code = $config['code']; } else { $code = sprintf('%s.%s', $this->plugin, $this->key); @@ -77,7 +76,7 @@ public function __invoke(array $config, Pipeline $pipeline, StepRepositoryInterf new Node\Name\FullyQualified('Kiboko\\Component\\Pipeline\\StepCode'), new Node\Identifier('fromString'), [ - new Node\Arg(new Node\Scalar\String_($code)) + new Node\Arg(new Node\Scalar\String_($code)), ] ), $repository->getBuilder() diff --git a/src/Plugin/Batching/Repository.php b/src/Plugin/Batching/Repository.php index 23dd6c42..cb4d4e14 100644 --- a/src/Plugin/Batching/Repository.php +++ b/src/Plugin/Batching/Repository.php @@ -11,9 +11,9 @@ final readonly class Repository implements Configurator\StepRepositoryInterface { - public function __construct(private Merge|Fork $builder) {} + public function __construct(private Fork|Merge $builder) {} - public function addFiles(Packaging\FileInterface|Packaging\DirectoryInterface ...$files): self + public function addFiles(Packaging\DirectoryInterface|Packaging\FileInterface ...$files): self { return $this; } @@ -33,7 +33,7 @@ public function getPackages(): iterable return new \EmptyIterator(); } - public function getBuilder(): Merge|Fork + public function getBuilder(): Fork|Merge { return $this->builder; } diff --git a/src/Plugin/Batching/Service.php b/src/Plugin/Batching/Service.php index 9bf76aab..d3204bb9 100644 --- a/src/Plugin/Batching/Service.php +++ b/src/Plugin/Batching/Service.php @@ -55,7 +55,7 @@ public function normalize(array $config): array { try { return $this->processor->processConfiguration($this->configuration, $config); - } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException $exception) { + } catch (Symfony\InvalidConfigurationException|Symfony\InvalidTypeException $exception) { throw new Configurator\InvalidConfigurationException($exception->getMessage(), 0, $exception); } } @@ -66,7 +66,7 @@ public function validate(array $config): bool $this->processor->processConfiguration($this->configuration, $config); return true; - } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException) { + } catch (Symfony\InvalidConfigurationException|Symfony\InvalidTypeException) { return false; } } diff --git a/src/Plugin/Custom/Factory/Extractor.php b/src/Plugin/Custom/Factory/Extractor.php index ccf1088d..5690023d 100644 --- a/src/Plugin/Custom/Factory/Extractor.php +++ b/src/Plugin/Custom/Factory/Extractor.php @@ -44,7 +44,7 @@ public function normalize(array $config): array { try { return $this->processor->processConfiguration($this->configuration, $config); - } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException $exception) { + } catch (Symfony\InvalidConfigurationException|Symfony\InvalidTypeException $exception) { throw new Configurator\InvalidConfigurationException($exception->getMessage(), 0, $exception); } } @@ -55,7 +55,7 @@ public function validate(array $config): bool $this->processor->processConfiguration($this->configuration, $config); return true; - } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException) { + } catch (Symfony\InvalidConfigurationException|Symfony\InvalidTypeException) { return false; } } diff --git a/src/Plugin/Custom/Factory/Loader.php b/src/Plugin/Custom/Factory/Loader.php index aed11d17..69a17a52 100644 --- a/src/Plugin/Custom/Factory/Loader.php +++ b/src/Plugin/Custom/Factory/Loader.php @@ -44,7 +44,7 @@ public function normalize(array $config): array { try { return $this->processor->processConfiguration($this->configuration, $config); - } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException $exception) { + } catch (Symfony\InvalidConfigurationException|Symfony\InvalidTypeException $exception) { throw new Configurator\InvalidConfigurationException($exception->getMessage(), 0, $exception); } } @@ -55,7 +55,7 @@ public function validate(array $config): bool $this->processor->processConfiguration($this->configuration, $config); return true; - } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException) { + } catch (Symfony\InvalidConfigurationException|Symfony\InvalidTypeException) { return false; } } diff --git a/src/Plugin/Custom/Factory/Repository/RepositoryTrait.php b/src/Plugin/Custom/Factory/Repository/RepositoryTrait.php index c8a7b63b..fb9a52a6 100644 --- a/src/Plugin/Custom/Factory/Repository/RepositoryTrait.php +++ b/src/Plugin/Custom/Factory/Repository/RepositoryTrait.php @@ -14,7 +14,7 @@ trait RepositoryTrait /** @var string[] */ private array $packages; - public function addFiles(Packaging\FileInterface|Packaging\DirectoryInterface ...$files): Configurator\RepositoryInterface + public function addFiles(Packaging\DirectoryInterface|Packaging\FileInterface ...$files): Configurator\RepositoryInterface { array_push($this->files, ...$files); diff --git a/src/Plugin/Custom/Factory/Transformer.php b/src/Plugin/Custom/Factory/Transformer.php index 23a99803..5beb12e3 100644 --- a/src/Plugin/Custom/Factory/Transformer.php +++ b/src/Plugin/Custom/Factory/Transformer.php @@ -44,7 +44,7 @@ public function normalize(array $config): array { try { return $this->processor->processConfiguration($this->configuration, $config); - } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException $exception) { + } catch (Symfony\InvalidConfigurationException|Symfony\InvalidTypeException $exception) { throw new Configurator\InvalidConfigurationException($exception->getMessage(), 0, $exception); } } @@ -55,7 +55,7 @@ public function validate(array $config): bool $this->processor->processConfiguration($this->configuration, $config); return true; - } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException) { + } catch (Symfony\InvalidConfigurationException|Symfony\InvalidTypeException) { return false; } } diff --git a/src/Plugin/Custom/Service.php b/src/Plugin/Custom/Service.php index 69a862dd..0818a8e4 100644 --- a/src/Plugin/Custom/Service.php +++ b/src/Plugin/Custom/Service.php @@ -47,7 +47,7 @@ public function normalize(array $config): array { try { return $this->processor->processConfiguration($this->configuration, $config); - } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException $exception) { + } catch (Symfony\InvalidConfigurationException|Symfony\InvalidTypeException $exception) { throw new Configurator\InvalidConfigurationException($exception->getMessage(), 0, $exception); } } @@ -58,7 +58,7 @@ public function validate(array $config): bool $this->processor->processConfiguration($this->configuration, $config); return true; - } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException) { + } catch (Symfony\InvalidConfigurationException|Symfony\InvalidTypeException) { return false; } } diff --git a/src/Plugin/FTP/Factory/Loader.php b/src/Plugin/FTP/Factory/Loader.php index 0e501b8c..f9caa4a7 100644 --- a/src/Plugin/FTP/Factory/Loader.php +++ b/src/Plugin/FTP/Factory/Loader.php @@ -39,7 +39,7 @@ public function normalize(array $config): array { try { return $this->processor->processConfiguration($this->configuration, $config); - } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException $exception) { + } catch (Symfony\InvalidConfigurationException|Symfony\InvalidTypeException $exception) { throw new Configurator\InvalidConfigurationException($exception->getMessage(), 0, $exception); } } @@ -50,7 +50,7 @@ public function validate(array $config): bool $this->normalize($config); return true; - } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException) { + } catch (Symfony\InvalidConfigurationException|Symfony\InvalidTypeException) { return false; } } @@ -88,7 +88,7 @@ public function compile(array $config): RepositoryInterface try { return new FTP\Factory\Repository\Repository($builder); - } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException $exception) { + } catch (Symfony\InvalidConfigurationException|Symfony\InvalidTypeException $exception) { throw new Configurator\InvalidConfigurationException(message: $exception->getMessage(), previous: $exception); } } diff --git a/src/Plugin/FTP/Factory/Repository/Repository.php b/src/Plugin/FTP/Factory/Repository/Repository.php index 240170e9..81b74abf 100644 --- a/src/Plugin/FTP/Factory/Repository/Repository.php +++ b/src/Plugin/FTP/Factory/Repository/Repository.php @@ -12,7 +12,7 @@ { public function __construct(private Builder\Loader|Builder\Server $builder) {} - public function addFiles(Packaging\FileInterface|Packaging\DirectoryInterface ...$files): self + public function addFiles(Packaging\DirectoryInterface|Packaging\FileInterface ...$files): self { return $this; } diff --git a/src/Plugin/FTP/Factory/Server.php b/src/Plugin/FTP/Factory/Server.php index 28530ff6..8bd71dd2 100644 --- a/src/Plugin/FTP/Factory/Server.php +++ b/src/Plugin/FTP/Factory/Server.php @@ -38,7 +38,7 @@ public function normalize(array $config): array { try { return $this->processor->processConfiguration($this->configuration, $config); - } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException $exception) { + } catch (Symfony\InvalidConfigurationException|Symfony\InvalidTypeException $exception) { throw new Configurator\InvalidConfigurationException($exception->getMessage(), 0, $exception); } } @@ -49,7 +49,7 @@ public function validate(array $config): bool $this->normalize($config); return true; - } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException) { + } catch (Symfony\InvalidConfigurationException|Symfony\InvalidTypeException) { return false; } } @@ -75,7 +75,7 @@ public function compile(array $config): FTP\Factory\Repository\Repository try { return new FTP\Factory\Repository\Repository($builder); - } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException $exception) { + } catch (Symfony\InvalidConfigurationException|Symfony\InvalidTypeException $exception) { throw new Configurator\InvalidConfigurationException(message: $exception->getMessage(), previous: $exception); } } diff --git a/src/Plugin/FTP/Service.php b/src/Plugin/FTP/Service.php index 33a816de..da93e63e 100644 --- a/src/Plugin/FTP/Service.php +++ b/src/Plugin/FTP/Service.php @@ -45,7 +45,7 @@ public function normalize(array $config): array { try { return $this->processor->processConfiguration($this->configuration, $config); - } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException $exception) { + } catch (Symfony\InvalidConfigurationException|Symfony\InvalidTypeException $exception) { throw new Configurator\InvalidConfigurationException($exception->getMessage(), 0, $exception); } } @@ -56,7 +56,7 @@ public function validate(array $config): bool $this->processor->processConfiguration($this->configuration, $config); return true; - } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException) { + } catch (Symfony\InvalidConfigurationException|Symfony\InvalidTypeException) { return false; } } diff --git a/src/Plugin/Filtering/Factory/Drop.php b/src/Plugin/Filtering/Factory/Drop.php index 5236e40a..0736b536 100644 --- a/src/Plugin/Filtering/Factory/Drop.php +++ b/src/Plugin/Filtering/Factory/Drop.php @@ -40,7 +40,7 @@ public function normalize(array $config): array { try { return $this->processor->processConfiguration($this->configuration, $config); - } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException $exception) { + } catch (Symfony\InvalidConfigurationException|Symfony\InvalidTypeException $exception) { throw new Configurator\InvalidConfigurationException($exception->getMessage(), 0, $exception); } } @@ -51,7 +51,7 @@ public function validate(array $config): bool $this->processor->processConfiguration($this->configuration, $config); return true; - } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException) { + } catch (Symfony\InvalidConfigurationException|Symfony\InvalidTypeException) { return false; } } diff --git a/src/Plugin/Filtering/Factory/Reject.php b/src/Plugin/Filtering/Factory/Reject.php index 047a919f..73cb67a0 100644 --- a/src/Plugin/Filtering/Factory/Reject.php +++ b/src/Plugin/Filtering/Factory/Reject.php @@ -40,7 +40,7 @@ public function normalize(array $config): array { try { return $this->processor->processConfiguration($this->configuration, $config); - } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException $exception) { + } catch (Symfony\InvalidConfigurationException|Symfony\InvalidTypeException $exception) { throw new Configurator\InvalidConfigurationException($exception->getMessage(), 0, $exception); } } @@ -51,7 +51,7 @@ public function validate(array $config): bool $this->processor->processConfiguration($this->configuration, $config); return true; - } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException) { + } catch (Symfony\InvalidConfigurationException|Symfony\InvalidTypeException) { return false; } } diff --git a/src/Plugin/Filtering/Factory/Repository/RepositoryTrait.php b/src/Plugin/Filtering/Factory/Repository/RepositoryTrait.php index f332d595..1457f00d 100644 --- a/src/Plugin/Filtering/Factory/Repository/RepositoryTrait.php +++ b/src/Plugin/Filtering/Factory/Repository/RepositoryTrait.php @@ -14,7 +14,7 @@ trait RepositoryTrait /** @var string[] */ private array $packages; - public function addFiles(Packaging\FileInterface|Packaging\DirectoryInterface ...$files): Configurator\RepositoryInterface + public function addFiles(Packaging\DirectoryInterface|Packaging\FileInterface ...$files): Configurator\RepositoryInterface { array_push($this->files, ...$files); diff --git a/src/Plugin/Filtering/Service.php b/src/Plugin/Filtering/Service.php index f63c4021..8c04104b 100644 --- a/src/Plugin/Filtering/Service.php +++ b/src/Plugin/Filtering/Service.php @@ -46,7 +46,7 @@ public function normalize(array $config): array { try { return $this->processor->processConfiguration($this->configuration, $config); - } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException $exception) { + } catch (Symfony\InvalidConfigurationException|Symfony\InvalidTypeException $exception) { throw new Configurator\InvalidConfigurationException($exception->getMessage(), 0, $exception); } } @@ -57,7 +57,7 @@ public function validate(array $config): bool $this->processor->processConfiguration($this->configuration, $config); return true; - } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException) { + } catch (Symfony\InvalidConfigurationException|Symfony\InvalidTypeException) { return false; } } diff --git a/src/Plugin/SFTP/Factory/Extractor.php b/src/Plugin/SFTP/Factory/Extractor.php index 014eb4e9..dc4e97ed 100644 --- a/src/Plugin/SFTP/Factory/Extractor.php +++ b/src/Plugin/SFTP/Factory/Extractor.php @@ -39,7 +39,7 @@ public function normalize(array $config): array { try { return $this->processor->processConfiguration($this->configuration, $config); - } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException $exception) { + } catch (Symfony\InvalidConfigurationException|Symfony\InvalidTypeException $exception) { throw new Configurator\InvalidConfigurationException($exception->getMessage(), 0, $exception); } } @@ -50,7 +50,7 @@ public function validate(array $config): bool $this->normalize($config); return true; - } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException) { + } catch (Symfony\InvalidConfigurationException|Symfony\InvalidTypeException) { return false; } } @@ -87,7 +87,7 @@ public function compile(array $config): Repository try { return new Repository($builder); - } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException $exception) { + } catch (Symfony\InvalidConfigurationException|Symfony\InvalidTypeException $exception) { throw new Configurator\InvalidConfigurationException(message: $exception->getMessage(), previous: $exception); } } diff --git a/src/Plugin/SFTP/Factory/Loader.php b/src/Plugin/SFTP/Factory/Loader.php index 1213dcee..e24b3611 100644 --- a/src/Plugin/SFTP/Factory/Loader.php +++ b/src/Plugin/SFTP/Factory/Loader.php @@ -39,7 +39,7 @@ public function normalize(array $config): array { try { return $this->processor->processConfiguration($this->configuration, $config); - } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException $exception) { + } catch (Symfony\InvalidConfigurationException|Symfony\InvalidTypeException $exception) { throw new Configurator\InvalidConfigurationException($exception->getMessage(), 0, $exception); } } @@ -50,7 +50,7 @@ public function validate(array $config): bool $this->normalize($config); return true; - } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException) { + } catch (Symfony\InvalidConfigurationException|Symfony\InvalidTypeException) { return false; } } @@ -87,7 +87,7 @@ public function compile(array $config): Repository try { return new Repository($builder); - } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException $exception) { + } catch (Symfony\InvalidConfigurationException|Symfony\InvalidTypeException $exception) { throw new Configurator\InvalidConfigurationException(message: $exception->getMessage(), previous: $exception); } } diff --git a/src/Plugin/SFTP/Factory/Repository/Repository.php b/src/Plugin/SFTP/Factory/Repository/Repository.php index 8ed17a76..d6277f17 100644 --- a/src/Plugin/SFTP/Factory/Repository/Repository.php +++ b/src/Plugin/SFTP/Factory/Repository/Repository.php @@ -12,7 +12,7 @@ { public function __construct(private Builder\Loader|Builder\Server $builder) {} - public function addFiles(Packaging\FileInterface|Packaging\DirectoryInterface ...$files): self + public function addFiles(Packaging\DirectoryInterface|Packaging\FileInterface ...$files): self { return $this; } diff --git a/src/Plugin/SFTP/Factory/Server.php b/src/Plugin/SFTP/Factory/Server.php index 62e498fa..1a2f7d02 100644 --- a/src/Plugin/SFTP/Factory/Server.php +++ b/src/Plugin/SFTP/Factory/Server.php @@ -38,7 +38,7 @@ public function normalize(array $config): array { try { return $this->processor->processConfiguration($this->configuration, $config); - } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException $exception) { + } catch (Symfony\InvalidConfigurationException|Symfony\InvalidTypeException $exception) { throw new Configurator\InvalidConfigurationException($exception->getMessage(), 0, $exception); } } @@ -49,7 +49,7 @@ public function validate(array $config): bool $this->normalize($config); return true; - } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException) { + } catch (Symfony\InvalidConfigurationException|Symfony\InvalidTypeException) { return false; } } @@ -84,7 +84,7 @@ public function compile(array $config): SFTP\Factory\Repository\Repository try { return new SFTP\Factory\Repository\Repository($builder); - } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException $exception) { + } catch (Symfony\InvalidConfigurationException|Symfony\InvalidTypeException $exception) { throw new Configurator\InvalidConfigurationException(message: $exception->getMessage(), previous: $exception); } } diff --git a/src/Plugin/SFTP/Service.php b/src/Plugin/SFTP/Service.php index ba5992c5..e0ae7a85 100644 --- a/src/Plugin/SFTP/Service.php +++ b/src/Plugin/SFTP/Service.php @@ -46,7 +46,7 @@ public function normalize(array $config): array { try { return $this->processor->processConfiguration($this->configuration, $config); - } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException $exception) { + } catch (Symfony\InvalidConfigurationException|Symfony\InvalidTypeException $exception) { throw new Configurator\InvalidConfigurationException($exception->getMessage(), 0, $exception); } } @@ -57,7 +57,7 @@ public function validate(array $config): bool $this->processor->processConfiguration($this->configuration, $config); return true; - } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException) { + } catch (Symfony\InvalidConfigurationException|Symfony\InvalidTypeException) { return false; } } diff --git a/src/Plugin/Stream/Repository.php b/src/Plugin/Stream/Repository.php index 79bb0dff..c2f9b53c 100644 --- a/src/Plugin/Stream/Repository.php +++ b/src/Plugin/Stream/Repository.php @@ -10,10 +10,10 @@ final readonly class Repository implements Configurator\StepRepositoryInterface { public function __construct( - private Builder\StderrLoader|Builder\StdoutLoader|Builder\JSONStreamLoader|Builder\DebugLoader $builder + private Builder\DebugLoader|Builder\JSONStreamLoader|Builder\StderrLoader|Builder\StdoutLoader $builder ) {} - public function addFiles(Packaging\FileInterface|Packaging\DirectoryInterface ...$files): self + public function addFiles(Packaging\DirectoryInterface|Packaging\FileInterface ...$files): self { return $this; } @@ -33,7 +33,7 @@ public function getPackages(): iterable return new \EmptyIterator(); } - public function getBuilder(): Builder\StderrLoader|Builder\StdoutLoader|Builder\JSONStreamLoader|Builder\DebugLoader + public function getBuilder(): Builder\DebugLoader|Builder\JSONStreamLoader|Builder\StderrLoader|Builder\StdoutLoader { return $this->builder; } diff --git a/src/Plugin/Stream/Service.php b/src/Plugin/Stream/Service.php index 3f3e11a9..c1fba50c 100644 --- a/src/Plugin/Stream/Service.php +++ b/src/Plugin/Stream/Service.php @@ -45,7 +45,7 @@ public function normalize(array $config): array { try { return $this->processor->processConfiguration($this->configuration, $config); - } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException $exception) { + } catch (Symfony\InvalidConfigurationException|Symfony\InvalidTypeException $exception) { throw new Configurator\InvalidConfigurationException($exception->getMessage(), 0, $exception); } } @@ -56,7 +56,7 @@ public function validate(array $config): bool $this->processor->processConfiguration($this->configuration, $config); return true; - } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException) { + } catch (Symfony\InvalidConfigurationException|Symfony\InvalidTypeException) { return false; } } diff --git a/src/Service.php b/src/Service.php index 628cf4cc..4dbe781b 100644 --- a/src/Service.php +++ b/src/Service.php @@ -147,7 +147,7 @@ public function registerRuntimes(Satellite\Runtime\FactoryInterface ...$runtimes return $this; } - public function registerPlugins(Configurator\PipelinePluginInterface|Configurator\PipelineFeatureInterface ...$plugins): self + public function registerPlugins(Configurator\PipelineFeatureInterface|Configurator\PipelinePluginInterface ...$plugins): self { foreach ($plugins as $plugin) { /** @var Configurator\Feature $attribute */ @@ -188,7 +188,7 @@ public function normalize(array $config): array { try { return $this->processor->processConfiguration($this->configuration, $config); - } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException $exception) { + } catch (Symfony\InvalidConfigurationException|Symfony\InvalidTypeException $exception) { throw new Configurator\InvalidConfigurationException($exception->getMessage(), 0, $exception); } } @@ -199,7 +199,7 @@ public function validate(array $config): bool $this->processor->processConfiguration($this->configuration, $config); return true; - } catch (Symfony\InvalidTypeException|Symfony\InvalidConfigurationException) { + } catch (Symfony\InvalidConfigurationException|Symfony\InvalidTypeException) { return false; } } From 829ce1a917fc3a6bfa9fe97d62e288e0cc59f43c Mon Sep 17 00:00:00 2001 From: Jonathan Date: Mon, 4 Dec 2023 12:15:20 +0100 Subject: [PATCH 4/7] revert some change from rector --- src/Action/Action.php | 2 +- src/Builder/API/APIRuntime.php | 4 +- src/Builder/Hook/HookRuntime.php | 4 +- src/Builder/Pipeline/ConsoleRuntime.php | 6 +-- src/Builder/Workflow.php | 8 ++-- src/Builder/Workflow/ActionBuilder.php | 2 +- src/Builder/Workflow/PipelineBuilder.php | 2 +- src/Builder/Workflow/WorkflowRuntime.php | 4 +- .../AddPipelineStepProbeCommandHandler.php | 2 +- .../DeclarePipelineCommandHandler.php | 38 ++++++++++--------- src/Console/Command/RunCommand.php | 18 ++++----- src/Plugin/Batching/Builder/Fork.php | 4 +- src/Plugin/Batching/Builder/Merge.php | 12 +++--- src/Plugin/FTP/Builder/Loader.php | 2 +- src/Plugin/Filtering/Builder/Drop.php | 6 +-- src/Plugin/Filtering/Builder/Reject.php | 8 ++-- src/Plugin/SFTP/Builder/Extractor.php | 4 +- src/Plugin/SFTP/Builder/Loader.php | 4 +- src/Plugin/Stream/Builder/DebugLoader.php | 2 +- .../Stream/Builder/JSONStreamLoader.php | 2 +- src/Plugin/Stream/Builder/StderrLoader.php | 2 +- src/Plugin/Stream/Builder/StdoutLoader.php | 2 +- src/Runtime/Pipeline/Runtime.php | 2 +- src/Runtime/Workflow/Runtime.php | 2 +- 24 files changed, 72 insertions(+), 70 deletions(-) diff --git a/src/Action/Action.php b/src/Action/Action.php index 31cd2269..f4f59f74 100644 --- a/src/Action/Action.php +++ b/src/Action/Action.php @@ -43,7 +43,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::class), + new Node\Name\FullyQualified('Kiboko\\Contract\\Action\\NullState'), ); } diff --git a/src/Builder/API/APIRuntime.php b/src/Builder/API/APIRuntime.php index b1034b10..312c06af 100644 --- a/src/Builder/API/APIRuntime.php +++ b/src/Builder/API/APIRuntime.php @@ -15,11 +15,11 @@ 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), + 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), + class: new Node\Name\FullyQualified('Kiboko\\Component\\Pipeline\\PipelineRunner'), args: [ new Node\Arg( value: new Node\Expr\New_( diff --git a/src/Builder/Hook/HookRuntime.php b/src/Builder/Hook/HookRuntime.php index bb348507..64d4e1e2 100644 --- a/src/Builder/Hook/HookRuntime.php +++ b/src/Builder/Hook/HookRuntime.php @@ -15,11 +15,11 @@ class: new Node\Name\FullyQualified('Kiboko\\Component\\Runtime\\Hook\\HookRunti args: [ new Node\Arg( value: new Node\Expr\New_( - class: new Node\Name\FullyQualified(\Kiboko\Component\Pipeline\Pipeline::class), + 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), + class: new Node\Name\FullyQualified('Kiboko\\Component\\Pipeline\\PipelineRunner'), args: [ new Node\Arg( value: new Node\Expr\New_( diff --git a/src/Builder/Pipeline/ConsoleRuntime.php b/src/Builder/Pipeline/ConsoleRuntime.php index b77af50f..87fe608f 100644 --- a/src/Builder/Pipeline/ConsoleRuntime.php +++ b/src/Builder/Pipeline/ConsoleRuntime.php @@ -12,7 +12,7 @@ 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), + class: new Node\Name\FullyQualified('Kiboko\\Component\\Runtime\\Pipeline\\Console'), args: [ new Node\Arg( value: new Node\Expr\New_( @@ -21,11 +21,11 @@ class: new Node\Name\FullyQualified(\Symfony\Component\Console\Output\ConsoleOut ), new Node\Arg( value: new Node\Expr\New_( - class: new Node\Name\FullyQualified(\Kiboko\Component\Pipeline\Pipeline::class), + 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), + class: new Node\Name\FullyQualified('Kiboko\\Component\\Pipeline\\PipelineRunner'), args: [ new Node\Arg( value: new Node\Expr\New_( diff --git a/src/Builder/Workflow.php b/src/Builder/Workflow.php index a815d2ef..3ca024b5 100644 --- a/src/Builder/Workflow.php +++ b/src/Builder/Workflow.php @@ -23,7 +23,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::class), + new Node\Name\FullyQualified('Kiboko\Component\Workflow\JobCode'), new Node\Identifier('fromString'), [ new Node\Arg(new Node\Scalar\String_($code)), @@ -37,7 +37,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::class), + new Node\Name\FullyQualified('Kiboko\Component\Workflow\JobCode'), new Node\Identifier('fromString'), [ new Node\Arg(new Node\Scalar\String_($code)), @@ -72,7 +72,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::class), + new Node\Name\FullyQualified('Kiboko\Component\Workflow\JobCode'), new Node\Identifier('fromString'), [ new Node\Arg(new Node\Scalar\String_($code)), @@ -86,7 +86,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::class), + new Node\Name\FullyQualified('Kiboko\Component\Workflow\JobCode'), new Node\Identifier('fromString'), [ new Node\Arg(new Node\Scalar\String_($code)), diff --git a/src/Builder/Workflow/ActionBuilder.php b/src/Builder/Workflow/ActionBuilder.php index d0d77cd9..c53ba66d 100644 --- a/src/Builder/Workflow/ActionBuilder.php +++ b/src/Builder/Workflow/ActionBuilder.php @@ -19,7 +19,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::class), + type: new Node\Name\FullyQualified('Kiboko\\Component\\Runtime\\Action\\ActionRuntimeInterface'), ), ], 'stmts' => [ diff --git a/src/Builder/Workflow/PipelineBuilder.php b/src/Builder/Workflow/PipelineBuilder.php index ebe839d5..55bdc5ac 100644 --- a/src/Builder/Workflow/PipelineBuilder.php +++ b/src/Builder/Workflow/PipelineBuilder.php @@ -19,7 +19,7 @@ public function getNode(): Node\Expr 'params' => [ new Node\Param( var: new Node\Expr\Variable('runtime'), - type: new Node\Name\FullyQualified(\Kiboko\Component\Runtime\Pipeline\PipelineRuntimeInterface::class), + type: new Node\Name\FullyQualified('Kiboko\\Component\\Runtime\\Pipeline\\PipelineRuntimeInterface'), ), ], 'stmts' => [ diff --git a/src/Builder/Workflow/WorkflowRuntime.php b/src/Builder/Workflow/WorkflowRuntime.php index 92198b45..890032ff 100644 --- a/src/Builder/Workflow/WorkflowRuntime.php +++ b/src/Builder/Workflow/WorkflowRuntime.php @@ -12,7 +12,7 @@ final class WorkflowRuntime implements Builder public function getNode(): Node\Expr { return new Node\Expr\New_( - class: new Node\Name\FullyQualified(\Kiboko\Component\Runtime\Workflow\Console::class), + class: new Node\Name\FullyQualified('Kiboko\Component\Runtime\Workflow\Console'), args: [ new Node\Arg( value: new Node\Expr\New_( @@ -21,7 +21,7 @@ class: new Node\Name\FullyQualified(\Symfony\Component\Console\Output\ConsoleOut ), new Node\Arg( new Node\Expr\New_( - class: new Node\Name\FullyQualified(\Kiboko\Component\Pipeline\PipelineRunner::class), + class: new Node\Name\FullyQualified('Kiboko\Component\Pipeline\PipelineRunner'), args: [ new Node\Arg( value: new Node\Expr\New_( diff --git a/src/Cloud/Handler/Pipeline/AddPipelineStepProbeCommandHandler.php b/src/Cloud/Handler/Pipeline/AddPipelineStepProbeCommandHandler.php index 599a9567..7e4f74ea 100644 --- a/src/Cloud/Handler/Pipeline/AddPipelineStepProbeCommandHandler.php +++ b/src/Cloud/Handler/Pipeline/AddPipelineStepProbeCommandHandler.php @@ -19,7 +19,7 @@ public function __invoke(Cloud\Command\Pipeline\AddPipelineStepProbeCommand $com /** @var \stdClass $result */ $result = $this->client->addPipelineStepProbePipelineItem( $command->pipeline->asString(), - (new Api\Model\PipelineAddPipelineStepProbCommandInput()) + (new Api\Model\PipelineAddPipelineStepProbeCommandInput()) ->setProbe( (new Api\Model\Probe()) ->setCode($command->probe->code) diff --git a/src/Cloud/Handler/Pipeline/DeclarePipelineCommandHandler.php b/src/Cloud/Handler/Pipeline/DeclarePipelineCommandHandler.php index b2747f8e..516dedd2 100644 --- a/src/Cloud/Handler/Pipeline/DeclarePipelineCommandHandler.php +++ b/src/Cloud/Handler/Pipeline/DeclarePipelineCommandHandler.php @@ -25,7 +25,7 @@ public function __invoke(Cloud\Command\Pipeline\DeclarePipelineCommand $command) ->setLabel($command->label) ->setCode($command->code) ->setSteps($command->steps->map( - fn (Step $step) => (new Api\Model\StepInput()) + fn (Step $step) => (new Api\Model\PipelineAppendPipelineStepCommandInput()) ->setCode((string) $step->code) ->setLabel($step->label) ->setConfiguration($step->config) @@ -33,23 +33,27 @@ public function __invoke(Cloud\Command\Pipeline\DeclarePipelineCommand $command) fn (Probe $probe) => (new Api\Model\Probe())->setCode($probe->code)->setLabel($probe->label)) ) )) - ->setAutoloads($command->autoload->map( - fn (PSR4AutoloadConfig $autoloadConfig) => (new Api\Model\AutoloadInput()) - ->setNamespace($autoloadConfig->namespace) - ->setPaths($autoloadConfig->paths) - )) - ->setPackages($command->packages->transform()) - ->setAuths($command->auths->map( - fn (Cloud\DTO\Auth $auth) => (new Api\Model\AddPipelineComposerAuthCommandInput()) - ->setUrl($auth->url) - ->setToken($auth->token) + ->setComposer(new Api\Model\Composer( + array_merge( + $command->autoload->map( + fn (PSR4AutoloadConfig $autoloadConfig) => (new Api\Model\PipelineAddPipelineComposerPSR4AutoloadCommandInput()) + ->setNamespace($autoloadConfig->namespace) + ->setPaths($autoloadConfig->paths) + ), + $command->packages->transform(), + $command->auths->map( + fn (Cloud\DTO\Auth $auth) => (new Api\Model\PipelineAddPipelineComposerAuthCommandInput()) + ->setUrl($auth->url) + ->setToken($auth->token) + ), + $command->repositories->map( + fn (Cloud\DTO\Repository $repository) => (new Api\Model\PipelineAddPipelineComposerRepositoryCommandInput()) + ->setName($repository->name) + ->setType($repository->type) + ->setUrl($repository->url) + ) + ) )) - ->setRepositories($command->repositories->map( - fn (Cloud\DTO\Repository $repository) => (new Api\Model\AddPipelineComposerRepositoryCommandInput()) - ->setName($repository->name) - ->setType($repository->type) - ->setUrl($repository->url) - )), ); } catch (Api\Exception\DeclarePipelinePipelineCollectionBadRequestException $exception) { throw new Cloud\DeclarePipelineFailedException('Something went wrong while declaring the pipeline. Maybe your client is not up to date, you may want to update your Gyroscops client.', previous: $exception); diff --git a/src/Console/Command/RunCommand.php b/src/Console/Command/RunCommand.php index ffaeca5f..83b03500 100644 --- a/src/Console/Command/RunCommand.php +++ b/src/Console/Command/RunCommand.php @@ -81,7 +81,7 @@ private function pipelineWorker(Console\Style\SymfonyStyle $style, string $cwd, \\ProjectServiceContainer::class => 'container.php', ]); \$autoload->register(); - + \$dotenv = new \\Symfony\\Component\\Dotenv\\Dotenv(); \$dotenv->usePutenv(); @@ -91,7 +91,7 @@ private function pipelineWorker(Console\Style\SymfonyStyle $style, string $cwd, if (file_exists(\$file = '{$cwd}/{$path}/.env')) { \$dotenv->loadEnv(\$file); } - + \$runtime = new \\Kiboko\\Component\\Runtime\\Pipeline\\Console( new \\Symfony\\Component\\Console\\Output\\ConsoleOutput(), new \\Kiboko\\Component\\Pipeline\\Pipeline( @@ -101,12 +101,12 @@ private function pipelineWorker(Console\Style\SymfonyStyle $style, string $cwd, new \\Kiboko\\Contract\\Pipeline\\NullState(), ), ); - + \$satellite = include '{$cwd}/{$path}/{$entrypoint}'; - + \$satellite(\$runtime); \$runtime->run(); - + \$autoload->unregister(); PHP; @@ -153,7 +153,7 @@ private function workflowWorker(Console\Style\SymfonyStyle $style, string $cwd, \\ProjectServiceContainer::class => 'container.php', ]); \$autoload->register(); - + \$dotenv = new \\Symfony\\Component\\Dotenv\\Dotenv(); \$dotenv->usePutenv(); @@ -170,12 +170,12 @@ private function workflowWorker(Console\Style\SymfonyStyle $style, string $cwd, new \\Psr\\Log\\NullLogger() ), ); - + \$satellite = include '{$cwd}/{$path}/{$entrypoint}'; - + \$satellite(\$runtime); \$runtime->run(); - + \$autoload->unregister(); PHP; diff --git a/src/Plugin/Batching/Builder/Fork.php b/src/Plugin/Batching/Builder/Fork.php index 2190c765..d251caa3 100644 --- a/src/Plugin/Batching/Builder/Fork.php +++ b/src/Plugin/Batching/Builder/Fork.php @@ -50,7 +50,7 @@ class: new Node\Stmt\Class_( name: null, subNodes: [ 'implements' => [ - new Node\Name\FullyQualified(\Kiboko\Contract\Pipeline\TransformerInterface::class), + new Node\Name\FullyQualified('Kiboko\\Contract\\Pipeline\\TransformerInterface'), ], 'stmts' => [ new Node\Stmt\ClassMethod( @@ -70,7 +70,7 @@ class: new Node\Stmt\Class_( expr: new Node\Expr\Yield_( new Node\Expr\New_( class: new Node\Name\FullyQualified( - name: \Kiboko\Component\Bucket\AcceptanceResultBucket::class + name: 'Kiboko\\Component\\Bucket\\AcceptanceResultBucket' ), args: [ new Node\Arg( diff --git a/src/Plugin/Batching/Builder/Merge.php b/src/Plugin/Batching/Builder/Merge.php index 038a867d..99c6e006 100644 --- a/src/Plugin/Batching/Builder/Merge.php +++ b/src/Plugin/Batching/Builder/Merge.php @@ -43,8 +43,8 @@ class: new Node\Stmt\Class_( name: null, subNodes: [ 'implements' => [ - new Node\Name\FullyQualified(\Kiboko\Contract\Pipeline\TransformerInterface::class), - new Node\Name\FullyQualified(\Kiboko\Contract\Pipeline\FlushableInterface::class), + new Node\Name\FullyQualified('Kiboko\\Contract\\Pipeline\\TransformerInterface'), + new Node\Name\FullyQualified('Kiboko\\Contract\\Pipeline\\FlushableInterface'), ], 'stmts' => [ new Node\Stmt\Property( @@ -144,7 +144,7 @@ class: new Node\Stmt\Class_( var: new Node\Expr\Variable('line'), expr: new Node\Expr\Yield_( value: new Node\Expr\New_( - class: new Node\Name\FullyQualified(\Kiboko\Component\Bucket\AcceptanceResultBucket::class), + class: new Node\Name\FullyQualified('Kiboko\\Component\\Bucket\\AcceptanceResultBucket'), args: [ new Node\Arg( new Node\Expr\PropertyFetch( @@ -190,7 +190,7 @@ class: new Node\Name\FullyQualified(\Kiboko\Component\Bucket\AcceptanceResultBuc var: new Node\Expr\Variable('line'), expr: new Node\Expr\Yield_( value: new Node\Expr\New_( - class: new Node\Name\FullyQualified(\Kiboko\Component\Bucket\EmptyResultBucket::class) + class: new Node\Name\FullyQualified('Kiboko\\Component\\Bucket\\EmptyResultBucket') ), ), ), @@ -212,7 +212,7 @@ class: new Node\Name\FullyQualified(\Kiboko\Component\Bucket\EmptyResultBucket:: 'stmts' => [ new Node\Stmt\Return_( expr: new Node\Expr\New_( - class: new Node\Name\FullyQualified(\Kiboko\Component\Bucket\AcceptanceResultBucket::class), + class: new Node\Name\FullyQualified('Kiboko\\Component\\Bucket\\AcceptanceResultBucket'), args: [ new Node\Arg( new Node\Expr\PropertyFetch( @@ -224,7 +224,7 @@ class: new Node\Name\FullyQualified(\Kiboko\Component\Bucket\AcceptanceResultBuc ) ), ], - 'returnType' => new Node\Name\FullyQualified(\Kiboko\Contract\Bucket\ResultBucketInterface::class), + 'returnType' => new Node\Name\FullyQualified('Kiboko\\Contract\\Bucket\\ResultBucketInterface'), ], ), ], diff --git a/src/Plugin/FTP/Builder/Loader.php b/src/Plugin/FTP/Builder/Loader.php index 05e21f32..829ed328 100644 --- a/src/Plugin/FTP/Builder/Loader.php +++ b/src/Plugin/FTP/Builder/Loader.php @@ -289,7 +289,7 @@ class: new Node\Stmt\Class_( new Node\Expr\Assign( var: new Node\Expr\Variable('bucket'), expr: new Node\Expr\New_( - class: new Node\Name\FullyQualified(\Kiboko\Component\Bucket\ComplexResultBucket::class) + class: new Node\Name\FullyQualified('Kiboko\Component\Bucket\ComplexResultBucket') ) ) ), diff --git a/src/Plugin/Filtering/Builder/Drop.php b/src/Plugin/Filtering/Builder/Drop.php index 3b0ca092..b78f9976 100644 --- a/src/Plugin/Filtering/Builder/Drop.php +++ b/src/Plugin/Filtering/Builder/Drop.php @@ -96,7 +96,7 @@ public function getNode(): Node return new Node\Expr\New_( class: new Node\Stmt\Class_(null, [ 'implements' => [ - new Node\Name\FullyQualified(TransformerInterface::class), + new Node\Name\FullyQualified('Kiboko\\Contract\\Pipeline\\TransformerInterface'), ], 'stmts' => [ (new Builder\Method('transform')) @@ -123,7 +123,7 @@ class: new Node\Stmt\Class_(null, [ new Node\Expr\Variable('input'), new Node\Expr\Yield_( new Node\Expr\New_( - new Node\Name\FullyQualified(RejectionResultBucket::class), + new Node\Name\FullyQualified('Kiboko\\Component\\Bucket\\RejectionResultBucket'), ), ), ), @@ -137,7 +137,7 @@ class: new Node\Stmt\Class_(null, [ new Node\Expr\Variable('input'), new Node\Expr\Yield_( new Node\Expr\New_( - new Node\Name\FullyQualified(AcceptanceResultBucket::class), + new Node\Name\FullyQualified('Kiboko\\Component\\Bucket\\AcceptanceResultBucket'), [ new Node\Arg(new Node\Expr\Variable('input')), ] diff --git a/src/Plugin/Filtering/Builder/Reject.php b/src/Plugin/Filtering/Builder/Reject.php index 444ec7ec..27bdaf4c 100644 --- a/src/Plugin/Filtering/Builder/Reject.php +++ b/src/Plugin/Filtering/Builder/Reject.php @@ -4,8 +4,6 @@ namespace Kiboko\Component\Satellite\Plugin\Filtering\Builder; -use Kiboko\Component\Bucket\AcceptanceResultBucket; -use Kiboko\Component\Bucket\RejectionResultBucket; use Kiboko\Contract\Configurator\StepBuilderInterface; use Kiboko\Contract\Pipeline\TransformerInterface; use PhpParser\Builder; @@ -96,7 +94,7 @@ public function getNode(): Node return new Node\Expr\New_( class: new Node\Stmt\Class_(null, [ 'implements' => [ - new Node\Name\FullyQualified(TransformerInterface::class), + new Node\Name\FullyQualified('Kiboko\\Contract\\Pipeline\\TransformerInterface'), ], 'stmts' => [ (new Builder\Method('transform')) @@ -123,7 +121,7 @@ class: new Node\Stmt\Class_(null, [ new Node\Expr\Variable('input'), new Node\Expr\Yield_( new Node\Expr\New_( - new Node\Name\FullyQualified(RejectionResultBucket::class), + new Node\Name\FullyQualified('Kiboko\\Component\\Bucket\\RejectionResultBucket'), [ new Node\Arg(new Node\Expr\Variable('input')), ] @@ -140,7 +138,7 @@ class: new Node\Stmt\Class_(null, [ new Node\Expr\Variable('input'), new Node\Expr\Yield_( new Node\Expr\New_( - new Node\Name\FullyQualified(AcceptanceResultBucket::class), + new Node\Name\FullyQualified('Kiboko\\Component\\Bucket\\AcceptanceResultBucket'), [ new Node\Arg(new Node\Expr\Variable('input')), ] diff --git a/src/Plugin/SFTP/Builder/Extractor.php b/src/Plugin/SFTP/Builder/Extractor.php index 79d617ce..ac88ff85 100644 --- a/src/Plugin/SFTP/Builder/Extractor.php +++ b/src/Plugin/SFTP/Builder/Extractor.php @@ -87,7 +87,7 @@ class: new Node\Stmt\Class_( name: null, subNodes: [ 'implements' => [ - new Node\Name\FullyQualified(\Kiboko\Contract\Pipeline\LoaderInterface::class), + new Node\Name\FullyQualified('Kiboko\\Contract\\Pipeline\\LoaderInterface'), ], 'stmts' => [ new Node\Stmt\ClassMethod( @@ -135,7 +135,7 @@ class: new Node\Stmt\Class_( new Node\Expr\Assign( var: new Node\Expr\Variable('bucket'), expr: new Node\Expr\New_( - class: new Node\Name\FullyQualified(\Kiboko\Component\Bucket\ComplexResultBucket::class) + class: new Node\Name\FullyQualified('Kiboko\\Component\\Bucket\\ComplexResultBucket') ) ) ), diff --git a/src/Plugin/SFTP/Builder/Loader.php b/src/Plugin/SFTP/Builder/Loader.php index ef10c89b..5605835c 100644 --- a/src/Plugin/SFTP/Builder/Loader.php +++ b/src/Plugin/SFTP/Builder/Loader.php @@ -87,7 +87,7 @@ class: new Node\Stmt\Class_( name: null, subNodes: [ 'implements' => [ - new Node\Name\FullyQualified(\Kiboko\Contract\Pipeline\LoaderInterface::class), + new Node\Name\FullyQualified('Kiboko\\Contract\\Pipeline\\LoaderInterface'), ], 'stmts' => [ new Node\Stmt\ClassMethod( @@ -135,7 +135,7 @@ class: new Node\Stmt\Class_( new Node\Expr\Assign( var: new Node\Expr\Variable('bucket'), expr: new Node\Expr\New_( - class: new Node\Name\FullyQualified(\Kiboko\Component\Bucket\ComplexResultBucket::class) + class: new Node\Name\FullyQualified('Kiboko\\Component\\Bucket\\ComplexResultBucket') ) ) ), diff --git a/src/Plugin/Stream/Builder/DebugLoader.php b/src/Plugin/Stream/Builder/DebugLoader.php index 29465d20..e519401e 100644 --- a/src/Plugin/Stream/Builder/DebugLoader.php +++ b/src/Plugin/Stream/Builder/DebugLoader.php @@ -39,7 +39,7 @@ public function withState(Node\Expr $state): self public function getNode(): Node { return new Node\Expr\New_( - class: new Node\Name\FullyQualified(\Kiboko\Component\Pipeline\Loader\DebugLoader::class), + class: new Node\Name\FullyQualified('Kiboko\\Component\\Pipeline\\Loader\\DebugLoader'), args: [ new Node\Arg( value: new Node\Expr\FuncCall( diff --git a/src/Plugin/Stream/Builder/JSONStreamLoader.php b/src/Plugin/Stream/Builder/JSONStreamLoader.php index 14ccac66..a05434ba 100644 --- a/src/Plugin/Stream/Builder/JSONStreamLoader.php +++ b/src/Plugin/Stream/Builder/JSONStreamLoader.php @@ -39,7 +39,7 @@ public function withState(Node\Expr $state): self public function getNode(): Node { return new Node\Expr\New_( - class: new Node\Name\FullyQualified(\Kiboko\Component\Pipeline\Loader\JSONStreamLoader::class), + class: new Node\Name\FullyQualified('Kiboko\\Component\\Pipeline\\Loader\\JSONStreamLoader'), args: [ new Node\Arg( value: new Node\Expr\FuncCall( diff --git a/src/Plugin/Stream/Builder/StderrLoader.php b/src/Plugin/Stream/Builder/StderrLoader.php index 9103f887..cc10c56b 100644 --- a/src/Plugin/Stream/Builder/StderrLoader.php +++ b/src/Plugin/Stream/Builder/StderrLoader.php @@ -37,7 +37,7 @@ public function withState(Node\Expr $state): self public function getNode(): Node { return new Node\Expr\New_( - class: new Node\Name\FullyQualified(\Kiboko\Component\Pipeline\Loader\StderrLoader::class), + class: new Node\Name\FullyQualified('Kiboko\\Component\\Pipeline\\Loader\\StderrLoader'), ); } } diff --git a/src/Plugin/Stream/Builder/StdoutLoader.php b/src/Plugin/Stream/Builder/StdoutLoader.php index 0835a0a9..4cceec34 100644 --- a/src/Plugin/Stream/Builder/StdoutLoader.php +++ b/src/Plugin/Stream/Builder/StdoutLoader.php @@ -37,7 +37,7 @@ public function withState(Node\Expr $state): self public function getNode(): Node { return new Node\Expr\New_( - class: new Node\Name\FullyQualified(\Kiboko\Component\Pipeline\Loader\StdoutLoader::class), + class: new Node\Name\FullyQualified('Kiboko\\Component\\Pipeline\\Loader\\StdoutLoader'), ); } } diff --git a/src/Runtime/Pipeline/Runtime.php b/src/Runtime/Pipeline/Runtime.php index 1fd29002..df38dae7 100644 --- a/src/Runtime/Pipeline/Runtime.php +++ b/src/Runtime/Pipeline/Runtime.php @@ -51,7 +51,7 @@ public function build(Builder $builder): array 'params' => [ new Node\Param( var: new Node\Expr\Variable('runtime'), - type: new Node\Name\FullyQualified(\Kiboko\Component\Runtime\Pipeline\PipelineRuntimeInterface::class), + type: new Node\Name\FullyQualified('Kiboko\\Component\\Runtime\\Pipeline\\PipelineRuntimeInterface'), ), ], 'stmts' => [ diff --git a/src/Runtime/Workflow/Runtime.php b/src/Runtime/Workflow/Runtime.php index 847b9ce7..1d61ae30 100644 --- a/src/Runtime/Workflow/Runtime.php +++ b/src/Runtime/Workflow/Runtime.php @@ -48,7 +48,7 @@ public function build(Builder $builder): array 'params' => [ new Node\Param( var: new Node\Expr\Variable('runtime'), - type: new Node\Name\FullyQualified(\Kiboko\Component\Runtime\Workflow\Console::class), + type: new Node\Name\FullyQualified('Kiboko\\Component\\Runtime\\Workflow\\Console'), ), ], 'stmts' => [ From b2f33c88324bb625f73642fa322d04bef8ab26b4 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Tue, 5 Dec 2023 10:54:52 +0100 Subject: [PATCH 5/7] update satellite toolbox and switch use class PropertyPathBuilder --- composer.lock | 185 +++++++++++++++++++++++++++++--- src/Plugin/Batching/Service.php | 2 +- 2 files changed, 174 insertions(+), 13 deletions(-) diff --git a/composer.lock b/composer.lock index 672187c3..207ed5e0 100644 --- a/composer.lock +++ b/composer.lock @@ -1703,29 +1703,30 @@ }, { "name": "php-etl/satellite-toolbox", - "version": "v0.5.1", + "version": "v0.5.2", "source": { "type": "git", "url": "https://github.com/php-etl/satellite-toolbox.git", - "reference": "94552565ade7d29a632672aaed05ec98b623700d" + "reference": "84e2bf19a2bf2f94012f894edcaf48c97a4935f5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-etl/satellite-toolbox/zipball/94552565ade7d29a632672aaed05ec98b623700d", - "reference": "94552565ade7d29a632672aaed05ec98b623700d", + "url": "https://api.github.com/repos/php-etl/satellite-toolbox/zipball/84e2bf19a2bf2f94012f894edcaf48c97a4935f5", + "reference": "84e2bf19a2bf2f94012f894edcaf48c97a4935f5", "shasum": "" }, "require": { - "nikic/php-parser": "^4.10", + "nikic/php-parser": "^4.15", "php": "^8.2", "php-etl/configurator-contracts": "0.8.*", - "symfony/expression-language": "^6.0" + "symfony/expression-language": "^6.0", + "symfony/property-access": "^6.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^3.0", - "infection/infection": "^0.26.18", + "friendsofphp/php-cs-fixer": "^3.38", + "infection/infection": "^0.26", "mikey179/vfsstream": "^1.6", - "php-etl/phpunit-extension": "*", + "php-etl/phpunit-extension": "0.7.*", "phpstan/phpstan": "^1.10", "phpunit/php-invoker": "*", "phpunit/phpunit": "^10.0", @@ -1763,9 +1764,9 @@ "description": "This library aims at building and running lambda PHP functions", "support": { "issues": "https://github.com/php-etl/satellite-toolbox/issues", - "source": "https://github.com/php-etl/satellite-toolbox/tree/v0.5.1" + "source": "https://github.com/php-etl/satellite-toolbox/tree/v0.5.2" }, - "time": "2023-04-20T08:03:07+00:00" + "time": "2023-12-04T15:09:34+00:00" }, { "name": "php-http/client-common", @@ -5982,6 +5983,166 @@ ], "time": "2023-08-07T10:39:22+00:00" }, + { + "name": "symfony/property-access", + "version": "v6.4.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/property-access.git", + "reference": "75f6990ae8e8040dd587162f3f1863f755957129" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/property-access/zipball/75f6990ae8e8040dd587162f3f1863f755957129", + "reference": "75f6990ae8e8040dd587162f3f1863f755957129", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "symfony/deprecation-contracts": "^2.5|^3", + "symfony/property-info": "^5.4|^6.0|^7.0" + }, + "require-dev": { + "symfony/cache": "^5.4|^6.0|^7.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\PropertyAccess\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides functions to read and write from/to an object or array using a simple string notation", + "homepage": "https://symfony.com", + "keywords": [ + "access", + "array", + "extraction", + "index", + "injection", + "object", + "property", + "property-path", + "reflection" + ], + "support": { + "source": "https://github.com/symfony/property-access/tree/v6.4.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-09-25T12:52:38+00:00" + }, + { + "name": "symfony/property-info", + "version": "v6.3.9", + "source": { + "type": "git", + "url": "https://github.com/symfony/property-info.git", + "reference": "664ae7ad443d7cc591ff3e15496b954e4cefe729" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/property-info/zipball/664ae7ad443d7cc591ff3e15496b954e4cefe729", + "reference": "664ae7ad443d7cc591ff3e15496b954e4cefe729", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "symfony/string": "^5.4|^6.0" + }, + "conflict": { + "phpdocumentor/reflection-docblock": "<5.2", + "phpdocumentor/type-resolver": "<1.5.1", + "symfony/dependency-injection": "<5.4" + }, + "require-dev": { + "doctrine/annotations": "^1.10.4|^2", + "phpdocumentor/reflection-docblock": "^5.2", + "phpstan/phpdoc-parser": "^1.0", + "symfony/cache": "^5.4|^6.0", + "symfony/dependency-injection": "^5.4|^6.0", + "symfony/serializer": "^5.4|^6.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\PropertyInfo\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Kévin Dunglas", + "email": "dunglas@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Extracts information about PHP class' properties using metadata of popular sources", + "homepage": "https://symfony.com", + "keywords": [ + "doctrine", + "phpdoc", + "property", + "symfony", + "type", + "validator" + ], + "support": { + "source": "https://github.com/symfony/property-info/tree/v6.3.9" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-11-24T11:57:32+00:00" + }, { "name": "symfony/serializer", "version": "v6.3.8", @@ -9092,5 +9253,5 @@ "ext-json": "*" }, "platform-dev": [], - "plugin-api-version": "2.6.0" + "plugin-api-version": "2.3.0" } diff --git a/src/Plugin/Batching/Service.php b/src/Plugin/Batching/Service.php index d3204bb9..e8f86bdb 100644 --- a/src/Plugin/Batching/Service.php +++ b/src/Plugin/Batching/Service.php @@ -5,7 +5,7 @@ namespace Kiboko\Component\Satellite\Plugin\Batching; // FIXME: hidden dependency to php-etl/fast-map -use Kiboko\Component\FastMap\Compiler\Builder\PropertyPathBuilder; +use Kiboko\Component\SatelliteToolbox\Builder\PropertyPathBuilder; use Kiboko\Component\Satellite\ExpressionLanguage as Satellite; use Kiboko\Component\Satellite\Plugin\Batching\Builder\Fork; use Kiboko\Component\Satellite\Plugin\Batching\Builder\Merge; From 4242650ff5deb380acf051f6645a9cd98e22670b Mon Sep 17 00:00:00 2001 From: Jonathan Date: Tue, 5 Dec 2023 11:25:25 +0100 Subject: [PATCH 6/7] fix string class name, skip a rector rule on files --- rector.php | 16 ++++++++++++++++ src/Action/SFTP/Builder/Action.php | 2 +- src/Builder/Workflow.php | 8 ++++---- src/Builder/Workflow/WorkflowRuntime.php | 4 ++-- src/Feature/Rejection/Builder/Rejection.php | 2 +- src/Pipeline/Loader.php | 4 ++-- src/Pipeline/Transformer.php | 4 ++-- src/Plugin/Batching/Service.php | 3 +-- src/Plugin/Filtering/Builder/Drop.php | 3 --- src/Plugin/Filtering/Builder/Reject.php | 1 - 10 files changed, 29 insertions(+), 18 deletions(-) diff --git a/rector.php b/rector.php index 672403ab..c49752c9 100644 --- a/rector.php +++ b/rector.php @@ -3,7 +3,9 @@ declare(strict_types=1); use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector; +use Rector\CodingStyle\Rector\String_\UseClassKeywordForClassNameResolutionRector; use Rector\Config\RectorConfig; +use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector; use Rector\Set\ValueObject\LevelSetList; use Rector\PHPUnit\Set\PHPUnitLevelSetList; use Rector\Symfony\Set\SymfonyLevelSetList; @@ -20,4 +22,18 @@ PHPUnitLevelSetList::UP_TO_PHPUNIT_100, SymfonyLevelSetList::UP_TO_SYMFONY_60, ]); + + $rectorConfig->skip([StringClassNameToClassConstantRector::class => [ + __DIR__ . '/src/Plugin/Filtering/Builder/Drop.php', + __DIR__ . '/src/Plugin/Filtering/Builder/Reject.php', + __DIR__ . '/src/Plugin/SFTP/Builder/Extractor.php', + __DIR__ . '/src/Plugin/SFTP/Builder/Loader.php', + __DIR__ . '/src/Plugin/Batching/Builder/Fork.php', + __DIR__ . '/src/Plugin/Batching/Builder/Merge.php', + __DIR__ . '/src/Feature/Rejection/Builder/RabbitMQBuilder.php', + __DIR__ . '/src/Feature/Rejection/Builder/Rejection.php', + __DIR__ . '/src/Pipeline/Extractor.php', + __DIR__ . '/src/Pipeline/Loader.php', + __DIR__ . '/src/Pipeline/Transformer.php', + ]]); }; diff --git a/src/Action/SFTP/Builder/Action.php b/src/Action/SFTP/Builder/Action.php index c20bc4d8..98aba4de 100644 --- a/src/Action/SFTP/Builder/Action.php +++ b/src/Action/SFTP/Builder/Action.php @@ -37,7 +37,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, diff --git a/src/Builder/Workflow.php b/src/Builder/Workflow.php index 3ca024b5..6d868baf 100644 --- a/src/Builder/Workflow.php +++ b/src/Builder/Workflow.php @@ -23,7 +23,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)), @@ -37,7 +37,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)), @@ -72,7 +72,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)), @@ -86,7 +86,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)), diff --git a/src/Builder/Workflow/WorkflowRuntime.php b/src/Builder/Workflow/WorkflowRuntime.php index 890032ff..5100c839 100644 --- a/src/Builder/Workflow/WorkflowRuntime.php +++ b/src/Builder/Workflow/WorkflowRuntime.php @@ -12,7 +12,7 @@ final class WorkflowRuntime implements Builder public function getNode(): Node\Expr { return new Node\Expr\New_( - class: new Node\Name\FullyQualified('Kiboko\Component\Runtime\Workflow\Console'), + class: new Node\Name\FullyQualified('Kiboko\\Component\\Runtime\\Workflow\\Console'), args: [ new Node\Arg( value: new Node\Expr\New_( @@ -21,7 +21,7 @@ class: new Node\Name\FullyQualified(\Symfony\Component\Console\Output\ConsoleOut ), 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_( diff --git a/src/Feature/Rejection/Builder/Rejection.php b/src/Feature/Rejection/Builder/Rejection.php index c24df18f..24776a7d 100644 --- a/src/Feature/Rejection/Builder/Rejection.php +++ b/src/Feature/Rejection/Builder/Rejection.php @@ -21,7 +21,7 @@ public function withRejection(Node\Expr $rejection): void private static function nullRejection(): Node\Expr { return new Node\Expr\New_( - new Node\Name\FullyQualified(\Kiboko\Contract\Pipeline\NullRejection::class) + new Node\Name\FullyQualified('Kiboko\\Contract\\Pipeline\\NullRejection') ); } diff --git a/src/Pipeline/Loader.php b/src/Pipeline/Loader.php index 26235559..3092ac15 100644 --- a/src/Pipeline/Loader.php +++ b/src/Pipeline/Loader.php @@ -49,7 +49,7 @@ public function __invoke(array $config, Pipeline $pipeline, StepRepositoryInterf $rejection = $compiled->getBuilder()->getNode(); } else { $rejection = new Node\Expr\New_( - new Node\Name\FullyQualified(\Kiboko\Contract\Pipeline\NullStepRejection::class), + new Node\Name\FullyQualified('Kiboko\\Contract\\Pipeline\\NullStepRejection'), ); } @@ -61,7 +61,7 @@ public function __invoke(array $config, Pipeline $pipeline, StepRepositoryInterf $state = $compiled->getBuilder()->getNode(); } else { $state = new Node\Expr\New_( - new Node\Name\FullyQualified(\Kiboko\Contract\Pipeline\NullStepState::class), + new Node\Name\FullyQualified('Kiboko\\Contract\\Pipeline\\NullStepState'), ); } diff --git a/src/Pipeline/Transformer.php b/src/Pipeline/Transformer.php index 26fcfa0e..42cce201 100644 --- a/src/Pipeline/Transformer.php +++ b/src/Pipeline/Transformer.php @@ -49,7 +49,7 @@ public function __invoke(array $config, Pipeline $pipeline, StepRepositoryInterf $rejection = $compiled->getBuilder()->getNode(); } else { $rejection = new Node\Expr\New_( - new Node\Name\FullyQualified(\Kiboko\Contract\Pipeline\NullStepRejection::class), + new Node\Name\FullyQualified('Kiboko\\Contract\\Pipeline\\NullStepRejection'), ); } @@ -61,7 +61,7 @@ public function __invoke(array $config, Pipeline $pipeline, StepRepositoryInterf $state = $compiled->getBuilder()->getNode(); } else { $state = new Node\Expr\New_( - new Node\Name\FullyQualified(\Kiboko\Contract\Pipeline\NullStepState::class), + new Node\Name\FullyQualified('Kiboko\\Contract\\Pipeline\\NullStepState'), ); } diff --git a/src/Plugin/Batching/Service.php b/src/Plugin/Batching/Service.php index e8f86bdb..5dbea56c 100644 --- a/src/Plugin/Batching/Service.php +++ b/src/Plugin/Batching/Service.php @@ -4,11 +4,10 @@ namespace Kiboko\Component\Satellite\Plugin\Batching; -// FIXME: hidden dependency to php-etl/fast-map -use Kiboko\Component\SatelliteToolbox\Builder\PropertyPathBuilder; use Kiboko\Component\Satellite\ExpressionLanguage as Satellite; use Kiboko\Component\Satellite\Plugin\Batching\Builder\Fork; use Kiboko\Component\Satellite\Plugin\Batching\Builder\Merge; +use Kiboko\Component\SatelliteToolbox\Builder\PropertyPathBuilder; use Kiboko\Contract\Configurator; use PhpParser\Node\Expr\Variable; use Symfony\Component\Config\Definition\Exception as Symfony; diff --git a/src/Plugin/Filtering/Builder/Drop.php b/src/Plugin/Filtering/Builder/Drop.php index b78f9976..26fd3b3b 100644 --- a/src/Plugin/Filtering/Builder/Drop.php +++ b/src/Plugin/Filtering/Builder/Drop.php @@ -4,10 +4,7 @@ namespace Kiboko\Component\Satellite\Plugin\Filtering\Builder; -use Kiboko\Component\Bucket\AcceptanceResultBucket; -use Kiboko\Component\Bucket\RejectionResultBucket; use Kiboko\Contract\Configurator\StepBuilderInterface; -use Kiboko\Contract\Pipeline\TransformerInterface; use PhpParser\Builder; use PhpParser\Node; diff --git a/src/Plugin/Filtering/Builder/Reject.php b/src/Plugin/Filtering/Builder/Reject.php index 27bdaf4c..f9d813e3 100644 --- a/src/Plugin/Filtering/Builder/Reject.php +++ b/src/Plugin/Filtering/Builder/Reject.php @@ -5,7 +5,6 @@ namespace Kiboko\Component\Satellite\Plugin\Filtering\Builder; use Kiboko\Contract\Configurator\StepBuilderInterface; -use Kiboko\Contract\Pipeline\TransformerInterface; use PhpParser\Builder; use PhpParser\Node; From a92594b7d22341ad5ea1f662094b1b1967f15c66 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Wed, 17 Jan 2024 11:30:40 +0100 Subject: [PATCH 7/7] apply rector rule on all files --- rector.php | 14 +------------- src/Pipeline/Extractor.php | 3 ++- src/Pipeline/Loader.php | 3 ++- src/Pipeline/Transformer.php | 3 ++- src/Plugin/Batching/Repository.php | 2 +- 5 files changed, 8 insertions(+), 17 deletions(-) diff --git a/rector.php b/rector.php index c49752c9..bd599e9d 100644 --- a/rector.php +++ b/rector.php @@ -23,17 +23,5 @@ SymfonyLevelSetList::UP_TO_SYMFONY_60, ]); - $rectorConfig->skip([StringClassNameToClassConstantRector::class => [ - __DIR__ . '/src/Plugin/Filtering/Builder/Drop.php', - __DIR__ . '/src/Plugin/Filtering/Builder/Reject.php', - __DIR__ . '/src/Plugin/SFTP/Builder/Extractor.php', - __DIR__ . '/src/Plugin/SFTP/Builder/Loader.php', - __DIR__ . '/src/Plugin/Batching/Builder/Fork.php', - __DIR__ . '/src/Plugin/Batching/Builder/Merge.php', - __DIR__ . '/src/Feature/Rejection/Builder/RabbitMQBuilder.php', - __DIR__ . '/src/Feature/Rejection/Builder/Rejection.php', - __DIR__ . '/src/Pipeline/Extractor.php', - __DIR__ . '/src/Pipeline/Loader.php', - __DIR__ . '/src/Pipeline/Transformer.php', - ]]); + $rectorConfig->skip([StringClassNameToClassConstantRector::class]); }; diff --git a/src/Pipeline/Extractor.php b/src/Pipeline/Extractor.php index 075a7f6d..7e8bca76 100644 --- a/src/Pipeline/Extractor.php +++ b/src/Pipeline/Extractor.php @@ -19,7 +19,8 @@ public function __construct( private ?string $plugin, private ?string $key, private ExpressionLanguage $interpreter = new Satellite\ExpressionLanguage() - ) {} + ) { + } public function __invoke(array $config, Pipeline $pipeline, StepRepositoryInterface $repository): void { diff --git a/src/Pipeline/Loader.php b/src/Pipeline/Loader.php index 3092ac15..ff1fa4bb 100644 --- a/src/Pipeline/Loader.php +++ b/src/Pipeline/Loader.php @@ -19,7 +19,8 @@ public function __construct( private ?string $plugin, private ?string $key, private ExpressionLanguage $interpreter = new Satellite\ExpressionLanguage() - ) {} + ) { + } public function __invoke(array $config, Pipeline $pipeline, StepRepositoryInterface $repository): void { diff --git a/src/Pipeline/Transformer.php b/src/Pipeline/Transformer.php index 42cce201..7b7c3607 100644 --- a/src/Pipeline/Transformer.php +++ b/src/Pipeline/Transformer.php @@ -19,7 +19,8 @@ public function __construct( private ?string $plugin, private ?string $key, private ExpressionLanguage $interpreter = new Satellite\ExpressionLanguage() - ) {} + ) { + } public function __invoke(array $config, Pipeline $pipeline, StepRepositoryInterface $repository): void { diff --git a/src/Plugin/Batching/Repository.php b/src/Plugin/Batching/Repository.php index b9612f53..7c8514d7 100644 --- a/src/Plugin/Batching/Repository.php +++ b/src/Plugin/Batching/Repository.php @@ -15,7 +15,7 @@ public function __construct(private Fork|Merge $builder) { } - public function addFiles(Packaging\FileInterface|Packaging\DirectoryInterface ...$files): self + public function addFiles(Packaging\DirectoryInterface|Packaging\FileInterface ...$files): self { return $this; }