Skip to content

Commit

Permalink
code format commit
Browse files Browse the repository at this point in the history
  • Loading branch information
JoMessina committed May 23, 2024
1 parent da3ba77 commit ff3a724
Show file tree
Hide file tree
Showing 34 changed files with 118 additions and 123 deletions.
4 changes: 2 additions & 2 deletions src/Action/ConfigurationApplier.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

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

Check failure on line 14 in src/Action/ConfigurationApplier.php

View workflow job for this annotation

GitHub Actions / phpstan8

Property Kiboko\Component\Satellite\Action\ConfigurationApplier::$packages type has no value type specified in iterable type array.

Check failure on line 14 in src/Action/ConfigurationApplier.php

View workflow job for this annotation

GitHub Actions / phpstan6

Property Kiboko\Component\Satellite\Action\ConfigurationApplier::$packages type has no value type specified in iterable type array.

Check failure on line 14 in src/Action/ConfigurationApplier.php

View workflow job for this annotation

GitHub Actions / phpstan7

Property Kiboko\Component\Satellite\Action\ConfigurationApplier::$packages type has no value type specified in iterable type array.

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

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

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

Expand All @@ -74,7 +74,7 @@ public function compile(array $config): Custom\Factory\Repository\Action

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

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

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

namespace Kiboko\Component\Satellite\Action\Custom;

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

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

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

return $actionFactory->compile($config);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Adapter/ComposerFailureException.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

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

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

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

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

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

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

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

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

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

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

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

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

Expand Down
2 changes: 1 addition & 1 deletion src/Cloud/Auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ final class Auth
private string $pathName;
private array $configuration;

