Fix bin/publish: copy docs.dist from project root

Fix bin/publish: use correct .env path for rspade_system
Fix bin/publish script: prevent grep exit code 1 from terminating script

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
root
2025-10-21 02:08:33 +00:00
commit f6fac6c4bc
79758 changed files with 10547827 additions and 0 deletions

View File

@@ -0,0 +1,75 @@
<?php
declare(strict_types=1);
/*
* This file is part of PHP CS Fixer.
*
* (c) Fabien Potencier <fabien@symfony.com>
* Dariusz Rumiński <dariusz.ruminski@gmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace PhpCsFixer\FixerConfiguration;
/**
* @author ntzm
*
* @readonly
*
* @internal
*/
final class AliasedFixerOption implements FixerOptionInterface
{
private FixerOptionInterface $fixerOption;
private string $alias;
public function __construct(FixerOptionInterface $fixerOption, string $alias)
{
$this->fixerOption = $fixerOption;
$this->alias = $alias;
}
public function getAlias(): string
{
return $this->alias;
}
public function getName(): string
{
return $this->fixerOption->getName();
}
public function getDescription(): string
{
return $this->fixerOption->getDescription();
}
public function hasDefault(): bool
{
return $this->fixerOption->hasDefault();
}
public function getDefault()
{
return $this->fixerOption->getDefault();
}
public function getAllowedTypes(): ?array
{
return $this->fixerOption->getAllowedTypes();
}
public function getAllowedValues(): ?array
{
return $this->fixerOption->getAllowedValues();
}
public function getNormalizer(): ?\Closure
{
return $this->fixerOption->getNormalizer();
}
}

View File

@@ -0,0 +1,78 @@
<?php
declare(strict_types=1);
/*
* This file is part of PHP CS Fixer.
*
* (c) Fabien Potencier <fabien@symfony.com>
* Dariusz Rumiński <dariusz.ruminski@gmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace PhpCsFixer\FixerConfiguration;
/**
* @author ntzm
*
* @internal
*/
final class AliasedFixerOptionBuilder
{
private FixerOptionBuilder $optionBuilder;
private string $alias;
public function __construct(FixerOptionBuilder $optionBuilder, string $alias)
{
$this->optionBuilder = $optionBuilder;
$this->alias = $alias;
}
/**
* @param mixed $default
*/
public function setDefault($default): self
{
$this->optionBuilder->setDefault($default);
return $this;
}
/**
* @param list<string> $allowedTypes
*/
public function setAllowedTypes(array $allowedTypes): self
{
$this->optionBuilder->setAllowedTypes($allowedTypes);
return $this;
}
/**
* @param non-empty-list<null|(callable(mixed): bool)|scalar> $allowedValues
*/
public function setAllowedValues(array $allowedValues): self
{
$this->optionBuilder->setAllowedValues($allowedValues);
return $this;
}
public function setNormalizer(\Closure $normalizer): self
{
$this->optionBuilder->setNormalizer($normalizer);
return $this;
}
public function getOption(): AliasedFixerOption
{
return new AliasedFixerOption(
$this->optionBuilder->getOption(),
$this->alias
);
}
}

View File

@@ -0,0 +1,65 @@
<?php
declare(strict_types=1);
/*
* This file is part of PHP CS Fixer.
*
* (c) Fabien Potencier <fabien@symfony.com>
* Dariusz Rumiński <dariusz.ruminski@gmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace PhpCsFixer\FixerConfiguration;
/**
* @readonly
*
* @internal
*/
final class AllowedValueSubset
{
/**
* @var list<string>
*/
private array $allowedValues;
/**
* @param list<string> $allowedValues
*/
public function __construct(array $allowedValues)
{
sort($allowedValues, \SORT_FLAG_CASE | \SORT_STRING);
$this->allowedValues = $allowedValues;
}
/**
* Checks whether the given values are a subset of the allowed ones.
*
* @param mixed $values the value to validate
*/
public function __invoke($values): bool
{
if (!\is_array($values)) {
return false;
}
foreach ($values as $value) {
if (!\in_array($value, $this->allowedValues, true)) {
return false;
}
}
return true;
}
/**
* @return list<string>
*/
public function getAllowedValues(): array
{
return $this->allowedValues;
}
}

View File

