10BC0 PHP CS Fixer: enable `@PHP8x1Migration:risky` by keradus · Pull Request #63198 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Revert "temporary apply not-yet-solved CS issues"
This reverts commit e030c4e.
  • Loading branch information
keradus committed Jan 28, 2026
commit 476787e3bfe328aa23411e08a18d6668e89cdb1c
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,18 @@ protected function bootstrapProvider(): DoctrineTokenProvider
'password' => 'password',
], $config);
$connection->executeStatement(<<<'SQL'
DROP TABLE IF EXISTS rememberme_token;
SQL);
DROP TABLE IF EXISTS rememberme_token;
SQL);

$connection->executeStatement(<<<'SQL'
CREATE TABLE rememberme_token (
series CHAR(88) UNIQUE PRIMARY KEY NOT NULL,
value VARCHAR(88) NOT NULL, -- CHAR(88) adds spaces at the end
lastUsed TIMESTAMP NOT NULL,
class VARCHAR(100) NOT NULL,
username VARCHAR(200) NOT NULL
);
SQL);
CREATE TABLE rememberme_token (
series CHAR(88) UNIQUE PRIMARY KEY NOT NULL,
value VARCHAR(88) NOT NULL, -- CHAR(88) adds spaces at the end
lastUsed TIMESTAMP NOT NULL,
class VARCHAR(100) NOT NULL,
username VARCHAR(200) NOT NULL
);
SQL);

return new DoctrineTokenProvider($connection);
}
Expand Down
12 changes: 12 additions & 0 deletions src/Symfony/Bridge/PhpUnit/Tests/ExpectDeprecationTraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ final class ExpectDeprecationTraitTest extends TestCase

/**
* Do not remove this test in the next major version.
*
* @group legacy
*/
#[Group('legacy')]
public function testOne()
Expand All @@ -34,6 +36,10 @@ public function testOne()

/**
* Do not remove this test in the next major version.
*
* @group legacy
*
* @runInSeparateProcess
*/
#[Group('legacy')]
#[RunInSeparateProcess]
Expand All @@ -45,6 +51,8 @@ public function testOneInIsolation()

/**
* Do not remove this test in the next major version.
*
* @group legacy
*/
#[Group('legacy')]
public function testMany()
Expand All @@ -58,6 +66,8 @@ public function testMany()
/**
* Do not remove this test in the next major version.
*
* @group legacy
*
* @expectedDeprecation foo
*/
#[Group('legacy')]
Expand All @@ -71,6 +81,8 @@ public function testOneWithAnnotation()
/**
* Do not remove this test in the next major version.
*
* @group legacy
*
* @expectedDeprecation foo
* @expectedDeprecation bar
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ final class ExpectedDeprecationAnnotationTest extends TestCase
/**
* Do not remove this test in the next major versions.
*
* @group legacy
*
* @expectedDeprecation foo
*/
#[Group('legacy')]
Expand All @@ -32,6 +34,8 @@ public function testOne()
/**
* Do not remove this test in the next major versions.
*
* @group legacy
*
* @expectedDeprecation foo
* @expectedDeprecation bar
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ final class ExpectDeprecationTraitTestFail extends TestCase

/**
* Do not remove this test in the next major version.
*
* @group legacy
*/
#[Group('legacy')]
public function testOne()
Expand All @@ -40,6 +42,10 @@ public function testOne()

/**
* Do not remove this test in the next major version.
*
* @group legacy
*
* @runInSeparateProcess
*/
#[Group('legacy')]
#[RunInSeparateProcess]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ final class NoAssertionsTestRisky extends TestCase

/**
* Do not remove this test in the next major version.
*
* @group legacy
*/
#[Group('legacy')]
public function testOne()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@