public function __construct(string $pathName = null)
public function __construct(?string $pathName = null)
{
if (null === $pathName) {
$this->pathName = getenv('HOME').'/.gyroscops/';
Expand Down
17 changes: 8 additions & 9 deletions src/Cloud/CommandBus.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace Kiboko\Component\Satellite\Cloud;

use Gyroscops\Api\Client;
use Kiboko\Component\Satellite;
use React\Promise\Deferred;
use React\Promise\PromiseInterface;

Expand All @@ -22,14 +21,14 @@ public function __construct(
public static function withStandardHandlers(Client $client): self
{
return new self([
Satellite\Cloud\Command\Pipeline\DeclarePipelineCommand::class => new Satellite\Cloud\Handler\Pipeline\DeclarePipelineCommandHandler($client),
Satellite\Cloud\Command\Pipeline\AddPipelineComposerPSR4AutoloadCommand::class => new Satellite\Cloud\Handler\Pipeline\AddPipelineComposerPSR4AutoloadCommandHandler($client),
Satellite\Cloud\Command\Pipeline\AppendPipelineStepCommand::class => new Satellite\Cloud\Handler\Pipeline\AppendPipelineStepCommandHandler($client),
Satellite\Cloud\Command\Pipeline\RemovePipelineCommand::class => new Satellite\Cloud\Handler\Pipeline\RemovePipelineCommandHandler($client),
Satellite\Cloud\Command\Pipeline\AddAfterPipelineStepCommand::class => new Satellite\Cloud\Handler\Pipeline\AddAfterPipelineStepCommandHandler($client),
Satellite\Cloud\Command\Pipeline\AddBeforePipelineStepCommand::class => new Satellite\Cloud\Handler\Pipeline\AddBeforePipelineStepCommandHandler($client),
Satellite\Cloud\Command\Pipeline\ReplacePipelineStepCommand::class => new Satellite\Cloud\Handler\Pipeline\ReplacePipelineStepCommandHandler($client),
Satellite\Cloud\Command\Pipeline\RemovePipelineStepCommand::class => new Satellite\Cloud\Handler\Pipeline\RemovePipelineStepCommandHandler($client),
Command\Pipeline\DeclarePipelineCommand::class => new Handler\Pipeline\DeclarePipelineCommandHandler($client),
Command\Pipeline\AddPipelineComposerPSR4AutoloadCommand::class => new Handler\Pipeline\AddPipelineComposerPSR4AutoloadCommandHandler($client),
Command\Pipeline\AppendPipelineStepCommand::class => new Handler\Pipeline\AppendPipelineStepCommandHandler($client),
Command\Pipeline\RemovePipelineCommand::class => new Handler\Pipeline\RemovePipelineCommandHandler($client),
Command\Pipeline\AddAfterPipelineStepCommand::class => new Handler\Pipeline\AddAfterPipelineStepCommandHandler($client),
Command\Pipeline\AddBeforePipelineStepCommand::class => new Handler\Pipeline\AddBeforePipelineStepCommandHandler($client),
Command\Pipeline\ReplacePipelineStepCommand::class => new Handler\Pipeline\ReplacePipelineStepCommandHandler($client),
Command\Pipeline\RemovePipelineStepCommand::class => new Handler\Pipeline\RemovePipelineStepCommandHandler($client),
]);
}

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

class ExpressionNormalizer implements NormalizerInterface
{
public function normalize(mixed $object, string $format = null, array $context = []): string
public function normalize(mixed $object, ?string $format = null, array $context = []): string
{
return (string) $object;
}

public function supportsNormalization(mixed $data, string $format = null): bool
public function supportsNormalization(mixed $data, ?string $format = null): bool
{
return $data instanceof Expression;
}
Expand Down
7 changes: 3 additions & 4 deletions src/ConfigLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@

namespace Kiboko\Component\Satellite;

use Kiboko\Component\Satellite;
use Kiboko\Contract\Configurator\InvalidConfigurationException;
use Symfony\Component\Config;

class ConfigLoader implements Satellite\ConfigLoaderInterface
class ConfigLoader implements ConfigLoaderInterface
{
public function __construct(private readonly string $basePath)
{
Expand Down Expand Up @@ -120,8 +119,8 @@ public function loadFile(string $file): array
$locator = new Config\FileLocator([$this->basePath]);

$loaderResolver = new Config\Loader\LoaderResolver([
new Satellite\Console\Config\YamlFileLoader($locator),
new Satellite\Console\Config\JsonFileLoader($locator),
new Console\Config\YamlFileLoader($locator),
new Console\Config\JsonFileLoader($locator),
]);

$delegatingLoader = new Config\Loader\DelegatingLoader($loaderResolver);
Expand Down
6 changes: 3 additions & 3 deletions src/ExpressionLanguage/Download.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace Kiboko\Component\Satellite\ExpressionLanguage;

use PhpSpec\Locator\Resource;
use Symfony\Component\ExpressionLanguage\ExpressionFunction;

final class Download extends ExpressionFunction
Expand All @@ -27,10 +26,11 @@ function (string $value, string $context = ''): string {
return sprintf($pattern, $value, $context);
},
function (string $value, string $context = '') {
$resource = fopen($context . $value, 'r');
if ($resource === false) {
$resource = fopen($context.$value, 'r');
if (false === $resource) {
throw new \RuntimeException('Could not open file.');
}

return $resource;
},
);
Expand Down
2 changes: 1 addition & 1 deletion src/ExpressionLanguage/ExpressionLanguage.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

final class ExpressionLanguage extends BaseExpressionLanguage
{
public function __construct(CacheItemPoolInterface $cache = null, array $providers = [])
public function __construct(?CacheItemPoolInterface $cache = null, array $providers = [])
{
parent::__construct($cache, [

Check warning on line 14 in src/ExpressionLanguage/ExpressionLanguage.php

View workflow job for this annotation

GitHub Actions / infection

Escaped Mutant for Mutator "ArrayItemRemoval": --- Original +++ New @@ @@ { public function __construct(?CacheItemPoolInterface $cache = null, array $providers = []) { - parent::__construct($cache, [...$providers, new Provider()]); + parent::__construct($cache, [new Provider()]); } }

Check warning on line 14 in src/ExpressionLanguage/ExpressionLanguage.php

View workflow job for this annotation

GitHub Actions / infection

Escaped Mutant for Mutator "MethodCallRemoval": --- Original +++ New @@ @@ { public function __construct(?CacheItemPoolInterface $cache = null, array $providers = []) { - parent::__construct($cache, [...$providers, new Provider()]); + } }
...$providers,
Expand Down
4 changes: 2 additions & 2 deletions src/Feature/Logger/Builder/Monolog/GelfBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function withLevel(string $level): self
return $this;
}

public function withTCPTransport(string $host = null, int $port = null): self
public function withTCPTransport(?string $host = null, ?int $port = null): self
{
$this->transport = 'tcp';
$this->host = $host;
Expand All @@ -34,7 +34,7 @@ public function withTCPTransport(string $host = null, int $port = null): self
return $this;
}

public function withAMQPTransport(string $queue, string $channel, string $vhost, string $host = null, int $port = null, float $timeout = null): self
public function withAMQPTransport(string $queue, string $channel, string $vhost, ?string $host = null, ?int $port = null, ?float $timeout = null): self
{
$this->transport = 'amqp';
$this->queue = $queue;
Expand Down
4 changes: 2 additions & 2 deletions src/Feature/Logger/Factory/ElasticSearchFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function validate(array $config): bool
return false;
}

public function compile(array $config): Logger\Factory\Repository\ElasticSearchRepository
public function compile(array $config): Repository\ElasticSearchRepository
{
$builder = new Logger\Builder\Monolog\ElasticSearchBuilder($this->interpreter);

Expand All @@ -69,6 +69,6 @@ public function compile(array $config): Logger\Factory\Repository\ElasticSearchR
$builder->withIndex($config['index']);
}

return new Logger\Factory\Repository\ElasticSearchRepository($builder);
return new Repository\ElasticSearchRepository($builder);
}
}
4 changes: 2 additions & 2 deletions src/Feature/Logger/Factory/GelfFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function validate(array $config): bool
return false;
}

public function compile(array $config): Logger\Factory\Repository\GelfRepository
public function compile(array $config): Repository\GelfRepository
{
$builder = new Logger\Builder\Monolog\GelfBuilder();

Expand All @@ -74,6 +74,6 @@ public function compile(array $config): Logger\Factory\Repository\GelfRepository
);
}

return new Logger\Factory\Repository\GelfRepository($builder);
return new Repository\GelfRepository($builder);
}
}
4 changes: 2 additions & 2 deletions src/Feature/Logger/Factory/StreamFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function validate(array $config): bool
return false;
}

public function compile(array $config): Logger\Factory\Repository\StreamRepository
public function compile(array $config): Repository\StreamRepository
{
$builder = new Logger\Builder\Monolog\StreamBuilder($config['path']);

Expand All @@ -66,6 +66,6 @@ public function compile(array $config): Logger\Factory\Repository\StreamReposito
$builder->withLocking($config['use_locking']);
}

return new Logger\Factory\Repository\StreamRepository($builder);
return new Repository\StreamRepository($builder);
}
}
4 changes: 2 additions & 2 deletions src/Feature/Logger/Factory/SyslogFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function validate(array $config): bool
return false;
}