@@ -0,0 +1,74 @@
<?php
declare(strict_types=1);
/*
* This file is part of PHP CS Fixer.
*
* (c) Fabien Potencier <fabien@symfony.com>
* Dariusz Rumiński <dariusz.ruminski@gmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace PhpCsFixer\FixerConfiguration;
/**
* @readonly
*/
final class DeprecatedFixerOption implements DeprecatedFixerOptionInterface
{
private FixerOptionInterface $option;
private string $deprecationMessage;
public function __construct(FixerOptionInterface $option, string $deprecationMessage)
{
$this->option = $option;
$this->deprecationMessage = $deprecationMessage;
}
public function getName(): string
{
return $this->option->getName();
}
public function getDescription(): string
{
return $this->option->getDescription();
}
public function hasDefault(): bool
{
return $this->option->hasDefault();
}
/**
* @return mixed
*/
public function getDefault()
{
return $this->option->getDefault();
}
public function getAllowedTypes(): ?array
{
return $this->option->getAllowedTypes();
}
public function getAllowedValues(): ?array
{
return $this->option->getAllowedValues();
}
public function getNormalizer(): ?\Closure
{
return $this->option->getNormalizer();
}
public function getDeprecationMessage(): string
{
return $this->deprecationMessage;
}
}

View File

@@ -0,0 +1,20 @@
<?php
declare(strict_types=1);
/*
* This file is part of PHP CS Fixer.
*
* (c) Fabien Potencier <fabien@symfony.com>
* Dariusz Rumiński <dariusz.ruminski@gmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace PhpCsFixer\FixerConfiguration;
interface DeprecatedFixerOptionInterface extends FixerOptionInterface
{
public function getDeprecationMessage(): string;
}

View File

@@ -0,0 +1,152 @@
<?php
declare(strict_types=1);
/*
* This file is part of PHP CS Fixer.
*
* (c) Fabien Potencier <fabien@symfony.com>
* Dariusz Rumiński <dariusz.ruminski@gmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace PhpCsFixer\FixerConfiguration;
use PhpCsFixer\Preg;
use PhpCsFixer\Utils;
use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
* @readonly
*/
final class FixerConfigurationResolver implements FixerConfigurationResolverInterface
{
/**
* @var list<FixerOptionInterface>
*
* @readonly
*/
private array $options;
/**
* @param iterable<FixerOptionInterface> $options
*/
public function __construct(iterable $options)
{
$fixerOptionSorter = new FixerOptionSorter();
$this->validateOptions($options);
$this->options = $fixerOptionSorter->sort($options);
if (0 === \count($this->options)) {
throw new \LogicException('Options cannot be empty.');
}
}
public function getOptions(): array
{
return $this->options;
}
public function resolve(array $configuration): array
{
$resolver = new OptionsResolver();
foreach ($this->options as $option) {
$name = $option->getName();
if ($option instanceof AliasedFixerOption) {
$alias = $option->getAlias();
if (\array_key_exists($alias, $configuration)) {
if (\array_key_exists($name, $configuration)) {
throw new InvalidOptionsException(\sprintf('Aliased option "%s"/"%s" is passed multiple times.', $name, $alias));
}
Utils::triggerDeprecation(new \RuntimeException(\sprintf(
'Option "%s" is deprecated, use "%s" instead.',
$alias,
$name
)));
$configuration[$name] = $configuration[$alias];
unset($configuration[$alias]);
}
}
if ($option->hasDefault()) {
$resolver->setDefault($name, $option->getDefault());
} else {
$resolver->setRequired($name);
}
$allowedValues = $option->getAllowedValues();
if (null !== $allowedValues) {
foreach ($allowedValues as &$allowedValue) {
if (\is_object($allowedValue) && \is_callable($allowedValue)) {
$allowedValue = static fn (/* mixed */ $values) => $allowedValue($values);
}
}
$resolver->setAllowedValues($name, $allowedValues);
}
$allowedTypes = $option->getAllowedTypes();
if (null !== $allowedTypes) {
$allowedTypesNormalised = array_map(
static function (string $type): string {
// Symfony OptionsResolver doesn't support `array<foo, bar>` natively, let's simplify the type
$matches = [];
if (true === Preg::match('/array<\w+,\s*(\??[\w\'|]+)>/', $type, $matches)) {
if ('?' === $matches[1][0]) {
return 'array';
}
if ("'" === $matches[1][0]) {
return 'string[]';
}
return $matches[1].'[]';
}
// Symfony OptionsResolver doesn't support 'class-string' natively, let's simplify the type
return str_replace('class-string', 'string', $type);
},
$allowedTypes,
);
$resolver->setAllowedTypes($name, $allowedTypesNormalised);
}
$normalizer = $option->getNormalizer();
if (null !== $normalizer) {
$resolver->setNormalizer($name, $normalizer);
}
}
return $resolver->resolve($configuration);
}
/**
* @param iterable<FixerOptionInterface> $options
*
* @throws \LogicException when the option is already defined
*/
private function validateOptions(iterable $options): void
{
$names = [];
foreach ($options as $option) {
$name = $option->getName();
if (\in_array($name, $names, true)) {
throw new \LogicException(\sprintf('The "%s" option is defined multiple times.', $name));
}
$names[] = $name;
}
}
}

