Missing dependancies
This commit is contained in:
+94
@@ -0,0 +1,94 @@
|
||||
<?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 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName(): string
|
||||
{
|
||||
return $this->fixerOption->getName();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDescription(): string
|
||||
{
|
||||
return $this->fixerOption->getDescription();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function hasDefault(): bool
|
||||
{
|
||||
return $this->fixerOption->hasDefault();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDefault()
|
||||
{
|
||||
return $this->fixerOption->getDefault();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getAllowedTypes(): ?array
|
||||
{
|
||||
return $this->fixerOption->getAllowedTypes();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getAllowedValues(): ?array
|
||||
{
|
||||
return $this->fixerOption->getAllowedValues();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getNormalizer(): ?\Closure
|
||||
{
|
||||
return $this->fixerOption->getNormalizer();
|
||||
}
|
||||
}
|
||||
Vendored
+78
@@ -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 list<(callable(mixed): bool)|null|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
|
||||
);
|
||||
}
|
||||
}
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
<?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 AllowedValueSubset
|
||||
{
|
||||
/**
|
||||
* @var list<string>
|
||||
*/
|
||||
private array $allowedValues;
|
||||
|
||||
/**
|
||||
* @param list<string> $allowedValues
|
||||
*/
|
||||
public function __construct(array $allowedValues)
|
||||
{
|
||||
$this->allowedValues = $allowedValues;
|
||||
sort($this->allowedValues, SORT_FLAG_CASE | SORT_STRING);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
+89
@@ -0,0 +1,89 @@
|
||||
<?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 DeprecatedFixerOption implements DeprecatedFixerOptionInterface
|
||||
{
|
||||
private FixerOptionInterface $option;
|
||||
|
||||
private string $deprecationMessage;
|
||||
|
||||
public function __construct(FixerOptionInterface $option, string $deprecationMessage)
|
||||
{
|
||||
$this->option = $option;
|
||||
$this->deprecationMessage = $deprecationMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName(): string
|
||||
{
|
||||
return $this->option->getName();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDescription(): string
|
||||
{
|
||||
return $this->option->getDescription();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function hasDefault(): bool
|
||||
{
|
||||
return $this->option->hasDefault();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDefault()
|
||||
{
|
||||
return $this->option->getDefault();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getAllowedTypes(): ?array
|
||||
{
|
||||
return $this->option->getAllowedTypes();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getAllowedValues(): ?array
|
||||
{
|
||||
return $this->option->getAllowedValues();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getNormalizer(): ?\Closure
|
||||
{
|
||||
return $this->option->getNormalizer();
|
||||
}
|
||||
|
||||
public function getDeprecationMessage(): string
|
||||
{
|
||||
return $this->deprecationMessage;
|
||||
}
|
||||
}
|
||||
Vendored
+20
@@ -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;
|
||||
}
|
||||
Vendored
+131
@@ -0,0 +1,131 @@
|
||||
<?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\Utils;
|
||||
use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
final class FixerConfigurationResolver implements FixerConfigurationResolverInterface
|
||||
{
|
||||
/**
|
||||
* @var list<FixerOptionInterface>
|
||||
*/
|
||||
private array $options = [];
|
||||
|
||||
/**
|
||||
* @var list<string>
|
||||
*/
|
||||
private array $registeredNames = [];
|
||||
|
||||
/**
|
||||
* @param iterable<FixerOptionInterface> $options
|
||||
*/
|
||||
public function __construct(iterable $options)
|
||||
{
|
||||
foreach ($options as $option) {
|
||||
$this->addOption($option);
|
||||
}
|
||||
|
||||
if (0 === \count($this->registeredNames)) {
|
||||
throw new \LogicException('Options cannot be empty.');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getOptions(): array
|
||||
{
|
||||
return $this->options;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
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 function (/* mixed */ $values) use ($allowedValue) {
|
||||
return $allowedValue($values);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
$resolver->setAllowedValues($name, $allowedValues);
|
||||
}
|
||||
|
||||
$allowedTypes = $option->getAllowedTypes();
|
||||
if (null !== $allowedTypes) {
|
||||
$resolver->setAllowedTypes($name, $allowedTypes);
|
||||
}
|
||||
|
||||
$normalizer = $option->getNormalizer();
|
||||
if (null !== $normalizer) {
|
||||
$resolver->setNormalizer($name, $normalizer);
|
||||
}
|
||||
}
|
||||
|
||||
return $resolver->resolve($configuration);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \LogicException when the option is already defined
|
||||
*/
|
||||
private function addOption(FixerOptionInterface $option): void
|
||||
{
|
||||
$name = $option->getName();
|
||||
|
||||
if (\in_array($name, $this->registeredNames, true)) {
|
||||
throw new \LogicException(sprintf('The "%s" option is defined multiple times.', $name));
|
||||
}
|
||||
|
||||
$this->options[] = $option;
|
||||
$this->registeredNames[] = $name;
|
||||
}
|
||||
}
|
||||
+30
@@ -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;
|
||||
}
|
||||
+162
@@ -0,0 +1,162 @@
|
||||
<?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 FixerOption implements FixerOptionInterface
|
||||
{
|
||||
private string $name;
|
||||
|
||||
private string $description;
|
||||
|
||||
private bool $isRequired;
|
||||
|
||||
/**
|
||||
* @var mixed
|
||||
*/
|
||||
private $default;
|
||||
|
||||
/**
|
||||
* @var null|list<string>
|
||||
*/
|
||||
private $allowedTypes;
|
||||
|
||||
/**
|
||||
* @var null|list<(callable(mixed): bool)|null|scalar>
|
||||
*/
|
||||
private $allowedValues;
|
||||
|
||||
/**
|
||||
* @var null|\Closure
|
||||
*/
|
||||
private $normalizer;
|
||||
|
||||
/**
|
||||
* @param mixed $default
|
||||
* @param null|list<string> $allowedTypes
|
||||
* @param null|list<(callable(mixed): bool)|null|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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName(): string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDescription(): string
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function hasDefault(): bool
|
||||
{
|
||||
return !$this->isRequired;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDefault()
|
||||
{
|
||||
if (!$this->hasDefault()) {
|
||||
throw new \LogicException('No default value defined.');
|
||||
}
|
||||
|
||||
return $this->default;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getAllowedTypes(): ?array
|
||||
{
|
||||
return $this->allowedTypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getAllowedValues(): ?array
|
||||
{
|
||||
return $this->allowedValues;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
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);
|
||||
}
|
||||
}
|
||||
+131
@@ -0,0 +1,131 @@
|
||||
<?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 mixed
|
||||
*/
|
||||
private $default;
|
||||
|
||||
private bool $isRequired = true;
|
||||
|
||||
/**
|
||||
* @var null|list<string>
|
||||
*/
|
||||
private $allowedTypes;
|
||||
|
||||
/**
|
||||
* @var null|list<(callable(mixed): bool)|null|scalar>
|
||||
*/
|
||||
private $allowedValues;
|
||||
|
||||
/**
|
||||
* @var null|\Closure
|
||||
*/
|
||||
private $normalizer;
|
||||
|
||||
/**
|
||||
* @var null|string
|
||||
*/
|
||||
private $deprecationMessage;
|
||||
|
||||
public function __construct(string $name, string $description)
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 list<(callable(mixed): bool)|null|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;
|
||||
}
|
||||
}
|
||||
+43
@@ -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|list<(callable(mixed): bool)|null|scalar>
|
||||
*/
|
||||
public function getAllowedValues(): ?array;
|
||||
|
||||
public function getNormalizer(): ?\Closure;
|
||||
}
|
||||
Vendored
+26
@@ -0,0 +1,26 @@
|
||||
<?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
|
||||
{
|
||||
}
|
||||
Reference in New Issue
Block a user