Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DevKit updates for 2.x branch #508

Merged
merged 3 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"matthiasnoback/symfony-config-test": "^4.2 || ^5.1",
"matthiasnoback/symfony-dependency-injection-test": "^4.0 || ^5.0",
"phpstan/extension-installer": "^1.0",
"phpstan/phpdoc-parser": "^1.0",
"phpstan/phpstan": "^1.0",
"phpstan/phpstan-phpunit": "^1.0",
"phpstan/phpstan-strict-rules": "^1.0",
Expand Down
2 changes: 2 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

use Rector\Config\RectorConfig;
use Rector\Php70\Rector\FunctionLike\ExceptionHandlerTypehintRector;
use Rector\PHPUnit\CodeQuality\Rector\Class_\NarrowUnusedSetUpDefinedPropertyRector;
use Rector\PHPUnit\CodeQuality\Rector\Class_\PreferPHPUnitThisCallRector;
use Rector\PHPUnit\Set\PHPUnitSetList;
use Rector\Set\ValueObject\LevelSetList;
Expand All @@ -40,5 +41,6 @@
$rectorConfig->skip([
ExceptionHandlerTypehintRector::class,
PreferPHPUnitThisCallRector::class,
NarrowUnusedSetUpDefinedPropertyRector::class,
]);
};
4 changes: 2 additions & 2 deletions src/Bridge/Symfony/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ private function addFlashMessageSection(ArrayNodeDefinition $node): void
->defaultValue('standard')
->validate()
->ifNotInArray($validFormTypes = ['standard', 'horizontal'])
->thenInvalid(sprintf(
->thenInvalid(\sprintf(
'The form_type option value must be one of %s',
$validFormTypesString = implode(', ', $validFormTypes)
))
->end()
->info(sprintf('Must be one of %s', $validFormTypesString))
->info(\sprintf('Must be one of %s', $validFormTypesString))
->end()
->end();
}
Expand Down
2 changes: 1 addition & 1 deletion src/EventListener/ResizeFormListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function __construct(
private string $type,
private array $typeOptions = [],
private bool $resizeOnSubmit = false,
private ?\Closure $preSubmitDataCallback = null
private ?\Closure $preSubmitDataCallback = null,
) {
}

Expand Down
2 changes: 1 addition & 1 deletion src/Type/BasePickerType.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ abstract class BasePickerType extends AbstractType implements LocaleAwareInterfa

public function __construct(
private JavaScriptFormatConverter $formatConverter,
private string $locale
private string $locale,
) {
}

Expand Down
4 changes: 2 additions & 2 deletions src/Type/BaseStatusType.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ abstract class BaseStatusType extends AbstractType
public function __construct(
protected string $class,
protected string $getter,
protected string $name
protected string $name,
) {
}

Expand All @@ -46,7 +46,7 @@ public function configureOptions(OptionsResolver $resolver): void
{
$callable = [$this->class, $this->getter];
if (!\is_callable($callable)) {
throw new \RuntimeException(sprintf(
throw new \RuntimeException(\sprintf(
'The class "%s" has no method "%s()".',
$this->class,
$this->getter
Expand Down
118 changes: 59 additions & 59 deletions src/Validator/ErrorElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,61 +20,61 @@
use Symfony\Component\Validator\Context\ExecutionContextInterface;

/**
* @method self assertBic(array $options = [])
* @method self assertBlank(array $options = [])
* @method self assertCallback(array $options = [])
* @method self assertCardScheme(array $options = [])
* @method self assertChoice(array $options = [])
* @method self assertCollection(array $options = [])
* @method self assertCount(array $options = [])
* @method self assertCountry(array $options = [])
* @method self assertCurrency(array $options = [])
* @method self assertDate(array $options = [])
* @method self assertDateTime(array $options = [])
* @method self assertDisableAutoMapping(array $options = [])
* @method self assertDivisibleBy(array $options = [])
* @method self assertEmail(array $options = [])
* @method self assertEnableAutoMapping(array $options = [])
* @method self assertEqualTo(array $options = [])
* @method self assertExpression(array $options = [])
* @method self assertFile(array $options = [])
* @method self assertGreaterThan(array $options = [])
* @method self assertGreaterThanOrEqual(array $options = [])
* @method self assertIban(array $options = [])
* @method self assertIdenticalTo(array $options = [])
* @method self assertImage(array $options = [])
* @method self assertIp(array $options = [])
* @method self assertIsbn(array $options = [])
* @method self assertIsFalse(array $options = [])
* @method self assertIsNull(array $options = [])
* @method self assertIssn(array $options = [])
* @method self assertIsTrue(array $options = [])
* @method self assertJson(array $options = [])
* @method self assertLanguage(array $options = [])
* @method self assertLength(array $options = [])
* @method self assertLessThan(array $options = [])
* @method self assertLessThanOrEqual(array $options = [])
* @method self assertLocale(array $options = [])
* @method self assertLuhn(array $options = [])
* @method self assertNegative(array $options = [])
* @method self assertNegativeOrZero(array $options = [])
* @method self assertNotBlank(array $options = [])
* @method self assertNotCompromisedPassword(array $options = [])
* @method self assertNotEqualTo(array $options = [])
* @method self assertNotIdentificalTo(array $options = [])
* @method self assertNotNull(array $options = [])
* @method self assertPositive(array $options = [])
* @method self assertPositiveOrZero(array $options = [])
* @method self assertRange(array $options = [])
* @method self assertRegex(array $options = [])
* @method self assertTime(array $options = [])
* @method self assertTimezone(array $options = [])
* @method self assertTraverse(array $options = [])
* @method self assertType(array $options = [])
* @method self assertUnique(array $options = [])
* @method self assertUrl(array $options = [])
* @method self assertUuid(array $options = [])
* @method self assertValid(array $options = [])
* @method self assertBic(mixed[] $options = [])
* @method self assertBlank(mixed[] $options = [])
* @method self assertCallback(mixed[] $options = [])
* @method self assertCardScheme(mixed[] $options = [])
* @method self assertChoice(mixed[] $options = [])
* @method self assertCollection(mixed[] $options = [])
* @method self assertCount(mixed[] $options = [])
* @method self assertCountry(mixed[] $options = [])
* @method self assertCurrency(mixed[] $options = [])
* @method self assertDate(mixed[] $options = [])
* @method self assertDateTime(mixed[] $options = [])
* @method self assertDisableAutoMapping(mixed[] $options = [])
* @method self assertDivisibleBy(mixed[] $options = [])
* @method self assertEmail(mixed[] $options = [])
* @method self assertEnableAutoMapping(mixed[] $options = [])
* @method self assertEqualTo(mixed[] $options = [])
* @method self assertExpression(mixed[] $options = [])
* @method self assertFile(mixed[] $options = [])
* @method self assertGreaterThan(mixed[] $options = [])
* @method self assertGreaterThanOrEqual(mixed[] $options = [])
* @method self assertIban(mixed[] $options = [])
* @method self assertIdenticalTo(mixed[] $options = [])
* @method self assertImage(mixed[] $options = [])
* @method self assertIp(mixed[] $options = [])
* @method self assertIsbn(mixed[] $options = [])
* @method self assertIsFalse(mixed[] $options = [])
* @method self assertIsNull(mixed[] $options = [])
* @method self assertIssn(mixed[] $options = [])
* @method self assertIsTrue(mixed[] $options = [])
* @method self assertJson(mixed[] $options = [])
* @method self assertLanguage(mixed[] $options = [])
* @method self assertLength(mixed[] $options = [])
* @method self assertLessThan(mixed[] $options = [])
* @method self assertLessThanOrEqual(mixed[] $options = [])
* @method self assertLocale(mixed[] $options = [])
* @method self assertLuhn(mixed[] $options = [])
* @method self assertNegative(mixed[] $options = [])
* @method self assertNegativeOrZero(mixed[] $options = [])
* @method self assertNotBlank(mixed[] $options = [])
* @method self assertNotCompromisedPassword(mixed[] $options = [])
* @method self assertNotEqualTo(mixed[] $options = [])
* @method self assertNotIdentificalTo(mixed[] $options = [])
* @method self assertNotNull(mixed[] $options = [])
* @method self assertPositive(mixed[] $options = [])
* @method self assertPositiveOrZero(mixed[] $options = [])
* @method self assertRange(mixed[] $options = [])
* @method self assertRegex(mixed[] $options = [])
* @method self assertTime(mixed[] $options = [])
* @method self assertTimezone(mixed[] $options = [])
* @method self assertTraverse(mixed[] $options = [])
* @method self assertType(mixed[] $options = [])
* @method self assertUnique(mixed[] $options = [])
* @method self assertUrl(mixed[] $options = [])
* @method self assertUuid(mixed[] $options = [])
* @method self assertValid(mixed[] $options = [])
*/
final class ErrorElement
{
Expand Down Expand Up @@ -102,7 +102,7 @@ final class ErrorElement
public function __construct(
private mixed $subject,
private ExecutionContextInterface $context,
private ?string $group
private ?string $group,
) {
$this->basePropertyPath = $this->context->getPropertyPath();
}
Expand Down Expand Up @@ -157,7 +157,7 @@ public function getFullPropertyPath(): string
{
$propertyPath = $this->getCurrentPropertyPath();
if (null !== $propertyPath) {
return sprintf('%s.%s', $this->basePropertyPath, (string) $propertyPath);
return \sprintf('%s.%s', $this->basePropertyPath, (string) $propertyPath);
}

return $this->basePropertyPath;
Expand Down Expand Up @@ -236,15 +236,15 @@ private function newConstraint(string $name, array $options = []): Constraint
} else {
$className = 'Symfony\\Component\\Validator\\Constraints\\'.$name;
if (!class_exists($className)) {
throw new \RuntimeException(sprintf(
throw new \RuntimeException(\sprintf(
'Cannot find the class "%s".',
$className
));
}
}

if (!is_a($className, Constraint::class, true)) {
throw new \RuntimeException(sprintf(
throw new \RuntimeException(\sprintf(
'The class "%s" MUST implement "%s".',
$className,
Constraint::class
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function testHorizontalFormTypeMeansNoWrapping(): void
public function testPrepend(): void
{
$containerBuilder = new ContainerBuilder();
$containerBuilder->registerExtension(new class() extends Extension {
$containerBuilder->registerExtension(new class extends Extension {
public function load(array $configs, ContainerBuilder $container): void
{
}
Expand Down
2 changes: 1 addition & 1 deletion tests/EventListener/FixCheckboxDataListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function testFixCheckbox(
mixed $data,
mixed $expected,
?EventSubscriberInterface $subscriber,
BooleanToStringTransformer $transformer
BooleanToStringTransformer $transformer,
): void {
$dispatcher = new EventDispatcher();

Expand Down
4 changes: 2 additions & 2 deletions tests/Type/ImmutableArrayTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ public function testCallback(): void

$optionsCallback = static function (FormBuilderInterface $builder, string $name, string $type, array $extra): array {
static::assertSame(['foo', 'bar'], $extra);
static::assertSame($name, 'ttl');
static::assertSame($type, TextType::class);
static::assertSame('ttl', $name);
static::assertSame(TextType::class, $type);
static::assertInstanceOf(TestFormBuilderInterface::class, $builder);

return ['1' => '1'];
Expand Down
4 changes: 2 additions & 2 deletions tests/Validator/Constraints/InlineConstraintTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ public function testStandardSerialization(): void

$constraint = unserialize($data);

static::assertSame($constraint->getService(), 'foo');
static::assertSame($constraint->getMethod(), 'bar');
static::assertSame('foo', $constraint->getService());
static::assertSame('bar', $constraint->getMethod());
static::assertFalse($constraint->getSerializingWarning());
}

Expand Down
Loading