View File

@@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
/*
* This file is part of PHP CS Fixer.
*
* (c) Fabien Potencier <fabien@symfony.com>
* Dariusz Rumiński <dariusz.ruminski@gmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace PhpCsFixer\FixerConfiguration;
interface FixerConfigurationResolverInterface
{
/**
* @return list<FixerOptionInterface>
*/
public function getOptions(): array;
/**
* @param array<string, mixed> $configuration
*
* @return array<string, mixed>
*/
public function resolve(array $configuration): array;
}

View File

@@ -0,0 +1,146 @@
<?php
declare(strict_types=1);
/*
* This file is part of PHP CS Fixer.
*
* (c) Fabien Potencier <fabien@symfony.com>
* Dariusz Rumiński <dariusz.ruminski@gmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace PhpCsFixer\FixerConfiguration;
/**
* @readonly
*/
final class FixerOption implements FixerOptionInterface
{
private string $name;
private string $description;
private bool $isRequired;
/**
* @var mixed
*/
private $default;
/**
* @var null|list<string>
*/
private ?array $allowedTypes;
/**
* @var null|non-empty-list<null|(callable(mixed): bool)|scalar>
*/
private ?array $allowedValues;
private ?\Closure $normalizer;
/**
* @param mixed $default
* @param null|list<string> $allowedTypes
* @param null|non-empty-list<null|(callable(mixed): bool)|scalar> $allowedValues
*/
public function __construct(
string $name,
string $description,
bool $isRequired = true,
$default = null,
?array $allowedTypes = null,
?array $allowedValues = null,
?\Closure $normalizer = null
) {
if ($isRequired && null !== $default) {
throw new \LogicException('Required options cannot have a default value.');
}
if (null !== $allowedValues) {
foreach ($allowedValues as &$allowedValue) {
if ($allowedValue instanceof \Closure) {
$allowedValue = $this->unbind($allowedValue);
}
}
}
$this->name = $name;
$this->description = $description;
$this->isRequired = $isRequired;
$this->default = $default;
$this->allowedTypes = $allowedTypes;
$this->allowedValues = $allowedValues;
if (null !== $normalizer) {
$this->normalizer = $this->unbind($normalizer);
} else {
$this->normalizer = null;
}
}
public function getName(): string
{
return $this->name;
}
public function getDescription(): string
{
return $this->description;
}
public function hasDefault(): bool
{
return !$this->isRequired;
}
/**
* @return mixed
*/
public function getDefault()
{
if (!$this->hasDefault()) {
throw new \LogicException('No default value defined.');
}
return $this->default;
}
public function getAllowedTypes(): ?array
{
return $this->allowedTypes;
}
public function getAllowedValues(): ?array
{
return $this->allowedValues;
}
public function getNormalizer(): ?\Closure
{
return $this->normalizer;
}
/**
* Unbinds the given closure to avoid memory leaks.
*
* The closures provided to this class were probably defined in a fixer
* class and thus bound to it by default. The configuration will then be
* stored in {@see AbstractFixer::$configurationDefinition}, leading to the
* following cyclic reference:
*
* fixer -> configuration definition -> options -> closures -> fixer
*
* This cyclic reference prevent the garbage collector to free memory as
* all elements are still referenced.
*
* See {@see https://bugs.php.net/bug.php?id=69639 Bug #69639} for details.
*/
private function unbind(\Closure $closure): \Closure
{
return $closure->bindTo(null);
}
}

