Skip to content

Commit

Permalink
Ran php-cs-fixer
Browse files Browse the repository at this point in the history
  • Loading branch information
sebprt committed Jan 10, 2024
1 parent 2c758e4 commit 088a627
Show file tree
Hide file tree
Showing 190 changed files with 555 additions and 350 deletions.
4 changes: 3 additions & 1 deletion src/Action/Action.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@

final readonly class Action
{
public function __construct(private ?string $plugin, private ExpressionLanguage $interpreter = new Satellite\ExpressionLanguage()) {}
public function __construct(private ?string $plugin, private ExpressionLanguage $interpreter = new Satellite\ExpressionLanguage())
{
}

public function __invoke(array $config, ActionBuilder $action, RepositoryInterface $repository): void

Check failure on line 22 in src/Action/Action.php

View workflow job for this annotation

GitHub Actions / phpstan6

Method Kiboko\Component\Satellite\Action\Action::__invoke() has parameter $config with no value type specified in iterable type array.

Check failure on line 22 in src/Action/Action.php

View workflow job for this annotation

GitHub Actions / phpstan8

Method Kiboko\Component\Satellite\Action\Action::__invoke() has parameter $config with no value type specified in iterable type array.

Check failure on line 22 in src/Action/Action.php

View workflow job for this annotation

GitHub Actions / phpstan7

Method Kiboko\Component\Satellite\Action\Action::__invoke() has parameter $config with no value type specified in iterable type array.
{
Expand Down
3 changes: 2 additions & 1 deletion src/Action/ConfigurationApplier.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ public function __construct(
private readonly string $plugin,
private readonly FactoryInterface $service,
private readonly ExpressionLanguage $interpreter,
) {}
) {
}

public function withAction(): self
{
Expand Down
4 changes: 3 additions & 1 deletion src/Action/Custom/Builder/Action.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ final class Action implements ActionBuilderInterface
private ?Node\Expr $logger = null;

Check failure on line 12 in src/Action/Custom/Builder/Action.php

View workflow job for this annotation

GitHub Actions / phpstan5

Property Kiboko\Component\Satellite\Action\Custom\Builder\Action::$logger is never read, only written.

Check failure on line 12 in src/Action/Custom/Builder/Action.php

View workflow job for this annotation

GitHub Actions / phpstan6

Property Kiboko\Component\Satellite\Action\Custom\Builder\Action::$logger is never read, only written.

Check failure on line 12 in src/Action/Custom/Builder/Action.php

View workflow job for this annotation

GitHub Actions / phpstan8

Property Kiboko\Component\Satellite\Action\Custom\Builder\Action::$logger is never read, only written.

Check failure on line 12 in src/Action/Custom/Builder/Action.php

View workflow job for this annotation

GitHub Actions / phpstan7

Property Kiboko\Component\Satellite\Action\Custom\Builder\Action::$logger is never read, only written.
private ?Node\Expr $state = null;

Check failure on line 13 in src/Action/Custom/Builder/Action.php

View workflow job for this annotation

GitHub Actions / phpstan5

Property Kiboko\Component\Satellite\Action\Custom\Builder\Action::$state is never read, only written.

Check failure on line 13 in src/Action/Custom/Builder/Action.php

View workflow job for this annotation

GitHub Actions / phpstan6

Property Kiboko\Component\Satellite\Action\Custom\Builder\Action::$state is never read, only written.

Check failure on line 13 in src/Action/Custom/Builder/Action.php

View workflow job for this annotation

GitHub Actions / phpstan8

Property Kiboko\Component\Satellite\Action\Custom\Builder\Action::$state is never read, only written.

Check failure on line 13 in src/Action/Custom/Builder/Action.php

View workflow job for this annotation

GitHub Actions / phpstan7

Property Kiboko\Component\Satellite\Action\Custom\Builder\Action::$state is never read, only written.

public function __construct(private readonly Node\Expr $service, private readonly string $containerNamespace) {}
public function __construct(private readonly Node\Expr $service, private readonly string $containerNamespace)
{
}

public function withLogger(Node\Expr $logger): self
{
Expand Down
4 changes: 2 additions & 2 deletions src/Action/Custom/Factory/Action.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand All @@ -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;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Action/Custom/Factory/Repository/RepositoryTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
4 changes: 2 additions & 2 deletions src/Action/Custom/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand All @@ -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;
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/Action/SFTP/Builder/Action.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ public function __construct(
private readonly Node\Expr $password,
private readonly Node\Expr $localFilePath,
private readonly Node\Expr $serverFilePath,
) {}
) {
}

public function withLogger(Node\Expr $logger): self
{
Expand Down
6 changes: 3 additions & 3 deletions src/Action/SFTP/Factory/Action.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand All @@ -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;
}
}
Expand All @@ -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);
}
}
Expand Down
6 changes: 4 additions & 2 deletions src/Action/SFTP/Factory/Repository/Repository.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@