public function compile(array $config): Logger\Factory\Repository\SyslogRepository
public function compile(array $config): Repository\SyslogRepository
{
$builder = new Logger\Builder\Monolog\SyslogBuilder($config['ident']);

Expand All @@ -66,6 +66,6 @@ public function compile(array $config): Logger\Factory\Repository\SyslogReposito
$builder->withLogopts($config['logopts']);
}

return new Logger\Factory\Repository\SyslogRepository($builder);
return new Repository\SyslogRepository($builder);
}
}
4 changes: 2 additions & 2 deletions src/Feature/Rejection/Factory/RabbitMQFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function validate(array $config): bool
return false;
}

public function compile(array $config): Rejection\Factory\Repository\RabbitMQRepository
public function compile(array $config): Repository\RabbitMQRepository
{
$builder = new Rejection\Builder\RabbitMQBuilder(
stepUuid: compileValueWhenExpression($this->interpreter, uniqid()),
Expand All @@ -76,6 +76,6 @@ public function compile(array $config): Rejection\Factory\Repository\RabbitMQRep
$builder->withExchange(compileValueWhenExpression($this->interpreter, $config['exchange']));
}

return new Rejection\Factory\Repository\RabbitMQRepository($builder);
return new Repository\RabbitMQRepository($builder);
}
}
Loading

0 comments on commit ff3a724

Please sign in to comment.