View File

@@ -0,0 +1,126 @@
<?php
declare(strict_types=1);
/*
* This file is part of PHP CS Fixer.
*
* (c) Fabien Potencier <fabien@symfony.com>
* Dariusz Rumiński <dariusz.ruminski@gmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace PhpCsFixer\FixerConfiguration;
final class FixerOptionBuilder
{
private string $name;
private string $description;
/**
* @var null|mixed
*/
private $default;
private bool $isRequired = true;
/**
* @var null|list<string>
*/
private ?array $allowedTypes = null;
/**
* @var null|non-empty-list<null|(callable(mixed): bool)|scalar>
*/
private ?array $allowedValues = null;
private ?\Closure $normalizer = null;
private ?string $deprecationMessage = null;
public function __construct(string $name, string $description)
{
$this->name = $name;
$this->description = $description;
$this->default = null;
}
/**
* @param mixed $default
*
* @return $this
*/
public function setDefault($default): self
{
$this->default = $default;
$this->isRequired = false;
return $this;
}
/**
* @param list<string> $allowedTypes
*
* @return $this
*/
public function setAllowedTypes(array $allowedTypes): self
{
$this->allowedTypes = $allowedTypes;
return $this;
}
/**
* @param non-empty-list<null|(callable(mixed): bool)|scalar> $allowedValues
*
* @return $this
*/
public function setAllowedValues(array $allowedValues): self
{
$this->allowedValues = $allowedValues;
return $this;
}
/**
* @return $this
*/
public function setNormalizer(\Closure $normalizer): self
{
$this->normalizer = $normalizer;
return $this;
}
/**
* @return $this
*/
public function setDeprecationMessage(?string $deprecationMessage): self
{
$this->deprecationMessage = $deprecationMessage;
return $this;
}
public function getOption(): FixerOptionInterface
{
$option = new FixerOption(
$this->name,
$this->description,
$this->isRequired,
$this->default,
$this->allowedTypes,
$this->allowedValues,
$this->normalizer
);
if (null !== $this->deprecationMessage) {
$option = new DeprecatedFixerOption($option, $this->deprecationMessage);
}
return $option;
}
}

View File

@@ -0,0 +1,43 @@
<?php
declare(strict_types=1);
/*
* This file is part of PHP CS Fixer.
*
* (c) Fabien Potencier <fabien@symfony.com>
* Dariusz Rumiński <dariusz.ruminski@gmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace PhpCsFixer\FixerConfiguration;
interface FixerOptionInterface
{
public function getName(): string;
public function getDescription(): string;
public function hasDefault(): bool;
/**
* @return mixed
*
* @throws \LogicException when no default value is defined
*/
public function getDefault();
/**
* @return null|list<string>
*/
public function getAllowedTypes(): ?array;
/**
* @return null|non-empty-list<null|(callable(mixed): bool)|scalar>
*/
public function getAllowedValues(): ?array;
public function getNormalizer(): ?\Closure;
}

View File

@@ -0,0 +1,37 @@
<?php
declare(strict_types=1);
/*
* This file is part of PHP CS Fixer.
*
* (c) Fabien Potencier <fabien@symfony.com>
* Dariusz Rumiński <dariusz.ruminski@gmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace PhpCsFixer\FixerConfiguration;
/**
* @internal
*/
final class FixerOptionSorter
{
/**
* @param iterable<FixerOptionInterface> $options
*
* @return list<FixerOptionInterface>
*/
public function sort(iterable $options): array
{
if (!\is_array($options)) {
$options = iterator_to_array($options, false);
}
usort($options, static fn (FixerOptionInterface $a, FixerOptionInterface $b): int => $a->getName() <=> $b->getName());
return $options;
}
}

View File

@@ -0,0 +1,24 @@
<?php
declare(strict_types=1);
/*
* This file is part of PHP CS Fixer.
*
* (c) Fabien Potencier <fabien@symfony.com>
* Dariusz Rumiński <dariusz.ruminski@gmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace PhpCsFixer\FixerConfiguration;
use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException;
/**
* @author Dariusz Rumiński <dariusz.ruminski@gmail.com>
*
* @internal
*/
final class InvalidOptionsForEnvException extends InvalidOptionsException {}