Skip to content

Commit

Permalink
chore(cs): fix cs with new php cs fixer version
Browse files Browse the repository at this point in the history
  • Loading branch information
joelwurtz committed Oct 16, 2023
1 parent db74d00 commit 0385af4
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 33 deletions.
2 changes: 1 addition & 1 deletion src/Attribute/AsCommandArgument.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
abstract class AsCommandArgument
{
public function __construct(
public readonly string|null $name = null,
public readonly null|string $name = null,
) {}
}
4 changes: 2 additions & 2 deletions src/Attribute/AsOption.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ class AsOption extends AsCommandArgument
*/
public function __construct(
string $name = null,
public readonly string|array|null $shortcut = null,
public readonly int|null $mode = null,
public readonly null|array|string $shortcut = null,
public readonly null|int $mode = null,
public readonly string $description = '',
public readonly array $suggestedValues = [],
) {
Expand Down
4 changes: 2 additions & 2 deletions src/Attribute/AsTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ class AsTask
*/
public function __construct(
public string $name = '',
public string|null $namespace = null,
public null|string $namespace = null,
public string $description = '',
public array $aliases = [],
public array $onSignals = [],
public string|bool $enabled = true,
public bool|string $enabled = true,
) {}
}
2 changes: 1 addition & 1 deletion src/Console/Command/TaskCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function getSubscribedSignals(): array
return array_keys($this->taskAttribute->onSignals);
}

public function handleSignal(int $signal): int|false
public function handleSignal(int $signal): false|int
{
if (!\array_key_exists($signal, $this->taskAttribute->onSignals)) {
return false;
Expand Down
4 changes: 2 additions & 2 deletions src/Context.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function __construct(
string $currentDirectory = null,
public readonly bool $tty = false,
public readonly bool $pty = true,
public readonly float|null $timeout = 60,
public readonly null|float $timeout = 60,
public readonly bool $quiet = false,
public readonly bool $allowFailure = false,
public readonly bool $notify = false,
Expand Down Expand Up @@ -108,7 +108,7 @@ public function withPty(bool $pty = true): self
);
}

public function withTimeout(float|null $timeout): self
public function withTimeout(null|float $timeout): self
{
return new self(
$this->data,
Expand Down
6 changes: 3 additions & 3 deletions src/GlobalHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class GlobalHelper
private static Context $initialContext;
private static Filesystem $fs;
private static HttpClientInterface $httpClient;
private static CacheItemPoolInterface&CacheInterface $cache;
private static CacheInterface&CacheItemPoolInterface $cache;
private static ExpressionLanguage $expressionLanguage;

public static function setApplication(Application $application): void
Expand Down Expand Up @@ -162,12 +162,12 @@ public static function getHttpClient(): HttpClientInterface
]);
}

public static function setCache(CacheItemPoolInterface&CacheInterface $cache): void
public static function setCache(CacheInterface&CacheItemPoolInterface $cache): void
{
self::$cache = $cache;
}

public static function getCache(): CacheItemPoolInterface&CacheInterface
public static function getCache(): CacheInterface&CacheItemPoolInterface
{
return self::$cache ?? throw new \LogicException('Cache not available yet.');
}
Expand Down
2 changes: 1 addition & 1 deletion src/PlatformUtil.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class PlatformUtil extends OsHelper
/**
* getenv() equivalent but reads from the runtime global variables first.
*/
public static function getEnv(string $name): string|false
public static function getEnv(string $name): false|string
{
if (\array_key_exists($name, $_SERVER)) {
return (string) $_SERVER[$name];
Expand Down
4 changes: 2 additions & 2 deletions src/SectionOutput.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ class SectionOutput
{
private const COLORS = ['black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white', 'default'];

private OutputInterface|ConsoleSectionOutput $consoleOutput;
private ConsoleSectionOutput|OutputInterface $consoleOutput;

private ConsoleOutput|null $mainOutput;
private null|ConsoleOutput $mainOutput;

/** @var \SplObjectStorage<Process, SectionDetails> */
private \SplObjectStorage $sections;
Expand Down
10 changes: 5 additions & 5 deletions src/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ function parallel(callable ...$callbacks): array
* @param (callable(string, string, Process) :void)|null $callback
*/
function run(
string|array $command,
array|string $command,
array $environment = null,
string $path = null,
bool $tty = null,
Expand Down Expand Up @@ -217,7 +217,7 @@ function run(
* @param array<string, string|\Stringable|int>|null $environment
*/
function capture(
string|array $command,
array|string $command,
array $environment = null,
string $path = null,
float $timeout = null,
Expand Down Expand Up @@ -255,7 +255,7 @@ function capture(
* @param array<string, string|\Stringable|int>|null $environment
*/
function exit_code(
string|array $command,
array|string $command,
array $environment = null,
string $path = null,
float $timeout = null,
Expand Down Expand Up @@ -465,7 +465,7 @@ function notify(string $message): void
* @param string|non-empty-array<string> $path
* @param (callable(string, string) : (false|void|null)) $function
*/
function watch(string|array $path, callable $function, Context $context = null): void
function watch(array|string $path, callable $function, Context $context = null): void
{
if (\is_array($path)) {
$parallelCallbacks = [];
Expand Down Expand Up @@ -667,7 +667,7 @@ function cache(string $key, callable $or): mixed
return GlobalHelper::getCache()->get($key, $or);
}

function get_cache(): CacheItemPoolInterface&CacheInterface
function get_cache(): CacheInterface&CacheItemPoolInterface
{
return GlobalHelper::getCache();
}
Expand Down
26 changes: 12 additions & 14 deletions tools/php-cs-fixer/composer.lock

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

0 comments on commit 0385af4

Please sign in to comment.