class AttributeReaderTest extends TestCase
{
/**
* @dataProvider provideReadCases
*/
#[DataProvider('provideReadCases')]
public function testAttributesAreRead(string $method, string $attributeClass, array $expected)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,17 @@

/**
* This test is meant to be skipped.
*
* @requires extension ext-dummy
*/
#[RequiresPhpExtension('ext-dummy')]
final class OnlyExpectingDeprecationSkippedTest extends TestCase
{
/**
* Do not remove this test in the next major versions.
*
* @group legacy
*
* @expectedDeprecation unreachable
*/
#[Group('legacy')]
Expand Down
2 changes: 2 additions & 0 deletions src/Symfony/Bridge/PhpUnit/Tests/ProcessIsolationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
/**
* Don't remove this test case, it tests the legacy group.
*
* @group legacy
*
* @runTestsInSeparateProcesses
*/
#[RequiresPhpunit('<10')]
Expand Down
9 changes: 6 additions & 3 deletions src/Symfony/Component/Cache/Traits/RedisTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -364,8 +364,10 @@ public static function createConnection(#[\SensitiveParameter] string $dsn, arra

foreach ($context as $name => $value) {
match ($name) {
'use-cache', 'client-tracking', 'throw-on-error', 'client-invalidations', 'reply-literal', 'persistent', => $context[$name] = filter_var($value, \FILTER_VALIDATE_BOOLEAN),
'max-retries', 'serializer', 'compression', 'compression-level', => $context[$name] = filter_var($value, \FILTER_VALIDATE_INT),
'use-cache', 'client-tracking', 'throw-on-error', 'client-invalidations', 'reply-literal', 'persistent',
=> $context[$name] = filter_var($value, \FILTER_VALIDATE_BOOLEAN),
'max-retries', 'serializer', 'compression', 'compression-level',
=> $context[$name] = filter_var($value, \FILTER_VALIDATE_INT),
default => null,
};
}
Expand Down Expand Up @@ -770,7 +772,8 @@ private static function filterSslOptions(array $options): array
{
foreach ($options as $name => $value) {
match ($name) {
'allow_self_signed', 'capture_peer_cert', 'capture_peer_cert_chain', 'disable_compression', 'SNI_enabled', 'verify_peer', 'verify_peer_name', => $options[$name] = filter_var($value, \FILTER_VALIDATE_BOOLEAN),
'allow_self_signed', 'capture_peer_cert', 'capture_peer_cert_chain', 'disable_compression', 'SNI_enabled', 'verify_peer', 'verify_peer_name',
=> $options[$name] = filter_var($value, \FILTER_VALIDATE_BOOLEAN),
default => null,
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ public function resolve(string $argumentName, InputInterface $input, ReflectionM
}

if ($value instanceof \DateTimeInterface) {
/* @var class-string<\DateTimeImmutable>|class-string<\DateTime> $class */
/** @var class-string<\DateTimeImmutable>|class-string<\DateTime> $class */
return [$value instanceof $class ? $value : $class::createFromInterface($value)];
}

$format = $attribute?->format;

/* @var class-string<\DateTimeImmutable>|class-string<\DateTime> $class */
/** @var class-string<\DateTimeImmutable>|class-string<\DateTime> $class */
if (null !== $format) {
$date = $class::createFromFormat($format, $value, $this->clock?->now()->getTimeZone());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ final class MapQueryParameter extends ValueResolver
/**
* @see https://php.net/manual/filter.constants for filter, flags and options
*
* @param string|null $name The name of the query parameter; if null, the name of the argument in the controller will be used
* @param string|null $name The name of the query parameter; if null, the name of the argument in the controller will be used
* @param (FILTER_VALIDATE_*)|(FILTER_SANITIZE_*)|null $filter The filter to pass to "filter_var()", deduced from the type-hint if null
* @param int-mask-of<(FILTER_FLAG_*)|FILTER_NULL_ON_FAILURE> $flags
* @param array{min_range?: int|float, max_range?: int|float, regexp?: string, ...} $options
* @param class-string<ValueResolverInterface>|string $resolver The name of the resolver to use
* @param class-string<ValueResolverInterface>|string $resolver The name of the resolver to use
*/
public function __construct(
public ?string $name = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ abstract public static function createProvider(): iterable;
*/
abstract public static function unsupportedSchemeProvider(): iterable;

/**
* @dataProvider supportsProvider
*/
#[DataProvider('supportsProvider')]
public function testSupports(Dsn $dsn, bool $supports)
{
Expand All @@ -48,6 +51,9 @@ public function testSupports(Dsn $dsn, bool $supports)
$this->assertSame($supports, $factory->supports($dsn));
}

/**
* @dataProvider createProvider
*/
#[DataProvider('createProvider')]
public function testCreate(Dsn $dsn, TransportInterface $transport)
{
Expand All @@ -59,6 +65,9 @@ public function testCreate(Dsn $dsn, TransportInterface $transport)
}
}

/**
* @dataProvider unsupportedSchemeProvider
*/
#[DataProvider('unsupportedSchemeProvider')]
public function testUnsupportedSchemeException(Dsn $dsn, ?string $message = null)
{
Expand Down
3 changes: 3 additions & 0 deletions src/Symfony/Component/Messenger/Handler/Acknowledger.php
2387
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ public function __construct(
$this->ack = $ack ?? static function () {};
}

/**
* @param mixed $result
*/
public function ack($result = null): void
{
$this->doAck(null, $result);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
interface BatchHandlerInterface
{
/**
* @param Acknowledger|null $ack The function to call to ack/nack the $message.
* The message should be handled synchronously when null.
*
* @return mixed The number of pending messages in the batch if $ack is not null,
* the result from handling the message otherwise
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ abstract public static function createProvider(): iterable;
*/
abstract public static function unsupportedSchemeProvider(): iterable;

/**
* @dataProvider supportsProvider
*/
#[DataProvider('supportsProvider')]
public function testSupports(bool $expected, string $dsn)
{
Expand All @@ -45,6 +48,9 @@ public function testSupports(bool $expected, string $dsn)
$this->assertSame($expected, $factory->supports(new Dsn($dsn)));
}

/**
* @dataProvider createProvider
*/
#[DataProvider('createProvider')]
public function testCreate(string $expected, string $dsn)
{
Expand All @@ -54,6 +60,9 @@ public function testCreate(string $expected, string $dsn)
$this->assertSame($expected, (string) $transport);
}

/**
* @dataProvider unsupportedSchemeProvider
*/
#[DataProvider('unsupportedSchemeProvider')]
public function testUnsupportedSchemeException(string $dsn, ?string $message = null)
{
Expand Down
12 changes: 12 additions & 0 deletions src/Symfony/Component/Notifier/Test/TransportTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,18 @@ abstract public static function supportedMessagesProvider(): iterable;
*/
abstract public static function unsupportedMessagesProvider(): iterable;

/**
* @dataProvider toStringProvider
*/
#[DataProvider('toStringProvider')]
public function testToString(string $expected, TransportInterface $transport)
{
$this->assertSame($expected, (string) $transport);
}

/**
* @dataProvider supportedMessagesProvider
*/
#[DataProvider('supportedMessagesProvider')]
public function testSupportedMessages(MessageInterface $message, ?TransportInterface $transport = null)
{
Expand All @@ -59,6 +65,9 @@ public function testSupportedMessages(MessageInterface $message, ?TransportInter
$this->assertTrue($transport->supports($message));
}

/**
* @dataProvider unsupportedMessagesProvider
*/
#[DataProvider('unsupportedMessagesProvider')]
public function testUnsupportedMessages(MessageInterface $message, ?TransportInterface $transport = null)
{
Expand All @@ -67,6 +76,9 @@ public function testUnsupportedMessages(MessageInterface $message, ?TransportInt
$this->assertFalse($transport->supports($message));
}

/**
* @dataProvider unsupportedMessagesProvider
*/
#[DataProvider('unsupportedMessagesProvider')]
public function testUnsupportedMessagesTrowUnsupportedMessageTypeExceptionWhenSend(MessageInterface $message, ?TransportInterface $transport = null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
abstract class AccessDecisionStrategyTestCase extends TestCase
{
/**
* @dataProvider provideStrategyTests
*
* @param VoterInterface[] $voters
*/
#[DataProvider('provideStrategyTests')]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ abstract public static function createProvider(): iterable;
*/
abstract public static function unsupportedSchemeProvider(): iterable;

/**
* @dataProvider supportsProvider
*/
#[DataProvider('supportsProvider')]
public function testSupports(bool $expected, string $dsn)
{
Expand All @@ -44,6 +47,9 @@ public function testSupports(bool $expected, string $dsn)
$this->assertSame($expected, $factory->supports(new Dsn($dsn)));
}

/**
* @dataProvider createProvider
*/
#[DataProvider('createProvider')]
public function testCreate(string $expected, string $dsn)
{
Expand All @@ -53,6 +59,9 @@ public function testCreate(string $expected, string $dsn)
$this->assertSame($expected, (string) $provider);
}

/**
* @dataProvider unsupportedSchemeProvider
*/
#[DataProvider('unsupportedSchemeProvider')]
public function testUnsupportedSchemeException(string $dsn, ?string $message = null)
{
Expand Down
3 changes: 3 additions & 0 deletions src/Symfony/Component/Translation/Test/ProviderTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ abstract public static function createProvider(HttpClientInterface $client, Load
*/
abstract public static function toStringProvider(): iterable;

/**
* @dataProvider toStringProvider
*/
#[DataProvider('toStringProvider')]
public function testToString(ProviderInterface $provider, string $expected)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/Uid/Ulid.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ public function __construct(?string $ulid = null)
/**
* @param int-mask-of<Ulid::FORMAT_*> $format
*/
public static function isValid(string $ulid/* , int $format = self::FORMAT_BASE_32 */): bool
public static function isValid(string $ulid/*, int $format = self::FORMAT_BASE_32*/): bool
{
$format = \func_num_args() > 1 ? func_get_arg(1) : self::FORMAT_BASE_32;
$format = \func_num_args() > 1 ? \func_get_arg(1) : self::FORMAT_BASE_32;

if (26 === \strlen($ulid) && !($format & self::FORMAT_BASE_32)) {
return false;
Expand Down
Loading
Loading
0