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 Jul 1, 2024
1 parent a18731f commit 96feec6
Show file tree
Hide file tree
Showing 40 changed files with 179 additions and 175 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"php-etl/configurator-contracts": "0.8.*",
"php-etl/satellite-toolbox": "*",
"php-etl/gyroscops-api-client": "^0.3.0",
"php-etl/dockerfile": "*",
"php-etl/dockerfile": "dev-composer-authentication",
"composer/composer": "*",
"symfony/deprecation-contracts": "*",
"react/child-process": "^0.7",
Expand Down
20 changes: 11 additions & 9 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

63 changes: 24 additions & 39 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,41 +1,26 @@
<?xml version="1.0"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd"
backupGlobals="true"
colors="false"
processIsolation="false"
stopOnError="false"
stopOnFailure="false"
stopOnIncomplete="false"
stopOnSkipped="false"
stopOnRisky="false"
timeoutForSmallTests="1"
timeoutForMediumTests="10"
timeoutForLargeTests="60"
cacheDirectory=".phpunit.cache"
backupStaticProperties="false"
requireCoverageMetadata="false">
<testsuites>
<testsuite name="schema">
<directory>tests/schema/</directory>
<exclude>vendor/</exclude>
</testsuite>
<testsuite name="functional">
<directory>tests/functional/</directory>
<exclude>vendor/</exclude>
</testsuite>
<testsuite name="integration">
<directory>tests/integration/</directory>
<exclude>vendor/</exclude>
</testsuite>
</testsuites>
<coverage>
<include>
<directory suffix=".php">src</directory>
</include>
</coverage>
<php>
<ini name="allow_url_include" value="1" />
</php>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.4/phpunit.xsd" backupGlobals="true" colors="false" processIsolation="false" stopOnError="false" stopOnFailure="false" stopOnIncomplete="false" stopOnSkipped="false" stopOnRisky="false" timeoutForSmallTests="1" timeoutForMediumTests="10" timeoutForLargeTests="60" cacheDirectory=".phpunit.cache" backupStaticProperties="false" requireCoverageMetadata="false">
<testsuites>
<testsuite name="schema">
<directory>tests/schema/</directory>
<exclude>vendor/</exclude>
</testsuite>
<testsuite name="functional">
<directory>tests/functional/</directory>
<exclude>vendor/</exclude>
</testsuite>
<testsuite name="integration">
<directory>tests/integration/</directory>
<exclude>vendor/</exclude>
</testsuite>
</testsuites>
<coverage/>
<php>
<ini name="allow_url_include" value="1"/>
</php>
<source>
<include>
<directory suffix=".php">src</directory>
</include>
</source>
</phpunit>
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 / 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 / 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 / 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 @@ -26,7 +25,7 @@ public function __construct(
private ExpressionLanguage $interpreter = new Satellite\ExpressionLanguage()
) {
$this->processor = new Processor();
$this->configuration = new Custom\Configuration();
$this->configuration = new Configuration();
}

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

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

return $actionFactory->compile($config);
}
Expand Down
2 changes: 1 addition & 1 deletion src/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/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
21 changes: 10 additions & 11 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,16 +21,16 @@ 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),
Satellite\Cloud\Command\Workflow\DeclareWorkflowCommand::class => new Satellite\Cloud\Handler\Workflow\DeclareWorkflowCommandHandler($client),
Satellite\Cloud\Command\Workflow\RemoveWorkflowCommand::class => new Satellite\Cloud\Handler\Workflow\RemoveWorkflowCommandHandler($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),
Command\Workflow\DeclareWorkflowCommand::class => new Handler\Workflow\DeclareWorkflowCommandHandler($client),
Command\Workflow\RemoveWorkflowCommand::class => new Handler\Workflow\RemoveWorkflowCommandHandler($client),
]);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Cloud/Context.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use Kiboko\Component\Satellite\Cloud\DTO\OrganizationId;
use Kiboko\Component\Satellite\Cloud\DTO\WorkspaceId;

final readonly class Context
final readonly class Context implements ContextInterface
{
public function __construct(
private Api\Client $client,
Expand Down
19 changes: 19 additions & 0 deletions src/Cloud/ContextInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

declare(strict_types=1);

namespace Kiboko\Component\Satellite\Cloud;

use Kiboko\Component\Satellite\Cloud\DTO\OrganizationId;
use Kiboko\Component\Satellite\Cloud\DTO\WorkspaceId;

interface ContextInterface
{
public function changeOrganization(OrganizationId $organization): void;

public function organization(): OrganizationId;

public function changeWorkspace(WorkspaceId $workspace): void;

public function workspace(): WorkspaceId;
}
12 changes: 5 additions & 7 deletions src/Cloud/DTO/JobList.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@

namespace Kiboko\Component\Satellite\Cloud\DTO;

use Kiboko\Component\Satellite\Cloud\DTO;

readonly class JobList implements \Countable, \IteratorAggregate
{
private array $jobs;

public function __construct(
DTO\Workflow\JobInterface ...$job,
Workflow\JobInterface ...$job,
) {
$this->jobs = $job;
}
Expand All @@ -21,7 +19,7 @@ public function getIterator(): \Traversable
$jobs = $this->jobs;

/* @phpstan-ignore-next-line */
usort($jobs, fn (DTO\Workflow\JobInterface $left, DTO\Workflow\JobInterface $right) => $left->order <=> $right->order);
usort($jobs, fn (Workflow\JobInterface $left, Workflow\JobInterface $right) => $left->order <=> $right->order);

return new \ArrayIterator($jobs);
}
Expand All @@ -31,13 +29,13 @@ public function codes(): array
$jobs = $this->jobs;

/* @phpstan-ignore-next-line */
usort($jobs, fn (DTO\Workflow\JobInterface $left, DTO\Workflow\JobInterface $right) => $left->order <=> $right->order);
usort($jobs, fn (Workflow\JobInterface $left, Workflow\JobInterface $right) => $left->order <=> $right->order);

/* @phpstan-ignore-next-line */
return array_map(fn (DTO\Workflow\JobInterface $job) => $job->code->asString(), $jobs);
return array_map(fn (Workflow\JobInterface $job) => $job->code->asString(), $jobs);
}

public function get(string $code): DTO\Workflow\JobInterface
public function get(string $code): Workflow\JobInterface
{
foreach ($this->jobs as $job) {
if ($job->code->asString() === $code) {
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
2 changes: 1 addition & 1 deletion src/Cloud/Pipeline.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
final readonly class Pipeline implements PipelineInterface
{
public function __construct(
private Context $context,
private ContextInterface $context,
) {
}

Expand Down
Loading

0 comments on commit 96feec6

Please sign in to comment.