final readonly class Repository implements Configurator\RepositoryInterface
{
public function __construct(private Builder\Action $builder) {}
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;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Action/SFTP/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand All @@ -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;
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/Adapter/AdapterChoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
{
public function __construct(

Check failure on line 11 in src/Adapter/AdapterChoice.php

View workflow job for this annotation

GitHub Actions / phpstan6

Method Kiboko\Component\Satellite\Adapter\AdapterChoice::__construct() has parameter $adapters with no value type specified in iterable type array.
private array $adapters,
) {}
) {
}

public function __invoke(array $configuration): Configurator\SatelliteBuilderInterface
{
Expand Down
4 changes: 3 additions & 1 deletion src/Adapter/AdapterNotFoundException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@

namespace Kiboko\Component\Satellite\Adapter;

final class AdapterNotFoundException extends \RuntimeException {}
final class AdapterNotFoundException extends \RuntimeException
{
}
9 changes: 5 additions & 4 deletions src/Adapter/Composer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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();
});

Expand All @@ -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,
);

Expand Down
4 changes: 3 additions & 1 deletion src/Adapter/Docker/FileOrDirectoryNotFoundException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@

namespace Kiboko\Component\Satellite\Adapter\Docker;

class FileOrDirectoryNotFoundException extends \RuntimeException {}
class FileOrDirectoryNotFoundException extends \RuntimeException
{
}
4 changes: 3 additions & 1 deletion src/Adapter/Docker/NetworkInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@

namespace Kiboko\Component\Satellite\Adapter\Docker;

interface NetworkInterface {}
interface NetworkInterface
{
}
13 changes: 7 additions & 6 deletions src/Adapter/Docker/Satellite.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;
}
Expand All @@ -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);

Expand Down Expand Up @@ -73,7 +74,7 @@ public function build(
$command = ['docker', 'build', '--rm', '-', ...iterator_to_array($iterator($this->imageTags))];

$process = new Process(
implode (' ', array_map(fn ($part) => escapeshellarg((string) $part), $command)),
implode(' ', array_map(fn ($part) => escapeshellarg((string) $part), $command)),
$this->workdir,
);

Expand All @@ -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();
});

Expand Down
10 changes: 5 additions & 5 deletions src/Adapter/Docker/SatelliteBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ final class SatelliteBuilder implements Configurator\SatelliteBuilderInterface
private iterable $command = [];
/** @var iterable<string> */
private iterable $tags = [];
private null|PackagingContract\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<array<string, string>> */
private iterable $paths = [];
/** @var \AppendIterator<string,PackagingContract\FileInterface, \Iterator<string,PackagingContract\FileInterface>> */
Expand Down Expand Up @@ -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;
Expand All @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions src/Adapter/FactoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

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

/*
* @deprecated since Satellite 0.4, use Kiboko\Contract\Configurator\Adapter\FactoryInterface instead.
*/
class_alias(\Kiboko\Contract\Configurator\Adapter\FactoryInterface::class, 'Kiboko\\Component\\Satellite\\Adapter\\FactoryInterface');
class_alias(Kiboko\Contract\Configurator\Adapter\FactoryInterface::class, 'Kiboko\\Component\\Satellite\\Adapter\\FactoryInterface');
4 changes: 2 additions & 2 deletions src/Adapter/Filesystem/Satellite.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
10 changes: 5 additions & 5 deletions src/Adapter/Filesystem/SatelliteBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ final class SatelliteBuilder implements Configurator\SatelliteBuilderInterface
];
private array $authenticationTokens = [];
private array $repositories = [];
private null|PackagingContract\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<array<string, string>> */
private iterable $paths = [];

Check failure on line 26 in src/Adapter/Filesystem/SatelliteBuilder.php

View workflow job for this annotation

GitHub Actions / phpstan5

Property Kiboko\Component\Satellite\Adapter\Filesystem\SatelliteBuilder::$paths is never read, only written.
/** @var \AppendIterator<string,PackagingContract\FileInterface, \Iterator<string,PackagingContract\FileInterface>> */
Expand Down Expand Up @@ -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;
Expand All @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions src/Adapter/Tar/Satellite.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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);

Expand Down
Loading

0 comments on commit 088a627

Please sign in to comment.