diff --git a/src/Symfony/Bridge/Doctrine/Tests/ContainerAwareEventManagerTest.php b/src/Symfony/Bridge/Doctrine/Tests/ContainerAwareEventManagerTest.php index 1c235824eca15..2c87b004ce92f 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/ContainerAwareEventManagerTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/ContainerAwareEventManagerTest.php @@ -21,8 +21,8 @@ class ContainerAwareEventManagerTest extends TestCase { use ExpectDeprecationTrait; - private $container; - private $evm; + private Container $container; + private ContainerAwareEventManager $evm; protected function setUp(): void { @@ -299,8 +299,8 @@ public function testRemoveEventListenerAfterDispatchEvent() class MyListener { - public $calledByInvokeCount = 0; - public $calledByEventNameCount = 0; + public int $calledByInvokeCount = 0; + public int $calledByEventNameCount = 0; public function __invoke() { @@ -315,8 +315,8 @@ public function foo() class MySubscriber extends MyListener implements EventSubscriber { - public $calledSubscribedEventsCount = 0; - private $listenedEvents; + public int $calledSubscribedEventsCount = 0; + private array $listenedEvents; public function __construct(array $listenedEvents) { diff --git a/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/DoctrineExtensionTest.php b/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/DoctrineExtensionTest.php index 34d36c52ffb54..5e7510e1f1476 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/DoctrineExtensionTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/DoctrineExtensionTest.php @@ -11,6 +11,7 @@ namespace Symfony\Bridge\Doctrine\Tests\DependencyInjection; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Bridge\Doctrine\DependencyInjection\AbstractDoctrineExtension; use Symfony\Component\DependencyInjection\ContainerBuilder; @@ -23,10 +24,7 @@ */ class DoctrineExtensionTest extends TestCase { - /** - * @var AbstractDoctrineExtension - */ - private $extension; + private MockObject&AbstractDoctrineExtension $extension; protected function setUp(): void { diff --git a/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/DoctrineChoiceLoaderTest.php b/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/DoctrineChoiceLoaderTest.php index 86e6dea0e50ae..a698e00f47c67 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/DoctrineChoiceLoaderTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/DoctrineChoiceLoaderTest.php @@ -20,7 +20,6 @@ use Symfony\Bridge\Doctrine\Form\ChoiceList\EntityLoaderInterface; use Symfony\Bridge\Doctrine\Form\ChoiceList\IdReader; use Symfony\Component\Form\ChoiceList\ArrayChoiceList; -use Symfony\Component\Form\ChoiceList\Factory\ChoiceListFactoryInterface; use Symfony\Component\Form\Exception\LogicException; /** @@ -28,54 +27,17 @@ */ class DoctrineChoiceLoaderTest extends TestCase { - /** - * @var MockObject&ChoiceListFactoryInterface - */ - private $factory; - - /** - * @var MockObject&ObjectManager - */ - private $om; - - /** - * @var MockObject&ObjectRepository - */ - private $repository; - - /** - * @var string - */ - private $class; - - /** - * @var MockObject&IdReader - */ - private $idReader; - - /** - * @var MockObject&EntityLoaderInterface - */ - private $objectLoader; - - /** - * @var \stdClass - */ - private $obj1; - - /** - * @var \stdClass - */ - private $obj2; - - /** - * @var \stdClass - */ - private $obj3; + private MockObject&ObjectManager $om; + private MockObject&ObjectRepository $repository; + private string $class; + private MockObject&IdReader $idReader; + private MockObject&EntityLoaderInterface $objectLoader; + private \stdClass $obj1; + private \stdClass $obj2; + private \stdClass $obj3; protected function setUp(): void { - $this->factory = $this->createMock(ChoiceListFactoryInterface::class); $this->om = $this->createMock(ObjectManager::class); $this->repository = $this->createMock(ObjectRepository::class); $this->class = 'stdClass'; diff --git a/src/Symfony/Bridge/Doctrine/Tests/Form/DataTransformer/CollectionToArrayTransformerTest.php b/src/Symfony/Bridge/Doctrine/Tests/Form/DataTransformer/CollectionToArrayTransformerTest.php index 48470c607db8c..c09119218b460 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Form/DataTransformer/CollectionToArrayTransformerTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Form/DataTransformer/CollectionToArrayTransformerTest.php @@ -21,10 +21,7 @@ */ class CollectionToArrayTransformerTest extends TestCase { - /** - * @var CollectionToArrayTransformer - */ - private $transformer; + private CollectionToArrayTransformer $transformer; protected function setUp(): void { diff --git a/src/Symfony/Bridge/Doctrine/Tests/Form/EventListener/MergeDoctrineCollectionListenerTest.php b/src/Symfony/Bridge/Doctrine/Tests/Form/EventListener/MergeDoctrineCollectionListenerTest.php index bbc69237ff36f..ca48281c9a92b 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Form/EventListener/MergeDoctrineCollectionListenerTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Form/EventListener/MergeDoctrineCollectionListenerTest.php @@ -12,6 +12,7 @@ namespace Symfony\Bridge\Doctrine\Tests\Form\EventListener; use Doctrine\Common\Collections\ArrayCollection; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Bridge\Doctrine\Form\EventListener\MergeDoctrineCollectionListener; use Symfony\Component\EventDispatcher\EventDispatcher; @@ -22,28 +23,15 @@ class MergeDoctrineCollectionListenerTest extends TestCase { - /** @var \Doctrine\Common\Collections\ArrayCollection */ - private $collection; - /** @var \Symfony\Component\EventDispatcher\EventDispatcher */ - private $dispatcher; - private $factory; - private $form; + private ArrayCollection $collection; + private EventDispatcher $dispatcher; + private MockObject&FormFactoryInterface $factory; protected function setUp(): void { $this->collection = new ArrayCollection(['test']); $this->dispatcher = new EventDispatcher(); $this->factory = $this->createMock(FormFactoryInterface::class); - $this->form = $this->getBuilder() - ->getForm(); - } - - protected function tearDown(): void - { - $this->collection = null; - $this->dispatcher = null; - $this->factory = null; - $this->form = null; } protected function getBuilder() diff --git a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypePerformanceTest.php b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypePerformanceTest.php index bdc6b5dcab91e..4e1f6d32ed94a 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypePerformanceTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypePerformanceTest.php @@ -11,6 +11,7 @@ namespace Symfony\Bridge\Doctrine\Tests\Form\Type; +use Doctrine\ORM\EntityManager; use Doctrine\ORM\Tools\SchemaTool; use Doctrine\Persistence\ManagerRegistry; use Symfony\Bridge\Doctrine\Form\DoctrineOrmExtension; @@ -26,10 +27,7 @@ class EntityTypePerformanceTest extends FormPerformanceTestCase { private const ENTITY_CLASS = 'Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdEntity'; - /** - * @var \Doctrine\ORM\EntityManager - */ - private $em; + private EntityManager $em; protected function getExtensions() { diff --git a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php index 0f7066609f6fb..698fcd2234c22 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php @@ -53,15 +53,8 @@ class EntityTypeTest extends BaseTypeTestCase private const COMPOSITE_IDENT_CLASS = 'Symfony\Bridge\Doctrine\Tests\Fixtures\CompositeIntIdEntity'; private const COMPOSITE_STRING_IDENT_CLASS = 'Symfony\Bridge\Doctrine\Tests\Fixtures\CompositeStringIdEntity'; - /** - * @var EntityManager - */ - private $em; - - /** - * @var MockObject&ManagerRegistry - */ - private $emRegistry; + private EntityManager $em; + private MockObject&ManagerRegistry $emRegistry; protected function setUp(): void { @@ -93,14 +86,6 @@ protected function setUp(): void } } - protected function tearDown(): void - { - parent::tearDown(); - - $this->em = null; - $this->emRegistry = null; - } - protected function getExtensions() { return array_merge(parent::getExtensions(), [ diff --git a/src/Symfony/Bridge/Doctrine/Tests/Messenger/DoctrineCloseConnectionMiddlewareTest.php b/src/Symfony/Bridge/Doctrine/Tests/Messenger/DoctrineCloseConnectionMiddlewareTest.php index ef5564eca4e95..2bfe9ba4a4990 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Messenger/DoctrineCloseConnectionMiddlewareTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Messenger/DoctrineCloseConnectionMiddlewareTest.php @@ -14,6 +14,7 @@ use Doctrine\DBAL\Connection; use Doctrine\ORM\EntityManagerInterface; use Doctrine\Persistence\ManagerRegistry; +use PHPUnit\Framework\MockObject\MockObject; use Symfony\Bridge\Doctrine\Messenger\DoctrineCloseConnectionMiddleware; use Symfony\Component\Messenger\Envelope; use Symfony\Component\Messenger\Exception\UnrecoverableMessageHandlingException; @@ -22,11 +23,11 @@ class DoctrineCloseConnectionMiddlewareTest extends MiddlewareTestCase { - private $connection; - private $entityManager; - private $managerRegistry; - private $middleware; - private $entityManagerName = 'default'; + private MockObject&Connection $connection; + private MockObject&EntityManagerInterface $entityManager; + private MockObject&ManagerRegistry $managerRegistry; + private DoctrineCloseConnectionMiddleware $middleware; + private string $entityManagerName = 'default'; protected function setUp(): void { diff --git a/src/Symfony/Bridge/Doctrine/Tests/Messenger/DoctrineOpenTransactionLoggerMiddlewareTest.php b/src/Symfony/Bridge/Doctrine/Tests/Messenger/DoctrineOpenTransactionLoggerMiddlewareTest.php index 626c19eb4ceae..73b247ecc7f87 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Messenger/DoctrineOpenTransactionLoggerMiddlewareTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Messenger/DoctrineOpenTransactionLoggerMiddlewareTest.php @@ -14,6 +14,7 @@ use Doctrine\DBAL\Connection; use Doctrine\ORM\EntityManagerInterface; use Doctrine\Persistence\ManagerRegistry; +use PHPUnit\Framework\MockObject\MockObject; use Psr\Log\AbstractLogger; use Symfony\Bridge\Doctrine\Messenger\DoctrineOpenTransactionLoggerMiddleware; use Symfony\Component\Messenger\Envelope; @@ -21,15 +22,15 @@ class DoctrineOpenTransactionLoggerMiddlewareTest extends MiddlewareTestCase { - private $logger; - private $connection; - private $entityManager; - private $middleware; + private AbstractLogger $logger; + private MockObject&Connection $connection; + private MockObject&EntityManagerInterface $entityManager; + private DoctrineOpenTransactionLoggerMiddleware $middleware; protected function setUp(): void { $this->logger = new class() extends AbstractLogger { - public $logs = []; + public array $logs = []; public function log($level, $message, $context = []): void { diff --git a/src/Symfony/Bridge/Doctrine/Tests/Messenger/DoctrinePingConnectionMiddlewareTest.php b/src/Symfony/Bridge/Doctrine/Tests/Messenger/DoctrinePingConnectionMiddlewareTest.php index 6c7bf67bc08af..581795817132d 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Messenger/DoctrinePingConnectionMiddlewareTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Messenger/DoctrinePingConnectionMiddlewareTest.php @@ -15,6 +15,7 @@ use Doctrine\DBAL\Exception as DBALException; use Doctrine\ORM\EntityManagerInterface; use Doctrine\Persistence\ManagerRegistry; +use PHPUnit\Framework\MockObject\MockObject; use Symfony\Bridge\Doctrine\Messenger\DoctrinePingConnectionMiddleware; use Symfony\Component\Messenger\Envelope; use Symfony\Component\Messenger\Exception\UnrecoverableMessageHandlingException; @@ -23,11 +24,11 @@ class DoctrinePingConnectionMiddlewareTest extends MiddlewareTestCase { - private $connection; - private $entityManager; - private $managerRegistry; - private $middleware; - private $entityManagerName = 'default'; + private MockObject&Connection $connection; + private MockObject&EntityManagerInterface $entityManager; + private MockObject&ManagerRegistry $managerRegistry; + private DoctrinePingConnectionMiddleware $middleware; + private string $entityManagerName = 'default'; protected function setUp(): void { diff --git a/src/Symfony/Bridge/Doctrine/Tests/Messenger/DoctrineTransactionMiddlewareTest.php b/src/Symfony/Bridge/Doctrine/Tests/Messenger/DoctrineTransactionMiddlewareTest.php index 91094173b6b36..ed585550e39b6 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Messenger/DoctrineTransactionMiddlewareTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Messenger/DoctrineTransactionMiddlewareTest.php @@ -14,6 +14,7 @@ use Doctrine\DBAL\Connection; use Doctrine\ORM\EntityManagerInterface; use Doctrine\Persistence\ManagerRegistry; +use PHPUnit\Framework\MockObject\MockObject; use Symfony\Bridge\Doctrine\Messenger\DoctrineTransactionMiddleware; use Symfony\Component\Messenger\Envelope; use Symfony\Component\Messenger\Exception\UnrecoverableMessageHandlingException; @@ -21,9 +22,9 @@ class DoctrineTransactionMiddlewareTest extends MiddlewareTestCase { - private $connection; - private $entityManager; - private $middleware; + private MockObject&Connection $connection; + private MockObject&EntityManagerInterface $entityManager; + private DoctrineTransactionMiddleware $middleware; protected function setUp(): void { diff --git a/src/Symfony/Bridge/Doctrine/Tests/Types/UlidTypeTest.php b/src/Symfony/Bridge/Doctrine/Tests/Types/UlidTypeTest.php index c1db2bbe70124..158014a43e2f7 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Types/UlidTypeTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Types/UlidTypeTest.php @@ -24,14 +24,13 @@ use Symfony\Component\Uid\Ulid; // DBAL 2 compatibility -class_exists('Doctrine\DBAL\Platforms\PostgreSqlPlatform'); +class_exists(\Doctrine\DBAL\Platforms\PostgreSqlPlatform::class); final class UlidTypeTest extends TestCase { private const DUMMY_ULID = '01EEDQEK6ZAZE93J8KG5B4MBJC'; - /** @var UlidType */ - private $type; + private UlidType $type; public static function setUpBeforeClass(): void { diff --git a/src/Symfony/Bridge/Doctrine/Tests/Types/UuidTypeTest.php b/src/Symfony/Bridge/Doctrine/Tests/Types/UuidTypeTest.php index 120887ef3653a..92d267b3be58d 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Types/UuidTypeTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Types/UuidTypeTest.php @@ -24,15 +24,14 @@ use Symfony\Component\Uid\Uuid; // DBAL 2 compatibility -class_exists('Doctrine\DBAL\Platforms\MySqlPlatform'); -class_exists('Doctrine\DBAL\Platforms\PostgreSqlPlatform'); +class_exists(\Doctrine\DBAL\Platforms\MySqlPlatform::class); +class_exists(\Doctrine\DBAL\Platforms\PostgreSqlPlatform::class); final class UuidTypeTest extends TestCase { private const DUMMY_UUID = '9f755235-5a2d-4aba-9605-e9962b312e50'; - /** @var UuidType */ - private $type; + private UuidType $type; public static function setUpBeforeClass(): void { diff --git a/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php b/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php index eb49736bac5f2..2ce2af2faf4d9 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php @@ -48,22 +48,10 @@ class UniqueEntityValidatorTest extends ConstraintValidatorTestCase { private const EM_NAME = 'foo'; - /** - * @var ObjectManager - */ - protected $em; - - /** - * @var ManagerRegistry - */ - protected $registry; - - /** - * @var MockObject&EntityRepository - */ - protected $repository; - - protected $repositoryFactory; + protected ?ObjectManager $em; + protected ManagerRegistry $registry; + protected MockObject&EntityRepository $repository; + protected TestRepositoryFactory $repositoryFactory; protected function setUp(): void { diff --git a/src/Symfony/Bridge/Monolog/Tests/Handler/MailerHandlerTest.php b/src/Symfony/Bridge/Monolog/Tests/Handler/MailerHandlerTest.php index 397e84259a706..a59ced55d9d36 100644 --- a/src/Symfony/Bridge/Monolog/Tests/Handler/MailerHandlerTest.php +++ b/src/Symfony/Bridge/Monolog/Tests/Handler/MailerHandlerTest.php @@ -24,8 +24,7 @@ class MailerHandlerTest extends TestCase { - /** @var MockObject|MailerInterface */ - private $mailer; + private MockObject&MailerInterface $mailer; protected function setUp(): void { diff --git a/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Instantiator/RuntimeInstantiatorTest.php b/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Instantiator/RuntimeInstantiatorTest.php index 15190df1d308b..e78ec163dd44a 100644 --- a/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Instantiator/RuntimeInstantiatorTest.php +++ b/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Instantiator/RuntimeInstantiatorTest.php @@ -27,10 +27,7 @@ */ class RuntimeInstantiatorTest extends TestCase { - /** - * @var RuntimeInstantiator - */ - protected $instantiator; + protected RuntimeInstantiator $instantiator; protected function setUp(): void { diff --git a/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/PhpDumper/ProxyDumperTest.php b/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/PhpDumper/ProxyDumperTest.php index 3652275c2bb65..417fa8aabc5a6 100644 --- a/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/PhpDumper/ProxyDumperTest.php +++ b/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/PhpDumper/ProxyDumperTest.php @@ -25,10 +25,7 @@ */ class ProxyDumperTest extends TestCase { - /** - * @var ProxyDumper - */ - protected $dumper; + protected ProxyDumper $dumper; protected function setUp(): void { diff --git a/src/Symfony/Bridge/Twig/Tests/AppVariableTest.php b/src/Symfony/Bridge/Twig/Tests/AppVariableTest.php index 764eade4d9171..6dc75cdd2ab86 100644 --- a/src/Symfony/Bridge/Twig/Tests/AppVariableTest.php +++ b/src/Symfony/Bridge/Twig/Tests/AppVariableTest.php @@ -24,10 +24,7 @@ class AppVariableTest extends TestCase { - /** - * @var AppVariable - */ - protected $appVariable; + protected AppVariable $appVariable; protected function setUp(): void { diff --git a/src/Symfony/Bridge/Twig/Tests/Command/LintCommandTest.php b/src/Symfony/Bridge/Twig/Tests/Command/LintCommandTest.php index 75203f9c899e0..649e2a0db9870 100644 --- a/src/Symfony/Bridge/Twig/Tests/Command/LintCommandTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Command/LintCommandTest.php @@ -24,7 +24,7 @@ class LintCommandTest extends TestCase { - private $files; + private array $files; public function testLintCorrectFile() { diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/AbstractLayoutTestCase.php b/src/Symfony/Bridge/Twig/Tests/Extension/AbstractLayoutTestCase.php index af1a013a556fa..da7b0b866c4f1 100644 --- a/src/Symfony/Bridge/Twig/Tests/Extension/AbstractLayoutTestCase.php +++ b/src/Symfony/Bridge/Twig/Tests/Extension/AbstractLayoutTestCase.php @@ -11,7 +11,7 @@ namespace Symfony\Bridge\Twig\Tests\Extension; -use PHPUnit\Framework\SkippedTestError; +use PHPUnit\Framework\MockObject\MockObject; use Symfony\Component\Form\Extension\Core\Type\PercentType; use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\Extension\Csrf\CsrfExtension; @@ -28,9 +28,10 @@ abstract class AbstractLayoutTestCase extends FormIntegrationTestCase { use VersionAwareTest; - protected $csrfTokenManager; - protected $testableFeatures = []; - private $defaultLocale; + protected MockObject&CsrfTokenManagerInterface $csrfTokenManager; + protected array $testableFeatures = []; + + private string $defaultLocale; protected function setUp(): void { @@ -55,7 +56,6 @@ protected function getExtensions() protected function tearDown(): void { - $this->csrfTokenManager = null; \Locale::setDefault($this->defaultLocale); parent::tearDown(); diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap3HorizontalLayoutTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap3HorizontalLayoutTest.php index e746a267105e2..2f5289ceda06f 100644 --- a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap3HorizontalLayoutTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap3HorizontalLayoutTest.php @@ -25,14 +25,11 @@ class FormExtensionBootstrap3HorizontalLayoutTest extends AbstractBootstrap3Hori { use RuntimeLoaderProvider; - protected $testableFeatures = [ + protected array $testableFeatures = [ 'choice_attr', ]; - /** - * @var FormRenderer - */ - private $renderer; + private FormRenderer $renderer; protected function setUp(): void { diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap3LayoutTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap3LayoutTest.php index 2b7e186c0d5cd..2e7ade2cdfe84 100644 --- a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap3LayoutTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap3LayoutTest.php @@ -25,10 +25,7 @@ class FormExtensionBootstrap3LayoutTest extends AbstractBootstrap3LayoutTestCase { use RuntimeLoaderProvider; - /** - * @var FormRenderer - */ - private $renderer; + private FormRenderer $renderer; protected function setUp(): void { diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap4HorizontalLayoutTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap4HorizontalLayoutTest.php index f95e678440b4d..a7d6c04e4b37a 100644 --- a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap4HorizontalLayoutTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap4HorizontalLayoutTest.php @@ -30,11 +30,11 @@ class FormExtensionBootstrap4HorizontalLayoutTest extends AbstractBootstrap4Hori { use RuntimeLoaderProvider; - protected $testableFeatures = [ + protected array $testableFeatures = [ 'choice_attr', ]; - private $renderer; + private FormRenderer $renderer; protected function setUp(): void { diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap4LayoutTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap4LayoutTest.php index 2d0ca9fabab21..ccf9d65c62bec 100644 --- a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap4LayoutTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap4LayoutTest.php @@ -29,10 +29,8 @@ class FormExtensionBootstrap4LayoutTest extends AbstractBootstrap4LayoutTestCase { use RuntimeLoaderProvider; - /** - * @var FormRenderer - */ - private $renderer; + + private FormRenderer $renderer; protected function setUp(): void { diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap5HorizontalLayoutTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap5HorizontalLayoutTest.php index d6d2c3c2ecb06..9682129e3fbfc 100644 --- a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap5HorizontalLayoutTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap5HorizontalLayoutTest.php @@ -30,11 +30,11 @@ class FormExtensionBootstrap5HorizontalLayoutTest extends AbstractBootstrap5Hori { use RuntimeLoaderProvider; - protected $testableFeatures = [ + protected array $testableFeatures = [ 'choice_attr', ]; - private $renderer; + private FormRenderer $renderer; protected function setUp(): void { diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap5LayoutTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap5LayoutTest.php index 94174615a0ce0..63d2dfa4849d6 100644 --- a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap5LayoutTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap5LayoutTest.php @@ -32,10 +32,7 @@ class FormExtensionBootstrap5LayoutTest extends AbstractBootstrap5LayoutTestCase { use RuntimeLoaderProvider; - /** - * @var FormRenderer - */ - private $renderer; + private FormRenderer $renderer; protected function setUp(): void { diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionDivLayoutTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionDivLayoutTest.php index 19efa9455d3d1..f18c03cefa554 100644 --- a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionDivLayoutTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionDivLayoutTest.php @@ -26,10 +26,7 @@ class FormExtensionDivLayoutTest extends AbstractDivLayoutTestCase { use RuntimeLoaderProvider; - /** - * @var FormRenderer - */ - private $renderer; + private FormRenderer $renderer; protected function setUp(): void { diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionFieldHelpersTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionFieldHelpersTest.php index ce3ee926e11b8..8e2c0298328e5 100644 --- a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionFieldHelpersTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionFieldHelpersTest.php @@ -22,20 +22,9 @@ class FormExtensionFieldHelpersTest extends FormIntegrationTestCase { - /** - * @var FormExtension - */ - private $rawExtension; - - /** - * @var FormExtension - */ - private $translatorExtension; - - /** - * @var FormView - */ - private $view; + private FormExtension $rawExtension; + private FormExtension $translatorExtension; + private FormView $view; protected function getTypes() { diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionTableLayoutTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionTableLayoutTest.php index c94f9b5c0d1f1..751d2b1f81e58 100644 --- a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionTableLayoutTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionTableLayoutTest.php @@ -25,10 +25,7 @@ class FormExtensionTableLayoutTest extends AbstractTableLayoutTestCase { use RuntimeLoaderProvider; - /** - * @var FormRenderer - */ - private $renderer; + private FormRenderer $renderer; protected function setUp(): void { diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/WebLinkExtensionTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/WebLinkExtensionTest.php index 1739c1ee91833..c81670773f39d 100644 --- a/src/Symfony/Bridge/Twig/Tests/Extension/WebLinkExtensionTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Extension/WebLinkExtensionTest.php @@ -22,15 +22,8 @@ */ class WebLinkExtensionTest extends TestCase { - /** - * @var Request - */ - private $request; - - /** - * @var WebLinkExtension - */ - private $extension; + private Request $request; + private WebLinkExtension $extension; protected function setUp(): void { diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/WorkflowExtensionTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/WorkflowExtensionTest.php index 1252efb8d6ee0..8a16e5b2c3f2e 100644 --- a/src/Symfony/Bridge/Twig/Tests/Extension/WorkflowExtensionTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Extension/WorkflowExtensionTest.php @@ -25,8 +25,8 @@ class WorkflowExtensionTest extends TestCase { - private $extension; - private $t1; + private WorkflowExtension $extension; + private Transition $t1; protected function setUp(): void { @@ -127,19 +127,19 @@ public function testbuildTransitionBlockerList() final class Subject { - private $marking; + private array $marking; - public function __construct($marking = null) + public function __construct(array $marking = []) { $this->marking = $marking; } - public function getMarking() + public function getMarking(): array { return $this->marking; } - public function setMarking($marking) + public function setMarking($marking): void { $this->marking = $marking; } diff --git a/src/Symfony/Bridge/Twig/Tests/NodeVisitor/TranslationDefaultDomainNodeVisitorTest.php b/src/Symfony/Bridge/Twig/Tests/NodeVisitor/TranslationDefaultDomainNodeVisitorTest.php index 25b8166eae62a..40063c6b7817f 100644 --- a/src/Symfony/Bridge/Twig/Tests/NodeVisitor/TranslationDefaultDomainNodeVisitorTest.php +++ b/src/Symfony/Bridge/Twig/Tests/NodeVisitor/TranslationDefaultDomainNodeVisitorTest.php @@ -21,8 +21,8 @@ class TranslationDefaultDomainNodeVisitorTest extends TestCase { - private static $message = 'message'; - private static $domain = 'domain'; + private static string $message = 'message'; + private static string $domain = 'domain'; /** @dataProvider getDefaultDomainAssignmentTestData */ public function testDefaultDomainAssignment(Node $node) diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/AboutCommand/AboutCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/AboutCommand/AboutCommandTest.php index 8a1fcf93caabd..bcf3c7fe0da76 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/AboutCommand/AboutCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/AboutCommand/AboutCommandTest.php @@ -21,8 +21,7 @@ class AboutCommandTest extends TestCase { - /** @var Filesystem */ - private $fs; + private Filesystem $fs; protected function setUp(): void { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CachePoolClearCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CachePoolClearCommandTest.php index 12ae2bd39236e..e1997777db277 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CachePoolClearCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CachePoolClearCommandTest.php @@ -23,7 +23,7 @@ class CachePoolClearCommandTest extends TestCase { - private $cachePool; + private CacheItemPoolInterface $cachePool; protected function setUp(): void { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CachePoolDeleteCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CachePoolDeleteCommandTest.php index b910489abb839..c581d3095c33c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CachePoolDeleteCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CachePoolDeleteCommandTest.php @@ -24,7 +24,7 @@ class CachePoolDeleteCommandTest extends TestCase { - private $cachePool; + private MockObject&CacheItemPoolInterface $cachePool; protected function setUp(): void { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationDebugCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationDebugCommandTest.php index 846abd44500e0..9169674789364 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationDebugCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationDebugCommandTest.php @@ -28,8 +28,8 @@ class TranslationDebugCommandTest extends TestCase { - private $fs; - private $translationDir; + private Filesystem $fs; + private string $translationDir; public function testDebugMissingMessages() { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandCompletionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandCompletionTest.php index 91999d288266e..90f88341bb2b9 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandCompletionTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandCompletionTest.php @@ -27,8 +27,8 @@ class TranslationUpdateCommandCompletionTest extends TestCase { - private $fs; - private $translationDir; + private Filesystem $fs; + private string $translationDir; /** * @dataProvider provideCompletionSuggestions diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php index f883fac0c57ce..3d3b56dcab7f3 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php @@ -26,8 +26,8 @@ class TranslationUpdateCommandTest extends TestCase { - private $fs; - private $translationDir; + private Filesystem $fs; + private string $translationDir; public function testDumpMessagesAndCleanWithDeprecatedCommandName() { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/XliffLintCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/XliffLintCommandTest.php index 2de30d44939e5..db32bc19cb359 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/XliffLintCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/XliffLintCommandTest.php @@ -29,7 +29,7 @@ */ class XliffLintCommandTest extends TestCase { - private $files; + private array $files; public function testGetHelp() { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/YamlLintCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/YamlLintCommandTest.php index 37d6d8f7fa888..667c76a4a3659 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/YamlLintCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/YamlLintCommandTest.php @@ -28,7 +28,7 @@ */ class YamlLintCommandTest extends TestCase { - private $files; + private array $files; public function testLintCorrectFile() { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/AbstractDescriptorTestCase.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/AbstractDescriptorTestCase.php index 03cd8c7628f2d..33c0a55b8f5f8 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/AbstractDescriptorTestCase.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/AbstractDescriptorTestCase.php @@ -26,7 +26,7 @@ abstract class AbstractDescriptorTestCase extends TestCase { - private $colSize; + private string|false $colSize; protected function setUp(): void { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/TextDescriptorTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/TextDescriptorTest.php index 340defd8e61fa..2a3c166158deb 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/TextDescriptorTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/TextDescriptorTest.php @@ -17,7 +17,7 @@ class TextDescriptorTest extends AbstractDescriptorTestCase { - private static $fileLinkFormatter; + private static ?FileLinkFormatter $fileLinkFormatter = null; protected static function getDescriptor() { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/TestAbstractController.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/TestAbstractController.php index 5238aee8ff07b..18f3eabb71e3f 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/TestAbstractController.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/TestAbstractController.php @@ -16,7 +16,7 @@ class TestAbstractController extends AbstractController { - private $throwOnUnexpectedService; + private bool $throwOnUnexpectedService; public function __construct($throwOnUnexpectedService = true) { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/DataCollectorTranslatorPassTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/DataCollectorTranslatorPassTest.php index 8601f8c81ad2c..f0646a74c6a89 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/DataCollectorTranslatorPassTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/DataCollectorTranslatorPassTest.php @@ -22,8 +22,8 @@ class DataCollectorTranslatorPassTest extends TestCase { - private $container; - private $dataCollectorTranslatorPass; + private ContainerBuilder $container; + private DataCollectorTranslatorPass $dataCollectorTranslatorPass; protected function setUp(): void { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/WorkflowGuardListenerPassTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/WorkflowGuardListenerPassTest.php index 6b12a00bb9389..908f92bc4cedd 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/WorkflowGuardListenerPassTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/WorkflowGuardListenerPassTest.php @@ -23,8 +23,8 @@ class WorkflowGuardListenerPassTest extends TestCase { - private $container; - private $compilerPass; + private ContainerBuilder $container; + private WorkflowGuardListenerPass $compilerPass; protected function setUp(): void { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTestCase.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTestCase.php index dbad832eadb93..0b34bcd9f7f9f 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTestCase.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTestCase.php @@ -95,7 +95,7 @@ abstract class FrameworkExtensionTestCase extends TestCase { use ExpectDeprecationTrait; - private static $containerCache = []; + private static array $containerCache = []; abstract protected function loadFromFile(ContainerBuilder $container, $file); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Messenger/DummyMessage.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Messenger/DummyMessage.php index 7f25eb4e5b9ed..34bdaa64fa37e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Messenger/DummyMessage.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Messenger/DummyMessage.php @@ -4,7 +4,7 @@ class DummyMessage implements DummyMessageInterface { - private $message; + private string $message; public function __construct(string $message) { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/LegacyBundle/Entity/LegacyPerson.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/LegacyBundle/Entity/LegacyPerson.php index 8135e95e89c02..d8c4eba98626b 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/LegacyBundle/Entity/LegacyPerson.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/LegacyBundle/Entity/LegacyPerson.php @@ -13,8 +13,8 @@ class LegacyPerson { - public $name; - public $age; + public string $name; + public string $age; public function __construct(string $name, string $age) { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/ModernBundle/src/Entity/ModernPerson.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/ModernBundle/src/Entity/ModernPerson.php index 6c22925d65eb0..cc5279a4e9f30 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/ModernBundle/src/Entity/ModernPerson.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/ModernBundle/src/Entity/ModernPerson.php @@ -13,8 +13,8 @@ class ModernPerson { - public $name; - public $age; + public string $name; + public string $age; public function __construct(string $name, string $age) { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/AutowiringTypes/AutowiredServices.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/AutowiringTypes/AutowiredServices.php index 4743460e6ee5b..e616265a7f9b3 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/AutowiringTypes/AutowiredServices.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/AutowiringTypes/AutowiredServices.php @@ -17,9 +17,9 @@ class AutowiredServices { - private $annotationReader; - private $dispatcher; - private $cachePool; + private ?Reader $annotationReader; + private EventDispatcherInterface $dispatcher; + private CacheItemPoolInterface $cachePool; public function __construct(Reader $annotationReader = null, EventDispatcherInterface $dispatcher, CacheItemPoolInterface $cachePool) { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Controller/FragmentController.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Controller/FragmentController.php index 894d2a738d5f9..cb89a5167fcc5 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Controller/FragmentController.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Controller/FragmentController.php @@ -52,7 +52,7 @@ public function fragmentUriAction(Request $request, FragmentUriGeneratorInterfac class Bar { - private $bar = 'bar'; + private string $bar = 'bar'; public function getBar() { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Controller/SecurityController.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Controller/SecurityController.php index 28e3d141aaedc..0336ece25fcb1 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Controller/SecurityController.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Controller/SecurityController.php @@ -18,7 +18,7 @@ class SecurityController implements ServiceSubscriberInterface { - private $container; + private ContainerInterface $container; public function __construct(ContainerInterface $container) { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/DependencyInjection/Configuration.php index 9120032e11028..20386304e2ab2 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/DependencyInjection/Configuration.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/DependencyInjection/Configuration.php @@ -11,14 +11,15 @@ namespace Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle\DependencyInjection; +use Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle\DependencyInjection\Config\CustomConfig; use Symfony\Component\Config\Definition\Builder\TreeBuilder; use Symfony\Component\Config\Definition\ConfigurationInterface; class Configuration implements ConfigurationInterface { - private $customConfig; + private ?CustomConfig $customConfig; - public function __construct($customConfig = null) + public function __construct(CustomConfig $customConfig = null) { $this->customConfig = $customConfig; } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/DependencyInjection/TestExtension.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/DependencyInjection/TestExtension.php index b1d01daf6a8a5..02b82df5406d6 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/DependencyInjection/TestExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/DependencyInjection/TestExtension.php @@ -11,15 +11,15 @@ namespace Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle\DependencyInjection; +use Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle\DependencyInjection\Config\CustomConfig; use Symfony\Component\Config\Definition\ConfigurationInterface; -use Symfony\Component\DependencyInjection\Alias; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Extension\Extension; use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface; class TestExtension extends Extension implements PrependExtensionInterface { - private $customConfig; + private ?CustomConfig $customConfig = null; public function load(array $configs, ContainerBuilder $container): void { @@ -37,7 +37,7 @@ public function getConfiguration(array $config, ContainerBuilder $container): ?C return new Configuration($this->customConfig); } - public function setCustomConfig($customConfig): void + public function setCustomConfig(CustomConfig $customConfig): void { $this->customConfig = $customConfig; } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Slugger/SlugConstructArgService.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Slugger/SlugConstructArgService.php index 943fda4b6b9e0..260137f3fe826 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Slugger/SlugConstructArgService.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Slugger/SlugConstructArgService.php @@ -15,7 +15,7 @@ class SlugConstructArgService { - private $slugger; + private SluggerInterface $slugger; public function __construct(SluggerInterface $slugger) { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/TestServiceContainer/PublicService.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/TestServiceContainer/PublicService.php index 14de890b630fe..e6660c2cb0484 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/TestServiceContainer/PublicService.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/TestServiceContainer/PublicService.php @@ -13,9 +13,8 @@ class PublicService { - private $nonPublicService; - - private $privateService; + private NonPublicService $nonPublicService; + private PrivateService $privateService; public function __construct(NonPublicService $nonPublicService, PrivateService $privateService) { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/TransDebug/TransConstructArgService.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/TransDebug/TransConstructArgService.php index c4b985e8ee80d..a48156b315a47 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/TransDebug/TransConstructArgService.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/TransDebug/TransConstructArgService.php @@ -15,7 +15,7 @@ class TransConstructArgService { - private $translator; + private TranslatorInterface $translator; public function __construct(TranslatorInterface $translator) { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/TransDebug/TransMethodCallsService.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/TransDebug/TransMethodCallsService.php index 66247e56c6175..a74babe1d2427 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/TransDebug/TransMethodCallsService.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/TransDebug/TransMethodCallsService.php @@ -15,7 +15,7 @@ class TransMethodCallsService { - private $translator; + private TranslatorInterface $translator; public function setTranslator(TranslatorInterface $translator): void { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/TransDebug/TransPropertyService.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/TransDebug/TransPropertyService.php index 6bd17bdfd034a..fc3f753fcb8f4 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/TransDebug/TransPropertyService.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/TransDebug/TransPropertyService.php @@ -15,8 +15,7 @@ class TransPropertyService { - /** @var TranslatorInterface */ - public $translator; + public TranslatorInterface $translator; public function hello(): string { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/TransDebug/TransSubscriberService.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/TransDebug/TransSubscriberService.php index 5738ab094b34c..e32f270cdb043 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/TransDebug/TransSubscriberService.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/TransDebug/TransSubscriberService.php @@ -17,7 +17,7 @@ class TransSubscriberService implements ServiceSubscriberInterface { - private $container; + private ContainerInterface $container; public function __construct(ContainerInterface $container) { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/DebugAutowiringCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/DebugAutowiringCommandTest.php index a90c56db4b6ae..ca11e3faea143 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/DebugAutowiringCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/DebugAutowiringCommandTest.php @@ -33,7 +33,7 @@ public function testBasicFunctionality() $application->setAutoExit(false); $tester = new ApplicationTester($application); - $tester->run(['command' => 'debug:autowiring']); + $tester->run(['command' => 'debug:autowiring'], ['decorated' => false]); $this->assertStringContainsString(HttpKernelInterface::class, $tester->getDisplay()); $this->assertStringContainsString('alias:http_kernel', $tester->getDisplay()); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/MailerTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/MailerTest.php index 0ca437c1e8d9c..1ba71d74f9e6e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/MailerTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/MailerTest.php @@ -41,12 +41,9 @@ public function testEnvelopeListener() $logger = self::getContainer()->get('logger'); $testTransport = new class($eventDispatcher, $logger, $onDoSend) extends AbstractTransport { - /** - * @var callable - */ - private $onDoSend; + private \Closure $onDoSend; - public function __construct(EventDispatcherInterface $eventDispatcher, LoggerInterface $logger, callable $onDoSend) + public function __construct(EventDispatcherInterface $eventDispatcher, LoggerInterface $logger, \Closure $onDoSend) { parent::__construct($eventDispatcher, $logger); $this->onDoSend = $onDoSend; diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/RouterDebugCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/RouterDebugCommandTest.php index 9865e7edea6fe..ff12535e10e17 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/RouterDebugCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/RouterDebugCommandTest.php @@ -20,7 +20,7 @@ */ class RouterDebugCommandTest extends AbstractWebTestCase { - private $application; + private Application $application; protected function setUp(): void { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/TranslationDebugCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/TranslationDebugCommandTest.php index 70a6c923dc418..5e396440cacf4 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/TranslationDebugCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/TranslationDebugCommandTest.php @@ -20,7 +20,7 @@ */ class TranslationDebugCommandTest extends AbstractWebTestCase { - private $application; + private Application $application; protected function setUp(): void { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AppKernel.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AppKernel.php index 80888c4a71e23..06dc2d637a8e5 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AppKernel.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AppKernel.php @@ -28,9 +28,9 @@ */ class AppKernel extends Kernel implements ExtensionInterface, ConfigurationInterface { - private $varDir; - private $testCase; - private $rootConfig; + private string $varDir; + private string $testCase; + private string $rootConfig; public function __construct($varDir, $testCase, $rootConfig, $environment, $debug) { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Kernel/ConcreteMicroKernel.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Kernel/ConcreteMicroKernel.php index 73a6bd297d9d9..eb9474d2f6752 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Kernel/ConcreteMicroKernel.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Kernel/ConcreteMicroKernel.php @@ -27,7 +27,7 @@ class ConcreteMicroKernel extends Kernel implements EventSubscriberInterface { use MicroKernelTrait; - private $cacheDir; + private string $cacheDir; public function onKernelException(ExceptionEvent $event) { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Kernel/MicroKernelTraitTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Kernel/MicroKernelTraitTest.php index 189134d124720..585a377c1dbd1 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Kernel/MicroKernelTraitTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Kernel/MicroKernelTraitTest.php @@ -30,7 +30,7 @@ class MicroKernelTraitTest extends TestCase { - private $kernel; + private ?Kernel $kernel = null; protected function tearDown(): void { @@ -144,7 +144,7 @@ abstract class MinimalKernel extends Kernel { use MicroKernelTrait; - private $cacheDir; + private string $cacheDir; public function __construct(string $cacheDir) { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Kernel/flex-style/src/FlexStyleMicroKernel.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Kernel/flex-style/src/FlexStyleMicroKernel.php index 878e6cc92a30e..fc35d383bcfa6 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Kernel/flex-style/src/FlexStyleMicroKernel.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Kernel/flex-style/src/FlexStyleMicroKernel.php @@ -27,7 +27,7 @@ class FlexStyleMicroKernel extends Kernel configureRoutes as traitConfigureRoutes; } - private $cacheDir; + private string $cacheDir; public function halloweenAction(\stdClass $o) { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Secrets/DotenvVaultTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Secrets/DotenvVaultTest.php index 780bffcff25a1..afc9288772bce 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Secrets/DotenvVaultTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Secrets/DotenvVaultTest.php @@ -17,7 +17,7 @@ class DotenvVaultTest extends TestCase { - private $envFile; + private string $envFile; protected function setUp(): void { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Secrets/SodiumVaultTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Secrets/SodiumVaultTest.php index 4beacafa0cb81..603d13504770f 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Secrets/SodiumVaultTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Secrets/SodiumVaultTest.php @@ -20,7 +20,7 @@ */ class SodiumVaultTest extends TestCase { - private $secretsDir; + private string $secretsDir; protected function setUp(): void { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Translation/TranslatorTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Translation/TranslatorTest.php index 0c3fb88cc9074..2ef550ef0d8b8 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Translation/TranslatorTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Translation/TranslatorTest.php @@ -26,7 +26,7 @@ class TranslatorTest extends TestCase { - protected $tmpDir; + protected string $tmpDir; protected function setUp(): void { diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Compiler/MakeFirewallsEventDispatcherTraceablePassTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Compiler/MakeFirewallsEventDispatcherTraceablePassTest.php index e156a2f6f51d4..7cdf96c6a7588 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Compiler/MakeFirewallsEventDispatcherTraceablePassTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Compiler/MakeFirewallsEventDispatcherTraceablePassTest.php @@ -23,7 +23,7 @@ class MakeFirewallsEventDispatcherTraceablePassTest extends TestCase { - private $container; + private ContainerBuilder $container; protected function setUp(): void { diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Compiler/RegisterGlobalSecurityEventListenersPassTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Compiler/RegisterGlobalSecurityEventListenersPassTest.php index c7f437e9d4808..e6567e67d6f7d 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Compiler/RegisterGlobalSecurityEventListenersPassTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Compiler/RegisterGlobalSecurityEventListenersPassTest.php @@ -31,7 +31,7 @@ class RegisterGlobalSecurityEventListenersPassTest extends TestCase { - private $container; + private ContainerBuilder $container; protected function setUp(): void { diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/MainConfigurationTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/MainConfigurationTest.php index 9765ff28338f1..5a813010653d3 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/MainConfigurationTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/MainConfigurationTest.php @@ -23,7 +23,7 @@ class MainConfigurationTest extends TestCase * The minimal, required config needed to not have any required validation * issues. */ - protected static $minimalConfig = [ + protected static array $minimalConfig = [ 'providers' => [ 'stub' => [ 'id' => 'foo', diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/AuthenticatorBundle/ApiAuthenticator.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/AuthenticatorBundle/ApiAuthenticator.php index 3060f4ef9e8c6..359e61a2b36e4 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/AuthenticatorBundle/ApiAuthenticator.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/AuthenticatorBundle/ApiAuthenticator.php @@ -25,7 +25,7 @@ class ApiAuthenticator extends AbstractAuthenticator { - private $selfLoadingUser = false; + private bool $selfLoadingUser; public function __construct(bool $selfLoadingUser = false) { diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/AuthenticatorBundle/LoginFormAuthenticator.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/AuthenticatorBundle/LoginFormAuthenticator.php index 963be4141d27e..2ade142850948 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/AuthenticatorBundle/LoginFormAuthenticator.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/AuthenticatorBundle/LoginFormAuthenticator.php @@ -27,8 +27,7 @@ class LoginFormAuthenticator extends AbstractLoginFormAuthenticator { use TargetPathTrait; - /** @var UrlGeneratorInterface */ - private $urlGenerator; + private UrlGeneratorInterface $urlGenerator; public function __construct(UrlGeneratorInterface $urlGenerator) { diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/AutowiringBundle/AutowiredServices.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/AutowiringBundle/AutowiredServices.php index 30aa62f1f66ec..114bc27d74803 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/AutowiringBundle/AutowiredServices.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/AutowiringBundle/AutowiredServices.php @@ -15,7 +15,7 @@ class AutowiredServices { - private $accessDecisionManager; + private AccessDecisionManagerInterface $accessDecisionManager; public function __construct(AccessDecisionManagerInterface $accessDecisionManager) { diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/CsrfFormLoginBundle/Controller/LoginController.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/CsrfFormLoginBundle/Controller/LoginController.php index 42a87a1235937..6821b68f985d2 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/CsrfFormLoginBundle/Controller/LoginController.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/CsrfFormLoginBundle/Controller/LoginController.php @@ -21,7 +21,7 @@ class LoginController implements ServiceSubscriberInterface { - private $container; + private ContainerInterface $container; public function __construct(ContainerInterface $container) { diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/EventBundle/EventSubscriber/TestSubscriber.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/EventBundle/EventSubscriber/TestSubscriber.php index 0a907008ec411..062ff54472741 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/EventBundle/EventSubscriber/TestSubscriber.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/EventBundle/EventSubscriber/TestSubscriber.php @@ -19,7 +19,7 @@ final class TestSubscriber implements EventSubscriberInterface { - public $calledMethods = []; + public array $calledMethods = []; public static function getSubscribedEvents(): array { diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FormLoginBundle/Controller/LocalizedController.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FormLoginBundle/Controller/LocalizedController.php index a09ca835897fd..c6954e296ed89 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FormLoginBundle/Controller/LocalizedController.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FormLoginBundle/Controller/LocalizedController.php @@ -20,7 +20,7 @@ class LocalizedController implements ServiceSubscriberInterface { - private $container; + private ContainerInterface $container; public function __construct(ContainerInterface $container) { diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FormLoginBundle/Controller/LoginController.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FormLoginBundle/Controller/LoginController.php index 09b0ff09ba8d1..dd8c1a2d055ef 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FormLoginBundle/Controller/LoginController.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FormLoginBundle/Controller/LoginController.php @@ -22,7 +22,7 @@ class LoginController implements ServiceSubscriberInterface { - private $container; + private ContainerInterface $container; public function __construct(ContainerInterface $container) { diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FormLoginBundle/Security/LocalizedFormFailureHandler.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FormLoginBundle/Security/LocalizedFormFailureHandler.php index afb4648d36c69..eb3c1182596d8 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FormLoginBundle/Security/LocalizedFormFailureHandler.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FormLoginBundle/Security/LocalizedFormFailureHandler.php @@ -21,7 +21,7 @@ class LocalizedFormFailureHandler implements AuthenticationFailureHandlerInterface { - private $router; + private RouterInterface $router; public function __construct(RouterInterface $router) { diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/RememberMeBundle/Security/StaticTokenProvider.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/RememberMeBundle/Security/StaticTokenProvider.php index c79518b6cb9fb..e75a79cd928a5 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/RememberMeBundle/Security/StaticTokenProvider.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/RememberMeBundle/Security/StaticTokenProvider.php @@ -17,8 +17,8 @@ class StaticTokenProvider implements TokenProviderInterface { - private static $db = []; - private static $kernelClass; + private static array $db = []; + private static ?string $kernelClass = null; public function __construct($kernel) { diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/RememberMeBundle/Security/UserChangingUserProvider.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/RememberMeBundle/Security/UserChangingUserProvider.php index c40a7e0a12267..3126c9ebe8226 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/RememberMeBundle/Security/UserChangingUserProvider.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/RememberMeBundle/Security/UserChangingUserProvider.php @@ -19,9 +19,9 @@ class UserChangingUserProvider implements UserProviderInterface { - private $inner; + private InMemoryUserProvider $inner; - public static $changePassword = false; + public static bool $changePassword = false; public function __construct(InMemoryUserProvider $inner) { diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/SecuredPageBundle/Security/Core/User/ArrayUserProvider.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/SecuredPageBundle/Security/Core/User/ArrayUserProvider.php index 42f2df9e10043..55b411dad754d 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/SecuredPageBundle/Security/Core/User/ArrayUserProvider.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/SecuredPageBundle/Security/Core/User/ArrayUserProvider.php @@ -21,7 +21,7 @@ class ArrayUserProvider implements UserProviderInterface { /** @var UserInterface[] */ - private $users = []; + private array $users = []; public function addUser(UserInterface $user) { diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SecurityTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SecurityTest.php index f2d6733fcf350..a704bb5654d2e 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SecurityTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SecurityTest.php @@ -164,13 +164,13 @@ public function testLogoutBypassCsrf() final class UserWithoutEquatable implements UserInterface, PasswordAuthenticatedUserInterface { - private $username; - private $password; - private $enabled; - private $accountNonExpired; - private $credentialsNonExpired; - private $accountNonLocked; - private $roles; + private ?string $username; + private ?string $password; + private bool $enabled; + private bool $accountNonExpired; + private bool $credentialsNonExpired; + private bool $accountNonLocked; + private array $roles; public function __construct(?string $username, ?string $password, array $roles = [], bool $enabled = true, bool $userNonExpired = true, bool $credentialsNonExpired = true, bool $userNonLocked = true) { @@ -244,7 +244,7 @@ public function eraseCredentials(): void class ForceLoginController { - public $authenticator = 'form_login'; + public string $authenticator = 'form_login'; public function __construct(private Security $security) { @@ -261,7 +261,7 @@ public function welcome() class LogoutController { - public $checkCsrf = false; + public bool $checkCsrf = false; public function __construct(private Security $security) { diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/AppKernel.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/AppKernel.php index 4969b13419fb8..edac38dd98658 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/AppKernel.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/AppKernel.php @@ -22,9 +22,9 @@ */ class AppKernel extends Kernel { - private $varDir; - private $testCase; - private $rootConfig; + private string $varDir; + private string $testCase; + private array $rootConfig; public function __construct($varDir, $testCase, $rootConfig, $environment, $debug) { diff --git a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Compiler/TwigLoaderPassTest.php b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Compiler/TwigLoaderPassTest.php index 68431f969fe10..891ca75724209 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Compiler/TwigLoaderPassTest.php +++ b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Compiler/TwigLoaderPassTest.php @@ -19,18 +19,9 @@ class TwigLoaderPassTest extends TestCase { - /** - * @var ContainerBuilder - */ - private $builder; - /** - * @var Definition - */ - private $chainLoader; - /** - * @var TwigLoaderPass - */ - private $pass; + private ContainerBuilder $builder; + private Definition $chainLoader; + private TwigLoaderPass $pass; protected function setUp(): void { diff --git a/src/Symfony/Bundle/WebProfilerBundle/Tests/DependencyInjection/WebProfilerExtensionTest.php b/src/Symfony/Bundle/WebProfilerBundle/Tests/DependencyInjection/WebProfilerExtensionTest.php index fff94134162e4..3ec1756dc0efd 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Tests/DependencyInjection/WebProfilerExtensionTest.php +++ b/src/Symfony/Bundle/WebProfilerBundle/Tests/DependencyInjection/WebProfilerExtensionTest.php @@ -11,6 +11,7 @@ namespace Symfony\Bundle\WebProfilerBundle\Tests\DependencyInjection; +use PHPUnit\Framework\MockObject\MockObject; use Symfony\Bundle\WebProfilerBundle\DependencyInjection\WebProfilerExtension; use Symfony\Bundle\WebProfilerBundle\Tests\TestCase; use Symfony\Component\DependencyInjection\Container; @@ -30,11 +31,8 @@ class WebProfilerExtensionTest extends TestCase { - private $kernel; - /** - * @var \Symfony\Component\DependencyInjection\Container - */ - private $container; + private MockObject&KernelInterface $kernel; + private ?ContainerBuilder $container; public static function assertSaneContainer(Container $container) { @@ -93,7 +91,6 @@ protected function tearDown(): void parent::tearDown(); $this->container = null; - $this->kernel = null; } /** diff --git a/src/Symfony/Bundle/WebProfilerBundle/Tests/Profiler/TemplateManagerTest.php b/src/Symfony/Bundle/WebProfilerBundle/Tests/Profiler/TemplateManagerTest.php index 4ad4070d3cee3..b837fc6636395 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Tests/Profiler/TemplateManagerTest.php +++ b/src/Symfony/Bundle/WebProfilerBundle/Tests/Profiler/TemplateManagerTest.php @@ -24,20 +24,9 @@ */ class TemplateManagerTest extends TestCase { - /** - * @var Environment - */ - protected $twigEnvironment; - - /** - * @var Profiler - */ - protected $profiler; - - /** - * @var TemplateManager - */ - protected $templateManager; + protected Environment $twigEnvironment; + protected Profiler $profiler; + protected TemplateManager $templateManager; protected function setUp(): void { diff --git a/src/Symfony/Component/BrowserKit/Tests/TestClient.php b/src/Symfony/Component/BrowserKit/Tests/TestClient.php index 47c76ad5e56b0..dc27e3b5fbe49 100644 --- a/src/Symfony/Component/BrowserKit/Tests/TestClient.php +++ b/src/Symfony/Component/BrowserKit/Tests/TestClient.php @@ -16,8 +16,8 @@ class TestClient extends AbstractBrowser { - protected $nextResponse; - protected $nextScript; + protected ?Response $nextResponse = null; + protected string $nextScript; public function setNextResponse(Response $response) { diff --git a/src/Symfony/Component/BrowserKit/Tests/TestHttpClient.php b/src/Symfony/Component/BrowserKit/Tests/TestHttpClient.php index 7a3c9a7ec6d2a..c11e6831847b4 100644 --- a/src/Symfony/Component/BrowserKit/Tests/TestHttpClient.php +++ b/src/Symfony/Component/BrowserKit/Tests/TestHttpClient.php @@ -20,8 +20,8 @@ class TestHttpClient extends HttpBrowser { - protected $nextResponse; - protected $nextScript; + protected ?Response $nextResponse = null; + protected string $nextScript; public function __construct(array $server = [], History $history = null, CookieJar $cookieJar = null) { diff --git a/src/Symfony/Component/Cache/Tests/Adapter/AdapterTestCase.php b/src/Symfony/Component/Cache/Tests/Adapter/AdapterTestCase.php index 29164c7bc37ab..fa02c7708d3a9 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/AdapterTestCase.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/AdapterTestCase.php @@ -72,7 +72,7 @@ public function testGet() $this->assertFalse($isHit); $this->assertSame($value, $cache->get('bar', new class($value) implements CallbackInterface { - private $value; + private int $value; public function __construct(int $value) { diff --git a/src/Symfony/Component/Cache/Tests/Adapter/CouchbaseBucketAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/CouchbaseBucketAdapterTest.php index 11ca665c38cf8..f496999fec147 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/CouchbaseBucketAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/CouchbaseBucketAdapterTest.php @@ -30,8 +30,7 @@ class CouchbaseBucketAdapterTest extends AdapterTestCase 'testClearPrefix' => 'Couchbase cannot clear by prefix', ]; - /** @var \CouchbaseBucket */ - protected static $client; + protected static \CouchbaseBucket $client; public static function setupBeforeClass(): void { diff --git a/src/Symfony/Component/Cache/Tests/Adapter/CouchbaseCollectionAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/CouchbaseCollectionAdapterTest.php index 192bc00e2c516..4260cee980a08 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/CouchbaseCollectionAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/CouchbaseCollectionAdapterTest.php @@ -30,8 +30,7 @@ class CouchbaseCollectionAdapterTest extends AdapterTestCase 'testClearPrefix' => 'Couchbase cannot clear by prefix', ]; - /** @var Collection */ - protected static $client; + protected static Collection $client; public static function setupBeforeClass(): void { diff --git a/src/Symfony/Component/Cache/Tests/Adapter/DoctrineDbalAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/DoctrineDbalAdapterTest.php index 7f250f7b53596..42bca61b2603a 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/DoctrineDbalAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/DoctrineDbalAdapterTest.php @@ -28,7 +28,7 @@ */ class DoctrineDbalAdapterTest extends AdapterTestCase { - protected static $dbFile; + protected static string $dbFile; public static function setUpBeforeClass(): void { diff --git a/src/Symfony/Component/Cache/Tests/Adapter/MemcachedAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/MemcachedAdapterTest.php index d5c8086a7e467..22c4d60603db8 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/MemcachedAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/MemcachedAdapterTest.php @@ -28,7 +28,7 @@ class MemcachedAdapterTest extends AdapterTestCase 'testClearPrefix' => 'Memcached cannot clear by prefix', ]; - protected static $client; + protected static \Memcached $client; public static function setUpBeforeClass(): void { diff --git a/src/Symfony/Component/Cache/Tests/Adapter/PdoAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/PdoAdapterTest.php index 4a8f233cec308..2c44f22c4da31 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/PdoAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/PdoAdapterTest.php @@ -20,7 +20,7 @@ */ class PdoAdapterTest extends AdapterTestCase { - protected static $dbFile; + protected static string $dbFile; public static function setUpBeforeClass(): void { diff --git a/src/Symfony/Component/Cache/Tests/Adapter/PhpArrayAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/PhpArrayAdapterTest.php index 83e230e8c22a6..1762aca5b94a6 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/PhpArrayAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/PhpArrayAdapterTest.php @@ -59,7 +59,7 @@ class PhpArrayAdapterTest extends AdapterTestCase 'testPrune' => 'PhpArrayAdapter just proxies', ]; - protected static $file; + protected static string $file; public static function setUpBeforeClass(): void { diff --git a/src/Symfony/Component/Cache/Tests/Adapter/PhpArrayAdapterWithFallbackTest.php b/src/Symfony/Component/Cache/Tests/Adapter/PhpArrayAdapterWithFallbackTest.php index 265b55e5ea392..d20ffd554f90a 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/PhpArrayAdapterWithFallbackTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/PhpArrayAdapterWithFallbackTest.php @@ -30,7 +30,7 @@ class PhpArrayAdapterWithFallbackTest extends AdapterTestCase 'testPrune' => 'PhpArrayAdapter just proxies', ]; - protected static $file; + protected static string $file; public static function setUpBeforeClass(): void { diff --git a/src/Symfony/Component/Cache/Tests/Adapter/ProxyAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/ProxyAdapterTest.php index 378efa7b759f9..612e5d09c3434 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/ProxyAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/ProxyAdapterTest.php @@ -54,7 +54,7 @@ public function testProxyfiedItem() class TestingArrayAdapter extends ArrayAdapter { - private $item; + private CacheItemInterface $item; public function __construct(CacheItemInterface $item) { diff --git a/src/Symfony/Component/Cache/Tests/DependencyInjection/CachePoolPassTest.php b/src/Symfony/Component/Cache/Tests/DependencyInjection/CachePoolPassTest.php index 39350274aea33..cdb361a5633d7 100644 --- a/src/Symfony/Component/Cache/Tests/DependencyInjection/CachePoolPassTest.php +++ b/src/Symfony/Component/Cache/Tests/DependencyInjection/CachePoolPassTest.php @@ -25,7 +25,7 @@ class CachePoolPassTest extends TestCase { - private $cachePoolPass; + private CachePoolPass $cachePoolPass; protected function setUp(): void { diff --git a/src/Symfony/Component/Cache/Tests/Fixtures/ExternalAdapter.php b/src/Symfony/Component/Cache/Tests/Fixtures/ExternalAdapter.php index 2d2a4b1593a38..d75bc532dda9c 100644 --- a/src/Symfony/Component/Cache/Tests/Fixtures/ExternalAdapter.php +++ b/src/Symfony/Component/Cache/Tests/Fixtures/ExternalAdapter.php @@ -22,7 +22,7 @@ */ class ExternalAdapter implements CacheItemPoolInterface { - private $cache; + private ArrayAdapter $cache; public function __construct(int $defaultLifetime = 0) { diff --git a/src/Symfony/Component/Cache/Tests/Fixtures/StringableTag.php b/src/Symfony/Component/Cache/Tests/Fixtures/StringableTag.php index caaf55c026e08..6fd1dcaa519fd 100644 --- a/src/Symfony/Component/Cache/Tests/Fixtures/StringableTag.php +++ b/src/Symfony/Component/Cache/Tests/Fixtures/StringableTag.php @@ -13,10 +13,7 @@ class StringableTag { - /** - * @var string - */ - private $tag; + private string $tag; public function __construct(string $tag) { diff --git a/src/Symfony/Component/Cache/Tests/Marshaller/SodiumMarshallerTest.php b/src/Symfony/Component/Cache/Tests/Marshaller/SodiumMarshallerTest.php index bd80fb10dc9d9..e26151c07216a 100644 --- a/src/Symfony/Component/Cache/Tests/Marshaller/SodiumMarshallerTest.php +++ b/src/Symfony/Component/Cache/Tests/Marshaller/SodiumMarshallerTest.php @@ -20,7 +20,7 @@ */ class SodiumMarshallerTest extends TestCase { - private $decryptionKey; + private string $decryptionKey; protected function setUp(): void { diff --git a/src/Symfony/Component/Cache/Tests/Messenger/EarlyExpirationDispatcherTest.php b/src/Symfony/Component/Cache/Tests/Messenger/EarlyExpirationDispatcherTest.php index cdaef155b5c28..47331bba2d312 100644 --- a/src/Symfony/Component/Cache/Tests/Messenger/EarlyExpirationDispatcherTest.php +++ b/src/Symfony/Component/Cache/Tests/Messenger/EarlyExpirationDispatcherTest.php @@ -132,7 +132,7 @@ public function __invoke(CacheItem $item) final class TestLogger extends AbstractLogger { - public $records = []; + public array $records = []; public function log($level, $message, array $context = []): void { diff --git a/src/Symfony/Component/Config/Tests/Builder/GeneratedConfigTest.php b/src/Symfony/Component/Config/Tests/Builder/GeneratedConfigTest.php index 4bb6fe3acec91..db2ade6ffa204 100644 --- a/src/Symfony/Component/Config/Tests/Builder/GeneratedConfigTest.php +++ b/src/Symfony/Component/Config/Tests/Builder/GeneratedConfigTest.php @@ -36,7 +36,7 @@ */ class GeneratedConfigTest extends TestCase { - private $tempDir = []; + private array $tempDir = []; protected function setup(): void { diff --git a/src/Symfony/Component/Config/Tests/ConfigCacheTest.php b/src/Symfony/Component/Config/Tests/ConfigCacheTest.php index 8662346d7e921..f4ead1d528d88 100644 --- a/src/Symfony/Component/Config/Tests/ConfigCacheTest.php +++ b/src/Symfony/Component/Config/Tests/ConfigCacheTest.php @@ -18,7 +18,7 @@ class ConfigCacheTest extends TestCase { - private $cacheFile; + private string $cacheFile; protected function setUp(): void { diff --git a/src/Symfony/Component/Config/Tests/Loader/FileLoaderTest.php b/src/Symfony/Component/Config/Tests/Loader/FileLoaderTest.php index aacefa863afbb..4b7464a3cd977 100644 --- a/src/Symfony/Component/Config/Tests/Loader/FileLoaderTest.php +++ b/src/Symfony/Component/Config/Tests/Loader/FileLoaderTest.php @@ -153,7 +153,7 @@ public static function excludeTrailingSlashConsistencyProvider(): iterable class TestFileLoader extends FileLoader { - private $supports = true; + private bool $supports = true; public function load(mixed $resource, string $type = null): mixed { diff --git a/src/Symfony/Component/Config/Tests/Resource/DirectoryResourceTest.php b/src/Symfony/Component/Config/Tests/Resource/DirectoryResourceTest.php index a114f214ab1ad..57c57519f911c 100644 --- a/src/Symfony/Component/Config/Tests/Resource/DirectoryResourceTest.php +++ b/src/Symfony/Component/Config/Tests/Resource/DirectoryResourceTest.php @@ -16,7 +16,7 @@ class DirectoryResourceTest extends TestCase { - protected $directory; + protected string $directory; protected function setUp(): void { diff --git a/src/Symfony/Component/Config/Tests/Resource/FileExistenceResourceTest.php b/src/Symfony/Component/Config/Tests/Resource/FileExistenceResourceTest.php index c450ff172c0ad..31fd7846d81ca 100644 --- a/src/Symfony/Component/Config/Tests/Resource/FileExistenceResourceTest.php +++ b/src/Symfony/Component/Config/Tests/Resource/FileExistenceResourceTest.php @@ -16,9 +16,9 @@ class FileExistenceResourceTest extends TestCase { - protected $resource; - protected $file; - protected $time; + protected FileExistenceResource $resource; + protected string $file; + protected int $time; protected function setUp(): void { diff --git a/src/Symfony/Component/Config/Tests/Resource/FileResourceTest.php b/src/Symfony/Component/Config/Tests/Resource/FileResourceTest.php index de2423830a58d..9b6f8b85dc506 100644 --- a/src/Symfony/Component/Config/Tests/Resource/FileResourceTest.php +++ b/src/Symfony/Component/Config/Tests/Resource/FileResourceTest.php @@ -16,9 +16,9 @@ class FileResourceTest extends TestCase { - protected $resource; - protected $file; - protected $time; + protected FileResource $resource; + protected string $file; + protected int $time; protected function setUp(): void { diff --git a/src/Symfony/Component/Config/Tests/Resource/ReflectionClassResourceTest.php b/src/Symfony/Component/Config/Tests/Resource/ReflectionClassResourceTest.php index ef7a9b420fbdd..5ee2272c306bd 100644 --- a/src/Symfony/Component/Config/Tests/Resource/ReflectionClassResourceTest.php +++ b/src/Symfony/Component/Config/Tests/Resource/ReflectionClassResourceTest.php @@ -244,13 +244,13 @@ public static function getHandledMessages(): iterable } class TestMessageSubscriberConfigHolder { - public static $handledMessages = []; + public static array $handledMessages = []; } } class TestServiceSubscriber implements ServiceSubscriberInterface { - public static $subscribedServices = []; + public static array $subscribedServices = []; public static function getSubscribedServices(): array { @@ -260,5 +260,5 @@ public static function getSubscribedServices(): array class TestServiceWithStaticProperty { - public static $initializedObject; + public static object $initializedObject; } diff --git a/src/Symfony/Component/Config/Tests/Resource/ResourceStub.php b/src/Symfony/Component/Config/Tests/Resource/ResourceStub.php index 3cf8cfdbfa3dc..8f6b4e7edb1e6 100644 --- a/src/Symfony/Component/Config/Tests/Resource/ResourceStub.php +++ b/src/Symfony/Component/Config/Tests/Resource/ResourceStub.php @@ -15,7 +15,7 @@ class ResourceStub implements SelfCheckingResourceInterface { - private $fresh = true; + private bool $fresh = true; public function setFresh(bool $isFresh): void { diff --git a/src/Symfony/Component/Config/Tests/ResourceCheckerConfigCacheTest.php b/src/Symfony/Component/Config/Tests/ResourceCheckerConfigCacheTest.php index f205a72e5561e..37f30a49d4ec0 100644 --- a/src/Symfony/Component/Config/Tests/ResourceCheckerConfigCacheTest.php +++ b/src/Symfony/Component/Config/Tests/ResourceCheckerConfigCacheTest.php @@ -19,7 +19,7 @@ class ResourceCheckerConfigCacheTest extends TestCase { - private $cacheFile; + private string $cacheFile; protected function setUp(): void { diff --git a/src/Symfony/Component/Console/Tester/TesterTrait.php b/src/Symfony/Component/Console/Tester/TesterTrait.php index 497b8c8c77a8a..1ab7a70aa22d9 100644 --- a/src/Symfony/Component/Console/Tester/TesterTrait.php +++ b/src/Symfony/Component/Console/Tester/TesterTrait.php @@ -130,7 +130,7 @@ public function setInputs(array $inputs): static */ private function initOutput(array $options): void { - $this->captureStreamsIndependently = \array_key_exists('capture_stderr_separately', $options) && $options['capture_stderr_separately']; + $this->captureStreamsIndependently = $options['capture_stderr_separately'] ?? false; if (!$this->captureStreamsIndependently) { $this->output = new StreamOutput(fopen('php://memory', 'w', false)); if (isset($options['decorated'])) { diff --git a/src/Symfony/Component/Console/Tests/ApplicationTest.php b/src/Symfony/Component/Console/Tests/ApplicationTest.php index e59942ac8cc01..1edef0e680b73 100644 --- a/src/Symfony/Component/Console/Tests/ApplicationTest.php +++ b/src/Symfony/Component/Console/Tests/ApplicationTest.php @@ -52,9 +52,9 @@ class ApplicationTest extends TestCase { - protected static $fixturesPath; + protected static string $fixturesPath; - private $colSize; + private string|false $colSize; protected function setUp(): void { @@ -2267,12 +2267,12 @@ public function isEnabled(): bool #[AsCommand(name: 'signal')] class BaseSignableCommand extends Command { - public $signaled = false; - public $exitCode = 1; - public $signalHandlers = []; - public $loop = 1000; - private $emitsSignal; - private $signal; + public bool $signaled = false; + public int $exitCode = 1; + public array $signalHandlers = []; + public int $loop = 1000; + private bool $emitsSignal; + private int $signal; public function __construct(bool $emitsSignal = true, int $signal = \SIGUSR1) { @@ -2383,7 +2383,7 @@ public static function getSubscribedEvents(): array class SignalEventSubscriber implements EventSubscriberInterface { - public $signaled = false; + public bool $signaled = false; public function onSignal(ConsoleSignalEvent $event): void { diff --git a/src/Symfony/Component/Console/Tests/Command/CommandTest.php b/src/Symfony/Component/Console/Tests/Command/CommandTest.php index f85280fed6401..99fc554b5738c 100644 --- a/src/Symfony/Component/Console/Tests/Command/CommandTest.php +++ b/src/Symfony/Component/Console/Tests/Command/CommandTest.php @@ -31,7 +31,7 @@ class CommandTest extends TestCase { use ExpectDeprecationTrait; - protected static $fixturesPath; + protected static string $fixturesPath; public static function setUpBeforeClass(): void { diff --git a/src/Symfony/Component/Console/Tests/Command/CompleteCommandTest.php b/src/Symfony/Component/Console/Tests/Command/CompleteCommandTest.php index a8b8f99c70022..0f64fbc8eaffe 100644 --- a/src/Symfony/Component/Console/Tests/Command/CompleteCommandTest.php +++ b/src/Symfony/Component/Console/Tests/Command/CompleteCommandTest.php @@ -24,9 +24,9 @@ class CompleteCommandTest extends TestCase { - private $command; - private $application; - private $tester; + private CompleteCommand $command; + private Application $application; + private CommandTester $tester; protected function setUp(): void { diff --git a/src/Symfony/Component/Console/Tests/Command/LockableTraitTest.php b/src/Symfony/Component/Console/Tests/Command/LockableTraitTest.php index 59ddf35958b49..77b54f9ee369b 100644 --- a/src/Symfony/Component/Console/Tests/Command/LockableTraitTest.php +++ b/src/Symfony/Component/Console/Tests/Command/LockableTraitTest.php @@ -19,7 +19,7 @@ class LockableTraitTest extends TestCase { - protected static $fixturesPath; + protected static string $fixturesPath; public static function setUpBeforeClass(): void { diff --git a/src/Symfony/Component/Console/Tests/ConsoleEventsTest.php b/src/Symfony/Component/Console/Tests/ConsoleEventsTest.php index 78672a58676a4..6179eb9b0c93c 100644 --- a/src/Symfony/Component/Console/Tests/ConsoleEventsTest.php +++ b/src/Symfony/Component/Console/Tests/ConsoleEventsTest.php @@ -73,7 +73,7 @@ public function testEventAliases() class EventTraceSubscriber implements EventSubscriberInterface { - public $observedEvents = []; + public array $observedEvents = []; public static function getSubscribedEvents(): array { diff --git a/src/Symfony/Component/Console/Tests/DependencyInjection/AddConsoleCommandPassTest.php b/src/Symfony/Component/Console/Tests/DependencyInjection/AddConsoleCommandPassTest.php index c2fa8c22a8b04..523781201ce18 100644 --- a/src/Symfony/Component/Console/Tests/DependencyInjection/AddConsoleCommandPassTest.php +++ b/src/Symfony/Component/Console/Tests/DependencyInjection/AddConsoleCommandPassTest.php @@ -322,7 +322,7 @@ class EscapedDefaultsFromPhpCommand extends Command #[AsCommand(name: '|cmdname|cmdalias', description: 'Just testing')] class DescribedCommand extends Command { - public static $initCounter = 0; + public static int $initCounter = 0; public function __construct() { diff --git a/src/Symfony/Component/Console/Tests/Helper/ProgressBarTest.php b/src/Symfony/Component/Console/Tests/Helper/ProgressBarTest.php index dcdba23b1163b..18644503b5f2f 100644 --- a/src/Symfony/Component/Console/Tests/Helper/ProgressBarTest.php +++ b/src/Symfony/Component/Console/Tests/Helper/ProgressBarTest.php @@ -23,7 +23,7 @@ */ class ProgressBarTest extends TestCase { - private $colSize; + private string|false $colSize; protected function setUp(): void { diff --git a/src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php b/src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php index 22da61ecd860b..9a37558eced2d 100644 --- a/src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php +++ b/src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php @@ -952,7 +952,7 @@ protected function createInputInterfaceMock($interactive = true) class AutocompleteValues implements \IteratorAggregate { - private $values; + private array $values; public function __construct(array $values) { diff --git a/src/Symfony/Component/Console/Tests/Input/InputDefinitionTest.php b/src/Symfony/Component/Console/Tests/Input/InputDefinitionTest.php index 39157af8f41d8..470f3ca740468 100644 --- a/src/Symfony/Component/Console/Tests/Input/InputDefinitionTest.php +++ b/src/Symfony/Component/Console/Tests/Input/InputDefinitionTest.php @@ -18,7 +18,7 @@ class InputDefinitionTest extends TestCase { - protected static $fixtures; + protected static string $fixtures; protected $multi; protected $foo; diff --git a/src/Symfony/Component/Console/Tests/Logger/ConsoleLoggerTest.php b/src/Symfony/Component/Console/Tests/Logger/ConsoleLoggerTest.php index 6baa57bd5158f..41205d793619c 100644 --- a/src/Symfony/Component/Console/Tests/Logger/ConsoleLoggerTest.php +++ b/src/Symfony/Component/Console/Tests/Logger/ConsoleLoggerTest.php @@ -26,10 +26,7 @@ */ class ConsoleLoggerTest extends TestCase { - /** - * @var DummyOutput - */ - protected $output; + protected DummyOutput $output; public function getLogger(): LoggerInterface { diff --git a/src/Symfony/Component/Console/Tests/Output/OutputTest.php b/src/Symfony/Component/Console/Tests/Output/OutputTest.php index b7c0a98d9fe6a..8a1e2840e6f51 100644 --- a/src/Symfony/Component/Console/Tests/Output/OutputTest.php +++ b/src/Symfony/Component/Console/Tests/Output/OutputTest.php @@ -175,7 +175,7 @@ public static function verbosityProvider() class TestOutput extends Output { - public $output = ''; + public string $output = ''; public function clear() { diff --git a/src/Symfony/Component/Console/Tests/Question/ChoiceQuestionTest.php b/src/Symfony/Component/Console/Tests/Question/ChoiceQuestionTest.php index 3738cb7ac0348..564dee7240a2c 100644 --- a/src/Symfony/Component/Console/Tests/Question/ChoiceQuestionTest.php +++ b/src/Symfony/Component/Console/Tests/Question/ChoiceQuestionTest.php @@ -152,7 +152,7 @@ public function testSelectWithNonStringChoices() class StringChoice { - private $string; + private string $string; public function __construct(string $string) { diff --git a/src/Symfony/Component/Console/Tests/Question/QuestionTest.php b/src/Symfony/Component/Console/Tests/Question/QuestionTest.php index 136717834c505..6e8053a35cbb0 100644 --- a/src/Symfony/Component/Console/Tests/Question/QuestionTest.php +++ b/src/Symfony/Component/Console/Tests/Question/QuestionTest.php @@ -16,7 +16,7 @@ class QuestionTest extends TestCase { - private $question; + private Question $question; protected function setUp(): void { diff --git a/src/Symfony/Component/Console/Tests/Style/SymfonyStyleTest.php b/src/Symfony/Component/Console/Tests/Style/SymfonyStyleTest.php index f053b60f84335..e728267f3dded 100644 --- a/src/Symfony/Component/Console/Tests/Style/SymfonyStyleTest.php +++ b/src/Symfony/Component/Console/Tests/Style/SymfonyStyleTest.php @@ -25,14 +25,13 @@ use Symfony\Component\Console\Output\StreamOutput; use Symfony\Component\Console\Style\SymfonyStyle; use Symfony\Component\Console\Tester\CommandTester; +use Symfony\Component\Console\Tests\Command\CommandTest; class SymfonyStyleTest extends TestCase { - /** @var Command */ - protected $command; - /** @var CommandTester */ - protected $tester; - private $colSize; + protected Command $command; + protected CommandTester $tester; + private string|false $colSize; protected function setUp(): void { @@ -45,8 +44,6 @@ protected function setUp(): void protected function tearDown(): void { putenv($this->colSize ? 'COLUMNS='.$this->colSize : 'COLUMNS'); - $this->command = null; - $this->tester = null; } /** diff --git a/src/Symfony/Component/Console/Tests/TerminalTest.php b/src/Symfony/Component/Console/Tests/TerminalTest.php index 653dd4afc8f87..d43469d12bb1f 100644 --- a/src/Symfony/Component/Console/Tests/TerminalTest.php +++ b/src/Symfony/Component/Console/Tests/TerminalTest.php @@ -17,9 +17,9 @@ class TerminalTest extends TestCase { - private $colSize; - private $lineSize; - private $ansiCon; + private string|false $colSize; + private string|false $lineSize; + private string|false $ansiCon; protected function setUp(): void { diff --git a/src/Symfony/Component/Console/Tests/Tester/ApplicationTesterTest.php b/src/Symfony/Component/Console/Tests/Tester/ApplicationTesterTest.php index 024e32a0021b8..f43775179f029 100644 --- a/src/Symfony/Component/Console/Tests/Tester/ApplicationTesterTest.php +++ b/src/Symfony/Component/Console/Tests/Tester/ApplicationTesterTest.php @@ -20,8 +20,8 @@ class ApplicationTesterTest extends TestCase { - protected $application; - protected $tester; + protected Application $application; + protected ApplicationTester $tester; protected function setUp(): void { @@ -38,12 +38,6 @@ protected function setUp(): void $this->tester->run(['command' => 'foo', 'foo' => 'bar'], ['interactive' => false, 'decorated' => false, 'verbosity' => Output::VERBOSITY_VERBOSE]); } - protected function tearDown(): void - { - $this->application = null; - $this->tester = null; - } - public function testRun() { $this->assertFalse($this->tester->getInput()->isInteractive(), '->execute() takes an interactive option'); diff --git a/src/Symfony/Component/Console/Tests/Tester/CommandTesterTest.php b/src/Symfony/Component/Console/Tests/Tester/CommandTesterTest.php index d3c6443403603..3fec7df2d5123 100644 --- a/src/Symfony/Component/Console/Tests/Tester/CommandTesterTest.php +++ b/src/Symfony/Component/Console/Tests/Tester/CommandTesterTest.php @@ -24,8 +24,8 @@ class CommandTesterTest extends TestCase { - protected $command; - protected $tester; + protected Command $command; + protected CommandTester $tester; protected function setUp(): void { @@ -38,12 +38,6 @@ protected function setUp(): void $this->tester->execute(['foo' => 'bar'], ['interactive' => false, 'decorated' => false, 'verbosity' => Output::VERBOSITY_VERBOSE]); } - protected function tearDown(): void - { - $this->command = null; - $this->tester = null; - } - public function testExecute() { $this->assertFalse($this->tester->getInput()->isInteractive(), '->execute() takes an interactive option'); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/AbstractRecursivePassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/AbstractRecursivePassTest.php index da13154e378f6..23c42d1306502 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/AbstractRecursivePassTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/AbstractRecursivePassTest.php @@ -36,7 +36,7 @@ public function testGetConstructorResolvesFactoryChildDefinitionsClass() ->setFactory([new Reference('child'), 'createFactory']); $pass = new class() extends AbstractRecursivePass { - public $actual; + public \ReflectionMethod $actual; protected function processValue($value, $isRoot = false): mixed { @@ -62,7 +62,7 @@ public function testGetConstructorResolvesChildDefinitionsClass() $container->setDefinition('foo', new ChildDefinition('parent')); $pass = new class() extends AbstractRecursivePass { - public $actual; + public \ReflectionMethod $actual; protected function processValue($value, $isRoot = false): mixed { @@ -88,7 +88,7 @@ public function testGetReflectionMethodResolvesChildDefinitionsClass() $container->setDefinition('foo', new ChildDefinition('parent')); $pass = new class() extends AbstractRecursivePass { - public $actual; + public \ReflectionMethod $actual; protected function processValue($value, $isRoot = false): mixed { diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ExtensionCompilerPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ExtensionCompilerPassTest.php index 5877f74de373a..ad242432cac77 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ExtensionCompilerPassTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ExtensionCompilerPassTest.php @@ -22,8 +22,8 @@ */ class ExtensionCompilerPassTest extends TestCase { - private $container; - private $pass; + private ContainerBuilder $container; + private ExtensionCompilerPass $pass; protected function setUp(): void { diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/IntegrationTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/IntegrationTest.php index 3bf66f0313967..1959724829c71 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/IntegrationTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/IntegrationTest.php @@ -1089,7 +1089,7 @@ public function testTaggedIteratorAndLocatorWithExclude() class ServiceSubscriberStub implements ServiceSubscriberInterface { - public $container; + public ContainerInterface $container; public function __construct(ContainerInterface $container) { @@ -1109,10 +1109,7 @@ class DecoratedServiceSubscriber class DecoratedServiceLocator implements ServiceProviderInterface { - /** - * @var ServiceLocator - */ - private $locator; + private ServiceLocator $locator; public function __construct(ServiceLocator $locator) { @@ -1153,7 +1150,7 @@ public function setSunshine($type) final class TagCollector implements CompilerPassInterface { - public $collectedTags; + public array $collectedTags; public function process(ContainerBuilder $container): void { diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveParameterPlaceHoldersPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveParameterPlaceHoldersPassTest.php index 2f4a8e1d94141..9f3b010178c20 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveParameterPlaceHoldersPassTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveParameterPlaceHoldersPassTest.php @@ -14,13 +14,14 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\DependencyInjection\Compiler\ResolveParameterPlaceHoldersPass; use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException; class ResolveParameterPlaceHoldersPassTest extends TestCase { - private $compilerPass; - private $container; - private $fooDefinition; + private ResolveParameterPlaceHoldersPass $compilerPass; + private ContainerBuilder $container; + private Definition $fooDefinition; protected function setUp(): void { diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ServiceLocatorTagPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ServiceLocatorTagPassTest.php index 10f9bff443919..da28c02939e43 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ServiceLocatorTagPassTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ServiceLocatorTagPassTest.php @@ -230,10 +230,7 @@ public function testBindingsAreProcessed() class Locator { - /** - * @var ServiceLocator - */ - public $locator; + public ServiceLocator $locator; public function __construct(ServiceLocator $locator) { diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ValidateEnvPlaceholdersPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ValidateEnvPlaceholdersPassTest.php index 9c82e3d8d32e7..cdaa1e2cd8c5d 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ValidateEnvPlaceholdersPassTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ValidateEnvPlaceholdersPassTest.php @@ -371,8 +371,8 @@ public function getConfigTreeBuilder(): TreeBuilder class EnvExtension extends Extension { - private $configuration; - private $config; + private ConfigurationInterface $configuration; + private array $config; public function __construct(ConfigurationInterface $configuration = null) { diff --git a/src/Symfony/Component/DependencyInjection/Tests/Config/ContainerParametersResourceCheckerTest.php b/src/Symfony/Component/DependencyInjection/Tests/Config/ContainerParametersResourceCheckerTest.php index f13acc8f140e2..9fefdd49e01e3 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Config/ContainerParametersResourceCheckerTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Config/ContainerParametersResourceCheckerTest.php @@ -13,21 +13,15 @@ use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; -use Symfony\Component\Config\ResourceCheckerInterface; use Symfony\Component\DependencyInjection\Config\ContainerParametersResource; use Symfony\Component\DependencyInjection\Config\ContainerParametersResourceChecker; use Symfony\Component\DependencyInjection\ContainerInterface; class ContainerParametersResourceCheckerTest extends TestCase { - /** @var ContainerParametersResource */ - private $resource; - - /** @var ResourceCheckerInterface */ - private $resourceChecker; - - /** @var ContainerInterface */ - private $container; + private ContainerParametersResource $resource; + private ContainerParametersResourceChecker $resourceChecker; + private MockObject&ContainerInterface $container; protected function setUp(): void { diff --git a/src/Symfony/Component/DependencyInjection/Tests/Config/ContainerParametersResourceTest.php b/src/Symfony/Component/DependencyInjection/Tests/Config/ContainerParametersResourceTest.php index 35422ce4224c1..0c00e6f26caee 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Config/ContainerParametersResourceTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Config/ContainerParametersResourceTest.php @@ -16,8 +16,7 @@ class ContainerParametersResourceTest extends TestCase { - /** @var ContainerParametersResource */ - private $resource; + private ContainerParametersResource $resource; protected function setUp(): void { diff --git a/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php b/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php index aadbdb48ab6b1..ad7454d3ba2d1 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php @@ -315,7 +315,7 @@ public function testReset() { $c = new Container(); $c->set('bar', $bar = new class() implements ResetInterface { - public $resetCounter = 0; + public int $resetCounter = 0; public function reset(): void { diff --git a/src/Symfony/Component/DependencyInjection/Tests/CrossCheckTest.php b/src/Symfony/Component/DependencyInjection/Tests/CrossCheckTest.php index 699080d6bdb82..db17da4082f56 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/CrossCheckTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/CrossCheckTest.php @@ -17,7 +17,7 @@ class CrossCheckTest extends TestCase { - protected static $fixturesPath; + protected static string $fixturesPath; public static function setUpBeforeClass(): void { diff --git a/src/Symfony/Component/DependencyInjection/Tests/Dumper/GraphvizDumperTest.php b/src/Symfony/Component/DependencyInjection/Tests/Dumper/GraphvizDumperTest.php index 7171672b17221..ec4df75f1e116 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Dumper/GraphvizDumperTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Dumper/GraphvizDumperTest.php @@ -19,7 +19,7 @@ class GraphvizDumperTest extends TestCase { - protected static $fixturesPath; + protected static string $fixturesPath; public static function setUpBeforeClass(): void { diff --git a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php index 91f8a20dcc224..463473db8e681 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php @@ -76,7 +76,7 @@ class PhpDumperTest extends TestCase { use ExpectDeprecationTrait; - protected static $fixturesPath; + protected static string $fixturesPath; public static function setUpBeforeClass(): void { diff --git a/src/Symfony/Component/DependencyInjection/Tests/Dumper/XmlDumperTest.php b/src/Symfony/Component/DependencyInjection/Tests/Dumper/XmlDumperTest.php index c1ee343bcb8b9..4f49599db726c 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Dumper/XmlDumperTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Dumper/XmlDumperTest.php @@ -28,7 +28,7 @@ class XmlDumperTest extends TestCase { - protected static $fixturesPath; + protected static string $fixturesPath; public static function setUpBeforeClass(): void { diff --git a/src/Symfony/Component/DependencyInjection/Tests/Dumper/YamlDumperTest.php b/src/Symfony/Component/DependencyInjection/Tests/Dumper/YamlDumperTest.php index 18ed93a430b4e..8a0df9844695a 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Dumper/YamlDumperTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Dumper/YamlDumperTest.php @@ -31,7 +31,7 @@ class YamlDumperTest extends TestCase { - protected static $fixturesPath; + protected static string $fixturesPath; public static function setUpBeforeClass(): void { diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/DirectoryLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/DirectoryLoaderTest.php index a62f7059f6e6c..9f96e51aee5f9 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Loader/DirectoryLoaderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/DirectoryLoaderTest.php @@ -22,10 +22,10 @@ class DirectoryLoaderTest extends TestCase { - private static $fixturesPath; + private static string $fixturesPath; - private $container; - private $loader; + private ContainerBuilder $container; + private DirectoryLoader $loader; public static function setUpBeforeClass(): void { diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/FileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/FileLoaderTest.php index dbfb3daf7bf27..2dd904428d086 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Loader/FileLoaderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/FileLoaderTest.php @@ -44,7 +44,7 @@ class FileLoaderTest extends TestCase { - protected static $fixturesPath; + protected static string $fixturesPath; public static function setUpBeforeClass(): void { diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/IniFileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/IniFileLoaderTest.php index f947da620bde3..aa0d22dc5e6d2 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Loader/IniFileLoaderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/IniFileLoaderTest.php @@ -19,8 +19,8 @@ class IniFileLoaderTest extends TestCase { - protected $container; - protected $loader; + protected ContainerBuilder$container; + protected IniFileLoader $loader; protected function setUp(): void { diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/LoaderResolverTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/LoaderResolverTest.php index 5980a3c636393..996cc524149fe 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Loader/LoaderResolverTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/LoaderResolverTest.php @@ -23,10 +23,9 @@ class LoaderResolverTest extends TestCase { - private static $fixturesPath; + private static string $fixturesPath; - /** @var LoaderResolver */ - private $resolver; + private LoaderResolver $resolver; protected function setUp(): void { diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php index a7c6df66fec3d..643d6e7245c41 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php @@ -51,7 +51,7 @@ class XmlFileLoaderTest extends TestCase { use ExpectDeprecationTrait; - protected static $fixturesPath; + protected static string $fixturesPath; public static function setUpBeforeClass(): void { diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php index 7027cdb232e3c..f1debaa09f6f8 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php @@ -49,7 +49,7 @@ class YamlFileLoaderTest extends TestCase { use ExpectDeprecationTrait; - protected static $fixturesPath; + protected static string $fixturesPath; public static function setUpBeforeClass(): void { diff --git a/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/ContainerBagTest.php b/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/ContainerBagTest.php index b01442d462f93..c91572069fc26 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/ContainerBagTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/ContainerBagTest.php @@ -22,10 +22,8 @@ class ContainerBagTest extends TestCase { - /** @var ParameterBag */ - private $parameterBag; - /** @var ContainerBag */ - private $containerBag; + private ParameterBag $parameterBag; + private ContainerBag $containerBag; protected function setUp(): void { diff --git a/src/Symfony/Component/DependencyInjection/Tests/ServiceLocatorTest.php b/src/Symfony/Component/DependencyInjection/Tests/ServiceLocatorTest.php index 4aebc0cd29434..9e5e9d19b1429 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/ServiceLocatorTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/ServiceLocatorTest.php @@ -106,7 +106,7 @@ public function testProvidesServicesInformation() class SomeServiceSubscriber implements ServiceSubscriberInterface { - public $container; + public ContainerInterface $container; public function getFoo() { diff --git a/src/Symfony/Component/ErrorHandler/Tests/DebugClassLoaderTest.php b/src/Symfony/Component/ErrorHandler/Tests/DebugClassLoaderTest.php index 87db0bf4b5a80..ac08e698e2756 100644 --- a/src/Symfony/Component/ErrorHandler/Tests/DebugClassLoaderTest.php +++ b/src/Symfony/Component/ErrorHandler/Tests/DebugClassLoaderTest.php @@ -17,9 +17,9 @@ class DebugClassLoaderTest extends TestCase { - private $patchTypes; - private $errorReporting; - private $loader; + private string|false $patchTypes; + private int $errorReporting; + private array $loader; protected function setUp(): void { diff --git a/src/Symfony/Component/EventDispatcher/Tests/EventDispatcherTest.php b/src/Symfony/Component/EventDispatcher/Tests/EventDispatcherTest.php index 59f6fcbebfb37..d6d07780351f6 100644 --- a/src/Symfony/Component/EventDispatcher/Tests/EventDispatcherTest.php +++ b/src/Symfony/Component/EventDispatcher/Tests/EventDispatcherTest.php @@ -23,12 +23,8 @@ class EventDispatcherTest extends TestCase private const postFoo = 'post.foo'; private const preBar = 'pre.bar'; - /** - * @var EventDispatcher - */ - private $dispatcher; - - private $listener; + private EventDispatcher $dispatcher; + private TestEventListener $listener; protected function setUp(): void { @@ -36,12 +32,6 @@ protected function setUp(): void $this->listener = new TestEventListener(); } - protected function tearDown(): void - { - $this->dispatcher = null; - $this->listener = null; - } - protected function createEventDispatcher() { return new EventDispatcher(); @@ -446,9 +436,9 @@ public function __invoke() class TestEventListener { - public $name; - public $preFooInvoked = false; - public $postFooInvoked = false; + public string $name; + public bool $preFooInvoked = false; + public bool $postFooInvoked = false; /* Listener methods */ @@ -473,9 +463,9 @@ public function __invoke() class TestWithDispatcher { - public $name; - public $dispatcher; - public $invoked = false; + public ?string $name = null; + public ?EventDispatcher $dispatcher = null; + public bool $invoked = false; public function foo($e, $name, $dispatcher) { diff --git a/src/Symfony/Component/EventDispatcher/Tests/GenericEventTest.php b/src/Symfony/Component/EventDispatcher/Tests/GenericEventTest.php index d13d53629f7c6..15dac83ea654c 100644 --- a/src/Symfony/Component/EventDispatcher/Tests/GenericEventTest.php +++ b/src/Symfony/Component/EventDispatcher/Tests/GenericEventTest.php @@ -19,31 +19,15 @@ */ class GenericEventTest extends TestCase { - /** - * @var GenericEvent - */ - private $event; - - private $subject; + private GenericEvent $event; + private \stdClass $subject; - /** - * Prepares the environment before running a test. - */ protected function setUp(): void { $this->subject = new \stdClass(); $this->event = new GenericEvent($this->subject, ['name' => 'Event']); } - /** - * Cleans up the environment after running a test. - */ - protected function tearDown(): void - { - $this->subject = null; - $this->event = null; - } - public function testConstruct() { $this->assertEquals($this->event, new GenericEvent($this->subject, ['name' => 'Event'])); diff --git a/src/Symfony/Component/EventDispatcher/Tests/ImmutableEventDispatcherTest.php b/src/Symfony/Component/EventDispatcher/Tests/ImmutableEventDispatcherTest.php index 35bab1a9325da..af3ec9513d8a6 100644 --- a/src/Symfony/Component/EventDispatcher/Tests/ImmutableEventDispatcherTest.php +++ b/src/Symfony/Component/EventDispatcher/Tests/ImmutableEventDispatcherTest.php @@ -23,15 +23,8 @@ */ class ImmutableEventDispatcherTest extends TestCase { - /** - * @var MockObject&EventDispatcherInterface - */ - private $innerDispatcher; - - /** - * @var ImmutableEventDispatcher - */ - private $dispatcher; + private MockObject&EventDispatcherInterface $innerDispatcher; + private ImmutableEventDispatcher $dispatcher; protected function setUp(): void { diff --git a/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php b/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php index bef2395e859c6..93bf44c404c0e 100644 --- a/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php +++ b/src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php @@ -170,10 +170,10 @@ public function testParseThrowsInsteadOfNotice() public static function shortCircuitProviderEvaluate() { - $object = new class(\Closure::fromCallable([static::class, 'fail'])) { - private $fail; + $object = new class(static::fail(...)) { + private \Closure $fail; - public function __construct(callable $fail) + public function __construct(\Closure $fail) { $this->fail = $fail; } diff --git a/src/Symfony/Component/ExpressionLanguage/Tests/LexerTest.php b/src/Symfony/Component/ExpressionLanguage/Tests/LexerTest.php index 64f060d722018..b1962b51d0a47 100644 --- a/src/Symfony/Component/ExpressionLanguage/Tests/LexerTest.php +++ b/src/Symfony/Component/ExpressionLanguage/Tests/LexerTest.php @@ -19,10 +19,7 @@ class LexerTest extends TestCase { - /** - * @var Lexer - */ - private $lexer; + private Lexer $lexer; protected function setUp(): void { diff --git a/src/Symfony/Component/Filesystem/Tests/FilesystemTestCase.php b/src/Symfony/Component/Filesystem/Tests/FilesystemTestCase.php index 79cb453ed4f28..8ac8bf5b3ce76 100644 --- a/src/Symfony/Component/Filesystem/Tests/FilesystemTestCase.php +++ b/src/Symfony/Component/Filesystem/Tests/FilesystemTestCase.php @@ -16,29 +16,14 @@ class FilesystemTestCase extends TestCase { - private $umask; + protected array $longPathNamesWindows = []; + protected Filesystem $filesystem; + protected string $workspace; - protected $longPathNamesWindows = []; + private int $umask; - /** - * @var Filesystem - */ - protected $filesystem; - - /** - * @var string - */ - protected $workspace; - - /** - * @var bool|null Flag for hard links on Windows - */ - private static $linkOnWindows; - - /** - * @var bool|null Flag for symbolic links on Windows - */ - private static $symlinkOnWindows; + private static ?bool $linkOnWindows = null; + private static ?bool $symlinkOnWindows = null; public static function setUpBeforeClass(): void { diff --git a/src/Symfony/Component/Filesystem/Tests/PathTest.php b/src/Symfony/Component/Filesystem/Tests/PathTest.php index 77b9f2a2d0576..6964e5c6ad68b 100644 --- a/src/Symfony/Component/Filesystem/Tests/PathTest.php +++ b/src/Symfony/Component/Filesystem/Tests/PathTest.php @@ -21,7 +21,7 @@ */ class PathTest extends TestCase { - protected $storedEnv = []; + protected array $storedEnv = []; protected function setUp(): void { diff --git a/src/Symfony/Component/Finder/Tests/Iterator/Iterator.php b/src/Symfony/Component/Finder/Tests/Iterator/Iterator.php index f1e68e5a35ccf..28d9c931d4174 100644 --- a/src/Symfony/Component/Finder/Tests/Iterator/Iterator.php +++ b/src/Symfony/Component/Finder/Tests/Iterator/Iterator.php @@ -13,7 +13,7 @@ class Iterator implements \Iterator { - protected $values = []; + protected array $values = []; public function __construct(array $values = []) { diff --git a/src/Symfony/Component/Finder/Tests/Iterator/MockSplFileInfo.php b/src/Symfony/Component/Finder/Tests/Iterator/MockSplFileInfo.php index 14bb5e4f3090c..854c17152e6cf 100644 --- a/src/Symfony/Component/Finder/Tests/Iterator/MockSplFileInfo.php +++ b/src/Symfony/Component/Finder/Tests/Iterator/MockSplFileInfo.php @@ -17,11 +17,11 @@ class MockSplFileInfo extends \SplFileInfo public const TYPE_FILE = 2; public const TYPE_UNKNOWN = 3; - private $contents; - private $mode; - private $type; - private $relativePath; - private $relativePathname; + private ?string $contents = null; + private ?string $mode = null; + private ?int $type = null; + private ?string $relativePath = null; + private ?string $relativePathname = null; public function __construct($param) { diff --git a/src/Symfony/Component/Finder/Tests/Iterator/RealIteratorTestCase.php b/src/Symfony/Component/Finder/Tests/Iterator/RealIteratorTestCase.php index 9a9d528fa7e1d..943c9ad0b389e 100644 --- a/src/Symfony/Component/Finder/Tests/Iterator/RealIteratorTestCase.php +++ b/src/Symfony/Component/Finder/Tests/Iterator/RealIteratorTestCase.php @@ -16,8 +16,8 @@ abstract class RealIteratorTestCase extends IteratorTestCase { - protected static $tmpDir; - protected static $files; + protected static string $tmpDir; + protected static array $files; public static function setUpBeforeClass(): void { @@ -126,9 +126,7 @@ protected static function toAbsolute($files = null) /* * Without the call to setUpBeforeClass() property can be null. */ - if (!self::$tmpDir) { - self::$tmpDir = realpath(sys_get_temp_dir()).\DIRECTORY_SEPARATOR.'symfony_finder'; - } + self::$tmpDir ??= realpath(sys_get_temp_dir()).\DIRECTORY_SEPARATOR.'symfony_finder'; if (\is_array($files)) { $f = []; diff --git a/src/Symfony/Component/Finder/Tests/Iterator/VcsIgnoredFilterIteratorTest.php b/src/Symfony/Component/Finder/Tests/Iterator/VcsIgnoredFilterIteratorTest.php index 61da148dc9c40..3ebe481f559c5 100644 --- a/src/Symfony/Component/Finder/Tests/Iterator/VcsIgnoredFilterIteratorTest.php +++ b/src/Symfony/Component/Finder/Tests/Iterator/VcsIgnoredFilterIteratorTest.php @@ -16,10 +16,7 @@ class VcsIgnoredFilterIteratorTest extends IteratorTestCase { - /** - * @var string - */ - private $tmpDir; + private string $tmpDir; protected function setUp(): void { diff --git a/src/Symfony/Component/Form/Test/FormIntegrationTestCase.php b/src/Symfony/Component/Form/Test/FormIntegrationTestCase.php index 4feb8df5a6567..5bf37fd48ad5a 100644 --- a/src/Symfony/Component/Form/Test/FormIntegrationTestCase.php +++ b/src/Symfony/Component/Form/Test/FormIntegrationTestCase.php @@ -20,10 +20,7 @@ */ abstract class FormIntegrationTestCase extends TestCase { - /** - * @var FormFactoryInterface - */ - protected $factory; + protected FormFactoryInterface $factory; protected function setUp(): void { diff --git a/src/Symfony/Component/Form/Tests/AbstractRequestHandlerTestCase.php b/src/Symfony/Component/Form/Tests/AbstractRequestHandlerTestCase.php index becf3504c3183..3367d58047efd 100644 --- a/src/Symfony/Component/Form/Tests/AbstractRequestHandlerTestCase.php +++ b/src/Symfony/Component/Form/Tests/AbstractRequestHandlerTestCase.php @@ -29,25 +29,16 @@ */ abstract class AbstractRequestHandlerTestCase extends TestCase { - /** - * @var RequestHandlerInterface - */ - protected $requestHandler; - - /** - * @var FormFactory - */ - protected $factory; - + protected RequestHandlerInterface $requestHandler; + protected FormFactory $factory; protected $request; - - protected $serverParams; + protected ServerParams $serverParams; protected function setUp(): void { $this->serverParams = new class() extends ServerParams { - public $contentLength; - public $postMaxSize = ''; + public ?int $contentLength = null; + public string $postMaxSize = ''; public function getContentLength(): ?int { diff --git a/src/Symfony/Component/Form/Tests/ChoiceList/AbstractChoiceListTestCase.php b/src/Symfony/Component/Form/Tests/ChoiceList/AbstractChoiceListTestCase.php index dd55bfcff0555..0b0cb8e79f62e 100644 --- a/src/Symfony/Component/Form/Tests/ChoiceList/AbstractChoiceListTestCase.php +++ b/src/Symfony/Component/Form/Tests/ChoiceList/AbstractChoiceListTestCase.php @@ -19,90 +19,23 @@ */ abstract class AbstractChoiceListTestCase extends TestCase { - /** - * @var ChoiceListInterface - */ - protected $list; - - /** - * @var array - */ - protected $choices; - - /** - * @var array - */ - protected $values; - - /** - * @var array - */ - protected $structuredValues; - - /** - * @var array - */ - protected $keys; - - /** - * @var mixed - */ - protected $choice1; - - /** - * @var mixed - */ - protected $choice2; - - /** - * @var mixed - */ - protected $choice3; - - /** - * @var mixed - */ - protected $choice4; - - /** - * @var string - */ - protected $value1; - - /** - * @var string - */ - protected $value2; - - /** - * @var string - */ - protected $value3; - - /** - * @var string - */ - protected $value4; - - /** - * @var string - */ - protected $key1; - - /** - * @var string - */ - protected $key2; - - /** - * @var string - */ - protected $key3; - - /** - * @var string - */ - protected $key4; + protected ChoiceListInterface $list; + protected array $choices; + protected array $values; + protected array $structuredValues; + protected array $keys; + protected mixed $choice1; + protected mixed $choice2; + protected mixed $choice3; + protected mixed $choice4; + protected string $value1; + protected string $value2; + protected string $value3; + protected string $value4; + protected string $key1; + protected string $key2; + protected string $key3; + protected string $key4; protected function setUp(): void { diff --git a/src/Symfony/Component/Form/Tests/ChoiceList/ArrayChoiceListTest.php b/src/Symfony/Component/Form/Tests/ChoiceList/ArrayChoiceListTest.php index 835085a7acb5f..f8a6b5b26e4d1 100644 --- a/src/Symfony/Component/Form/Tests/ChoiceList/ArrayChoiceListTest.php +++ b/src/Symfony/Component/Form/Tests/ChoiceList/ArrayChoiceListTest.php @@ -19,7 +19,7 @@ */ class ArrayChoiceListTest extends AbstractChoiceListTestCase { - private $object; + private \stdClass $object; protected function setUp(): void { diff --git a/src/Symfony/Component/Form/Tests/ChoiceList/Factory/CachingFactoryDecoratorTest.php b/src/Symfony/Component/Form/Tests/ChoiceList/Factory/CachingFactoryDecoratorTest.php index d4231bf946a2f..2668d72edcfcb 100644 --- a/src/Symfony/Component/Form/Tests/ChoiceList/Factory/CachingFactoryDecoratorTest.php +++ b/src/Symfony/Component/Form/Tests/ChoiceList/Factory/CachingFactoryDecoratorTest.php @@ -28,10 +28,7 @@ */ class CachingFactoryDecoratorTest extends TestCase { - /** - * @var CachingFactoryDecorator - */ - private $factory; + private CachingFactoryDecorator $factory; protected function setUp(): void { diff --git a/src/Symfony/Component/Form/Tests/ChoiceList/Factory/DefaultChoiceListFactoryTest.php b/src/Symfony/Component/Form/Tests/ChoiceList/Factory/DefaultChoiceListFactoryTest.php index dfbbd2b5b8166..9973c62ae9a3c 100644 --- a/src/Symfony/Component/Form/Tests/ChoiceList/Factory/DefaultChoiceListFactoryTest.php +++ b/src/Symfony/Component/Form/Tests/ChoiceList/Factory/DefaultChoiceListFactoryTest.php @@ -27,24 +27,12 @@ class DefaultChoiceListFactoryTest extends TestCase { - private $obj1; - - private $obj2; - - private $obj3; - - private $obj4; - - private $obj5; - - private $obj6; - - private $list; - - /** - * @var DefaultChoiceListFactory - */ - private $factory; + private \stdClass $obj1; + private \stdClass $obj2; + private \stdClass $obj3; + private \stdClass $obj4; + private ArrayChoiceList $list; + private DefaultChoiceListFactory $factory; public function getValue($object) { @@ -208,9 +196,9 @@ public function testCreateFromChoicesGroupedValuesAsClosure() public function testCreateFromFilteredChoices() { $list = $this->factory->createListFromChoices( - ['A' => $this->obj1, 'B' => $this->obj2, 'C' => $this->obj3, 'D' => $this->obj4, 'E' => $this->obj5, 'F' => $this->obj6], + ['A' => $this->obj1, 'B' => $this->obj2, 'C' => $this->obj3, 'D' => $this->obj4, 'E' => null, 'F' => null], null, - fn ($choice) => $choice !== $this->obj5 && $choice !== $this->obj6 + fn ($choice) => null !== $choice ); $this->assertObjectListWithGeneratedValues($list); @@ -222,11 +210,11 @@ public function testCreateFromChoicesGroupedAndFiltered() [ 'Group 1' => ['A' => $this->obj1, 'B' => $this->obj2], 'Group 2' => ['C' => $this->obj3, 'D' => $this->obj4], - 'Group 3' => ['E' => $this->obj5, 'F' => $this->obj6], + 'Group 3' => ['E' => null, 'F' => null], 'Group 4' => [/* empty group should be filtered */], ], null, - fn ($choice) => $choice !== $this->obj5 && $choice !== $this->obj6 + fn ($choice) => null !== $choice ); $this->assertObjectListWithGeneratedValues($list); @@ -238,11 +226,11 @@ public function testCreateFromChoicesGroupedAndFilteredTraversable() new \ArrayIterator([ 'Group 1' => ['A' => $this->obj1, 'B' => $this->obj2], 'Group 2' => ['C' => $this->obj3, 'D' => $this->obj4], - 'Group 3' => ['E' => $this->obj5, 'F' => $this->obj6], + 'Group 3' => ['E' => null, 'F' => null], 'Group 4' => [/* empty group should be filtered */], ]), null, - fn ($choice) => $choice !== $this->obj5 && $choice !== $this->obj6 + fn ($choice) => null !== $choice ); $this->assertObjectListWithGeneratedValues($list); @@ -1026,7 +1014,7 @@ private function assertGroupedViewWithChoiceDuplication($view) class DefaultChoiceListFactoryTest_Castable { - private $property; + private string $property; public function __construct($property) { diff --git a/src/Symfony/Component/Form/Tests/ChoiceList/Factory/PropertyAccessDecoratorTest.php b/src/Symfony/Component/Form/Tests/ChoiceList/Factory/PropertyAccessDecoratorTest.php index 09482fda89642..afc83f707f098 100644 --- a/src/Symfony/Component/Form/Tests/ChoiceList/Factory/PropertyAccessDecoratorTest.php +++ b/src/Symfony/Component/Form/Tests/ChoiceList/Factory/PropertyAccessDecoratorTest.php @@ -25,10 +25,7 @@ */ class PropertyAccessDecoratorTest extends TestCase { - /** - * @var PropertyAccessDecorator - */ - private $factory; + private PropertyAccessDecorator $factory; protected function setUp(): void { diff --git a/src/Symfony/Component/Form/Tests/ChoiceList/Loader/CallbackChoiceLoaderTest.php b/src/Symfony/Component/Form/Tests/ChoiceList/Loader/CallbackChoiceLoaderTest.php index e175c58103fef..d394196ee1dff 100644 --- a/src/Symfony/Component/Form/Tests/ChoiceList/Loader/CallbackChoiceLoaderTest.php +++ b/src/Symfony/Component/Form/Tests/ChoiceList/Loader/CallbackChoiceLoaderTest.php @@ -21,30 +21,11 @@ */ class CallbackChoiceLoaderTest extends TestCase { - /** - * @var \Symfony\Component\Form\ChoiceList\Loader\CallbackChoiceLoader - */ - private static $loader; - - /** - * @var callable - */ - private static $value; - - /** - * @var array - */ - private static $choices; - - /** - * @var string[] - */ - private static $choiceValues; - - /** - * @var \Symfony\Component\Form\ChoiceList\LazyChoiceList - */ - private static $lazyChoiceList; + private static CallbackChoiceLoader $loader; + private static \Closure $value; + private static array $choices; + private static array $choiceValues = ['choice_one', 'choice_two']; + private static LazyChoiceList $lazyChoiceList; public static function setUpBeforeClass(): void { @@ -54,7 +35,6 @@ public static function setUpBeforeClass(): void (object) ['value' => 'choice_one'], (object) ['value' => 'choice_two'], ]; - self::$choiceValues = ['choice_one', 'choice_two']; self::$lazyChoiceList = new LazyChoiceList(self::$loader, self::$value); } @@ -106,13 +86,4 @@ public function testLoadValuesForChoicesLoadsChoiceListOnFirstCall() 'Choice list should not be reloaded.' ); } - - public static function tearDownAfterClass(): void - { - self::$loader = null; - self::$value = null; - self::$choices = []; - self::$choiceValues = []; - self::$lazyChoiceList = null; - } } diff --git a/src/Symfony/Component/Form/Tests/ChoiceList/Loader/IntlCallbackChoiceLoaderTest.php b/src/Symfony/Component/Form/Tests/ChoiceList/Loader/IntlCallbackChoiceLoaderTest.php index 0aed92fb5e901..2c61388d0ea66 100644 --- a/src/Symfony/Component/Form/Tests/ChoiceList/Loader/IntlCallbackChoiceLoaderTest.php +++ b/src/Symfony/Component/Form/Tests/ChoiceList/Loader/IntlCallbackChoiceLoaderTest.php @@ -22,30 +22,11 @@ */ class IntlCallbackChoiceLoaderTest extends TestCase { - /** - * @var \Symfony\Component\Form\ChoiceList\Loader\IntlCallbackChoiceLoader - */ - private static $loader; - - /** - * @var callable - */ - private static $value; - - /** - * @var array - */ - private static $choices; - - /** - * @var string[] - */ - private static $choiceValues; - - /** - * @var \Symfony\Component\Form\ChoiceList\LazyChoiceList - */ - private static $lazyChoiceList; + private static IntlCallbackChoiceLoader $loader; + private static \Closure $value; + private static array $choices; + private static array $choiceValues = ['choice_one', 'choice_two']; + private static LazyChoiceList $lazyChoiceList; public static function setUpBeforeClass(): void { @@ -55,7 +36,6 @@ public static function setUpBeforeClass(): void (object) ['value' => 'choice_one'], (object) ['value' => 'choice_two'], ]; - self::$choiceValues = ['choice_one', 'choice_two']; self::$lazyChoiceList = new LazyChoiceList(self::$loader, self::$value); } @@ -101,13 +81,4 @@ public function testLoadValuesForChoicesLoadsChoiceListOnFirstCall() 'Choice list should not be reloaded.' ); } - - public static function tearDownAfterClass(): void - { - self::$loader = null; - self::$value = null; - self::$choices = []; - self::$choiceValues = []; - self::$lazyChoiceList = null; - } } diff --git a/src/Symfony/Component/Form/Tests/CompoundFormTest.php b/src/Symfony/Component/Form/Tests/CompoundFormTest.php index 5247cdecdb820..daa8cf7c6870a 100644 --- a/src/Symfony/Component/Form/Tests/CompoundFormTest.php +++ b/src/Symfony/Component/Form/Tests/CompoundFormTest.php @@ -26,7 +26,6 @@ use Symfony\Component\Form\FormEvent; use Symfony\Component\Form\FormEvents; use Symfony\Component\Form\FormFactory; -use Symfony\Component\Form\FormFactoryInterface; use Symfony\Component\Form\FormInterface; use Symfony\Component\Form\FormRegistry; use Symfony\Component\Form\Forms; @@ -42,15 +41,8 @@ class CompoundFormTest extends TestCase { - /** - * @var FormFactoryInterface - */ - private $factory; - - /** - * @var FormInterface - */ - private $form; + private FormFactory $factory; + private FormInterface $form; protected function setUp(): void { diff --git a/src/Symfony/Component/Form/Tests/Console/Descriptor/AbstractDescriptorTestCase.php b/src/Symfony/Component/Form/Tests/Console/Descriptor/AbstractDescriptorTestCase.php index 3201ab9f72770..fa8745b58498b 100644 --- a/src/Symfony/Component/Form/Tests/Console/Descriptor/AbstractDescriptorTestCase.php +++ b/src/Symfony/Component/Form/Tests/Console/Descriptor/AbstractDescriptorTestCase.php @@ -28,7 +28,7 @@ abstract class AbstractDescriptorTestCase extends TestCase { - private $colSize; + private string|false $colSize; protected function setUp(): void { diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataMapper/DataMapperTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataMapper/DataMapperTest.php index 7dcf4169bac94..fafd0e9d032fc 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/DataMapper/DataMapperTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataMapper/DataMapperTest.php @@ -13,7 +13,6 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\EventDispatcher\EventDispatcher; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\Form\Extension\Core\DataAccessor\PropertyPathAccessor; use Symfony\Component\Form\Extension\Core\DataMapper\DataMapper; use Symfony\Component\Form\Extension\Core\Type\DateType; @@ -26,15 +25,8 @@ class DataMapperTest extends TestCase { - /** - * @var DataMapper - */ - private $mapper; - - /** - * @var EventDispatcherInterface - */ - private $dispatcher; + private DataMapper $mapper; + private EventDispatcher $dispatcher; protected function setUp(): void { @@ -431,7 +423,7 @@ public function isSynchronized(): bool class DummyPerson { - private $name; + private string $name; public function __construct(string $name) { diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ArrayToPartsTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ArrayToPartsTransformerTest.php index b82a3a3802123..6040792240556 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ArrayToPartsTransformerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ArrayToPartsTransformerTest.php @@ -17,7 +17,7 @@ class ArrayToPartsTransformerTest extends TestCase { - private $transformer; + private ArrayToPartsTransformer $transformer; protected function setUp(): void { @@ -27,11 +27,6 @@ protected function setUp(): void ]); } - protected function tearDown(): void - { - $this->transformer = null; - } - public function testTransform() { $input = [ diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/BooleanToStringTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/BooleanToStringTransformerTest.php index 98d58c612a34d..a40a26e54bc38 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/BooleanToStringTransformerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/BooleanToStringTransformerTest.php @@ -20,21 +20,13 @@ class BooleanToStringTransformerTest extends TestCase { private const TRUE_VALUE = '1'; - /** - * @var BooleanToStringTransformer - */ - protected $transformer; + protected BooleanToStringTransformer $transformer; protected function setUp(): void { $this->transformer = new BooleanToStringTransformer(self::TRUE_VALUE); } - protected function tearDown(): void - { - $this->transformer = null; - } - public function testTransform() { $this->assertEquals(self::TRUE_VALUE, $this->transformer->transform(true)); diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ChoiceToValueTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ChoiceToValueTransformerTest.php index 5253058527516..cb2db09462dc9 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ChoiceToValueTransformerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ChoiceToValueTransformerTest.php @@ -18,8 +18,8 @@ class ChoiceToValueTransformerTest extends TestCase { - protected $transformer; - protected $transformerWithNull; + protected ChoiceToValueTransformer $transformer; + protected ChoiceToValueTransformer $transformerWithNull; protected function setUp(): void { @@ -30,12 +30,6 @@ protected function setUp(): void $this->transformerWithNull = new ChoiceToValueTransformer($listWithNull); } - protected function tearDown(): void - { - $this->transformer = null; - $this->transformerWithNull = null; - } - public static function transformProvider() { return [ diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ChoicesToValuesTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ChoicesToValuesTransformerTest.php index d0911673dd7d9..f7233463bdfb2 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ChoicesToValuesTransformerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ChoicesToValuesTransformerTest.php @@ -18,8 +18,8 @@ class ChoicesToValuesTransformerTest extends TestCase { - protected $transformer; - protected $transformerWithNull; + protected ChoicesToValuesTransformer $transformer; + protected ChoicesToValuesTransformer $transformerWithNull; protected function setUp(): void { @@ -30,12 +30,6 @@ protected function setUp(): void $this->transformerWithNull = new ChoicesToValuesTransformer($listWithNull); } - protected function tearDown(): void - { - $this->transformer = null; - $this->transformerWithNull = null; - } - public function testTransform() { $in = ['', false, 'X']; diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformerTest.php index e4e70714785a9..107d5513d6c03 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformerTest.php @@ -21,9 +21,9 @@ class DateTimeToLocalizedStringTransformerTest extends BaseDateTimeTransformerTe { use DateTimeEqualsTrait; - protected $dateTime; - protected $dateTimeWithoutSeconds; - private $defaultLocale; + protected \DateTime $dateTime; + protected \DateTime $dateTimeWithoutSeconds; + private string $defaultLocale; protected function setUp(): void { @@ -47,8 +47,6 @@ protected function setUp(): void protected function tearDown(): void { - $this->dateTime = null; - $this->dateTimeWithoutSeconds = null; \Locale::setDefault($this->defaultLocale); } diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToRfc3339TransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToRfc3339TransformerTest.php index 18005e0ed5559..f214be450d799 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToRfc3339TransformerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToRfc3339TransformerTest.php @@ -20,8 +20,8 @@ class DateTimeToRfc3339TransformerTest extends BaseDateTimeTransformerTestCase { use DateTimeEqualsTrait; - protected $dateTime; - protected $dateTimeWithoutSeconds; + protected \DateTime $dateTime; + protected \DateTime $dateTimeWithoutSeconds; protected function setUp(): void { @@ -31,12 +31,6 @@ protected function setUp(): void $this->dateTimeWithoutSeconds = new \DateTime('2010-02-03 04:05:00 UTC'); } - protected function tearDown(): void - { - $this->dateTime = null; - $this->dateTimeWithoutSeconds = null; - } - public static function allProvider() { return [ diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformerTest.php index 837717670a8cd..513224574a891 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformerTest.php @@ -18,7 +18,7 @@ class IntegerToLocalizedStringTransformerTest extends TestCase { - private $defaultLocale; + private string $defaultLocale; protected function setUp(): void { diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/MoneyToLocalizedStringTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/MoneyToLocalizedStringTransformerTest.php index 7f9d436679b38..2d43e9533298d 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/MoneyToLocalizedStringTransformerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/MoneyToLocalizedStringTransformerTest.php @@ -18,8 +18,8 @@ class MoneyToLocalizedStringTransformerTest extends TestCase { - private $previousLocale; - private $defaultLocale; + private string|false $previousLocale; + private string $defaultLocale; protected function setUp(): void { diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/NumberToLocalizedStringTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/NumberToLocalizedStringTransformerTest.php index 9c2e3bcae3d13..a1dc724fd7aec 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/NumberToLocalizedStringTransformerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/NumberToLocalizedStringTransformerTest.php @@ -18,7 +18,7 @@ class NumberToLocalizedStringTransformerTest extends TestCase { - private $defaultLocale; + private string $defaultLocale; protected function setUp(): void { diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/PercentToLocalizedStringTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/PercentToLocalizedStringTransformerTest.php index 59e31101a02dd..957098ad86423 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/PercentToLocalizedStringTransformerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/PercentToLocalizedStringTransformerTest.php @@ -18,7 +18,7 @@ class PercentToLocalizedStringTransformerTest extends TestCase { - private $defaultLocale; + private string $defaultLocale; protected function setUp(): void { diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ValueToDuplicatesTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ValueToDuplicatesTransformerTest.php index fdfd983576413..5909a51ef4741 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ValueToDuplicatesTransformerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ValueToDuplicatesTransformerTest.php @@ -17,18 +17,13 @@ class ValueToDuplicatesTransformerTest extends TestCase { - private $transformer; + private ValueToDuplicatesTransformer $transformer; protected function setUp(): void { $this->transformer = new ValueToDuplicatesTransformer(['a', 'b', 'c']); } - protected function tearDown(): void - { - $this->transformer = null; - } - public function testTransform() { $output = [ diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/EventListener/MergeCollectionListenerArrayObjectTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/EventListener/MergeCollectionListenerArrayObjectTest.php index 47db5a0acddce..80dfa22bd4d7e 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/EventListener/MergeCollectionListenerArrayObjectTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/EventListener/MergeCollectionListenerArrayObjectTest.php @@ -13,6 +13,7 @@ use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\Form\FormBuilder; +use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormFactoryBuilder; class MergeCollectionListenerArrayObjectTest extends MergeCollectionListenerTestCase @@ -22,7 +23,7 @@ protected function getData(array $data) return new \ArrayObject($data); } - protected function getBuilder($name = 'name') + protected function getBuilder($name = 'name'): FormBuilderInterface { return new FormBuilder($name, \ArrayObject::class, new EventDispatcher(), (new FormFactoryBuilder())->getFormFactory()); } diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/EventListener/MergeCollectionListenerArrayTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/EventListener/MergeCollectionListenerArrayTest.php index df382a0b50f81..9095951748ad2 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/EventListener/MergeCollectionListenerArrayTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/EventListener/MergeCollectionListenerArrayTest.php @@ -13,6 +13,7 @@ use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\Form\FormBuilder; +use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormFactoryBuilder; class MergeCollectionListenerArrayTest extends MergeCollectionListenerTestCase @@ -22,7 +23,7 @@ protected function getData(array $data) return $data; } - protected function getBuilder($name = 'name') + protected function getBuilder($name = 'name'): FormBuilderInterface { return new FormBuilder($name, null, new EventDispatcher(), (new FormFactoryBuilder())->getFormFactory()); } diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/EventListener/MergeCollectionListenerCustomArrayObjectTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/EventListener/MergeCollectionListenerCustomArrayObjectTest.php index a13a6c071a956..b57eabc0bb74e 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/EventListener/MergeCollectionListenerCustomArrayObjectTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/EventListener/MergeCollectionListenerCustomArrayObjectTest.php @@ -13,6 +13,7 @@ use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\Form\FormBuilder; +use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormFactoryBuilder; use Symfony\Component\Form\Tests\Fixtures\CustomArrayObject; @@ -23,7 +24,7 @@ protected function getData(array $data) return new CustomArrayObject($data); } - protected function getBuilder($name = 'name') + protected function getBuilder($name = 'name'): FormBuilderInterface { return new FormBuilder($name, 'Symfony\Component\Form\Tests\Fixtures\CustomArrayObject', new EventDispatcher(), (new FormFactoryBuilder())->getFormFactory()); } diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/EventListener/MergeCollectionListenerTestCase.php b/src/Symfony/Component/Form/Tests/Extension/Core/EventListener/MergeCollectionListenerTestCase.php index 4717ed2789e25..7070db995b025 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/EventListener/MergeCollectionListenerTestCase.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/EventListener/MergeCollectionListenerTestCase.php @@ -14,23 +14,20 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\Form\Exception\UnexpectedTypeException; use Symfony\Component\Form\Extension\Core\EventListener\MergeCollectionListener; +use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormEvent; +use Symfony\Component\Form\FormInterface; abstract class MergeCollectionListenerTestCase extends TestCase { - protected $form; + protected FormInterface $form; protected function setUp(): void { $this->form = $this->getForm('axes'); } - protected function tearDown(): void - { - $this->form = null; - } - - abstract protected function getBuilder($name = 'name'); + abstract protected function getBuilder($name = 'name'): FormBuilderInterface; protected function getForm($name = 'name', $propertyPath = null) { diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/EventListener/ResizeFormListenerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/EventListener/ResizeFormListenerTest.php index d42d4d8899585..f63a5c1548858 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/EventListener/ResizeFormListenerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/EventListener/ResizeFormListenerTest.php @@ -21,11 +21,13 @@ use Symfony\Component\Form\FormBuilder; use Symfony\Component\Form\FormEvent; use Symfony\Component\Form\FormFactoryBuilder; +use Symfony\Component\Form\FormFactoryInterface; +use Symfony\Component\Form\FormInterface; class ResizeFormListenerTest extends TestCase { - private $factory; - private $form; + private FormFactoryInterface $factory; + private FormInterface $form; protected function setUp(): void { @@ -36,12 +38,6 @@ protected function setUp(): void ->getForm(); } - protected function tearDown(): void - { - $this->factory = null; - $this->form = null; - } - protected function getBuilder($name = 'name') { return new FormBuilder($name, null, new EventDispatcher(), $this->factory); diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php index 11c389551b825..8e2372d7e16f7 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php @@ -22,7 +22,7 @@ class ChoiceTypeTest extends BaseTypeTestCase { public const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\ChoiceType'; - private $choices = [ + private array $choices = [ 'Bernhard' => 'a', 'Fabien' => 'b', 'Kris' => 'c', @@ -30,19 +30,19 @@ class ChoiceTypeTest extends BaseTypeTestCase 'Roman' => 'e', ]; - private $scalarChoices = [ + private array $scalarChoices = [ 'Yes' => true, 'No' => false, 'n/a' => '', ]; - private $booleanChoicesWithNull = [ + private array $booleanChoicesWithNull = [ 'Yes' => true, 'No' => false, 'n/a' => null, ]; - private $numericChoicesFlipped = [ + private array $numericChoicesFlipped = [ 0 => 'Bernhard', 1 => 'Fabien', 2 => 'Kris', @@ -50,9 +50,9 @@ class ChoiceTypeTest extends BaseTypeTestCase 4 => 'Roman', ]; - private $objectChoices; + private array $objectChoices; - protected $groupedChoices = [ + protected array $groupedChoices = [ 'Symfony' => [ 'Bernhard' => 'a', 'Fabien' => 'b', @@ -77,13 +77,6 @@ protected function setUp(): void ]; } - protected function tearDown(): void - { - parent::tearDown(); - - $this->objectChoices = null; - } - public function testChoicesOptionExpectsArrayOrTraversable() { $this->expectException(InvalidOptionsException::class); diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTranslationTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTranslationTest.php index 490e84604aa15..26055c203c524 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTranslationTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTranslationTest.php @@ -19,7 +19,7 @@ class ChoiceTypeTranslationTest extends TypeTestCase { public const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\ChoiceType'; - private $choices = [ + private array $choices = [ 'Bernhard' => 'a', 'Fabien' => 'b', 'Kris' => 'c', diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTimeTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTimeTypeTest.php index a94f2dff34ead..95e7901fafc77 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTimeTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTimeTypeTest.php @@ -21,7 +21,7 @@ class DateTimeTypeTest extends BaseTypeTestCase public const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\DateTimeType'; - private $defaultLocale; + private string $defaultLocale; protected function setUp(): void { diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php index bb171ffe88735..29cacc24223cc 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php @@ -24,8 +24,8 @@ class DateTypeTest extends BaseTypeTestCase public const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\DateType'; - private $defaultTimezone; - private $defaultLocale; + private string $defaultTimezone; + private string $defaultLocale; protected function setUp(): void { diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/IntegerTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/IntegerTypeTest.php index 6d03ebf6cf284..1e143b342fcfe 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/IntegerTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/IntegerTypeTest.php @@ -17,7 +17,7 @@ class IntegerTypeTest extends BaseTypeTestCase { public const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\IntegerType'; - private $previousLocale; + private string $previousLocale; protected function setUp(): void { diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/MoneyTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/MoneyTypeTest.php index c65629d946818..b00439b574153 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/MoneyTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/MoneyTypeTest.php @@ -17,7 +17,7 @@ class MoneyTypeTest extends BaseTypeTestCase { public const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\MoneyType'; - private $defaultLocale; + private string $defaultLocale; protected function setUp(): void { diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/NumberTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/NumberTypeTest.php index f289fa6978db5..9efe052219722 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/NumberTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/NumberTypeTest.php @@ -19,7 +19,7 @@ class NumberTypeTest extends BaseTypeTestCase { public const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\NumberType'; - private $defaultLocale; + private string $defaultLocale; protected function setUp(): void { diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/PercentTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/PercentTypeTest.php index be92926e0b39d..76595d79be367 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/PercentTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/PercentTypeTest.php @@ -19,7 +19,7 @@ class PercentTypeTest extends TypeTestCase { public const TESTED_TYPE = PercentType::class; - private $defaultLocale; + private string $defaultLocale; protected function setUp(): void { diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/RepeatedTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/RepeatedTypeTest.php index b2a295b276f48..06b9151fbe7a8 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/RepeatedTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/RepeatedTypeTest.php @@ -19,10 +19,7 @@ class RepeatedTypeTest extends BaseTypeTestCase { public const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\RepeatedType'; - /** - * @var Form - */ - protected $form; + protected Form $form; protected function setUp(): void { diff --git a/src/Symfony/Component/Form/Tests/Extension/Csrf/EventListener/CsrfValidationListenerTest.php b/src/Symfony/Component/Form/Tests/Extension/Csrf/EventListener/CsrfValidationListenerTest.php index 3d028ac801374..6a6a8be9cdfe8 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Csrf/EventListener/CsrfValidationListenerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Csrf/EventListener/CsrfValidationListenerTest.php @@ -18,15 +18,17 @@ use Symfony\Component\Form\FormBuilder; use Symfony\Component\Form\FormEvent; use Symfony\Component\Form\FormFactoryBuilder; +use Symfony\Component\Form\FormFactoryInterface; +use Symfony\Component\Form\FormInterface; use Symfony\Component\Form\Util\ServerParams; use Symfony\Component\Security\Csrf\CsrfTokenManager; class CsrfValidationListenerTest extends TestCase { - protected $dispatcher; - protected $factory; - protected $tokenManager; - protected $form; + protected EventDispatcher $dispatcher; + protected FormFactoryInterface $factory; + protected CsrfTokenManager $tokenManager; + protected FormInterface $form; protected function setUp(): void { @@ -38,14 +40,6 @@ protected function setUp(): void ->getForm(); } - protected function tearDown(): void - { - $this->dispatcher = null; - $this->factory = null; - $this->tokenManager = null; - $this->form = null; - } - protected function getBuilder() { return new FormBuilder('post', null, $this->dispatcher, $this->factory, ['compound' => true]); diff --git a/src/Symfony/Component/Form/Tests/Extension/Csrf/Type/FormTypeCsrfExtensionTest.php b/src/Symfony/Component/Form/Tests/Extension/Csrf/Type/FormTypeCsrfExtensionTest.php index 81418527eefe9..bfa30255545ec 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Csrf/Type/FormTypeCsrfExtensionTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Csrf/Type/FormTypeCsrfExtensionTest.php @@ -33,10 +33,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void class FormTypeCsrfExtensionTest extends TypeTestCase { - /** - * @var MockObject&CsrfTokenManagerInterface - */ - protected $tokenManager; + protected MockObject&CsrfTokenManagerInterface $tokenManager; protected function setUp(): void { diff --git a/src/Symfony/Component/Form/Tests/Extension/DataCollector/DataCollectorExtensionTest.php b/src/Symfony/Component/Form/Tests/Extension/DataCollector/DataCollectorExtensionTest.php index 0ae127d0775d1..99e6215cbbde7 100644 --- a/src/Symfony/Component/Form/Tests/Extension/DataCollector/DataCollectorExtensionTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/DataCollector/DataCollectorExtensionTest.php @@ -19,10 +19,7 @@ class DataCollectorExtensionTest extends TestCase { - /** - * @var DataCollectorExtension - */ - private $extension; + private DataCollectorExtension $extension; protected function setUp(): void { diff --git a/src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataCollectorTest.php b/src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataCollectorTest.php index fd9870fa6d50e..798faa0c5e5bd 100644 --- a/src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataCollectorTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataCollectorTest.php @@ -28,35 +28,12 @@ class FormDataCollectorTest extends TestCase { - /** - * @var FormDataCollector - */ - private $dataCollector; - - /** - * @var FormFactory - */ - private $factory; - - /** - * @var Form - */ - private $form; - - /** - * @var Form - */ - private $childForm; - - /** - * @var FormView - */ - private $view; - - /** - * @var FormView - */ - private $childView; + private FormDataCollector $dataCollector; + private FormFactory $factory; + private FormInterface $form; + private FormInterface $childForm; + private FormView $view; + private FormView $childView; protected function setUp(): void { diff --git a/src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataExtractorTest.php b/src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataExtractorTest.php index b496b71fd57ac..ec01721c704b4 100644 --- a/src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataExtractorTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataExtractorTest.php @@ -36,10 +36,7 @@ class FormDataExtractorTest extends TestCase { use VarDumperTestTrait; - /** - * @var FormDataExtractor - */ - private $dataExtractor; + private FormDataExtractor $dataExtractor; protected function setUp(): void { diff --git a/src/Symfony/Component/Form/Tests/Extension/DataCollector/Type/DataCollectorTypeExtensionTest.php b/src/Symfony/Component/Form/Tests/Extension/DataCollector/Type/DataCollectorTypeExtensionTest.php index 1f7d6a817dd44..7442d181b8e2a 100644 --- a/src/Symfony/Component/Form/Tests/Extension/DataCollector/Type/DataCollectorTypeExtensionTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/DataCollector/Type/DataCollectorTypeExtensionTest.php @@ -24,10 +24,7 @@ class DataCollectorTypeExtensionTest extends TestCase { - /** - * @var DataCollectorTypeExtension - */ - private $extension; + private DataCollectorTypeExtension $extension; protected function setUp(): void { diff --git a/src/Symfony/Component/Form/Tests/Extension/PasswordHasher/Type/PasswordTypePasswordHasherExtensionTest.php b/src/Symfony/Component/Form/Tests/Extension/PasswordHasher/Type/PasswordTypePasswordHasherExtensionTest.php index 0b745c172f0f2..4ec91c8274dd8 100644 --- a/src/Symfony/Component/Form/Tests/Extension/PasswordHasher/Type/PasswordTypePasswordHasherExtensionTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/PasswordHasher/Type/PasswordTypePasswordHasherExtensionTest.php @@ -27,10 +27,7 @@ class PasswordTypePasswordHasherExtensionTest extends TypeTestCase { - /** - * @var MockObject&UserPasswordHasherInterface - */ - protected $passwordHasher; + protected MockObject&UserPasswordHasherInterface $passwordHasher; protected function setUp(): void { diff --git a/src/Symfony/Component/Form/Tests/Extension/Validator/Constraints/FormValidatorFunctionalTest.php b/src/Symfony/Component/Form/Tests/Extension/Validator/Constraints/FormValidatorFunctionalTest.php index e1698e6b9b769..aa6056c13702a 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Validator/Constraints/FormValidatorFunctionalTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Validator/Constraints/FormValidatorFunctionalTest.php @@ -23,6 +23,7 @@ use Symfony\Component\Form\Extension\Validator\ValidatorExtension; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormFactoryBuilder; +use Symfony\Component\Form\FormFactoryInterface; use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Validator\Constraints\Collection; use Symfony\Component\Validator\Constraints\Expression; @@ -34,11 +35,12 @@ use Symfony\Component\Validator\Mapping\Factory\LazyLoadingMetadataFactory; use Symfony\Component\Validator\Mapping\Loader\StaticMethodLoader; use Symfony\Component\Validator\Validation; +use Symfony\Component\Validator\Validator\ValidatorInterface; class FormValidatorFunctionalTest extends TestCase { - private $validator; - private $formFactory; + private ValidatorInterface $validator; + private FormFactoryInterface $formFactory; protected function setUp(): void { diff --git a/src/Symfony/Component/Form/Tests/Extension/Validator/Constraints/FormValidatorTest.php b/src/Symfony/Component/Form/Tests/Extension/Validator/Constraints/FormValidatorTest.php index 7d9061c882808..180a9578fe488 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Validator/Constraints/FormValidatorTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Validator/Constraints/FormValidatorTest.php @@ -12,7 +12,6 @@ namespace Symfony\Component\Form\Tests\Extension\Validator\Constraints; use Symfony\Component\EventDispatcher\EventDispatcher; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\Form\CallbackTransformer; use Symfony\Component\Form\Exception\TransformationFailedException; use Symfony\Component\Form\Extension\Core\DataMapper\DataMapper; @@ -39,15 +38,8 @@ */ class FormValidatorTest extends ConstraintValidatorTestCase { - /** - * @var EventDispatcherInterface - */ - private $dispatcher; - - /** - * @var FormFactoryInterface - */ - private $factory; + private EventDispatcher $dispatcher; + private FormFactoryInterface $factory; protected function setUp(): void { diff --git a/src/Symfony/Component/Form/Tests/Extension/Validator/EventListener/ValidationListenerTest.php b/src/Symfony/Component/Form/Tests/Extension/Validator/EventListener/ValidationListenerTest.php index ba0118391533e..b3f900e87e335 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Validator/EventListener/ValidationListenerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Validator/EventListener/ValidationListenerTest.php @@ -13,7 +13,6 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\EventDispatcher\EventDispatcher; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\Form\Extension\Core\DataMapper\DataMapper; use Symfony\Component\Form\Extension\Validator\Constraints\Form as FormConstraint; use Symfony\Component\Form\Extension\Validator\EventListener\ValidationListener; @@ -23,7 +22,6 @@ use Symfony\Component\Form\FormConfigBuilder; use Symfony\Component\Form\FormEvent; use Symfony\Component\Form\FormFactoryBuilder; -use Symfony\Component\Form\FormFactoryInterface; use Symfony\Component\Validator\ConstraintViolation; use Symfony\Component\Validator\ConstraintViolationInterface; use Symfony\Component\Validator\ConstraintViolationList; @@ -36,36 +34,14 @@ class ValidationListenerTest extends TestCase { - /** - * @var EventDispatcherInterface - */ - private $dispatcher; - - /** - * @var FormFactoryInterface - */ - private $factory; - - /** - * @var ValidatorInterface - */ - private $validator; - - /** - * @var ValidationListener - */ - private $listener; - - private $message; - - private $messageTemplate; - - private $params; + private ValidatorInterface $validator; + private ValidationListener $listener; + private string $message; + private string $messageTemplate; + private array $params; protected function setUp(): void { - $this->dispatcher = new EventDispatcher(); - $this->factory = (new FormFactoryBuilder())->getFormFactory(); $this->validator = Validation::createValidator(); $this->listener = new ValidationListener($this->validator, new ViolationMapper()); $this->message = 'Message'; @@ -153,7 +129,7 @@ public function isSynchronized(): bool class DummyValidator implements ValidatorInterface { - private $violation; + private ConstraintViolationInterface $violation; public function __construct(ConstraintViolationInterface $violation) { diff --git a/src/Symfony/Component/Form/Tests/Extension/Validator/ValidatorTypeGuesserTest.php b/src/Symfony/Component/Form/Tests/Extension/Validator/ValidatorTypeGuesserTest.php index 0c8ab23e83d58..0ac6b39148a65 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Validator/ValidatorTypeGuesserTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Validator/ValidatorTypeGuesserTest.php @@ -42,23 +42,15 @@ class ValidatorTypeGuesserTest extends TestCase { public const TEST_CLASS = 'Symfony\Component\Form\Tests\Extension\Validator\ValidatorTypeGuesserTest_TestClass'; - public const TEST_PROPERTY = 'property'; - /** - * @var ValidatorTypeGuesser - */ - private $guesser; - - /** - * @var ClassMetadata - */ - private $metadata; + private ValidatorTypeGuesser $guesser; + private ClassMetadata $metadata; /** * @var MetadataFactoryInterface */ - private $metadataFactory; + private \Symfony\Component\Validator\Tests\Fixtures\FakeMetadataFactory $metadataFactory; protected function setUp(): void { diff --git a/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationMapperTest.php b/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationMapperTest.php index b2c48305552c9..6cb270ac2e077 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationMapperTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationMapperTest.php @@ -43,30 +43,11 @@ class ViolationMapperTest extends TestCase private const LEVEL_1B = 2; private const LEVEL_2 = 3; - /** - * @var EventDispatcherInterface - */ - private $dispatcher; - - /** - * @var ViolationMapper - */ - private $mapper; - - /** - * @var string - */ - private $message; - - /** - * @var string - */ - private $messageTemplate; - - /** - * @var array - */ - private $params; + private EventDispatcher $dispatcher; + private ViolationMapper $mapper; + private string $message; + private string $messageTemplate; + private array $params; protected function setUp(): void { diff --git a/src/Symfony/Component/Form/Tests/Fixtures/CustomArrayObject.php b/src/Symfony/Component/Form/Tests/Fixtures/CustomArrayObject.php index 009b79568a60e..b37bfe5ed2d85 100644 --- a/src/Symfony/Component/Form/Tests/Fixtures/CustomArrayObject.php +++ b/src/Symfony/Component/Form/Tests/Fixtures/CustomArrayObject.php @@ -17,7 +17,7 @@ */ class CustomArrayObject implements \ArrayAccess, \IteratorAggregate, \Countable { - private $array; + private array $array; public function __construct(array $array = null) { diff --git a/src/Symfony/Component/Form/Tests/Fixtures/FixedDataTransformer.php b/src/Symfony/Component/Form/Tests/Fixtures/FixedDataTransformer.php index fc99419f55ae8..f3121fc1039da 100644 --- a/src/Symfony/Component/Form/Tests/Fixtures/FixedDataTransformer.php +++ b/src/Symfony/Component/Form/Tests/Fixtures/FixedDataTransformer.php @@ -16,7 +16,7 @@ class FixedDataTransformer implements DataTransformerInterface { - private $mapping; + private array $mapping; public function __construct(array $mapping) { diff --git a/src/Symfony/Component/Form/Tests/Fixtures/FixedTranslator.php b/src/Symfony/Component/Form/Tests/Fixtures/FixedTranslator.php index ba17b5dd3d99d..1fc0fa90165f8 100644 --- a/src/Symfony/Component/Form/Tests/Fixtures/FixedTranslator.php +++ b/src/Symfony/Component/Form/Tests/Fixtures/FixedTranslator.php @@ -15,7 +15,7 @@ class FixedTranslator implements TranslatorInterface { - private $translations; + private array $translations; public function __construct(array $translations) { diff --git a/src/Symfony/Component/Form/Tests/Fixtures/Map.php b/src/Symfony/Component/Form/Tests/Fixtures/Map.php index d3a9de6f92f2d..ffe89e0875411 100644 --- a/src/Symfony/Component/Form/Tests/Fixtures/Map.php +++ b/src/Symfony/Component/Form/Tests/Fixtures/Map.php @@ -13,7 +13,7 @@ class Map implements \ArrayAccess { - private $data = []; + private array $data = []; public function offsetExists($offset): bool { diff --git a/src/Symfony/Component/Form/Tests/Fixtures/TestExtension.php b/src/Symfony/Component/Form/Tests/Fixtures/TestExtension.php index 5f6556ca6ec6f..44725a69c71a5 100644 --- a/src/Symfony/Component/Form/Tests/Fixtures/TestExtension.php +++ b/src/Symfony/Component/Form/Tests/Fixtures/TestExtension.php @@ -18,11 +18,9 @@ class TestExtension implements FormExtensionInterface { - private $types = []; - - private $extensions = []; - - private $guesser; + private array $types = []; + private array $extensions = []; + private FormTypeGuesserInterface $guesser; public function __construct(FormTypeGuesserInterface $guesser) { diff --git a/src/Symfony/Component/Form/Tests/Fixtures/User.php b/src/Symfony/Component/Form/Tests/Fixtures/User.php index 486311ee6c2e8..a637a4e1fe63a 100644 --- a/src/Symfony/Component/Form/Tests/Fixtures/User.php +++ b/src/Symfony/Component/Form/Tests/Fixtures/User.php @@ -15,7 +15,7 @@ class User implements PasswordAuthenticatedUserInterface { - private $password; + private ?string $password = null; public function getPassword(): ?string { diff --git a/src/Symfony/Component/Form/Tests/FormBuilderTest.php b/src/Symfony/Component/Form/Tests/FormBuilderTest.php index c08c64867afc7..023cf77d6045d 100644 --- a/src/Symfony/Component/Form/Tests/FormBuilderTest.php +++ b/src/Symfony/Component/Form/Tests/FormBuilderTest.php @@ -27,8 +27,8 @@ class FormBuilderTest extends TestCase { - private $factory; - private $builder; + private FormFactory $factory; + private FormBuilder $builder; protected function setUp(): void { diff --git a/src/Symfony/Component/Form/Tests/FormFactoryBuilderTest.php b/src/Symfony/Component/Form/Tests/FormFactoryBuilderTest.php index 818ab1b2b12b0..13e6e30a16983 100644 --- a/src/Symfony/Component/Form/Tests/FormFactoryBuilderTest.php +++ b/src/Symfony/Component/Form/Tests/FormFactoryBuilderTest.php @@ -19,8 +19,8 @@ class FormFactoryBuilderTest extends TestCase { - private $registry; - private $type; + private \ReflectionProperty $registry; + private FooType $type; protected function setUp(): void { diff --git a/src/Symfony/Component/Form/Tests/FormFactoryTest.php b/src/Symfony/Component/Form/Tests/FormFactoryTest.php index ab13c67775765..678e343759545 100644 --- a/src/Symfony/Component/Form/Tests/FormFactoryTest.php +++ b/src/Symfony/Component/Form/Tests/FormFactoryTest.php @@ -31,25 +31,10 @@ */ class FormFactoryTest extends TestCase { - /** - * @var ConfigurableFormTypeGuesser - */ - private $guesser1; - - /** - * @var ConfigurableFormTypeGuesser - */ - private $guesser2; - - /** - * @var FormRegistryInterface - */ - private $registry; - - /** - * @var FormFactory - */ - private $factory; + private ConfigurableFormTypeGuesser $guesser1; + private ConfigurableFormTypeGuesser $guesser2; + private FormRegistry $registry; + private FormFactory $factory; protected function setUp(): void { @@ -189,10 +174,10 @@ public function testCreateBuilderUsesPatternIfFound() class ConfigurableFormTypeGuesser implements FormTypeGuesserInterface { - private $typeGuess; - private $requiredGuess; - private $maxLengthGuess; - private $patternGuess; + private ?\Symfony\Component\Form\Guess\TypeGuess $typeGuess = null; + private ?\Symfony\Component\Form\Guess\ValueGuess $requiredGuess = null; + private ?\Symfony\Component\Form\Guess\ValueGuess $maxLengthGuess = null; + private ?\Symfony\Component\Form\Guess\ValueGuess $patternGuess = null; public function guessType($class, $property): ?TypeGuess { diff --git a/src/Symfony/Component/Form/Tests/FormRegistryTest.php b/src/Symfony/Component/Form/Tests/FormRegistryTest.php index 8cee7282a4de2..e2f226924cc44 100644 --- a/src/Symfony/Component/Form/Tests/FormRegistryTest.php +++ b/src/Symfony/Component/Form/Tests/FormRegistryTest.php @@ -35,20 +35,9 @@ */ class FormRegistryTest extends TestCase { - /** - * @var FormRegistry - */ - private $registry; - - /** - * @var TestExtension - */ - private $extension1; - - /** - * @var TestExtension - */ - private $extension2; + private FormRegistry $registry; + private TestExtension $extension1; + private TestExtension $extension2; protected function setUp(): void { diff --git a/src/Symfony/Component/Form/Tests/NativeRequestHandlerTest.php b/src/Symfony/Component/Form/Tests/NativeRequestHandlerTest.php index e698138376b6f..bdb0763f9d50f 100644 --- a/src/Symfony/Component/Form/Tests/NativeRequestHandlerTest.php +++ b/src/Symfony/Component/Form/Tests/NativeRequestHandlerTest.php @@ -19,7 +19,7 @@ */ class NativeRequestHandlerTest extends AbstractRequestHandlerTestCase { - private static $serverBackup; + private static array $serverBackup; public static function setUpBeforeClass(): void { diff --git a/src/Symfony/Component/Form/Tests/ResolvedFormTypeTest.php b/src/Symfony/Component/Form/Tests/ResolvedFormTypeTest.php index ca943fed53a0b..03adb3e0b408d 100644 --- a/src/Symfony/Component/Form/Tests/ResolvedFormTypeTest.php +++ b/src/Symfony/Component/Form/Tests/ResolvedFormTypeTest.php @@ -19,11 +19,8 @@ use Symfony\Component\Form\FormBuilder; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormFactory; -use Symfony\Component\Form\FormFactoryInterface; use Symfony\Component\Form\FormInterface; use Symfony\Component\Form\FormRegistry; -use Symfony\Component\Form\FormTypeExtensionInterface; -use Symfony\Component\Form\FormTypeInterface; use Symfony\Component\Form\FormView; use Symfony\Component\Form\ResolvedFormType; use Symfony\Component\Form\ResolvedFormTypeFactory; @@ -36,42 +33,14 @@ */ class ResolvedFormTypeTest extends TestCase { - private $calls; - - /** - * @var FormTypeInterface - */ - private $parentType; - - /** - * @var FormTypeInterface - */ - private $type; - - /** - * @var FormTypeExtensionInterface - */ - private $extension1; - - /** - * @var FormTypeExtensionInterface - */ - private $extension2; - - /** - * @var ResolvedFormType - */ - private $parentResolvedType; - - /** - * @var ResolvedFormType - */ - private $resolvedType; - - /** - * @var FormFactoryInterface - */ - private $formFactory; + private array $calls; + private UsageTrackingParentFormType $parentType; + private UsageTrackingFormType $type; + private UsageTrackingFormTypeExtension $extension1; + private UsageTrackingFormTypeExtension $extension2; + private ResolvedFormType $parentResolvedType; + private ResolvedFormType $resolvedType; + private FormFactory $formFactory; protected function setUp(): void { @@ -246,7 +215,7 @@ class UsageTrackingFormTypeExtension extends AbstractTypeExtension { use UsageTrackingTrait; - private $defaultOptions; + private array $defaultOptions; public function __construct(array &$calls, array $defaultOptions) { @@ -267,7 +236,7 @@ public static function getExtendedTypes(): iterable trait UsageTrackingTrait { - private $calls; + private array $calls; public function buildForm(FormBuilderInterface $builder, array $options): void { diff --git a/src/Symfony/Component/Form/Tests/SimpleFormTest.php b/src/Symfony/Component/Form/Tests/SimpleFormTest.php index 1b7af764ad2e2..da01c89cbcbaa 100644 --- a/src/Symfony/Component/Form/Tests/SimpleFormTest.php +++ b/src/Symfony/Component/Form/Tests/SimpleFormTest.php @@ -38,7 +38,7 @@ class SimpleFormTest_Countable implements \Countable { - private $count; + private int $count; public function __construct($count) { @@ -53,7 +53,7 @@ public function count(): int class SimpleFormTest_Traversable implements \IteratorAggregate { - private $iterator; + private \ArrayIterator $iterator; public function __construct($count) { @@ -68,7 +68,7 @@ public function getIterator(): \Traversable class SimpleFormTest extends TestCase { - private $form; + private Form $form; protected function setUp(): void { diff --git a/src/Symfony/Component/Form/Tests/Util/ServerParamsTest.php b/src/Symfony/Component/Form/Tests/Util/ServerParamsTest.php index ebe680e71083b..1904812d81e51 100644 --- a/src/Symfony/Component/Form/Tests/Util/ServerParamsTest.php +++ b/src/Symfony/Component/Form/Tests/Util/ServerParamsTest.php @@ -70,7 +70,7 @@ public static function getGetPostMaxSizeTestData() class DummyServerParams extends ServerParams { - private $size; + private string $size; public function __construct($size) { diff --git a/src/Symfony/Component/HttpClient/Tests/AsyncDecoratorTraitTest.php b/src/Symfony/Component/HttpClient/Tests/AsyncDecoratorTraitTest.php index e8d699e9993ce..e1c4b7ee34bff 100644 --- a/src/Symfony/Component/HttpClient/Tests/AsyncDecoratorTraitTest.php +++ b/src/Symfony/Component/HttpClient/Tests/AsyncDecoratorTraitTest.php @@ -15,6 +15,7 @@ use Symfony\Component\HttpClient\DecoratorTrait; use Symfony\Component\HttpClient\Exception\TransportException; use Symfony\Component\HttpClient\HttpClient; +use Symfony\Component\HttpClient\NativeHttpClient; use Symfony\Component\HttpClient\Response\AsyncContext; use Symfony\Component\HttpClient\Response\AsyncResponse; use Symfony\Contracts\HttpClient\ChunkInterface; @@ -40,7 +41,7 @@ protected function getHttpClient(string $testCase, \Closure $chunkFilter = null, return new class($decoratedClient ?? parent::getHttpClient($testCase), $chunkFilter) implements HttpClientInterface { use AsyncDecoratorTrait; - private $chunkFilter; + private ?\Closure $chunkFilter; public function __construct(HttpClientInterface $client, \Closure $chunkFilter = null) { diff --git a/src/Symfony/Component/HttpClient/Tests/HttpClientTestCase.php b/src/Symfony/Component/HttpClient/Tests/HttpClientTestCase.php index 4d083bc27a9e9..0a823fe91d3d7 100644 --- a/src/Symfony/Component/HttpClient/Tests/HttpClientTestCase.php +++ b/src/Symfony/Component/HttpClient/Tests/HttpClientTestCase.php @@ -31,7 +31,7 @@ abstract class HttpClientTestCase extends BaseHttpClientTestCase { - private static $vulcainStarted = false; + private static bool $vulcainStarted = false; public function testTimeoutOnDestruct() { diff --git a/src/Symfony/Component/HttpClient/Tests/RetryableHttpClientTest.php b/src/Symfony/Component/HttpClient/Tests/RetryableHttpClientTest.php index 2ef52336c340c..fcd839da18c67 100644 --- a/src/Symfony/Component/HttpClient/Tests/RetryableHttpClientTest.php +++ b/src/Symfony/Component/HttpClient/Tests/RetryableHttpClientTest.php @@ -208,7 +208,7 @@ public function testRetryWithDelay() new GenericRetryStrategy(), 1, $logger = new class() extends TestLogger { - public $context = []; + public array $context = []; public function log($level, $message, array $context = []): void { diff --git a/src/Symfony/Component/HttpClient/Tests/TestLogger.php b/src/Symfony/Component/HttpClient/Tests/TestLogger.php index 83aa096889fa0..0e241e40a6e97 100644 --- a/src/Symfony/Component/HttpClient/Tests/TestLogger.php +++ b/src/Symfony/Component/HttpClient/Tests/TestLogger.php @@ -15,7 +15,7 @@ class TestLogger extends AbstractLogger { - public $logs = []; + public array $logs = []; public function log($level, $message, array $context = []): void { diff --git a/src/Symfony/Component/HttpFoundation/Tests/File/FakeFile.php b/src/Symfony/Component/HttpFoundation/Tests/File/FakeFile.php index 8b2f12f4144cf..9bac076ca36c9 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/File/FakeFile.php +++ b/src/Symfony/Component/HttpFoundation/Tests/File/FakeFile.php @@ -15,7 +15,7 @@ class FakeFile extends OrigFile { - private $realpath; + private string $realpath; public function __construct(string $realpath, string $path) { diff --git a/src/Symfony/Component/HttpFoundation/Tests/File/FileTest.php b/src/Symfony/Component/HttpFoundation/Tests/File/FileTest.php index fc806e95147c4..65ce2308f8e4c 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/File/FileTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/File/FileTest.php @@ -20,8 +20,6 @@ */ class FileTest extends TestCase { - protected $file; - public function testGetMimeTypeUsesMimeTypeGuessers() { $file = new File(__DIR__.'/Fixtures/test.gif'); diff --git a/src/Symfony/Component/HttpFoundation/Tests/Fixtures/response-functional/deleted_cookie.php b/src/Symfony/Component/HttpFoundation/Tests/Fixtures/response-functional/deleted_cookie.php index 003b0c121f888..6b54f6614ab88 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Fixtures/response-functional/deleted_cookie.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Fixtures/response-functional/deleted_cookie.php @@ -34,10 +34,7 @@ $listener = new SessionListener($container); $kernel = new class($r) implements HttpKernelInterface { - /** - * @var Response - */ - private $response; + private Response $response; public function __construct(Response $response) { diff --git a/src/Symfony/Component/HttpFoundation/Tests/RateLimiter/MockAbstractRequestRateLimiter.php b/src/Symfony/Component/HttpFoundation/Tests/RateLimiter/MockAbstractRequestRateLimiter.php index 0acc918bf4d5c..31f03c8162f6c 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/RateLimiter/MockAbstractRequestRateLimiter.php +++ b/src/Symfony/Component/HttpFoundation/Tests/RateLimiter/MockAbstractRequestRateLimiter.php @@ -20,7 +20,7 @@ class MockAbstractRequestRateLimiter extends AbstractRequestRateLimiter /** * @var LimiterInterface[] */ - private $limiters; + private array $limiters; public function __construct(array $limiters) { diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Attribute/AttributeBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Attribute/AttributeBagTest.php index 273efddf16591..afd281f0a15b6 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Attribute/AttributeBagTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Attribute/AttributeBagTest.php @@ -21,12 +21,9 @@ */ class AttributeBagTest extends TestCase { - private $array = []; + private array $array = []; - /** - * @var AttributeBag - */ - private $bag; + private ?AttributeBag $bag = null; protected function setUp(): void { diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Flash/AutoExpireFlashBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Flash/AutoExpireFlashBagTest.php index ba2687199d7b5..6a6510a576b9c 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Flash/AutoExpireFlashBagTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Flash/AutoExpireFlashBagTest.php @@ -21,12 +21,9 @@ */ class AutoExpireFlashBagTest extends TestCase { - /** - * @var \Symfony\Component\HttpFoundation\Session\Flash\AutoExpireFlashBag - */ - private $bag; + protected array $array = []; - protected $array = []; + private FlashBag $bag; protected function setUp(): void { @@ -38,7 +35,7 @@ protected function setUp(): void protected function tearDown(): void { - $this->bag = null; + unset($this->bag); parent::tearDown(); } diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Flash/FlashBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Flash/FlashBagTest.php index 24dbbfe98f05f..59e3f1f0e69a7 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Flash/FlashBagTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Flash/FlashBagTest.php @@ -21,12 +21,9 @@ */ class FlashBagTest extends TestCase { - /** - * @var \Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface - */ - private $bag; + protected array $array = []; - protected $array = []; + private FlashBag $bag; protected function setUp(): void { @@ -38,7 +35,7 @@ protected function setUp(): void protected function tearDown(): void { - $this->bag = null; + unset($this->bag); parent::tearDown(); } diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php index 56011ddb558fb..56ef60806df3a 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php @@ -17,8 +17,10 @@ use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface; use Symfony\Component\HttpFoundation\Session\Session; use Symfony\Component\HttpFoundation\Session\SessionBagProxy; +use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\HttpFoundation\Session\Storage\MetadataBag; use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage; +use Symfony\Component\HttpFoundation\Session\Storage\SessionStorageInterface; /** * SessionTest. @@ -29,15 +31,8 @@ */ class SessionTest extends TestCase { - /** - * @var \Symfony\Component\HttpFoundation\Session\Storage\SessionStorageInterface - */ - protected $storage; - - /** - * @var \Symfony\Component\HttpFoundation\Session\SessionInterface - */ - protected $session; + protected SessionStorageInterface $storage; + protected SessionInterface $session; protected function setUp(): void { @@ -45,12 +40,6 @@ protected function setUp(): void $this->session = new Session($this->storage, new AttributeBag(), new FlashBag()); } - protected function tearDown(): void - { - $this->storage = null; - $this->session = null; - } - public function testStart() { $this->assertEquals('', $this->session->getId()); diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/AbstractRedisSessionHandlerTestCase.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/AbstractRedisSessionHandlerTestCase.php index 52f8a4cb025b4..4df1553c899e9 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/AbstractRedisSessionHandlerTestCase.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/AbstractRedisSessionHandlerTestCase.php @@ -24,15 +24,8 @@ abstract class AbstractRedisSessionHandlerTestCase extends TestCase { protected const PREFIX = 'prefix_'; - /** - * @var RedisSessionHandler - */ - protected $storage; - - /** - * @var \Redis|\RedisArray|\RedisCluster|\Predis\Client - */ - protected $redisClient; + protected RedisSessionHandler $storage; + protected \Redis|Relay|\RedisArray|\RedisCluster|\Predis\Client $redisClient; abstract protected function createRedisClient(string $host): \Redis|Relay|\RedisArray|\RedisCluster|\Predis\Client; @@ -58,14 +51,6 @@ protected function setUp(): void ); } - protected function tearDown(): void - { - $this->redisClient = null; - $this->storage = null; - - parent::tearDown(); - } - public function testOpenSession() { $this->assertTrue($this->storage->open('', '')); diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MarshallingSessionHandlerTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MarshallingSessionHandlerTest.php index 7216cdd1ece74..894a71589b47d 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MarshallingSessionHandlerTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MarshallingSessionHandlerTest.php @@ -22,15 +22,8 @@ */ class MarshallingSessionHandlerTest extends TestCase { - /** - * @var MockObject|\SessionHandlerInterface - */ - protected $handler; - - /** - * @var MockObject|MarshallerInterface - */ - protected $marshaller; + protected MockObject&\SessionHandlerInterface $handler; + protected MockObject&MarshallerInterface $marshaller; protected function setUp(): void { diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php index 0b25c37d90638..379fcb0d17874 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Session\Storage\Handler\MemcachedSessionHandler; @@ -24,12 +25,8 @@ class MemcachedSessionHandlerTest extends TestCase private const PREFIX = 'prefix_'; private const TTL = 1000; - /** - * @var MemcachedSessionHandler - */ - protected $storage; - - protected $memcached; + protected MemcachedSessionHandler $storage; + protected MockObject&\Memcached $memcached; protected function setUp(): void { @@ -54,13 +51,6 @@ protected function setUp(): void ); } - protected function tearDown(): void - { - $this->memcached = null; - $this->storage = null; - parent::tearDown(); - } - public function testOpenSession() { $this->assertTrue($this->storage->open('', '')); diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MigratingSessionHandlerTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MigratingSessionHandlerTest.php index f56f753af6c85..eb988dfd6e46a 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MigratingSessionHandlerTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MigratingSessionHandlerTest.php @@ -11,14 +11,15 @@ namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Session\Storage\Handler\MigratingSessionHandler; class MigratingSessionHandlerTest extends TestCase { - private $dualHandler; - private $currentHandler; - private $writeOnlyHandler; + private MigratingSessionHandler $dualHandler; + private MockObject&\SessionHandlerInterface $currentHandler; + private MockObject&\SessionHandlerInterface $writeOnlyHandler; protected function setUp(): void { diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php index 30e8cc0f9dfc9..c37f0c3af3b2a 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php @@ -25,12 +25,9 @@ */ class MongoDbSessionHandlerTest extends TestCase { - /** - * @var MockObject&Client - */ - private $mongo; - private $storage; - public $options; + public array $options; + private MockObject&Client $mongo; + private MongoDbSessionHandler $storage; protected function setUp(): void { diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php index ce8e778749222..cd34c72e34342 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php @@ -22,7 +22,7 @@ */ class PdoSessionHandlerTest extends TestCase { - private $dbFile; + private ?string $dbFile = null; protected function tearDown(): void { @@ -404,9 +404,9 @@ private function createStream($content) class MockPdo extends \PDO { - public $prepareResult; - private $driverName; - private $errorMode; + public \Closure|\PDOStatement|false $prepareResult; + private ?string $driverName; + private bool|int $errorMode; public function __construct(string $driverName = null, int $errorMode = null) { diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MetadataBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MetadataBagTest.php index 51a1b6472f764..b2f3de42b0e20 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MetadataBagTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MetadataBagTest.php @@ -21,12 +21,8 @@ */ class MetadataBagTest extends TestCase { - /** - * @var MetadataBag - */ - protected $bag; - - protected $array = []; + protected MetadataBag $bag; + protected array $array = []; protected function setUp(): void { @@ -36,13 +32,6 @@ protected function setUp(): void $this->bag->initialize($this->array); } - protected function tearDown(): void - { - $this->array = []; - $this->bag = null; - parent::tearDown(); - } - public function testInitialize() { $sessionMetadata = []; diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockArraySessionStorageTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockArraySessionStorageTest.php index 2428e9fc24c9a..0fc9910582208 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockArraySessionStorageTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockArraySessionStorageTest.php @@ -23,22 +23,10 @@ */ class MockArraySessionStorageTest extends TestCase { - /** - * @var MockArraySessionStorage - */ - private $storage; - - /** - * @var AttributeBag - */ - private $attributes; - - /** - * @var FlashBag - */ - private $flashes; - - private $data; + private MockArraySessionStorage $storage; + private AttributeBag $attributes; + private FlashBag $flashes; + private array $data; protected function setUp(): void { @@ -56,14 +44,6 @@ protected function setUp(): void $this->storage->setSessionData($this->data); } - protected function tearDown(): void - { - $this->data = null; - $this->flashes = null; - $this->attributes = null; - $this->storage = null; - } - public function testStart() { $this->assertEquals('', $this->storage->getId()); diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockFileSessionStorageTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockFileSessionStorageTest.php index 3f994cb2a7f9f..61804c268100b 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockFileSessionStorageTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockFileSessionStorageTest.php @@ -23,15 +23,9 @@ */ class MockFileSessionStorageTest extends TestCase { - /** - * @var string - */ - private $sessionDir; + protected MockFileSessionStorage $storage; - /** - * @var MockFileSessionStorage - */ - protected $storage; + private string $sessionDir; protected function setUp(): void { @@ -45,8 +39,6 @@ protected function tearDown(): void if (is_dir($this->sessionDir)) { @rmdir($this->sessionDir); } - $this->sessionDir = null; - $this->storage = null; } public function testStart() diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php index 9234e2b40b0a6..a59c8de5f3c4b 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php @@ -32,7 +32,7 @@ */ class NativeSessionStorageTest extends TestCase { - private $savePath; + private string $savePath; protected function setUp(): void { @@ -50,8 +50,6 @@ protected function tearDown(): void if (is_dir($this->savePath)) { @rmdir($this->savePath); } - - $this->savePath = null; } protected function getStorage(array $options = []): NativeSessionStorage diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php index e2fb93ebcc000..5a777be9ce590 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php @@ -28,7 +28,7 @@ */ class PhpBridgeSessionStorageTest extends TestCase { - private $savePath; + private string $savePath; protected function setUp(): void { @@ -46,8 +46,6 @@ protected function tearDown(): void if (is_dir($this->savePath)) { @rmdir($this->savePath); } - - $this->savePath = null; } protected function getStorage(): PhpBridgeSessionStorage diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/AbstractProxyTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/AbstractProxyTest.php index fde7a4a0aef71..0d9eb56aecc07 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/AbstractProxyTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/AbstractProxyTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Proxy; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Session\Storage\Proxy\AbstractProxy; use Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy; @@ -22,21 +23,13 @@ */ class AbstractProxyTest extends TestCase { - /** - * @var AbstractProxy - */ - protected $proxy; + protected MockObject&AbstractProxy $proxy; protected function setUp(): void { $this->proxy = $this->getMockForAbstractClass(AbstractProxy::class); } - protected function tearDown(): void - { - $this->proxy = null; - } - public function testGetSaveHandlerName() { $this->assertNull($this->proxy->getSaveHandlerName()); diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php index eed23fe0b25a2..d9c4974ef474a 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Proxy; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Session\Storage\Handler\StrictSessionHandler; use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage; @@ -27,15 +28,9 @@ */ class SessionHandlerProxyTest extends TestCase { - /** - * @var \PHPUnit\Framework\MockObject\Matcher - */ - private $mock; + private MockObject&\SessionHandlerInterface $mock; - /** - * @var SessionHandlerProxy - */ - private $proxy; + private SessionHandlerProxy $proxy; protected function setUp(): void { @@ -43,12 +38,6 @@ protected function setUp(): void $this->proxy = new SessionHandlerProxy($this->mock); } - protected function tearDown(): void - { - $this->mock = null; - $this->proxy = null; - } - public function testOpenTrue() { $this->mock->expects($this->once()) diff --git a/src/Symfony/Component/HttpKernel/Tests/CacheClearer/ChainCacheClearerTest.php b/src/Symfony/Component/HttpKernel/Tests/CacheClearer/ChainCacheClearerTest.php index 80d9796070bc0..cffe93b0f73d9 100644 --- a/src/Symfony/Component/HttpKernel/Tests/CacheClearer/ChainCacheClearerTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/CacheClearer/ChainCacheClearerTest.php @@ -17,7 +17,7 @@ class ChainCacheClearerTest extends TestCase { - protected static $cacheDir; + protected static string $cacheDir; public static function setUpBeforeClass(): void { diff --git a/src/Symfony/Component/HttpKernel/Tests/CacheWarmer/CacheWarmerTest.php b/src/Symfony/Component/HttpKernel/Tests/CacheWarmer/CacheWarmerTest.php index 0b4c89c65da27..c41bd1d1dc537 100644 --- a/src/Symfony/Component/HttpKernel/Tests/CacheWarmer/CacheWarmerTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/CacheWarmer/CacheWarmerTest.php @@ -16,7 +16,7 @@ class CacheWarmerTest extends TestCase { - protected static $cacheFile; + protected static string $cacheFile; public static function setUpBeforeClass(): void { @@ -47,7 +47,7 @@ public function testWriteNonWritableCacheFileThrowsARuntimeException() class TestCacheWarmer extends CacheWarmer { - protected $file; + protected string $file; public function __construct(string $file) { diff --git a/src/Symfony/Component/HttpKernel/Tests/ControllerMetadata/ArgumentMetadataFactoryTest.php b/src/Symfony/Component/HttpKernel/Tests/ControllerMetadata/ArgumentMetadataFactoryTest.php index 2984950e120ea..8c3d93d5aed24 100644 --- a/src/Symfony/Component/HttpKernel/Tests/ControllerMetadata/ArgumentMetadataFactoryTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/ControllerMetadata/ArgumentMetadataFactoryTest.php @@ -23,10 +23,7 @@ class ArgumentMetadataFactoryTest extends TestCase { - /** - * @var ArgumentMetadataFactory - */ - private $factory; + private ArgumentMetadataFactory $factory; protected function setUp(): void { diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/AddRequestFormatsListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/AddRequestFormatsListenerTest.php index c40468f3daf41..5382063a12f9e 100644 --- a/src/Symfony/Component/HttpKernel/Tests/EventListener/AddRequestFormatsListenerTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/AddRequestFormatsListenerTest.php @@ -24,21 +24,13 @@ */ class AddRequestFormatsListenerTest extends TestCase { - /** - * @var AddRequestFormatsListener - */ - private $listener; + private AddRequestFormatsListener $listener; protected function setUp(): void { $this->listener = new AddRequestFormatsListener(['csv' => ['text/csv', 'text/plain']]); } - protected function tearDown(): void - { - $this->listener = null; - } - public function testIsAnEventSubscriber() { $this->assertInstanceOf(EventSubscriberInterface::class, $this->listener); diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/LocaleAwareListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/LocaleAwareListenerTest.php index f6328e250734b..09dd946923196 100644 --- a/src/Symfony/Component/HttpKernel/Tests/EventListener/LocaleAwareListenerTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/LocaleAwareListenerTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\HttpKernel\Tests\EventListener; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\RequestStack; @@ -22,9 +23,9 @@ class LocaleAwareListenerTest extends TestCase { - private $listener; - private $localeAwareService; - private $requestStack; + private LocaleAwareListener $listener; + private MockObject&LocaleAwareInterface $localeAwareService; + private RequestStack $requestStack; protected function setUp(): void { diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/LocaleListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/LocaleListenerTest.php index 58ad7f2ff6f4b..e1998163f70d9 100644 --- a/src/Symfony/Component/HttpKernel/Tests/EventListener/LocaleListenerTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/LocaleListenerTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\HttpKernel\Tests\EventListener; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpFoundation\Request; @@ -25,7 +26,7 @@ class LocaleListenerTest extends TestCase { - private $requestStack; + private MockObject&RequestStack $requestStack; protected function setUp(): void { diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/ResponseListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/ResponseListenerTest.php index 4bb8a607cf911..42307bec77a41 100644 --- a/src/Symfony/Component/HttpKernel/Tests/EventListener/ResponseListenerTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/ResponseListenerTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\HttpKernel\Tests\EventListener; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\HttpFoundation\Request; @@ -22,9 +23,8 @@ class ResponseListenerTest extends TestCase { - private $dispatcher; - - private $kernel; + private EventDispatcher $dispatcher; + private MockObject&HttpKernelInterface $kernel; protected function setUp(): void { @@ -35,12 +35,6 @@ protected function setUp(): void $this->kernel = $this->createMock(HttpKernelInterface::class); } - protected function tearDown(): void - { - $this->dispatcher = null; - $this->kernel = null; - } - public function testFilterDoesNothingForSubRequests() { $response = new Response('foo'); diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php index 6df52c8e267c6..8c270a8e6e13e 100644 --- a/src/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php @@ -37,7 +37,7 @@ class RouterListenerTest extends TestCase { - private $requestStack; + private RequestStack $requestStack; protected function setUp(): void { diff --git a/src/Symfony/Component/HttpKernel/Tests/Fragment/FragmentHandlerTest.php b/src/Symfony/Component/HttpKernel/Tests/Fragment/FragmentHandlerTest.php index 1d0eb90bf6fdb..05e4dfa410c75 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Fragment/FragmentHandlerTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/Fragment/FragmentHandlerTest.php @@ -21,7 +21,7 @@ class FragmentHandlerTest extends TestCase { - private $requestStack; + private RequestStack $requestStack; protected function setUp(): void { diff --git a/src/Symfony/Component/HttpKernel/Tests/Fragment/InlineFragmentRendererTest.php b/src/Symfony/Component/HttpKernel/Tests/Fragment/InlineFragmentRendererTest.php index d9e66da0409b1..c5cec4ba7aa3c 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Fragment/InlineFragmentRendererTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/Fragment/InlineFragmentRendererTest.php @@ -311,7 +311,7 @@ private function getKernelExpectingRequest(Request $expectedRequest) class Bar { - public $bar = 'bar'; + public string $bar = 'bar'; public function getBar() { diff --git a/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php b/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php index ae1ff9e2a54e8..1f63686053d51 100644 --- a/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php @@ -1863,7 +1863,7 @@ public function testTraceLevelShort() class TestKernel implements HttpKernelInterface { - public $terminateCalled = false; + public bool $terminateCalled = false; public function terminate(Request $request, Response $response) { diff --git a/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTestCase.php b/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTestCase.php index 0cf32f6020f3c..02a34a7a4cf1d 100644 --- a/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTestCase.php +++ b/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTestCase.php @@ -30,11 +30,7 @@ abstract class HttpCacheTestCase extends TestCase protected $responses; protected $catch; protected $esi; - - /** - * @var Store - */ - protected $store; + protected Store $store; protected function setUp(): void { diff --git a/src/Symfony/Component/HttpKernel/Tests/HttpCache/StoreTest.php b/src/Symfony/Component/HttpKernel/Tests/HttpCache/StoreTest.php index dccadc01985d4..1942e8d33766a 100644 --- a/src/Symfony/Component/HttpKernel/Tests/HttpCache/StoreTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/HttpCache/StoreTest.php @@ -20,13 +20,9 @@ class StoreTest extends TestCase { - protected $request; - protected $response; - - /** - * @var Store - */ - protected $store; + protected Request $request; + protected Response $response; + protected Store $store; protected function setUp(): void { @@ -40,10 +36,6 @@ protected function setUp(): void protected function tearDown(): void { - $this->store = null; - $this->request = null; - $this->response = null; - HttpCacheTestCase::clearDirectory(sys_get_temp_dir().'/http_cache'); } diff --git a/src/Symfony/Component/HttpKernel/Tests/HttpCache/SubRequestHandlerTest.php b/src/Symfony/Component/HttpKernel/Tests/HttpCache/SubRequestHandlerTest.php index f17abb20281f3..97b8b461d20e4 100644 --- a/src/Symfony/Component/HttpKernel/Tests/HttpCache/SubRequestHandlerTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/HttpCache/SubRequestHandlerTest.php @@ -19,7 +19,7 @@ class SubRequestHandlerTest extends TestCase { - private static $globalState; + private static array $globalState; protected function setUp(): void { @@ -131,7 +131,7 @@ public function testTrustedXForwardedForHeader() $this->assertSame($globalState, $this->getGlobalState()); } - private function getGlobalState() + private function getGlobalState(): array { return [ Request::getTrustedProxies(), diff --git a/src/Symfony/Component/HttpKernel/Tests/HttpCache/TestHttpKernel.php b/src/Symfony/Component/HttpKernel/Tests/HttpCache/TestHttpKernel.php index 17ba768e55adc..f60099140b056 100644 --- a/src/Symfony/Component/HttpKernel/Tests/HttpCache/TestHttpKernel.php +++ b/src/Symfony/Component/HttpKernel/Tests/HttpCache/TestHttpKernel.php @@ -21,13 +21,13 @@ class TestHttpKernel extends HttpKernel implements ControllerResolverInterface, ArgumentResolverInterface { - protected $body; - protected $status; - protected $headers; - protected $called = false; - protected $customizer; - protected $catch = false; - protected $backendRequest; + protected ?string $body = null; + protected int $status; + protected array $headers; + protected bool $called = false; + protected ?\Closure $customizer; + protected bool $catch = false; + protected array $backendRequest; public function __construct($body, $status, $headers, \Closure $customizer = null, EventDispatcher $eventDispatcher = null) { diff --git a/src/Symfony/Component/HttpKernel/Tests/HttpCache/TestMultipleHttpKernel.php b/src/Symfony/Component/HttpKernel/Tests/HttpCache/TestMultipleHttpKernel.php index 1302fb8336655..56503cb013f58 100644 --- a/src/Symfony/Component/HttpKernel/Tests/HttpCache/TestMultipleHttpKernel.php +++ b/src/Symfony/Component/HttpKernel/Tests/HttpCache/TestMultipleHttpKernel.php @@ -21,11 +21,11 @@ class TestMultipleHttpKernel extends HttpKernel implements ControllerResolverInterface, ArgumentResolverInterface { - protected $bodies = []; - protected $statuses = []; - protected $headers = []; - protected $called = false; - protected $backendRequest; + protected array $bodies = []; + protected array $statuses = []; + protected array $headers = []; + protected bool $called = false; + protected Request $backendRequest; public function __construct($responses) { diff --git a/src/Symfony/Component/HttpKernel/Tests/KernelTest.php b/src/Symfony/Component/HttpKernel/Tests/KernelTest.php index 7ec9fa33133cb..459eafd016e78 100644 --- a/src/Symfony/Component/HttpKernel/Tests/KernelTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/KernelTest.php @@ -731,7 +731,7 @@ protected function getKernel(array $methods = [], array $bundles = [], bool $deb class TestKernel implements HttpKernelInterface { - public $terminateCalled = false; + public bool $terminateCalled = false; public function terminate(): void { @@ -750,8 +750,7 @@ public function getProjectDir(): string class CustomProjectDirKernel extends Kernel implements WarmableInterface { - public $warmedUp = false; - private $baseDir; + public bool $warmedUp = false; public function __construct( private readonly ?\Closure $buildContainer = null, diff --git a/src/Symfony/Component/HttpKernel/Tests/Log/LoggerTest.php b/src/Symfony/Component/HttpKernel/Tests/Log/LoggerTest.php index 1334190798a9c..f6c943e88b121 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Log/LoggerTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/Log/LoggerTest.php @@ -22,15 +22,8 @@ */ class LoggerTest extends TestCase { - /** - * @var LoggerInterface - */ - private $logger; - - /** - * @var string - */ - private $tmpFile; + private Logger $logger; + private string $tmpFile; protected function setUp(): void { diff --git a/src/Symfony/Component/HttpKernel/Tests/Logger.php b/src/Symfony/Component/HttpKernel/Tests/Logger.php index c553116b57fad..22ef90d423875 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Logger.php +++ b/src/Symfony/Component/HttpKernel/Tests/Logger.php @@ -15,7 +15,7 @@ class Logger implements LoggerInterface { - protected $logs; + protected array $logs; public function __construct() { diff --git a/src/Symfony/Component/HttpKernel/Tests/Profiler/FileProfilerStorageTest.php b/src/Symfony/Component/HttpKernel/Tests/Profiler/FileProfilerStorageTest.php index 004b4d61f1f3e..b186a56d410a3 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Profiler/FileProfilerStorageTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/Profiler/FileProfilerStorageTest.php @@ -17,8 +17,8 @@ class FileProfilerStorageTest extends TestCase { - private $tmpDir; - private $storage; + private string $tmpDir; + private FileProfilerStorage $storage; protected function setUp(): void { diff --git a/src/Symfony/Component/HttpKernel/Tests/Profiler/ProfilerTest.php b/src/Symfony/Component/HttpKernel/Tests/Profiler/ProfilerTest.php index f35f9cf2a4da9..5dd79b033f48f 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Profiler/ProfilerTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/Profiler/ProfilerTest.php @@ -21,8 +21,8 @@ class ProfilerTest extends TestCase { - private $tmp; - private $storage; + private string $tmp; + private ?FileProfilerStorage $storage = null; public function testCollect() { diff --git a/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/BundleEntryReaderTest.php b/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/BundleEntryReaderTest.php index 8d6c91f9d0101..75276d22c7e64 100644 --- a/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/BundleEntryReaderTest.php +++ b/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/BundleEntryReaderTest.php @@ -25,15 +25,8 @@ class BundleEntryReaderTest extends TestCase { private const RES_DIR = '/res/dir'; - /** - * @var BundleEntryReader - */ - private $reader; - - /** - * @var MockObject&BundleEntryReaderInterface - */ - private $readerImpl; + private BundleEntryReader $reader; + private MockObject&BundleEntryReaderInterface $readerImpl; private const DATA = [ 'Entries' => [ diff --git a/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/IntlBundleReaderTest.php b/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/IntlBundleReaderTest.php index 6b3a461a9c5f3..42f596420cff4 100644 --- a/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/IntlBundleReaderTest.php +++ b/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/IntlBundleReaderTest.php @@ -23,10 +23,7 @@ */ class IntlBundleReaderTest extends TestCase { - /** - * @var IntlBundleReader - */ - private $reader; + private IntlBundleReader $reader; protected function setUp(): void { diff --git a/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/JsonBundleReaderTest.php b/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/JsonBundleReaderTest.php index f6abfc4693424..2eb0419cd5596 100644 --- a/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/JsonBundleReaderTest.php +++ b/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/JsonBundleReaderTest.php @@ -21,10 +21,7 @@ */ class JsonBundleReaderTest extends TestCase { - /** - * @var JsonBundleReader - */ - private $reader; + private JsonBundleReader $reader; protected function setUp(): void { diff --git a/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/PhpBundleReaderTest.php b/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/PhpBundleReaderTest.php index fcb2480123af0..c4b6b10c54166 100644 --- a/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/PhpBundleReaderTest.php +++ b/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/PhpBundleReaderTest.php @@ -21,10 +21,7 @@ */ class PhpBundleReaderTest extends TestCase { - /** - * @var PhpBundleReader - */ - private $reader; + private PhpBundleReader $reader; protected function setUp(): void { diff --git a/src/Symfony/Component/Intl/Tests/Data/Bundle/Writer/JsonBundleWriterTest.php b/src/Symfony/Component/Intl/Tests/Data/Bundle/Writer/JsonBundleWriterTest.php index c0703dd233a0f..9bd41217cd9c9 100644 --- a/src/Symfony/Component/Intl/Tests/Data/Bundle/Writer/JsonBundleWriterTest.php +++ b/src/Symfony/Component/Intl/Tests/Data/Bundle/Writer/JsonBundleWriterTest.php @@ -20,17 +20,9 @@ */ class JsonBundleWriterTest extends TestCase { - /** - * @var JsonBundleWriter - */ - private $writer; - - private $directory; - - /** - * @var Filesystem - */ - private $filesystem; + private JsonBundleWriter $writer; + private string $directory; + private Filesystem $filesystem; protected function setUp(): void { diff --git a/src/Symfony/Component/Intl/Tests/Data/Bundle/Writer/PhpBundleWriterTest.php b/src/Symfony/Component/Intl/Tests/Data/Bundle/Writer/PhpBundleWriterTest.php index bc0ef87c2b775..ebdc8b285021b 100644 --- a/src/Symfony/Component/Intl/Tests/Data/Bundle/Writer/PhpBundleWriterTest.php +++ b/src/Symfony/Component/Intl/Tests/Data/Bundle/Writer/PhpBundleWriterTest.php @@ -20,17 +20,9 @@ */ class PhpBundleWriterTest extends TestCase { - /** - * @var PhpBundleWriter - */ - private $writer; - - private $directory; - - /** - * @var Filesystem - */ - private $filesystem; + private PhpBundleWriter $writer; + private string $directory; + private Filesystem $filesystem; protected function setUp(): void { diff --git a/src/Symfony/Component/Intl/Tests/Data/Bundle/Writer/TextBundleWriterTest.php b/src/Symfony/Component/Intl/Tests/Data/Bundle/Writer/TextBundleWriterTest.php index 6271f9c314805..0ad1100d88246 100644 --- a/src/Symfony/Component/Intl/Tests/Data/Bundle/Writer/TextBundleWriterTest.php +++ b/src/Symfony/Component/Intl/Tests/Data/Bundle/Writer/TextBundleWriterTest.php @@ -22,17 +22,9 @@ */ class TextBundleWriterTest extends TestCase { - /** - * @var TextBundleWriter - */ - private $writer; - - private $directory; - - /** - * @var Filesystem - */ - private $filesystem; + private TextBundleWriter $writer; + private string $directory; + private Filesystem $filesystem; protected function setUp(): void { diff --git a/src/Symfony/Component/Intl/Tests/Data/Util/LocaleScannerTest.php b/src/Symfony/Component/Intl/Tests/Data/Util/LocaleScannerTest.php index 0719fd0092946..ec54eacecef8a 100644 --- a/src/Symfony/Component/Intl/Tests/Data/Util/LocaleScannerTest.php +++ b/src/Symfony/Component/Intl/Tests/Data/Util/LocaleScannerTest.php @@ -20,17 +20,9 @@ */ class LocaleScannerTest extends TestCase { - private $directory; - - /** - * @var Filesystem - */ - private $filesystem; - - /** - * @var LocaleScanner - */ - private $scanner; + private string $directory; + private Filesystem $filesystem; + private LocaleScanner $scanner; protected function setUp(): void { diff --git a/src/Symfony/Component/Intl/Tests/Data/Util/RingBufferTest.php b/src/Symfony/Component/Intl/Tests/Data/Util/RingBufferTest.php index cd21b8f9b0edf..1ca30c728d635 100644 --- a/src/Symfony/Component/Intl/Tests/Data/Util/RingBufferTest.php +++ b/src/Symfony/Component/Intl/Tests/Data/Util/RingBufferTest.php @@ -20,10 +20,7 @@ */ class RingBufferTest extends TestCase { - /** - * @var RingBuffer - */ - private $buffer; + private RingBuffer $buffer; protected function setUp(): void { diff --git a/src/Symfony/Component/Intl/Tests/IntlTest.php b/src/Symfony/Component/Intl/Tests/IntlTest.php index fec739fac35f9..cc5a3a93d5526 100644 --- a/src/Symfony/Component/Intl/Tests/IntlTest.php +++ b/src/Symfony/Component/Intl/Tests/IntlTest.php @@ -16,7 +16,7 @@ class IntlTest extends TestCase { - private $defaultLocale; + private string $defaultLocale; protected function setUp(): void { diff --git a/src/Symfony/Component/Intl/Tests/ResourceBundleTestCase.php b/src/Symfony/Component/Intl/Tests/ResourceBundleTestCase.php index 4cd72cbc5b731..96e80612f97bd 100644 --- a/src/Symfony/Component/Intl/Tests/ResourceBundleTestCase.php +++ b/src/Symfony/Component/Intl/Tests/ResourceBundleTestCase.php @@ -734,8 +734,8 @@ abstract class ResourceBundleTestCase extends TestCase 'zh_TW' => 'zh_Hant_TW', ]; - private static $rootLocales; - private $defaultLocale; + private static ?array $rootLocales = null; + private string $defaultLocale; protected function setUp(): void { diff --git a/src/Symfony/Component/Intl/Tests/ScriptsTest.php b/src/Symfony/Component/Intl/Tests/ScriptsTest.php index 96ac0f36f5a9e..094d80451186e 100644 --- a/src/Symfony/Component/Intl/Tests/ScriptsTest.php +++ b/src/Symfony/Component/Intl/Tests/ScriptsTest.php @@ -21,7 +21,7 @@ class ScriptsTest extends ResourceBundleTestCase { // The below arrays document the state of the ICU data bundled with this package. - protected static $scripts = [ + protected static array $scripts = [ 'Adlm', 'Afak', 'Aghb', diff --git a/src/Symfony/Component/Intl/Tests/Util/GitRepositoryTest.php b/src/Symfony/Component/Intl/Tests/Util/GitRepositoryTest.php index cc1cacff7809a..ce87547d920c3 100644 --- a/src/Symfony/Component/Intl/Tests/Util/GitRepositoryTest.php +++ b/src/Symfony/Component/Intl/Tests/Util/GitRepositoryTest.php @@ -21,7 +21,7 @@ */ class GitRepositoryTest extends TestCase { - private $targetDir; + private ?string $targetDir = null; private const REPO_URL = 'https://github.com/symfony/intl.git'; diff --git a/src/Symfony/Component/Ldap/Tests/Adapter/ExtLdap/LdapManagerTest.php b/src/Symfony/Component/Ldap/Tests/Adapter/ExtLdap/LdapManagerTest.php index f849b4bf25f23..b803c7b300626 100644 --- a/src/Symfony/Component/Ldap/Tests/Adapter/ExtLdap/LdapManagerTest.php +++ b/src/Symfony/Component/Ldap/Tests/Adapter/ExtLdap/LdapManagerTest.php @@ -27,8 +27,7 @@ */ class LdapManagerTest extends LdapTestCase { - /** @var Adapter */ - private $adapter; + private Adapter $adapter; protected function setUp(): void { diff --git a/src/Symfony/Component/Ldap/Tests/LdapTest.php b/src/Symfony/Component/Ldap/Tests/LdapTest.php index 18200d8f073b9..878ac0d0baf44 100644 --- a/src/Symfony/Component/Ldap/Tests/LdapTest.php +++ b/src/Symfony/Component/Ldap/Tests/LdapTest.php @@ -21,11 +21,8 @@ class LdapTest extends TestCase { - /** @var MockObject&AdapterInterface */ - private $adapter; - - /** @var Ldap */ - private $ldap; + private MockObject&AdapterInterface $adapter; + private Ldap $ldap; protected function setUp(): void { diff --git a/src/Symfony/Component/Ldap/Tests/Security/CheckLdapCredentialsListenerTest.php b/src/Symfony/Component/Ldap/Tests/Security/CheckLdapCredentialsListenerTest.php index 495072ca6816b..6392c0d3b4265 100644 --- a/src/Symfony/Component/Ldap/Tests/Security/CheckLdapCredentialsListenerTest.php +++ b/src/Symfony/Component/Ldap/Tests/Security/CheckLdapCredentialsListenerTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Ldap\Tests\Security; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Psr\Container\ContainerInterface; use Symfony\Component\HttpFoundation\Request; @@ -37,7 +38,7 @@ class CheckLdapCredentialsListenerTest extends TestCase { - private $ldap; + private MockObject&LdapInterface $ldap; protected function setUp(): void { diff --git a/src/Symfony/Component/Lock/Tests/LockTest.php b/src/Symfony/Component/Lock/Tests/LockTest.php index f5b28f245d9ce..5c8c1ce3f0e7c 100644 --- a/src/Symfony/Component/Lock/Tests/LockTest.php +++ b/src/Symfony/Component/Lock/Tests/LockTest.php @@ -469,8 +469,8 @@ public function testAcquireReadTwiceWithExpiration() $key = new Key(uniqid(__METHOD__, true)); $store = new class() implements PersistingStoreInterface { use ExpiringStoreTrait; - private $keys = []; - private $initialTtl = 30; + private array $keys = []; + private int $initialTtl = 30; public function save(Key $key): void { @@ -513,8 +513,8 @@ public function testAcquireTwiceWithExpiration() $key = new Key(uniqid(__METHOD__, true)); $store = new class() implements PersistingStoreInterface { use ExpiringStoreTrait; - private $keys = []; - private $initialTtl = 30; + private array $keys = []; + private int $initialTtl = 30; public function save(Key $key): void { diff --git a/src/Symfony/Component/Lock/Tests/Store/AbstractRedisStoreTestCase.php b/src/Symfony/Component/Lock/Tests/Store/AbstractRedisStoreTestCase.php index ecfd6cb17c42c..d98e77e3d017f 100644 --- a/src/Symfony/Component/Lock/Tests/Store/AbstractRedisStoreTestCase.php +++ b/src/Symfony/Component/Lock/Tests/Store/AbstractRedisStoreTestCase.php @@ -56,7 +56,7 @@ public function testBackwardCompatibility() class Symfony51Store { - private $redis; + private \Redis|Relay|\RedisCluster|\RedisArray|\Predis\ClientInterface $redis; public function __construct($redis) { diff --git a/src/Symfony/Component/Lock/Tests/Store/CombinedStoreTest.php b/src/Symfony/Component/Lock/Tests/Store/CombinedStoreTest.php index b483ddb8995bc..efb711c46103b 100644 --- a/src/Symfony/Component/Lock/Tests/Store/CombinedStoreTest.php +++ b/src/Symfony/Component/Lock/Tests/Store/CombinedStoreTest.php @@ -50,14 +50,10 @@ public function getStore(): PersistingStoreInterface return new CombinedStore([new RedisStore($redis)], new UnanimousStrategy()); } - /** @var MockObject&StrategyInterface */ - private $strategy; - /** @var MockObject&BlockingStoreInterface */ - private $store1; - /** @var MockObject&BlockingStoreInterface */ - private $store2; - /** @var CombinedStore */ - private $store; + private MockObject&StrategyInterface $strategy; + private MockObject&BlockingStoreInterface $store1; + private MockObject&BlockingStoreInterface $store2; + private CombinedStore $store; protected function setUp(): void { diff --git a/src/Symfony/Component/Lock/Tests/Store/DoctrineDbalStoreTest.php b/src/Symfony/Component/Lock/Tests/Store/DoctrineDbalStoreTest.php index 514e140530f89..b2676ae1d8f8e 100644 --- a/src/Symfony/Component/Lock/Tests/Store/DoctrineDbalStoreTest.php +++ b/src/Symfony/Component/Lock/Tests/Store/DoctrineDbalStoreTest.php @@ -33,7 +33,7 @@ class DoctrineDbalStoreTest extends AbstractStoreTestCase { use ExpiringStoreTestTrait; - protected static $dbFile; + protected static string $dbFile; public static function setUpBeforeClass(): void { diff --git a/src/Symfony/Component/Lock/Tests/Store/PdoStoreTest.php b/src/Symfony/Component/Lock/Tests/Store/PdoStoreTest.php index 3c006a96660c7..76919ff8f23c7 100644 --- a/src/Symfony/Component/Lock/Tests/Store/PdoStoreTest.php +++ b/src/Symfony/Component/Lock/Tests/Store/PdoStoreTest.php @@ -27,7 +27,7 @@ class PdoStoreTest extends AbstractStoreTestCase { use ExpiringStoreTestTrait; - protected static $dbFile; + protected static string $dbFile; public static function setUpBeforeClass(): void { diff --git a/src/Symfony/Component/Lock/Tests/Strategy/ConsensusStrategyTest.php b/src/Symfony/Component/Lock/Tests/Strategy/ConsensusStrategyTest.php index 36691b4680dee..1f46510e597f7 100644 --- a/src/Symfony/Component/Lock/Tests/Strategy/ConsensusStrategyTest.php +++ b/src/Symfony/Component/Lock/Tests/Strategy/ConsensusStrategyTest.php @@ -19,8 +19,7 @@ */ class ConsensusStrategyTest extends TestCase { - /** @var ConsensusStrategy */ - private $strategy; + private ConsensusStrategy $strategy; protected function setUp(): void { diff --git a/src/Symfony/Component/Lock/Tests/Strategy/UnanimousStrategyTest.php b/src/Symfony/Component/Lock/Tests/Strategy/UnanimousStrategyTest.php index 69bb511add2ae..3dc00233eda54 100644 --- a/src/Symfony/Component/Lock/Tests/Strategy/UnanimousStrategyTest.php +++ b/src/Symfony/Component/Lock/Tests/Strategy/UnanimousStrategyTest.php @@ -19,8 +19,7 @@ */ class UnanimousStrategyTest extends TestCase { - /** @var UnanimousStrategy */ - private $strategy; + private UnanimousStrategy $strategy; protected function setUp(): void { diff --git a/src/Symfony/Component/Mailer/Tests/MailerTest.php b/src/Symfony/Component/Mailer/Tests/MailerTest.php index 95ab9d9391c7b..bcf7520312fa9 100644 --- a/src/Symfony/Component/Mailer/Tests/MailerTest.php +++ b/src/Symfony/Component/Mailer/Tests/MailerTest.php @@ -42,8 +42,8 @@ public function testSendingRawMessages() public function testSendMessageToBus() { $bus = new class() implements MessageBusInterface { - public $messages = []; - public $stamps = []; + public array $messages = []; + public array $stamps = []; public function dispatch($message, array $stamps = []): Envelope { diff --git a/src/Symfony/Component/Mailer/Tests/Transport/NativeTransportFactoryTest.php b/src/Symfony/Component/Mailer/Tests/Transport/NativeTransportFactoryTest.php index c253b4c7cb503..28b3c2c61a943 100644 --- a/src/Symfony/Component/Mailer/Tests/Transport/NativeTransportFactoryTest.php +++ b/src/Symfony/Component/Mailer/Tests/Transport/NativeTransportFactoryTest.php @@ -22,7 +22,7 @@ final class NativeTransportFactoryTest extends TestCase { - public static $fakeConfiguration = []; + public static array $fakeConfiguration = []; public static function setUpBeforeClass(): void { diff --git a/src/Symfony/Component/Mailer/Tests/Transport/SendmailTransportTest.php b/src/Symfony/Component/Mailer/Tests/Transport/SendmailTransportTest.php index d0c6f18659d2a..481659ec9f0df 100644 --- a/src/Symfony/Component/Mailer/Tests/Transport/SendmailTransportTest.php +++ b/src/Symfony/Component/Mailer/Tests/Transport/SendmailTransportTest.php @@ -21,10 +21,7 @@ class SendmailTransportTest extends TestCase { private const FAKE_SENDMAIL = __DIR__.'/Fixtures/fake-sendmail.php -t'; - /** - * @var string - */ - private $argsPath; + private string $argsPath; protected function setUp(): void { diff --git a/src/Symfony/Component/Mailer/Tests/TransportTest.php b/src/Symfony/Component/Mailer/Tests/TransportTest.php index 50e0f7440dffe..f0dd6d4be930e 100644 --- a/src/Symfony/Component/Mailer/Tests/TransportTest.php +++ b/src/Symfony/Component/Mailer/Tests/TransportTest.php @@ -102,7 +102,7 @@ public static function fromWrongStringProvider(): iterable class DummyTransport implements Transport\TransportInterface { - private $host; + private string $host; public function __construct(string $host) { diff --git a/src/Symfony/Component/Messenger/Bridge/AmazonSqs/Tests/Fixtures/DummyMessage.php b/src/Symfony/Component/Messenger/Bridge/AmazonSqs/Tests/Fixtures/DummyMessage.php index 59d4a2ad35cb2..f4fbc0046cab8 100644 --- a/src/Symfony/Component/Messenger/Bridge/AmazonSqs/Tests/Fixtures/DummyMessage.php +++ b/src/Symfony/Component/Messenger/Bridge/AmazonSqs/Tests/Fixtures/DummyMessage.php @@ -4,7 +4,7 @@ class DummyMessage { - private $message; + private string $message; public function __construct(string $message) { diff --git a/src/Symfony/Component/Messenger/Bridge/AmazonSqs/Tests/Transport/AmazonSqsTransportTest.php b/src/Symfony/Component/Messenger/Bridge/AmazonSqs/Tests/Transport/AmazonSqsTransportTest.php index 541b543f699d0..4be58b9e7ad7f 100644 --- a/src/Symfony/Component/Messenger/Bridge/AmazonSqs/Tests/Transport/AmazonSqsTransportTest.php +++ b/src/Symfony/Component/Messenger/Bridge/AmazonSqs/Tests/Transport/AmazonSqsTransportTest.php @@ -30,25 +30,10 @@ class AmazonSqsTransportTest extends TestCase { - /** - * @var MockObject|Connection - */ - private $connection; - - /** - * @var MockObject|ReceiverInterface - */ - private $receiver; - - /** - * @var MockObject|SenderInterface|MessageCountAwareInterface - */ - private $sender; - - /** - * @var AmazonSqsTransport - */ - private $transport; + private MockObject&Connection $connection; + private MockObject&ReceiverInterface $receiver; + private MockObject&SenderInterface $sender; + private AmazonSqsTransport $transport; protected function setUp(): void { diff --git a/src/Symfony/Component/Messenger/Bridge/Amqp/Tests/Fixtures/DummyMessage.php b/src/Symfony/Component/Messenger/Bridge/Amqp/Tests/Fixtures/DummyMessage.php index 4562b68419575..44368a5774a7b 100644 --- a/src/Symfony/Component/Messenger/Bridge/Amqp/Tests/Fixtures/DummyMessage.php +++ b/src/Symfony/Component/Messenger/Bridge/Amqp/Tests/Fixtures/DummyMessage.php @@ -4,7 +4,7 @@ class DummyMessage { - private $message; + private string $message; public function __construct(string $message) { diff --git a/src/Symfony/Component/Messenger/Bridge/Amqp/Tests/Transport/ConnectionTest.php b/src/Symfony/Component/Messenger/Bridge/Amqp/Tests/Transport/ConnectionTest.php index 5e9652dcede35..a08c102a4b9da 100644 --- a/src/Symfony/Component/Messenger/Bridge/Amqp/Tests/Transport/ConnectionTest.php +++ b/src/Symfony/Component/Messenger/Bridge/Amqp/Tests/Transport/ConnectionTest.php @@ -808,10 +808,10 @@ private function createDelayOrRetryConnection(\AMQPExchange $delayExchange, stri class TestAmqpFactory extends AmqpFactory { - private $connection; - private $channel; - private $queue; - private $exchange; + private \AMQPConnection $connection; + private \AMQPChannel $channel; + private \AMQPQueue $queue; + private \AMQPExchange $exchange; public function __construct(\AMQPConnection $connection, \AMQPChannel $channel, \AMQPQueue $queue, \AMQPExchange $exchange) { diff --git a/src/Symfony/Component/Messenger/Bridge/Beanstalkd/Tests/Fixtures/DummyMessage.php b/src/Symfony/Component/Messenger/Bridge/Beanstalkd/Tests/Fixtures/DummyMessage.php index b5b315a711d70..90954541a1a59 100644 --- a/src/Symfony/Component/Messenger/Bridge/Beanstalkd/Tests/Fixtures/DummyMessage.php +++ b/src/Symfony/Component/Messenger/Bridge/Beanstalkd/Tests/Fixtures/DummyMessage.php @@ -4,7 +4,7 @@ class DummyMessage { - private $message; + private string $message; public function __construct(string $message) { diff --git a/src/Symfony/Component/Messenger/Bridge/Doctrine/Tests/Fixtures/DummyMessage.php b/src/Symfony/Component/Messenger/Bridge/Doctrine/Tests/Fixtures/DummyMessage.php index 4ee9f6ef9596a..3e1b926f43301 100644 --- a/src/Symfony/Component/Messenger/Bridge/Doctrine/Tests/Fixtures/DummyMessage.php +++ b/src/Symfony/Component/Messenger/Bridge/Doctrine/Tests/Fixtures/DummyMessage.php @@ -4,7 +4,7 @@ class DummyMessage { - private $message; + private string $message; public function __construct(string $message) { diff --git a/src/Symfony/Component/Messenger/Bridge/Doctrine/Tests/Transport/DoctrineIntegrationTest.php b/src/Symfony/Component/Messenger/Bridge/Doctrine/Tests/Transport/DoctrineIntegrationTest.php index c9ff7c851e845..4fbd558354c11 100644 --- a/src/Symfony/Component/Messenger/Bridge/Doctrine/Tests/Transport/DoctrineIntegrationTest.php +++ b/src/Symfony/Component/Messenger/Bridge/Doctrine/Tests/Transport/DoctrineIntegrationTest.php @@ -26,10 +26,8 @@ */ class DoctrineIntegrationTest extends TestCase { - /** @var \Doctrine\DBAL\Connection */ - private $driverConnection; - /** @var Connection */ - private $connection; + private \Doctrine\DBAL\Connection $driverConnection; + private Connection $connection; protected function setUp(): void { diff --git a/src/Symfony/Component/Messenger/Bridge/Doctrine/Tests/Transport/DoctrinePostgreSqlIntegrationTest.php b/src/Symfony/Component/Messenger/Bridge/Doctrine/Tests/Transport/DoctrinePostgreSqlIntegrationTest.php index 63fe3ebd4b513..8f9fb31499ce4 100644 --- a/src/Symfony/Component/Messenger/Bridge/Doctrine/Tests/Transport/DoctrinePostgreSqlIntegrationTest.php +++ b/src/Symfony/Component/Messenger/Bridge/Doctrine/Tests/Transport/DoctrinePostgreSqlIntegrationTest.php @@ -28,10 +28,8 @@ */ class DoctrinePostgreSqlIntegrationTest extends TestCase { - /** @var Connection */ - private $driverConnection; - /** @var PostgreSqlConnection */ - private $connection; + private Connection $driverConnection; + private PostgreSqlConnection $connection; protected function setUp(): void { diff --git a/src/Symfony/Component/Messenger/Bridge/Doctrine/Tests/Transport/PostgreSqlConnectionTest.php b/src/Symfony/Component/Messenger/Bridge/Doctrine/Tests/Transport/PostgreSqlConnectionTest.php index 74357dc461e2a..71dfcc3d1cb08 100644 --- a/src/Symfony/Component/Messenger/Bridge/Doctrine/Tests/Transport/PostgreSqlConnectionTest.php +++ b/src/Symfony/Component/Messenger/Bridge/Doctrine/Tests/Transport/PostgreSqlConnectionTest.php @@ -65,7 +65,7 @@ public function testListenOnConnection() ->willReturn(new QueryBuilder($driverConnection)); $wrappedConnection = new class() { - private $notifyCalls = 0; + private int $notifyCalls = 0; public function pgsqlGetNotify() { diff --git a/src/Symfony/Component/Messenger/Bridge/Redis/Tests/Fixtures/DummyMessage.php b/src/Symfony/Component/Messenger/Bridge/Redis/Tests/Fixtures/DummyMessage.php index 92f8a89c018ad..02c3a14c50256 100644 --- a/src/Symfony/Component/Messenger/Bridge/Redis/Tests/Fixtures/DummyMessage.php +++ b/src/Symfony/Component/Messenger/Bridge/Redis/Tests/Fixtures/DummyMessage.php @@ -4,7 +4,7 @@ class DummyMessage { - private $message; + private string $message; public function __construct(string $message) { diff --git a/src/Symfony/Component/Messenger/Bridge/Redis/Tests/Fixtures/ExternalMessage.php b/src/Symfony/Component/Messenger/Bridge/Redis/Tests/Fixtures/ExternalMessage.php index bf8391e730ac3..098d1cce95f84 100644 --- a/src/Symfony/Component/Messenger/Bridge/Redis/Tests/Fixtures/ExternalMessage.php +++ b/src/Symfony/Component/Messenger/Bridge/Redis/Tests/Fixtures/ExternalMessage.php @@ -4,8 +4,8 @@ class ExternalMessage { - private $foo; - private $bar = []; + private string $foo; + private array $bar = []; public function __construct(string $foo) { diff --git a/src/Symfony/Component/Messenger/Bridge/Redis/Tests/Transport/RedisExtIntegrationTest.php b/src/Symfony/Component/Messenger/Bridge/Redis/Tests/Transport/RedisExtIntegrationTest.php index 2bbc8db84ce5e..254ee9edb8da5 100644 --- a/src/Symfony/Component/Messenger/Bridge/Redis/Tests/Transport/RedisExtIntegrationTest.php +++ b/src/Symfony/Component/Messenger/Bridge/Redis/Tests/Transport/RedisExtIntegrationTest.php @@ -28,8 +28,8 @@ */ class RedisExtIntegrationTest extends TestCase { - private $redis; - private $connection; + private \Redis|Relay|null $redis = null; + private ?Connection $connection = null; protected function setUp(): void { diff --git a/src/Symfony/Component/Messenger/Tests/Command/DebugCommandTest.php b/src/Symfony/Component/Messenger/Tests/Command/DebugCommandTest.php index 363f46c5ccad4..f74661dc5ad1b 100644 --- a/src/Symfony/Component/Messenger/Tests/Command/DebugCommandTest.php +++ b/src/Symfony/Component/Messenger/Tests/Command/DebugCommandTest.php @@ -31,7 +31,7 @@ */ class DebugCommandTest extends TestCase { - private $colSize; + private string|false $colSize; protected function setUp(): void { diff --git a/src/Symfony/Component/Messenger/Tests/Command/FailedMessagesShowCommandTest.php b/src/Symfony/Component/Messenger/Tests/Command/FailedMessagesShowCommandTest.php index 7476970ac30f4..c67f85efd30e7 100644 --- a/src/Symfony/Component/Messenger/Tests/Command/FailedMessagesShowCommandTest.php +++ b/src/Symfony/Component/Messenger/Tests/Command/FailedMessagesShowCommandTest.php @@ -30,7 +30,7 @@ */ class FailedMessagesShowCommandTest extends TestCase { - private $colSize; + private string|false $colSize; protected function setUp(): void { diff --git a/src/Symfony/Component/Messenger/Tests/DataCollector/MessengerDataCollectorTest.php b/src/Symfony/Component/Messenger/Tests/DataCollector/MessengerDataCollectorTest.php index af419bf7639af..cd8287fdc5782 100644 --- a/src/Symfony/Component/Messenger/Tests/DataCollector/MessengerDataCollectorTest.php +++ b/src/Symfony/Component/Messenger/Tests/DataCollector/MessengerDataCollectorTest.php @@ -25,8 +25,7 @@ */ class MessengerDataCollectorTest extends TestCase { - /** @var CliDumper */ - private $dumper; + private CliDumper $dumper; protected function setUp(): void { diff --git a/src/Symfony/Component/Messenger/Tests/FailureIntegrationTest.php b/src/Symfony/Component/Messenger/Tests/FailureIntegrationTest.php index a41ee33ac72af..fa57de1eb05bb 100644 --- a/src/Symfony/Component/Messenger/Tests/FailureIntegrationTest.php +++ b/src/Symfony/Component/Messenger/Tests/FailureIntegrationTest.php @@ -358,7 +358,7 @@ public function testMultipleFailedTransportsWithoutGlobalFailureTransport() class DummyFailureTestSenderAndReceiver implements ReceiverInterface, SenderInterface { - private $messagesWaiting = []; + private array $messagesWaiting = []; public function get(): iterable { @@ -397,8 +397,8 @@ public function getMessagesWaitingToBeReceived(): array class DummyTestHandler { - private $timesCalled = 0; - private $shouldThrow; + private int $timesCalled = 0; + private bool $shouldThrow; public function __construct(bool $shouldThrow) { diff --git a/src/Symfony/Component/Messenger/Tests/Fixtures/DummyMessage.php b/src/Symfony/Component/Messenger/Tests/Fixtures/DummyMessage.php index 2a9c70b1c5349..391a4682c56e1 100644 --- a/src/Symfony/Component/Messenger/Tests/Fixtures/DummyMessage.php +++ b/src/Symfony/Component/Messenger/Tests/Fixtures/DummyMessage.php @@ -4,7 +4,7 @@ class DummyMessage implements DummyMessageInterface { - private $message; + private string $message; public function __construct(string $message) { diff --git a/src/Symfony/Component/Messenger/Tests/Middleware/DispatchAfterCurrentBusMiddlewareTest.php b/src/Symfony/Component/Messenger/Tests/Middleware/DispatchAfterCurrentBusMiddlewareTest.php index 52e507eb6be8f..5b1dced27ff0a 100644 --- a/src/Symfony/Component/Messenger/Tests/Middleware/DispatchAfterCurrentBusMiddlewareTest.php +++ b/src/Symfony/Component/Messenger/Tests/Middleware/DispatchAfterCurrentBusMiddlewareTest.php @@ -299,7 +299,7 @@ private function willHandleMessage(): ReturnCallback class DummyEvent { - private $message; + private string $message; public function __construct(string $message) { @@ -314,8 +314,8 @@ public function getMessage(): string class DispatchingMiddleware implements MiddlewareInterface { - private $bus; - private $messages; + private MessageBusInterface $bus; + private array $messages; public function __construct(MessageBusInterface $bus, array $messages) { diff --git a/src/Symfony/Component/Messenger/Tests/Middleware/HandleMessageMiddlewareTest.php b/src/Symfony/Component/Messenger/Tests/Middleware/HandleMessageMiddlewareTest.php index 4d54f83bb7767..0829765319c99 100644 --- a/src/Symfony/Component/Messenger/Tests/Middleware/HandleMessageMiddlewareTest.php +++ b/src/Symfony/Component/Messenger/Tests/Middleware/HandleMessageMiddlewareTest.php @@ -170,7 +170,7 @@ public function testAllowNoHandlers() public function testBatchHandler() { $handler = new class() implements BatchHandlerInterface { - public $processedMessages; + public array $processedMessages; use BatchHandlerTrait; diff --git a/src/Symfony/Component/Messenger/Tests/Middleware/TraceableMiddlewareTest.php b/src/Symfony/Component/Messenger/Tests/Middleware/TraceableMiddlewareTest.php index a0006bbf05e07..af313b96eef9f 100644 --- a/src/Symfony/Component/Messenger/Tests/Middleware/TraceableMiddlewareTest.php +++ b/src/Symfony/Component/Messenger/Tests/Middleware/TraceableMiddlewareTest.php @@ -32,7 +32,7 @@ public function testHandle() $envelope = new Envelope(new DummyMessage('Hello')); $middleware = new class() implements MiddlewareInterface { - public $calls = 0; + public int $calls = 0; public function handle(Envelope $envelope, StackInterface $stack): Envelope { @@ -117,8 +117,8 @@ public function testHandleWhenStopwatchHasBeenReset() $stopwatch = new Stopwatch(); $middleware = new class($stopwatch) implements MiddlewareInterface { - public $calls = 0; - private $stopwatch; + public int $calls = 0; + private Stopwatch $stopwatch; public function __construct(Stopwatch $stopwatch) { diff --git a/src/Symfony/Component/Messenger/Tests/Transport/InMemory/InMemoryTransportFactoryTest.php b/src/Symfony/Component/Messenger/Tests/Transport/InMemory/InMemoryTransportFactoryTest.php index af0fbc04a3c31..d2e8323009fef 100644 --- a/src/Symfony/Component/Messenger/Tests/Transport/InMemory/InMemoryTransportFactoryTest.php +++ b/src/Symfony/Component/Messenger/Tests/Transport/InMemory/InMemoryTransportFactoryTest.php @@ -24,10 +24,7 @@ */ class InMemoryTransportFactoryTest extends TestCase { - /** - * @var InMemoryTransportFactory - */ - private $factory; + private InMemoryTransportFactory $factory; protected function setUp(): void { diff --git a/src/Symfony/Component/Messenger/Tests/Transport/InMemory/InMemoryTransportTest.php b/src/Symfony/Component/Messenger/Tests/Transport/InMemory/InMemoryTransportTest.php index 1cd1db68beaa0..0a4b218623a2e 100644 --- a/src/Symfony/Component/Messenger/Tests/Transport/InMemory/InMemoryTransportTest.php +++ b/src/Symfony/Component/Messenger/Tests/Transport/InMemory/InMemoryTransportTest.php @@ -25,20 +25,11 @@ */ class InMemoryTransportTest extends TestCase { - /** - * @var InMemoryTransport - */ - private $transport; - - /** - * @var InMemoryTransport - */ - private $serializeTransport; - - /** - * @var SerializerInterface - */ - private $serializer; + private InMemoryTransport $transport; + + private InMemoryTransport $serializeTransport; + + private SerializerInterface $serializer; protected function setUp(): void { diff --git a/src/Symfony/Component/Messenger/Tests/Transport/Serialization/Normalizer/FlattenExceptionNormalizerTest.php b/src/Symfony/Component/Messenger/Tests/Transport/Serialization/Normalizer/FlattenExceptionNormalizerTest.php index 87967140b3c26..76fea64740c7a 100644 --- a/src/Symfony/Component/Messenger/Tests/Transport/Serialization/Normalizer/FlattenExceptionNormalizerTest.php +++ b/src/Symfony/Component/Messenger/Tests/Transport/Serialization/Normalizer/FlattenExceptionNormalizerTest.php @@ -21,10 +21,7 @@ */ class FlattenExceptionNormalizerTest extends TestCase { - /** - * @var FlattenExceptionNormalizer - */ - private $normalizer; + private FlattenExceptionNormalizer $normalizer; protected function setUp(): void { diff --git a/src/Symfony/Component/Messenger/Tests/WorkerTest.php b/src/Symfony/Component/Messenger/Tests/WorkerTest.php index e781d2958ef0c..82b3935867395 100644 --- a/src/Symfony/Component/Messenger/Tests/WorkerTest.php +++ b/src/Symfony/Component/Messenger/Tests/WorkerTest.php @@ -582,11 +582,11 @@ public function testFlushBatchOnStop() class DummyReceiver implements ReceiverInterface { - private $deliveriesOfEnvelopes; - private $acknowledgedEnvelopes; - private $rejectedEnvelopes; - private $acknowledgeCount = 0; - private $rejectCount = 0; + private array $deliveriesOfEnvelopes; + private array $acknowledgedEnvelopes = []; + private array $rejectedEnvelopes = []; + private int $acknowledgeCount = 0; + private int $rejectCount = 0; /** * @param Envelope[][] $deliveriesOfEnvelopes @@ -643,7 +643,7 @@ class DummyBatchHandler implements BatchHandlerInterface { use BatchHandlerTrait; - public $processedMessages; + public array $processedMessages; public function __invoke(DummyMessage $message, Acknowledger $ack = null) { @@ -667,7 +667,7 @@ private function process(array $jobs): void class ResettableDummyReceiver extends DummyReceiver implements ResetInterface { - private $hasBeenReset = false; + private bool $hasBeenReset = false; public function reset(): void { diff --git a/src/Symfony/Component/Mime/Tests/Crypto/DkimSignerTest.php b/src/Symfony/Component/Mime/Tests/Crypto/DkimSignerTest.php index c11114644386b..8832c72f01cf3 100644 --- a/src/Symfony/Component/Mime/Tests/Crypto/DkimSignerTest.php +++ b/src/Symfony/Component/Mime/Tests/Crypto/DkimSignerTest.php @@ -25,7 +25,7 @@ */ class DkimSignerTest extends TestCase { - private static $pk = <<createMock(HttpClientInterface::class); $transport = new class($clientMock, $eventDispatcherMock) extends AbstractTransport { - public $exception; + public NullTransportException $exception; public function __construct($client, EventDispatcherInterface $dispatcher = null) { diff --git a/src/Symfony/Component/Notifier/Tests/Fixtures/TestOptions.php b/src/Symfony/Component/Notifier/Tests/Fixtures/TestOptions.php index f2e09016985f8..0d241133fb6f2 100644 --- a/src/Symfony/Component/Notifier/Tests/Fixtures/TestOptions.php +++ b/src/Symfony/Component/Notifier/Tests/Fixtures/TestOptions.php @@ -15,7 +15,7 @@ final class TestOptions implements MessageOptionsInterface { - private $options; + private array $options; public function __construct(array $options = []) { diff --git a/src/Symfony/Component/Notifier/Tests/Mailer/DummyMailer.php b/src/Symfony/Component/Notifier/Tests/Mailer/DummyMailer.php index 9c3f96402ed36..c1e57fd7281d4 100644 --- a/src/Symfony/Component/Notifier/Tests/Mailer/DummyMailer.php +++ b/src/Symfony/Component/Notifier/Tests/Mailer/DummyMailer.php @@ -20,7 +20,7 @@ */ class DummyMailer implements MailerInterface { - private $sentMessage; + private RawMessage $sentMessage; public function send(RawMessage $message, Envelope $envelope = null): void { diff --git a/src/Symfony/Component/Notifier/Tests/TexterTest.php b/src/Symfony/Component/Notifier/Tests/TexterTest.php index da83f4df5f5cf..aba420acd2a43 100644 --- a/src/Symfony/Component/Notifier/Tests/TexterTest.php +++ b/src/Symfony/Component/Notifier/Tests/TexterTest.php @@ -22,11 +22,8 @@ class TexterTest extends TestCase { - /** @var MockObject&TransportInterface */ - private $transport; - - /** @var MockObject&MessageBusInterface */ - private $bus; + private MockObject&TransportInterface $transport; + private MockObject&MessageBusInterface $bus; protected function setUp(): void { diff --git a/src/Symfony/Component/Notifier/Tests/Transport/NullTransportFactoryTest.php b/src/Symfony/Component/Notifier/Tests/Transport/NullTransportFactoryTest.php index 470b848372bab..48b20fa774ca1 100644 --- a/src/Symfony/Component/Notifier/Tests/Transport/NullTransportFactoryTest.php +++ b/src/Symfony/Component/Notifier/Tests/Transport/NullTransportFactoryTest.php @@ -24,10 +24,7 @@ */ class NullTransportFactoryTest extends TestCase { - /** - * @var NullTransportFactory - */ - private $nullTransportFactory; + private NullTransportFactory $nullTransportFactory; protected function setUp(): void { diff --git a/src/Symfony/Component/OptionsResolver/Tests/OptionsResolverTest.php b/src/Symfony/Component/OptionsResolver/Tests/OptionsResolverTest.php index 7e56d38c47969..42fb1b8136200 100644 --- a/src/Symfony/Component/OptionsResolver/Tests/OptionsResolverTest.php +++ b/src/Symfony/Component/OptionsResolver/Tests/OptionsResolverTest.php @@ -26,10 +26,7 @@ class OptionsResolverTest extends TestCase { - /** - * @var OptionsResolver - */ - private $resolver; + private OptionsResolver $resolver; protected function setUp(): void { diff --git a/src/Symfony/Component/PasswordHasher/Tests/Command/UserPasswordHashCommandTest.php b/src/Symfony/Component/PasswordHasher/Tests/Command/UserPasswordHashCommandTest.php index 8ec8baf6bf86c..253403d218205 100644 --- a/src/Symfony/Component/PasswordHasher/Tests/Command/UserPasswordHashCommandTest.php +++ b/src/Symfony/Component/PasswordHasher/Tests/Command/UserPasswordHashCommandTest.php @@ -24,9 +24,8 @@ class UserPasswordHashCommandTest extends TestCase { - /** @var CommandTester */ - private $passwordHasherCommandTester; - private $colSize; + private ?CommandTester $passwordHasherCommandTester = null; + private string|false $colSize; public function testEncodePasswordEmptySalt() { diff --git a/src/Symfony/Component/PasswordHasher/Tests/Fixtures/TestLegacyPasswordAuthenticatedUser.php b/src/Symfony/Component/PasswordHasher/Tests/Fixtures/TestLegacyPasswordAuthenticatedUser.php index abe311c853da8..8ae6bdfe4dd24 100644 --- a/src/Symfony/Component/PasswordHasher/Tests/Fixtures/TestLegacyPasswordAuthenticatedUser.php +++ b/src/Symfony/Component/PasswordHasher/Tests/Fixtures/TestLegacyPasswordAuthenticatedUser.php @@ -7,10 +7,10 @@ final class TestLegacyPasswordAuthenticatedUser implements LegacyPasswordAuthenticatedUserInterface, UserInterface { - private $username; - private $password; - private $salt; - private $roles; + private string $username; + private ?string $password; + private ?string $salt; + private array $roles; public function __construct(string $username, ?string $password = null, ?string $salt = null, array $roles = []) { diff --git a/src/Symfony/Component/PasswordHasher/Tests/Fixtures/TestPasswordAuthenticatedUser.php b/src/Symfony/Component/PasswordHasher/Tests/Fixtures/TestPasswordAuthenticatedUser.php index a732ebb077751..d6372351f5ff1 100644 --- a/src/Symfony/Component/PasswordHasher/Tests/Fixtures/TestPasswordAuthenticatedUser.php +++ b/src/Symfony/Component/PasswordHasher/Tests/Fixtures/TestPasswordAuthenticatedUser.php @@ -6,7 +6,7 @@ final class TestPasswordAuthenticatedUser implements PasswordAuthenticatedUserInterface { - private $password; + private ?string $password; public function __construct(?string $password = null) { diff --git a/src/Symfony/Component/PasswordHasher/Tests/Hasher/PasswordHasherFactoryTest.php b/src/Symfony/Component/PasswordHasher/Tests/Hasher/PasswordHasherFactoryTest.php index f1851cc588058..b87a850ed43f0 100644 --- a/src/Symfony/Component/PasswordHasher/Tests/Hasher/PasswordHasherFactoryTest.php +++ b/src/Symfony/Component/PasswordHasher/Tests/Hasher/PasswordHasherFactoryTest.php @@ -218,7 +218,7 @@ class SomeChildUser extends SomeUser class HasherAwareUser extends SomeUser implements PasswordHasherAwareInterface { - public $hasherName = 'hasher_name'; + public ?string $hasherName = 'hasher_name'; public function getPasswordHasherName(): ?string { diff --git a/src/Symfony/Component/Process/Tests/ExecutableFinderTest.php b/src/Symfony/Component/Process/Tests/ExecutableFinderTest.php index 5c63cf0f91c47..155c5ee231ec9 100644 --- a/src/Symfony/Component/Process/Tests/ExecutableFinderTest.php +++ b/src/Symfony/Component/Process/Tests/ExecutableFinderTest.php @@ -19,7 +19,7 @@ */ class ExecutableFinderTest extends TestCase { - private $path; + private string|false $path = false; protected function tearDown(): void { diff --git a/src/Symfony/Component/Process/Tests/ProcessTest.php b/src/Symfony/Component/Process/Tests/ProcessTest.php index d326fe8e2601a..cca2b5293a2b8 100644 --- a/src/Symfony/Component/Process/Tests/ProcessTest.php +++ b/src/Symfony/Component/Process/Tests/ProcessTest.php @@ -28,9 +28,9 @@ */ class ProcessTest extends TestCase { - private static $phpBin; - private static $process; - private static $sigchild; + private static string $phpBin; + private static ?Process $process = null; + private static bool $sigchild; public static function setUpBeforeClass(): void { diff --git a/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorArrayAccessTestCase.php b/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorArrayAccessTestCase.php index b1b3f63d1c30e..90d931873e667 100644 --- a/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorArrayAccessTestCase.php +++ b/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorArrayAccessTestCase.php @@ -18,10 +18,7 @@ abstract class PropertyAccessorArrayAccessTestCase extends TestCase { - /** - * @var PropertyAccessor - */ - protected $propertyAccessor; + protected PropertyAccessor $propertyAccessor; protected function setUp(): void { diff --git a/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorBuilderTest.php b/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorBuilderTest.php index 2b664467e51e1..5ab73eb38bb3e 100644 --- a/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorBuilderTest.php +++ b/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorBuilderTest.php @@ -20,21 +20,13 @@ class PropertyAccessorBuilderTest extends TestCase { - /** - * @var PropertyAccessorBuilder - */ - protected $builder; + protected PropertyAccessorBuilder $builder; protected function setUp(): void { $this->builder = new PropertyAccessorBuilder(); } - protected function tearDown(): void - { - $this->builder = null; - } - public function testEnableMagicGet() { $this->assertSame($this->builder, $this->builder->enableMagicGet()); diff --git a/src/Symfony/Component/PropertyAccess/Tests/PropertyPathBuilderTest.php b/src/Symfony/Component/PropertyAccess/Tests/PropertyPathBuilderTest.php index 5f4671294ee74..948ca066cb8fb 100644 --- a/src/Symfony/Component/PropertyAccess/Tests/PropertyPathBuilderTest.php +++ b/src/Symfony/Component/PropertyAccess/Tests/PropertyPathBuilderTest.php @@ -22,10 +22,7 @@ class PropertyPathBuilderTest extends TestCase { private const PREFIX = 'old1[old2].old3[old4][old5].old6'; - /** - * @var PropertyPathBuilder - */ - private $builder; + private PropertyPathBuilder $builder; protected function setUp(): void { diff --git a/src/Symfony/Component/PropertyInfo/Tests/AbstractPropertyInfoExtractorTest.php b/src/Symfony/Component/PropertyInfo/Tests/AbstractPropertyInfoExtractorTest.php index ce5a43c0ddaa1..d53172ef1504f 100644 --- a/src/Symfony/Component/PropertyInfo/Tests/AbstractPropertyInfoExtractorTest.php +++ b/src/Symfony/Component/PropertyInfo/Tests/AbstractPropertyInfoExtractorTest.php @@ -27,10 +27,7 @@ */ class AbstractPropertyInfoExtractorTest extends TestCase { - /** - * @var PropertyInfoExtractor - */ - protected $propertyInfo; + protected PropertyInfoExtractorInterface $propertyInfo; protected function setUp(): void { diff --git a/src/Symfony/Component/PropertyInfo/Tests/Extractor/ConstructorExtractorTest.php b/src/Symfony/Component/PropertyInfo/Tests/Extractor/ConstructorExtractorTest.php index 8a6c8ce1fa614..6bd8318ed6229 100644 --- a/src/Symfony/Component/PropertyInfo/Tests/Extractor/ConstructorExtractorTest.php +++ b/src/Symfony/Component/PropertyInfo/Tests/Extractor/ConstructorExtractorTest.php @@ -21,10 +21,7 @@ */ class ConstructorExtractorTest extends TestCase { - /** - * @var ConstructorExtractor - */ - private $extractor; + private ConstructorExtractor $extractor; protected function setUp(): void { diff --git a/src/Symfony/Component/PropertyInfo/Tests/Extractor/PhpDocExtractorTest.php b/src/Symfony/Component/PropertyInfo/Tests/Extractor/PhpDocExtractorTest.php index 1ef1562f9d8e5..49aca038ef69f 100644 --- a/src/Symfony/Component/PropertyInfo/Tests/Extractor/PhpDocExtractorTest.php +++ b/src/Symfony/Component/PropertyInfo/Tests/Extractor/PhpDocExtractorTest.php @@ -26,10 +26,7 @@ */ class PhpDocExtractorTest extends TestCase { - /** - * @var PhpDocExtractor - */ - private $extractor; + private PhpDocExtractor $extractor; protected function setUp(): void { diff --git a/src/Symfony/Component/PropertyInfo/Tests/Extractor/PhpStanExtractorTest.php b/src/Symfony/Component/PropertyInfo/Tests/Extractor/PhpStanExtractorTest.php index f3405d0409ae3..f452957873ce0 100644 --- a/src/Symfony/Component/PropertyInfo/Tests/Extractor/PhpStanExtractorTest.php +++ b/src/Symfony/Component/PropertyInfo/Tests/Extractor/PhpStanExtractorTest.php @@ -32,15 +32,8 @@ */ class PhpStanExtractorTest extends TestCase { - /** - * @var PhpStanExtractor - */ - private $extractor; - - /** - * @var PhpDocExtractor - */ - private $phpDocExtractor; + private PhpStanExtractor $extractor; + private PhpDocExtractor $phpDocExtractor; protected function setUp(): void { diff --git a/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php b/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php index 1f3ba505ddcfb..c1fa11fbf24e9 100644 --- a/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php +++ b/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php @@ -33,10 +33,7 @@ */ class ReflectionExtractorTest extends TestCase { - /** - * @var ReflectionExtractor - */ - private $extractor; + private ReflectionExtractor $extractor; protected function setUp(): void { diff --git a/src/Symfony/Component/RateLimiter/Tests/CompoundLimiterTest.php b/src/Symfony/Component/RateLimiter/Tests/CompoundLimiterTest.php index 29a91eb182546..f5a728e4d85eb 100644 --- a/src/Symfony/Component/RateLimiter/Tests/CompoundLimiterTest.php +++ b/src/Symfony/Component/RateLimiter/Tests/CompoundLimiterTest.php @@ -23,7 +23,7 @@ */ class CompoundLimiterTest extends TestCase { - private $storage; + private InMemoryStorage $storage; protected function setUp(): void { diff --git a/src/Symfony/Component/RateLimiter/Tests/Policy/FixedWindowLimiterTest.php b/src/Symfony/Component/RateLimiter/Tests/Policy/FixedWindowLimiterTest.php index 3e422fbec55b0..e4bb38edd96ba 100644 --- a/src/Symfony/Component/RateLimiter/Tests/Policy/FixedWindowLimiterTest.php +++ b/src/Symfony/Component/RateLimiter/Tests/Policy/FixedWindowLimiterTest.php @@ -25,7 +25,7 @@ */ class FixedWindowLimiterTest extends TestCase { - private $storage; + private InMemoryStorage $storage; protected function setUp(): void { diff --git a/src/Symfony/Component/RateLimiter/Tests/Policy/SlidingWindowLimiterTest.php b/src/Symfony/Component/RateLimiter/Tests/Policy/SlidingWindowLimiterTest.php index 59a4f399ee1c4..d34bfa44bbe67 100644 --- a/src/Symfony/Component/RateLimiter/Tests/Policy/SlidingWindowLimiterTest.php +++ b/src/Symfony/Component/RateLimiter/Tests/Policy/SlidingWindowLimiterTest.php @@ -23,7 +23,7 @@ */ class SlidingWindowLimiterTest extends TestCase { - private $storage; + private InMemoryStorage $storage; protected function setUp(): void { diff --git a/src/Symfony/Component/RateLimiter/Tests/Policy/TokenBucketLimiterTest.php b/src/Symfony/Component/RateLimiter/Tests/Policy/TokenBucketLimiterTest.php index a08403f43092a..62fe00b35f783 100644 --- a/src/Symfony/Component/RateLimiter/Tests/Policy/TokenBucketLimiterTest.php +++ b/src/Symfony/Component/RateLimiter/Tests/Policy/TokenBucketLimiterTest.php @@ -26,7 +26,7 @@ */ class TokenBucketLimiterTest extends TestCase { - private $storage; + private InMemoryStorage $storage; protected function setUp(): void { diff --git a/src/Symfony/Component/RateLimiter/Tests/Resources/DummyWindow.php b/src/Symfony/Component/RateLimiter/Tests/Resources/DummyWindow.php index 36206de4bf0d5..a2c679184f20e 100644 --- a/src/Symfony/Component/RateLimiter/Tests/Resources/DummyWindow.php +++ b/src/Symfony/Component/RateLimiter/Tests/Resources/DummyWindow.php @@ -15,8 +15,8 @@ class DummyWindow implements LimiterStateInterface { - private $id; - private $expirationTime; + private string $id; + private ?int $expirationTime; public function __construct(string $id = 'test', ?int $expirationTime = 10) { diff --git a/src/Symfony/Component/RateLimiter/Tests/Storage/CacheStorageTest.php b/src/Symfony/Component/RateLimiter/Tests/Storage/CacheStorageTest.php index c1a11c556b6e3..6559de7758e8a 100644 --- a/src/Symfony/Component/RateLimiter/Tests/Storage/CacheStorageTest.php +++ b/src/Symfony/Component/RateLimiter/Tests/Storage/CacheStorageTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\RateLimiter\Tests\Storage; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Psr\Cache\CacheItemInterface; use Psr\Cache\CacheItemPoolInterface; @@ -19,8 +20,8 @@ class CacheStorageTest extends TestCase { - private $pool; - private $storage; + private MockObject&CacheItemPoolInterface $pool; + private CacheStorage $storage; protected function setUp(): void { diff --git a/src/Symfony/Component/Routing/Tests/Generator/Dumper/CompiledUrlGeneratorDumperTest.php b/src/Symfony/Component/Routing/Tests/Generator/Dumper/CompiledUrlGeneratorDumperTest.php index fedd25c71d283..8603ab6d98f82 100644 --- a/src/Symfony/Component/Routing/Tests/Generator/Dumper/CompiledUrlGeneratorDumperTest.php +++ b/src/Symfony/Component/Routing/Tests/Generator/Dumper/CompiledUrlGeneratorDumperTest.php @@ -26,25 +26,10 @@ class CompiledUrlGeneratorDumperTest extends TestCase { use ExpectDeprecationTrait; - /** - * @var RouteCollection - */ - private $routeCollection; - - /** - * @var CompiledUrlGeneratorDumper - */ - private $generatorDumper; - - /** - * @var string - */ - private $testTmpFilepath; - - /** - * @var string - */ - private $largeTestTmpFilepath; + private RouteCollection $routeCollection; + private CompiledUrlGeneratorDumper $generatorDumper; + private string $testTmpFilepath; + private string $largeTestTmpFilepath; protected function setUp(): void { @@ -63,10 +48,6 @@ protected function tearDown(): void parent::tearDown(); @unlink($this->testTmpFilepath); - - $this->routeCollection = null; - $this->generatorDumper = null; - $this->testTmpFilepath = null; } public function testDumpWithRoutes() @@ -166,7 +147,6 @@ public function testDumpWithTooManyRoutes() $this->routeCollection->add('Test2', new Route('/testing2')); file_put_contents($this->largeTestTmpFilepath, $this->generatorDumper->dump()); - $this->routeCollection = $this->generatorDumper = null; $projectUrlGenerator = new CompiledUrlGenerator(require $this->largeTestTmpFilepath, new RequestContext('/app.php')); diff --git a/src/Symfony/Component/Routing/Tests/Loader/ObjectLoaderTest.php b/src/Symfony/Component/Routing/Tests/Loader/ObjectLoaderTest.php index 00b6af62b5b64..54717b6116ae8 100644 --- a/src/Symfony/Component/Routing/Tests/Loader/ObjectLoaderTest.php +++ b/src/Symfony/Component/Routing/Tests/Loader/ObjectLoaderTest.php @@ -96,7 +96,7 @@ public function testExceptionOnMethodNotReturningCollection() class TestObjectLoader extends ObjectLoader { - public $loaderMap = []; + public array $loaderMap = []; public function supports(mixed $resource, string $type = null): bool { @@ -111,8 +111,8 @@ protected function getObject(string $id): object class TestObjectLoaderRouteService { - private $collection; - private $env; + private RouteCollection $collection; + private ?string $env; public function __construct($collection, string $env = null) { diff --git a/src/Symfony/Component/Routing/Tests/Matcher/Dumper/CompiledUrlMatcherDumperTest.php b/src/Symfony/Component/Routing/Tests/Matcher/Dumper/CompiledUrlMatcherDumperTest.php index 2236ca7c97e06..232314b5ab734 100644 --- a/src/Symfony/Component/Routing/Tests/Matcher/Dumper/CompiledUrlMatcherDumperTest.php +++ b/src/Symfony/Component/Routing/Tests/Matcher/Dumper/CompiledUrlMatcherDumperTest.php @@ -24,10 +24,7 @@ class CompiledUrlMatcherDumperTest extends TestCase { - /** - * @var string - */ - private $dumpPath; + private string $dumpPath; protected function setUp(): void { diff --git a/src/Symfony/Component/Routing/Tests/Matcher/ExpressionLanguageProviderTest.php b/src/Symfony/Component/Routing/Tests/Matcher/ExpressionLanguageProviderTest.php index 6d36be554d4d9..712802571ebb5 100644 --- a/src/Symfony/Component/Routing/Tests/Matcher/ExpressionLanguageProviderTest.php +++ b/src/Symfony/Component/Routing/Tests/Matcher/ExpressionLanguageProviderTest.php @@ -19,8 +19,8 @@ class ExpressionLanguageProviderTest extends TestCase { - private $context; - private $expressionLanguage; + private RequestContext $context; + private ExpressionLanguage $expressionLanguage; protected function setUp(): void { diff --git a/src/Symfony/Component/Routing/Tests/RouterTest.php b/src/Symfony/Component/Routing/Tests/RouterTest.php index 460fe29eef0cb..b8766831bd580 100644 --- a/src/Symfony/Component/Routing/Tests/RouterTest.php +++ b/src/Symfony/Component/Routing/Tests/RouterTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Routing\Tests; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\Config\Loader\LoaderInterface; use Symfony\Component\HttpFoundation\Request; @@ -25,11 +26,9 @@ class RouterTest extends TestCase { - private $router; - - private $loader; - - private $cacheDir; + private Router $router; + private MockObject&LoaderInterface $loader; + private string $cacheDir; protected function setUp(): void { @@ -45,10 +44,6 @@ protected function tearDown(): void array_map('unlink', glob($this->cacheDir.\DIRECTORY_SEPARATOR.'*')); @rmdir($this->cacheDir); } - - $this->loader = null; - $this->router = null; - $this->cacheDir = null; } public function testSetOptionsWithSupportedOptions() diff --git a/src/Symfony/Component/Runtime/Tests/phpt/kernel.php b/src/Symfony/Component/Runtime/Tests/phpt/kernel.php index 707a7be20e06c..c3bc8a1abfbb0 100644 --- a/src/Symfony/Component/Runtime/Tests/phpt/kernel.php +++ b/src/Symfony/Component/Runtime/Tests/phpt/kernel.php @@ -17,7 +17,7 @@ class TestKernel implements HttpKernelInterface { - private $var; + private string $var; public function __construct(string $var) { diff --git a/src/Symfony/Component/Security/Core/Tests/Authentication/Token/AbstractTokenTest.php b/src/Symfony/Component/Security/Core/Tests/Authentication/Token/AbstractTokenTest.php index dc67f22f2fb61..221df8f95cd8e 100644 --- a/src/Symfony/Component/Security/Core/Tests/Authentication/Token/AbstractTokenTest.php +++ b/src/Symfony/Component/Security/Core/Tests/Authentication/Token/AbstractTokenTest.php @@ -96,7 +96,7 @@ public function testSetUser($user) class ConcreteToken extends AbstractToken { - private $credentials = 'credentials_value'; + private string $credentials = 'credentials_value'; public function __construct(array $roles = [], UserInterface $user = null) { diff --git a/src/Symfony/Component/Security/Core/Tests/Authorization/AccessDecisionManagerTest.php b/src/Symfony/Component/Security/Core/Tests/Authorization/AccessDecisionManagerTest.php index 41b772d59fb68..37848ab7a9ee4 100644 --- a/src/Symfony/Component/Security/Core/Tests/Authorization/AccessDecisionManagerTest.php +++ b/src/Symfony/Component/Security/Core/Tests/Authorization/AccessDecisionManagerTest.php @@ -255,7 +255,7 @@ protected static function getVoters($grants, $denies, $abstains): array protected static function getVoter($vote) { return new class($vote) implements VoterInterface { - private $vote; + private int $vote; public function __construct(int $vote) { diff --git a/src/Symfony/Component/Security/Core/Tests/Authorization/AuthorizationCheckerTest.php b/src/Symfony/Component/Security/Core/Tests/Authorization/AuthorizationCheckerTest.php index 254bd9780a319..36b048c8976d1 100644 --- a/src/Symfony/Component/Security/Core/Tests/Authorization/AuthorizationCheckerTest.php +++ b/src/Symfony/Component/Security/Core/Tests/Authorization/AuthorizationCheckerTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Security\Core\Tests\Authorization; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\Security\Core\Authentication\Token\NullToken; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage; @@ -21,9 +22,9 @@ class AuthorizationCheckerTest extends TestCase { - private $accessDecisionManager; - private $authorizationChecker; - private $tokenStorage; + private MockObject&AccessDecisionManagerInterface $accessDecisionManager; + private AuthorizationChecker $authorizationChecker; + private TokenStorage $tokenStorage; protected function setUp(): void { diff --git a/src/Symfony/Component/Security/Core/Tests/Authorization/Voter/VoterTest.php b/src/Symfony/Component/Security/Core/Tests/Authorization/Voter/VoterTest.php index 25aff8e1ad841..80c3f4a00b6a2 100644 --- a/src/Symfony/Component/Security/Core/Tests/Authorization/Voter/VoterTest.php +++ b/src/Symfony/Component/Security/Core/Tests/Authorization/Voter/VoterTest.php @@ -18,7 +18,7 @@ class VoterTest extends TestCase { - protected $token; + protected TokenInterface $token; protected function setUp(): void { diff --git a/src/Symfony/Component/Security/Core/Tests/Validator/Constraints/UserPasswordValidatorTestCase.php b/src/Symfony/Component/Security/Core/Tests/Validator/Constraints/UserPasswordValidatorTestCase.php index e3f71b703a2f7..ccf556a01e240 100644 --- a/src/Symfony/Component/Security/Core/Tests/Validator/Constraints/UserPasswordValidatorTestCase.php +++ b/src/Symfony/Component/Security/Core/Tests/Validator/Constraints/UserPasswordValidatorTestCase.php @@ -29,20 +29,9 @@ abstract class UserPasswordValidatorTestCase extends ConstraintValidatorTestCase private const PASSWORD = 's3Cr3t'; private const SALT = '^S4lt$'; - /** - * @var TokenStorageInterface - */ - protected $tokenStorage; - - /** - * @var PasswordHasherInterface - */ - protected $hasher; - - /** - * @var PasswordHasherFactoryInterface - */ - protected $hasherFactory; + protected TokenStorageInterface $tokenStorage; + protected PasswordHasherInterface $hasher; + protected PasswordHasherFactoryInterface $hasherFactory; protected function createValidator(): UserPasswordValidator { diff --git a/src/Symfony/Component/Security/Csrf/Tests/TokenGenerator/UriSafeTokenGeneratorTest.php b/src/Symfony/Component/Security/Csrf/Tests/TokenGenerator/UriSafeTokenGeneratorTest.php index dd86f43ebc65a..a254dda577951 100644 --- a/src/Symfony/Component/Security/Csrf/Tests/TokenGenerator/UriSafeTokenGeneratorTest.php +++ b/src/Symfony/Component/Security/Csrf/Tests/TokenGenerator/UriSafeTokenGeneratorTest.php @@ -23,15 +23,10 @@ class UriSafeTokenGeneratorTest extends TestCase /** * A non alpha-numeric byte string. - * - * @var string */ - private static $bytes; + private static string $bytes; - /** - * @var UriSafeTokenGenerator - */ - private $generator; + private UriSafeTokenGenerator $generator; public static function setUpBeforeClass(): void { @@ -43,11 +38,6 @@ protected function setUp(): void $this->generator = new UriSafeTokenGenerator(self::ENTROPY); } - protected function tearDown(): void - { - $this->generator = null; - } - public function testGenerateToken() { $token = $this->generator->generateToken(); diff --git a/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/NativeSessionTokenStorageTest.php b/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/NativeSessionTokenStorageTest.php index 5e0383cb1c439..3c70c3c5046f7 100644 --- a/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/NativeSessionTokenStorageTest.php +++ b/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/NativeSessionTokenStorageTest.php @@ -26,10 +26,7 @@ class NativeSessionTokenStorageTest extends TestCase { private const SESSION_NAMESPACE = 'foobar'; - /** - * @var NativeSessionTokenStorage - */ - private $storage; + private NativeSessionTokenStorage $storage; protected function setUp(): void { diff --git a/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/SessionTokenStorageTest.php b/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/SessionTokenStorageTest.php index 230f33fb257f3..64e618031f7de 100644 --- a/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/SessionTokenStorageTest.php +++ b/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/SessionTokenStorageTest.php @@ -26,15 +26,8 @@ class SessionTokenStorageTest extends TestCase { private const SESSION_NAMESPACE = 'foobar'; - /** - * @var Session - */ - private $session; - - /** - * @var SessionTokenStorage - */ - private $storage; + private Session $session; + private SessionTokenStorage $storage; protected function setUp(): void { diff --git a/src/Symfony/Component/Security/Http/Tests/Authentication/AuthenticatorManagerTest.php b/src/Symfony/Component/Security/Http/Tests/Authentication/AuthenticatorManagerTest.php index 3825c11a64335..c61b85c58cb4d 100644 --- a/src/Symfony/Component/Security/Http/Tests/Authentication/AuthenticatorManagerTest.php +++ b/src/Symfony/Component/Security/Http/Tests/Authentication/AuthenticatorManagerTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Security\Http\Tests\Authentication; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Psr\Log\AbstractLogger; use Psr\Log\LoggerInterface; @@ -37,12 +38,12 @@ class AuthenticatorManagerTest extends TestCase { - private $tokenStorage; - private $eventDispatcher; - private $request; - private $user; - private $token; - private $response; + private MockObject&TokenStorageInterface $tokenStorage; + private EventDispatcher $eventDispatcher; + private Request $request; + private InMemoryUser $user; + private MockObject&TokenInterface $token; + private Response $response; protected function setUp(): void { @@ -343,7 +344,7 @@ public function testLogsUseTheDecoratedAuthenticatorWhenItIsTraceable() ->willReturn($this->response); $logger = new class() extends AbstractLogger { - public $logContexts = []; + public array $logContexts = []; public function log($level, $message, array $context = []): void { diff --git a/src/Symfony/Component/Security/Http/Tests/Authentication/DefaultAuthenticationFailureHandlerTest.php b/src/Symfony/Component/Security/Http/Tests/Authentication/DefaultAuthenticationFailureHandlerTest.php index e1f35a123bd64..ea58ca3553b64 100644 --- a/src/Symfony/Component/Security/Http/Tests/Authentication/DefaultAuthenticationFailureHandlerTest.php +++ b/src/Symfony/Component/Security/Http/Tests/Authentication/DefaultAuthenticationFailureHandlerTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Security\Http\Tests\Authentication; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; use Symfony\Component\HttpFoundation\ParameterBag; @@ -26,13 +27,13 @@ class DefaultAuthenticationFailureHandlerTest extends TestCase { - private $httpKernel; - private $httpUtils; - private $logger; - private $request; - private $response; - private $session; - private $exception; + private MockObject&HttpKernelInterface $httpKernel; + private MockObject&HttpUtils $httpUtils; + private MockObject&LoggerInterface $logger; + private Request $request; + private Response $response; + private MockObject&SessionInterface $session; + private AuthenticationException $exception; protected function setUp(): void { diff --git a/src/Symfony/Component/Security/Http/Tests/Authenticator/AbstractLoginFormAuthenticatorTest.php b/src/Symfony/Component/Security/Http/Tests/Authenticator/AbstractLoginFormAuthenticatorTest.php index c8c90b7f7cbe0..c155ed9806730 100644 --- a/src/Symfony/Component/Security/Http/Tests/Authenticator/AbstractLoginFormAuthenticatorTest.php +++ b/src/Symfony/Component/Security/Http/Tests/Authenticator/AbstractLoginFormAuthenticatorTest.php @@ -98,7 +98,7 @@ public static function provideSupportsData(): iterable class ConcreteFormAuthenticator extends AbstractLoginFormAuthenticator { - private $loginUrl; + private string $loginUrl; public function __construct(string $loginUrl) { diff --git a/src/Symfony/Component/Security/Http/Tests/Authenticator/FormLoginAuthenticatorTest.php b/src/Symfony/Component/Security/Http/Tests/Authenticator/FormLoginAuthenticatorTest.php index f81ec2c497a90..5499ca6682a91 100644 --- a/src/Symfony/Component/Security/Http/Tests/Authenticator/FormLoginAuthenticatorTest.php +++ b/src/Symfony/Component/Security/Http/Tests/Authenticator/FormLoginAuthenticatorTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Security\Http\Tests\Authenticator; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Session\SessionInterface; @@ -28,11 +29,10 @@ class FormLoginAuthenticatorTest extends TestCase { - private $userProvider; - private $successHandler; - private $failureHandler; - /** @var FormLoginAuthenticator */ - private $authenticator; + private InMemoryUserProvider $userProvider; + private MockObject&AuthenticationSuccessHandlerInterface $successHandler; + private MockObject&AuthenticationFailureHandlerInterface $failureHandler; + private FormLoginAuthenticator $authenticator; protected function setUp(): void { diff --git a/src/Symfony/Component/Security/Http/Tests/Authenticator/HttpBasicAuthenticatorTest.php b/src/Symfony/Component/Security/Http/Tests/Authenticator/HttpBasicAuthenticatorTest.php index b7b0cc010801f..67e196410c5da 100644 --- a/src/Symfony/Component/Security/Http/Tests/Authenticator/HttpBasicAuthenticatorTest.php +++ b/src/Symfony/Component/Security/Http/Tests/Authenticator/HttpBasicAuthenticatorTest.php @@ -24,20 +24,19 @@ class HttpBasicAuthenticatorTest extends TestCase { - private $userProvider; - private $hasherFactory; - private $hasher; - private $authenticator; + private InMemoryUserProvider $userProvider; + private HttpBasicAuthenticator $authenticator; protected function setUp(): void { $this->userProvider = new InMemoryUserProvider(); - $this->hasherFactory = $this->createMock(PasswordHasherFactoryInterface::class); - $this->hasher = $this->createMock(PasswordHasherInterface::class); - $this->hasherFactory + + $hasherFactory = $this->createMock(PasswordHasherFactoryInterface::class); + $hasher = $this->createMock(PasswordHasherInterface::class); + $hasherFactory ->expects($this->any()) ->method('getPasswordHasher') - ->willReturn($this->hasher); + ->willReturn($hasher); $this->authenticator = new HttpBasicAuthenticator('test', $this->userProvider); } diff --git a/src/Symfony/Component/Security/Http/Tests/Authenticator/InMemoryAccessTokenHandler.php b/src/Symfony/Component/Security/Http/Tests/Authenticator/InMemoryAccessTokenHandler.php index 3fe4c850736ce..03579f35566bf 100644 --- a/src/Symfony/Component/Security/Http/Tests/Authenticator/InMemoryAccessTokenHandler.php +++ b/src/Symfony/Component/Security/Http/Tests/Authenticator/InMemoryAccessTokenHandler.php @@ -20,7 +20,7 @@ class InMemoryAccessTokenHandler implements AccessTokenHandlerInterface /** * @var array */ - private $accessTokens = []; + private array $accessTokens = []; public function getUserBadgeFrom(string $accessToken): UserBadge { diff --git a/src/Symfony/Component/Security/Http/Tests/Authenticator/JsonLoginAuthenticatorTest.php b/src/Symfony/Component/Security/Http/Tests/Authenticator/JsonLoginAuthenticatorTest.php index 5350dd4a04935..3543851e145e7 100644 --- a/src/Symfony/Component/Security/Http/Tests/Authenticator/JsonLoginAuthenticatorTest.php +++ b/src/Symfony/Component/Security/Http/Tests/Authenticator/JsonLoginAuthenticatorTest.php @@ -29,9 +29,8 @@ class JsonLoginAuthenticatorTest extends TestCase { use ExpectDeprecationTrait; - private $userProvider; - /** @var JsonLoginAuthenticator */ - private $authenticator; + private InMemoryUserProvider $userProvider; + private JsonLoginAuthenticator $authenticator; protected function setUp(): void { diff --git a/src/Symfony/Component/Security/Http/Tests/Authenticator/LoginLinkAuthenticatorTest.php b/src/Symfony/Component/Security/Http/Tests/Authenticator/LoginLinkAuthenticatorTest.php index fb704d988ec7e..5d8088f4fb208 100644 --- a/src/Symfony/Component/Security/Http/Tests/Authenticator/LoginLinkAuthenticatorTest.php +++ b/src/Symfony/Component/Security/Http/Tests/Authenticator/LoginLinkAuthenticatorTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Security\Http\Tests\Authenticator; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Security\Core\User\UserInterface; @@ -27,11 +28,10 @@ class LoginLinkAuthenticatorTest extends TestCase { - private $loginLinkHandler; - private $successHandler; - private $failureHandler; - /** @var LoginLinkAuthenticator */ - private $authenticator; + private MockObject&LoginLinkHandlerInterface $loginLinkHandler; + private MockObject&AuthenticationSuccessHandlerInterface $successHandler; + private MockObject&AuthenticationFailureHandlerInterface $failureHandler; + private LoginLinkAuthenticator $authenticator; protected function setUp(): void { diff --git a/src/Symfony/Component/Security/Http/Tests/Authenticator/RememberMeAuthenticatorTest.php b/src/Symfony/Component/Security/Http/Tests/Authenticator/RememberMeAuthenticatorTest.php index 6fca973f7d5c3..52bb1a61d9ca1 100644 --- a/src/Symfony/Component/Security/Http/Tests/Authenticator/RememberMeAuthenticatorTest.php +++ b/src/Symfony/Component/Security/Http/Tests/Authenticator/RememberMeAuthenticatorTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Security\Http\Tests\Authenticator; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Cookie; use Symfony\Component\HttpFoundation\Request; @@ -25,9 +26,9 @@ class RememberMeAuthenticatorTest extends TestCase { - private $rememberMeHandler; - private $tokenStorage; - private $authenticator; + private MockObject&RememberMeHandlerInterface $rememberMeHandler; + private TokenStorage $tokenStorage; + private RememberMeAuthenticator $authenticator; protected function setUp(): void { diff --git a/src/Symfony/Component/Security/Http/Tests/Authenticator/X509AuthenticatorTest.php b/src/Symfony/Component/Security/Http/Tests/Authenticator/X509AuthenticatorTest.php index 9b764d3750a63..afc6335d2635b 100644 --- a/src/Symfony/Component/Security/Http/Tests/Authenticator/X509AuthenticatorTest.php +++ b/src/Symfony/Component/Security/Http/Tests/Authenticator/X509AuthenticatorTest.php @@ -20,8 +20,8 @@ class X509AuthenticatorTest extends TestCase { - private $userProvider; - private $authenticator; + private InMemoryUserProvider $userProvider; + private X509Authenticator $authenticator; protected function setUp(): void { diff --git a/src/Symfony/Component/Security/Http/Tests/EventListener/CheckCredentialsListenerTest.php b/src/Symfony/Component/Security/Http/Tests/EventListener/CheckCredentialsListenerTest.php index 5e0c1804ab594..85a9b8b78e465 100644 --- a/src/Symfony/Component/Security/Http/Tests/EventListener/CheckCredentialsListenerTest.php +++ b/src/Symfony/Component/Security/Http/Tests/EventListener/CheckCredentialsListenerTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Security\Http\Tests\EventListener; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\PasswordHasher\Hasher\PasswordHasherFactoryInterface; use Symfony\Component\PasswordHasher\PasswordHasherInterface; @@ -28,9 +29,9 @@ class CheckCredentialsListenerTest extends TestCase { - private $hasherFactory; - private $listener; - private $user; + private MockObject&PasswordHasherFactoryInterface $hasherFactory; + private CheckCredentialsListener $listener; + private InMemoryUser $user; protected function setUp(): void { diff --git a/src/Symfony/Component/Security/Http/Tests/EventListener/CheckRememberMeConditionsListenerTest.php b/src/Symfony/Component/Security/Http/Tests/EventListener/CheckRememberMeConditionsListenerTest.php index 4d97ece3894e1..ab95a25a7b324 100644 --- a/src/Symfony/Component/Security/Http/Tests/EventListener/CheckRememberMeConditionsListenerTest.php +++ b/src/Symfony/Component/Security/Http/Tests/EventListener/CheckRememberMeConditionsListenerTest.php @@ -26,9 +26,9 @@ class CheckRememberMeConditionsListenerTest extends TestCase { - private $listener; - private $request; - private $response; + private CheckRememberMeConditionsListener $listener; + private Request $request; + private Response $response; protected function setUp(): void { @@ -59,6 +59,7 @@ public function testSuccessfulJsonLoginWithoutSupportingAuthenticator() public function testSuccessfulLoginWithoutRequestParameter() { $this->request = Request::create('/login'); + $this->response = new Response(); $passport = $this->createPassport([new RememberMeBadge()]); $this->listener->onSuccessfulLogin($this->createLoginSuccessfulEvent($passport)); diff --git a/src/Symfony/Component/Security/Http/Tests/EventListener/CsrfProtectionListenerTest.php b/src/Symfony/Component/Security/Http/Tests/EventListener/CsrfProtectionListenerTest.php index 7acdc329a2c40..7942616b2a396 100644 --- a/src/Symfony/Component/Security/Http/Tests/EventListener/CsrfProtectionListenerTest.php +++ b/src/Symfony/Component/Security/Http/Tests/EventListener/CsrfProtectionListenerTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Security\Http\Tests\EventListener; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\Security\Core\Exception\InvalidCsrfTokenException; use Symfony\Component\Security\Core\User\InMemoryUser; @@ -25,8 +26,8 @@ class CsrfProtectionListenerTest extends TestCase { - private $csrfTokenManager; - private $listener; + private MockObject&CsrfTokenManagerInterface $csrfTokenManager; + private CsrfProtectionListener $listener; protected function setUp(): void { diff --git a/src/Symfony/Component/Security/Http/Tests/EventListener/LoginThrottlingListenerTest.php b/src/Symfony/Component/Security/Http/Tests/EventListener/LoginThrottlingListenerTest.php index a1ad2c8531bb4..248a09efba64e 100644 --- a/src/Symfony/Component/Security/Http/Tests/EventListener/LoginThrottlingListenerTest.php +++ b/src/Symfony/Component/Security/Http/Tests/EventListener/LoginThrottlingListenerTest.php @@ -28,8 +28,8 @@ class LoginThrottlingListenerTest extends TestCase { - private $requestStack; - private $listener; + private RequestStack $requestStack; + private LoginThrottlingListener $listener; protected function setUp(): void { diff --git a/src/Symfony/Component/Security/Http/Tests/EventListener/PasswordMigratingListenerTest.php b/src/Symfony/Component/Security/Http/Tests/EventListener/PasswordMigratingListenerTest.php index 55eb269688d71..ba66a6e413581 100644 --- a/src/Symfony/Component/Security/Http/Tests/EventListener/PasswordMigratingListenerTest.php +++ b/src/Symfony/Component/Security/Http/Tests/EventListener/PasswordMigratingListenerTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Security\Http\Tests\EventListener; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\PasswordHasher\Hasher\PasswordHasherFactoryInterface; @@ -31,9 +32,9 @@ class PasswordMigratingListenerTest extends TestCase { - private $hasherFactory; - private $listener; - private $user; + private MockObject&PasswordHasherFactoryInterface $hasherFactory; + private PasswordMigratingListener $listener; + private UserInterface&PasswordAuthenticatedUserInterface $user; protected function setUp(): void { diff --git a/src/Symfony/Component/Security/Http/Tests/EventListener/RememberMeListenerTest.php b/src/Symfony/Component/Security/Http/Tests/EventListener/RememberMeListenerTest.php index d7e4d845bcd00..07e1203d33cdd 100644 --- a/src/Symfony/Component/Security/Http/Tests/EventListener/RememberMeListenerTest.php +++ b/src/Symfony/Component/Security/Http/Tests/EventListener/RememberMeListenerTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Security\Http\Tests\EventListener; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -27,10 +28,10 @@ class RememberMeListenerTest extends TestCase { - private $rememberMeHandler; - private $listener; - private $request; - private $response; + private MockObject&RememberMeHandlerInterface $rememberMeHandler; + private RememberMeListener $listener; + private Request $request; + private Response $response; protected function setUp(): void { diff --git a/src/Symfony/Component/Security/Http/Tests/EventListener/SessionStrategyListenerTest.php b/src/Symfony/Component/Security/Http/Tests/EventListener/SessionStrategyListenerTest.php index 751e4c937a039..cb44264286140 100644 --- a/src/Symfony/Component/Security/Http/Tests/EventListener/SessionStrategyListenerTest.php +++ b/src/Symfony/Component/Security/Http/Tests/EventListener/SessionStrategyListenerTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Security\Http\Tests\EventListener; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Session\SessionInterface; @@ -25,10 +26,10 @@ class SessionStrategyListenerTest extends TestCase { - private $sessionAuthenticationStrategy; - private $listener; - private $request; - private $token; + private MockObject&SessionAuthenticationStrategyInterface $sessionAuthenticationStrategy; + private SessionStrategyListener $listener; + private Request $request; + private NullToken $token; protected function setUp(): void { diff --git a/src/Symfony/Component/Security/Http/Tests/EventListener/UserCheckerListenerTest.php b/src/Symfony/Component/Security/Http/Tests/EventListener/UserCheckerListenerTest.php index 5ba70dac5ae7f..3d9da4028300a 100644 --- a/src/Symfony/Component/Security/Http/Tests/EventListener/UserCheckerListenerTest.php +++ b/src/Symfony/Component/Security/Http/Tests/EventListener/UserCheckerListenerTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Security\Http\Tests\EventListener; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\Security\Core\Event\AuthenticationSuccessEvent; use Symfony\Component\Security\Core\User\InMemoryUser; @@ -25,9 +26,9 @@ class UserCheckerListenerTest extends TestCase { - private $userChecker; - private $listener; - private $user; + private MockObject&UserCheckerInterface $userChecker; + private UserCheckerListener $listener; + private InMemoryUser $user; protected function setUp(): void { diff --git a/src/Symfony/Component/Security/Http/Tests/EventListener/UserProviderListenerTest.php b/src/Symfony/Component/Security/Http/Tests/EventListener/UserProviderListenerTest.php index a8840351af615..63bf554cda48d 100644 --- a/src/Symfony/Component/Security/Http/Tests/EventListener/UserProviderListenerTest.php +++ b/src/Symfony/Component/Security/Http/Tests/EventListener/UserProviderListenerTest.php @@ -22,8 +22,8 @@ class UserProviderListenerTest extends TestCase { - private $userProvider; - private $listener; + private InMemoryUserProvider $userProvider; + private UserProviderListener $listener; protected function setUp(): void { diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/ContextListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/ContextListenerTest.php index 64052062d00f5..17650e6c0eddc 100644 --- a/src/Symfony/Component/Security/Http/Tests/Firewall/ContextListenerTest.php +++ b/src/Symfony/Component/Security/Http/Tests/Firewall/ContextListenerTest.php @@ -429,8 +429,7 @@ private function handleEventWithPreviousSession($userProviders, UserInterface $u class NotSupportingUserProvider implements UserProviderInterface { - /** @var bool */ - private $throwsUnsupportedException; + private bool $throwsUnsupportedException; public function __construct($throwsUnsupportedException) { @@ -464,7 +463,7 @@ public function supportsClass($class): bool class SupportingUserProvider implements UserProviderInterface { - private $refreshedUser; + private ?InMemoryUser $refreshedUser; public function __construct(InMemoryUser $refreshedUser = null) { @@ -500,8 +499,8 @@ public function supportsClass($class): bool class CustomToken implements TokenInterface { - private $user; - private $roles; + private UserInterface $user; + private array $roles; public function __construct(UserInterface $user, array $roles) { diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/SwitchUserListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/SwitchUserListenerTest.php index fa117b8a961de..916e54d669376 100644 --- a/src/Symfony/Component/Security/Http/Tests/Firewall/SwitchUserListenerTest.php +++ b/src/Symfony/Component/Security/Http/Tests/Firewall/SwitchUserListenerTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Security\Http\Tests\Firewall; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; @@ -32,17 +33,12 @@ class SwitchUserListenerTest extends TestCase { - private $tokenStorage; - - private $userProvider; - - private $userChecker; - - private $accessDecisionManager; - - private $request; - - private $event; + private TokenStorage $tokenStorage; + private InMemoryUserProvider $userProvider; + private MockObject&UserCheckerInterface $userChecker; + private MockObject&AccessDecisionManagerInterface $accessDecisionManager; + private Request $request; + private RequestEvent $event; protected function setUp(): void { diff --git a/src/Symfony/Component/Security/Http/Tests/LoginLink/LoginLinkHandlerTest.php b/src/Symfony/Component/Security/Http/Tests/LoginLink/LoginLinkHandlerTest.php index 438f7b2cbdbca..b7cc25f36c245 100644 --- a/src/Symfony/Component/Security/Http/Tests/LoginLink/LoginLinkHandlerTest.php +++ b/src/Symfony/Component/Security/Http/Tests/LoginLink/LoginLinkHandlerTest.php @@ -32,16 +32,11 @@ class LoginLinkHandlerTest extends TestCase { - /** @var MockObject|UrlGeneratorInterface */ - private $router; - /** @var TestLoginLinkHandlerUserProvider */ - private $userProvider; - /** @var PropertyAccessorInterface */ - private $propertyAccessor; - /** @var MockObject|ExpiredSignatureStorage */ - private $expiredLinkStorage; - /** @var CacheItemPoolInterface */ - private $expiredLinkCache; + private MockObject&UrlGeneratorInterface $router; + private TestLoginLinkHandlerUserProvider $userProvider; + private PropertyAccessorInterface $propertyAccessor; + private ExpiredSignatureStorage $expiredLinkStorage; + private CacheItemPoolInterface $expiredLinkCache; protected function setUp(): void { @@ -266,10 +261,10 @@ private function createLinker(array $options = [], array $extraProperties = ['em class TestLoginLinkHandlerUser implements UserInterface { - public $username; - public $emailProperty; - public $passwordProperty; - public $lastAuthenticatedAt; + public string $username; + public string $emailProperty; + public string $passwordProperty; + public \DateTimeImmutable|string|null $lastAuthenticatedAt; public function __construct($username, $emailProperty, $passwordProperty, $lastAuthenticatedAt = null) { diff --git a/src/Symfony/Component/Security/Http/Tests/Logout/LogoutUrlGeneratorTest.php b/src/Symfony/Component/Security/Http/Tests/Logout/LogoutUrlGeneratorTest.php index 16f354c8865ba..c0e5dcbe38521 100644 --- a/src/Symfony/Component/Security/Http/Tests/Logout/LogoutUrlGeneratorTest.php +++ b/src/Symfony/Component/Security/Http/Tests/Logout/LogoutUrlGeneratorTest.php @@ -24,10 +24,8 @@ */ class LogoutUrlGeneratorTest extends TestCase { - /** @var TokenStorage */ - private $tokenStorage; - /** @var LogoutUrlGenerator */ - private $generator; + private TokenStorage $tokenStorage; + private LogoutUrlGenerator $generator; protected function setUp(): void { diff --git a/src/Symfony/Component/Security/Http/Tests/RememberMe/PersistentRememberMeHandlerTest.php b/src/Symfony/Component/Security/Http/Tests/RememberMe/PersistentRememberMeHandlerTest.php index d6d6b5d110c0d..39c7a9f3ed7b8 100644 --- a/src/Symfony/Component/Security/Http/Tests/RememberMe/PersistentRememberMeHandlerTest.php +++ b/src/Symfony/Component/Security/Http/Tests/RememberMe/PersistentRememberMeHandlerTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Security\Http\Tests\RememberMe; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Cookie; use Symfony\Component\HttpFoundation\Request; @@ -28,11 +29,11 @@ class PersistentRememberMeHandlerTest extends TestCase { - private $tokenProvider; - private $userProvider; - private $requestStack; - private $request; - private $handler; + private MockObject&TokenProviderInterface $tokenProvider; + private InMemoryUserProvider $userProvider; + private RequestStack $requestStack; + private Request $request; + private PersistentRememberMeHandler $handler; protected function setUp(): void { diff --git a/src/Symfony/Component/Security/Http/Tests/RememberMe/SignatureRememberMeHandlerTest.php b/src/Symfony/Component/Security/Http/Tests/RememberMe/SignatureRememberMeHandlerTest.php index 8205009448a64..5a61d3aa6b3c2 100644 --- a/src/Symfony/Component/Security/Http/Tests/RememberMe/SignatureRememberMeHandlerTest.php +++ b/src/Symfony/Component/Security/Http/Tests/RememberMe/SignatureRememberMeHandlerTest.php @@ -26,11 +26,11 @@ class SignatureRememberMeHandlerTest extends TestCase { - private $signatureHasher; - private $userProvider; - private $request; - private $requestStack; - private $handler; + private SignatureHasher $signatureHasher; + private InMemoryUserProvider $userProvider; + private Request $request; + private RequestStack $requestStack; + private SignatureRememberMeHandler $handler; protected function setUp(): void { diff --git a/src/Symfony/Component/Serializer/Tests/Encoder/ChainDecoderTest.php b/src/Symfony/Component/Serializer/Tests/Encoder/ChainDecoderTest.php index 8f433ce0fa15a..c3bbad2ab9e62 100644 --- a/src/Symfony/Component/Serializer/Tests/Encoder/ChainDecoderTest.php +++ b/src/Symfony/Component/Serializer/Tests/Encoder/ChainDecoderTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Serializer\Tests\Encoder; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\Serializer\Encoder\ChainDecoder; use Symfony\Component\Serializer\Encoder\ContextAwareDecoderInterface; @@ -23,9 +24,9 @@ class ChainDecoderTest extends TestCase private const FORMAT_2 = 'format2'; private const FORMAT_3 = 'format3'; - private $chainDecoder; - private $decoder1; - private $decoder2; + private ChainDecoder $chainDecoder; + private MockObject&ContextAwareDecoderInterface $decoder1; + private MockObject&DecoderInterface $decoder2; protected function setUp(): void { diff --git a/src/Symfony/Component/Serializer/Tests/Encoder/ChainEncoderTest.php b/src/Symfony/Component/Serializer/Tests/Encoder/ChainEncoderTest.php index 0afd67813435b..375d08054ab51 100644 --- a/src/Symfony/Component/Serializer/Tests/Encoder/ChainEncoderTest.php +++ b/src/Symfony/Component/Serializer/Tests/Encoder/ChainEncoderTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Serializer\Tests\Encoder; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\Serializer\Debug\TraceableEncoder; use Symfony\Component\Serializer\Encoder\ChainEncoder; @@ -25,9 +26,9 @@ class ChainEncoderTest extends TestCase private const FORMAT_2 = 'format2'; private const FORMAT_3 = 'format3'; - private $chainEncoder; - private $encoder1; - private $encoder2; + private ChainEncoder $chainEncoder; + private MockObject&ContextAwareEncoderInterface $encoder1; + private MockObject&EncoderInterface $encoder2; protected function setUp(): void { diff --git a/src/Symfony/Component/Serializer/Tests/Encoder/CsvEncoderTest.php b/src/Symfony/Component/Serializer/Tests/Encoder/CsvEncoderTest.php index c0c8ec740716e..448622c5e7080 100644 --- a/src/Symfony/Component/Serializer/Tests/Encoder/CsvEncoderTest.php +++ b/src/Symfony/Component/Serializer/Tests/Encoder/CsvEncoderTest.php @@ -20,10 +20,7 @@ */ class CsvEncoderTest extends TestCase { - /** - * @var CsvEncoder - */ - private $encoder; + private CsvEncoder $encoder; protected function setUp(): void { diff --git a/src/Symfony/Component/Serializer/Tests/Encoder/JsonDecodeTest.php b/src/Symfony/Component/Serializer/Tests/Encoder/JsonDecodeTest.php index 62045972dbe68..ffef479e21f25 100644 --- a/src/Symfony/Component/Serializer/Tests/Encoder/JsonDecodeTest.php +++ b/src/Symfony/Component/Serializer/Tests/Encoder/JsonDecodeTest.php @@ -18,8 +18,7 @@ class JsonDecodeTest extends TestCase { - /** @var \Symfony\Component\Serializer\Encoder\JsonDecode */ - private $decode; + private JsonDecode $decode; protected function setUp(): void { diff --git a/src/Symfony/Component/Serializer/Tests/Encoder/JsonEncodeTest.php b/src/Symfony/Component/Serializer/Tests/Encoder/JsonEncodeTest.php index 779cad6e37958..e5e6534033d1e 100644 --- a/src/Symfony/Component/Serializer/Tests/Encoder/JsonEncodeTest.php +++ b/src/Symfony/Component/Serializer/Tests/Encoder/JsonEncodeTest.php @@ -18,7 +18,7 @@ class JsonEncodeTest extends TestCase { - private $encode; + private JsonEncode $encode; protected function setUp(): void { diff --git a/src/Symfony/Component/Serializer/Tests/Encoder/JsonEncoderTest.php b/src/Symfony/Component/Serializer/Tests/Encoder/JsonEncoderTest.php index 6cd1f82b1ab6c..1b47684ae1c8d 100644 --- a/src/Symfony/Component/Serializer/Tests/Encoder/JsonEncoderTest.php +++ b/src/Symfony/Component/Serializer/Tests/Encoder/JsonEncoderTest.php @@ -19,8 +19,8 @@ class JsonEncoderTest extends TestCase { - private $encoder; - private $serializer; + private JsonEncoder $encoder; + private Serializer $serializer; protected function setUp(): void { diff --git a/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php b/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php index 965256d3747fe..a10cfbba9974b 100644 --- a/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php +++ b/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php @@ -29,12 +29,8 @@ class XmlEncoderTest extends TestCase { - /** - * @var XmlEncoder - */ - private $encoder; - - private $exampleDateTimeString = '2017-02-19T15:16:08+0300'; + private XmlEncoder $encoder; + private string $exampleDateTimeString = '2017-02-19T15:16:08+0300'; protected function setUp(): void { diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractNormalizerTest.php index 74018ebb424b3..924f07e343c24 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractNormalizerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractNormalizerTest.php @@ -42,15 +42,8 @@ */ class AbstractNormalizerTest extends TestCase { - /** - * @var AbstractNormalizerDummy - */ - private $normalizer; - - /** - * @var MockObject&ClassMetadataFactoryInterface - */ - private $classMetadata; + private AbstractNormalizerDummy $normalizer; + private MockObject&ClassMetadataFactoryInterface $classMetadata; protected function setUp(): void { diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php index 42eed47eb021f..aa9d57ad13647 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php @@ -996,7 +996,7 @@ class DummyChild class SerializerCollectionDummy implements SerializerInterface, DenormalizerInterface { - private $normalizers; + private array $normalizers; /** * @param DenormalizerInterface[] $normalizers diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/BackedEnumNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/BackedEnumNormalizerTest.php index 997ac4fa97cc2..46963fe70b7bf 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/BackedEnumNormalizerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/BackedEnumNormalizerTest.php @@ -24,10 +24,7 @@ */ class BackedEnumNormalizerTest extends TestCase { - /** - * @var BackedEnumNormalizer - */ - private $normalizer; + private BackedEnumNormalizer $normalizer; protected function setUp(): void { diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/ConstraintViolationListNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/ConstraintViolationListNormalizerTest.php index 8e8df388d0ff0..b7a4273f2c9c9 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/ConstraintViolationListNormalizerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/ConstraintViolationListNormalizerTest.php @@ -24,7 +24,7 @@ */ class ConstraintViolationListNormalizerTest extends TestCase { - private $normalizer; + private ConstraintViolationListNormalizer $normalizer; protected function setUp(): void { diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/CustomNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/CustomNormalizerTest.php index d69ee8e40fa9f..2b4af40545436 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/CustomNormalizerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/CustomNormalizerTest.php @@ -21,10 +21,7 @@ class CustomNormalizerTest extends TestCase { - /** - * @var CustomNormalizer - */ - private $normalizer; + private CustomNormalizer $normalizer; protected function setUp(): void { diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/DataUriNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/DataUriNormalizerTest.php index 8c55ac1ab2454..92e173fe096ad 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/DataUriNormalizerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/DataUriNormalizerTest.php @@ -27,10 +27,7 @@ class DataUriNormalizerTest extends TestCase private const TEST_TXT_DATA = 'data:text/plain,K%C3%A9vin%20Dunglas%0A'; private const TEST_TXT_CONTENT = "Kévin Dunglas\n"; - /** - * @var DataUriNormalizer - */ - private $normalizer; + private DataUriNormalizer $normalizer; protected function setUp(): void { diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/DateIntervalNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/DateIntervalNormalizerTest.php index cfe8c573c9c50..9c50cc9b0ad5c 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/DateIntervalNormalizerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/DateIntervalNormalizerTest.php @@ -21,10 +21,7 @@ */ class DateIntervalNormalizerTest extends TestCase { - /** - * @var DateIntervalNormalizer - */ - private $normalizer; + private DateIntervalNormalizer $normalizer; protected function setUp(): void { diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/DateTimeNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/DateTimeNormalizerTest.php index 5f30f1be947c3..9c9a25bbbd82e 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/DateTimeNormalizerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/DateTimeNormalizerTest.php @@ -21,10 +21,7 @@ */ class DateTimeNormalizerTest extends TestCase { - /** - * @var DateTimeNormalizer - */ - private $normalizer; + private DateTimeNormalizer $normalizer; protected function setUp(): void { diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/DateTimeZoneNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/DateTimeZoneNormalizerTest.php index b32e39d033f99..6ee179dbe8bd5 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/DateTimeZoneNormalizerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/DateTimeZoneNormalizerTest.php @@ -21,10 +21,7 @@ */ class DateTimeZoneNormalizerTest extends TestCase { - /** - * @var DateTimeZoneNormalizer - */ - private $normalizer; + private DateTimeZoneNormalizer $normalizer; protected function setUp(): void { diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/FormErrorNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/FormErrorNormalizerTest.php index 4f3e6a1e6afc3..bc18125cf93cd 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/FormErrorNormalizerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/FormErrorNormalizerTest.php @@ -19,15 +19,8 @@ class FormErrorNormalizerTest extends TestCase { - /** - * @var FormErrorNormalizer - */ - private $normalizer; - - /** - * @var FormInterface - */ - private $form; + private FormErrorNormalizer $normalizer; + private FormInterface $form; protected function setUp(): void { diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/JsonSerializableNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/JsonSerializableNormalizerTest.php index 177b8c6e70446..54a977f55ec3b 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/JsonSerializableNormalizerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/JsonSerializableNormalizerTest.php @@ -30,15 +30,8 @@ class JsonSerializableNormalizerTest extends TestCase { use CircularReferenceTestTrait; - /** - * @var JsonSerializableNormalizer - */ - private $normalizer; - - /** - * @var MockObject&JsonSerializerNormalizer - */ - private $serializer; + private JsonSerializableNormalizer $normalizer; + private MockObject&JsonSerializerNormalizer $serializer; protected function setUp(): void { diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/ProblemNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/ProblemNormalizerTest.php index 0937e66d86a26..e6f267bc8a83e 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/ProblemNormalizerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/ProblemNormalizerTest.php @@ -25,10 +25,7 @@ class ProblemNormalizerTest extends TestCase { - /** - * @var ProblemNormalizer - */ - private $normalizer; + private ProblemNormalizer $normalizer; protected function setUp(): void { diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/UidNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/UidNormalizerTest.php index ea00e1161e9e6..9797e2b1d18bc 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/UidNormalizerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/UidNormalizerTest.php @@ -28,10 +28,7 @@ class UidNormalizerTest extends TestCase { use ExpectDeprecationTrait; - /** - * @var UidNormalizer - */ - private $normalizer; + private UidNormalizer $normalizer; protected function setUp(): void { diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/UnwrappinDenormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/UnwrappinDenormalizerTest.php index 25063b8620d90..59ddd6da65aad 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/UnwrappinDenormalizerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/UnwrappinDenormalizerTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Serializer\Tests\Normalizer; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\Serializer\Normalizer\UnwrappingDenormalizer; use Symfony\Component\Serializer\Serializer; @@ -21,9 +22,8 @@ */ class UnwrappinDenormalizerTest extends TestCase { - private $denormalizer; - - private $serializer; + private UnwrappingDenormalizer $denormalizer; + private MockObject&Serializer $serializer; protected function setUp(): void { diff --git a/src/Symfony/Component/String/Tests/LazyStringTest.php b/src/Symfony/Component/String/Tests/LazyStringTest.php index 1c7540234bec6..f2d24ebcb23f4 100644 --- a/src/Symfony/Component/String/Tests/LazyStringTest.php +++ b/src/Symfony/Component/String/Tests/LazyStringTest.php @@ -49,7 +49,7 @@ public function testLazyCallable() $count = 0; $s = LazyString::fromCallable([function () use (&$count) { return new class($count) { - private $count; + private int $count; public function __construct(int &$count) { diff --git a/src/Symfony/Component/Templating/Tests/Loader/ChainLoaderTest.php b/src/Symfony/Component/Templating/Tests/Loader/ChainLoaderTest.php index 4c946ea486cb8..f9b4df2fa3bd1 100644 --- a/src/Symfony/Component/Templating/Tests/Loader/ChainLoaderTest.php +++ b/src/Symfony/Component/Templating/Tests/Loader/ChainLoaderTest.php @@ -18,8 +18,8 @@ class ChainLoaderTest extends TestCase { - protected $loader1; - protected $loader2; + protected FilesystemLoader $loader1; + protected FilesystemLoader $loader2; protected function setUp(): void { diff --git a/src/Symfony/Component/Templating/Tests/Loader/FilesystemLoaderTest.php b/src/Symfony/Component/Templating/Tests/Loader/FilesystemLoaderTest.php index 998d9e522834c..83cc32cb3bac9 100644 --- a/src/Symfony/Component/Templating/Tests/Loader/FilesystemLoaderTest.php +++ b/src/Symfony/Component/Templating/Tests/Loader/FilesystemLoaderTest.php @@ -19,7 +19,7 @@ class FilesystemLoaderTest extends TestCase { - protected static $fixturesPath; + protected static string $fixturesPath; public static function setUpBeforeClass(): void { diff --git a/src/Symfony/Component/Templating/Tests/PhpEngineTest.php b/src/Symfony/Component/Templating/Tests/PhpEngineTest.php index 52c8121833fb0..a5cbdaa968135 100644 --- a/src/Symfony/Component/Templating/Tests/PhpEngineTest.php +++ b/src/Symfony/Component/Templating/Tests/PhpEngineTest.php @@ -24,18 +24,13 @@ class PhpEngineTest extends TestCase { - protected $loader; + protected ProjectTemplateLoader $loader; protected function setUp(): void { $this->loader = new ProjectTemplateLoader(); } - protected function tearDown(): void - { - $this->loader = null; - } - public function testConstructor() { $engine = new ProjectTemplateEngine(new TemplateNameParser(), $this->loader); @@ -204,7 +199,7 @@ public function getLoader(): LoaderInterface class ProjectTemplateLoader extends Loader { - public $templates = []; + public array $templates = []; public function setTemplate($name, $content) { diff --git a/src/Symfony/Component/Templating/Tests/TemplateNameParserTest.php b/src/Symfony/Component/Templating/Tests/TemplateNameParserTest.php index 6c833f7342b72..81bbb838b1fbc 100644 --- a/src/Symfony/Component/Templating/Tests/TemplateNameParserTest.php +++ b/src/Symfony/Component/Templating/Tests/TemplateNameParserTest.php @@ -17,18 +17,13 @@ class TemplateNameParserTest extends TestCase { - protected $parser; + protected TemplateNameParser $parser; protected function setUp(): void { $this->parser = new TemplateNameParser(); } - protected function tearDown(): void - { - $this->parser = null; - } - /** * @dataProvider getLogicalNameToTemplateProvider */ diff --git a/src/Symfony/Component/Translation/Tests/Command/TranslationProviderTestCase.php b/src/Symfony/Component/Translation/Tests/Command/TranslationProviderTestCase.php index d4f4f7227624f..e6488f61ea9f2 100644 --- a/src/Symfony/Component/Translation/Tests/Command/TranslationProviderTestCase.php +++ b/src/Symfony/Component/Translation/Tests/Command/TranslationProviderTestCase.php @@ -22,10 +22,10 @@ */ abstract class TranslationProviderTestCase extends TestCase { - protected $fs; - protected $translationAppDir; - protected $files; - protected $defaultLocale; + protected Filesystem $fs; + protected string $translationAppDir; + protected array $files; + protected string $defaultLocale; protected function setUp(): void { diff --git a/src/Symfony/Component/Translation/Tests/Command/TranslationPullCommandTest.php b/src/Symfony/Component/Translation/Tests/Command/TranslationPullCommandTest.php index f35d6c195fada..6587a8c71b210 100644 --- a/src/Symfony/Component/Translation/Tests/Command/TranslationPullCommandTest.php +++ b/src/Symfony/Component/Translation/Tests/Command/TranslationPullCommandTest.php @@ -28,7 +28,7 @@ */ class TranslationPullCommandTest extends TranslationProviderTestCase { - private $colSize; + private string|false $colSize; protected function setUp(): void { diff --git a/src/Symfony/Component/Translation/Tests/Command/TranslationPushCommandTest.php b/src/Symfony/Component/Translation/Tests/Command/TranslationPushCommandTest.php index 6debf20f64f74..44cc569cfa276 100644 --- a/src/Symfony/Component/Translation/Tests/Command/TranslationPushCommandTest.php +++ b/src/Symfony/Component/Translation/Tests/Command/TranslationPushCommandTest.php @@ -28,7 +28,7 @@ */ class TranslationPushCommandTest extends TranslationProviderTestCase { - private $colSize; + private string|false $colSize; protected function setUp(): void { diff --git a/src/Symfony/Component/Translation/Tests/Command/XliffLintCommandTest.php b/src/Symfony/Component/Translation/Tests/Command/XliffLintCommandTest.php index 00c5da32247e8..ee8e52e06dea0 100644 --- a/src/Symfony/Component/Translation/Tests/Command/XliffLintCommandTest.php +++ b/src/Symfony/Component/Translation/Tests/Command/XliffLintCommandTest.php @@ -26,7 +26,7 @@ */ class XliffLintCommandTest extends TestCase { - private $files; + private array $files; public function testLintCorrectFile() { diff --git a/src/Symfony/Component/Translation/Tests/DependencyInjection/fixtures/ControllerArguments.php b/src/Symfony/Component/Translation/Tests/DependencyInjection/Fixtures/ControllerArguments.php similarity index 97% rename from src/Symfony/Component/Translation/Tests/DependencyInjection/fixtures/ControllerArguments.php rename to src/Symfony/Component/Translation/Tests/DependencyInjection/Fixtures/ControllerArguments.php index 5f0981799387e..aeb4436bede00 100644 --- a/src/Symfony/Component/Translation/Tests/DependencyInjection/fixtures/ControllerArguments.php +++ b/src/Symfony/Component/Translation/Tests/DependencyInjection/Fixtures/ControllerArguments.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Symfony\Component\Translation\Tests\DependencyInjection\fixtures; +namespace Symfony\Component\Translation\Tests\DependencyInjection\Fixtures; use Symfony\Contracts\Translation\TranslatorInterface; diff --git a/src/Symfony/Component/Translation/Tests/DependencyInjection/fixtures/ServiceArguments.php b/src/Symfony/Component/Translation/Tests/DependencyInjection/Fixtures/ServiceArguments.php similarity index 97% rename from src/Symfony/Component/Translation/Tests/DependencyInjection/fixtures/ServiceArguments.php rename to src/Symfony/Component/Translation/Tests/DependencyInjection/Fixtures/ServiceArguments.php index e99c0dc2198eb..6b48437b9250a 100644 --- a/src/Symfony/Component/Translation/Tests/DependencyInjection/fixtures/ServiceArguments.php +++ b/src/Symfony/Component/Translation/Tests/DependencyInjection/Fixtures/ServiceArguments.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Symfony\Component\Translation\Tests\DependencyInjection\fixtures; +namespace Symfony\Component\Translation\Tests\DependencyInjection\Fixtures; use Symfony\Contracts\Translation\TranslatorInterface; diff --git a/src/Symfony/Component/Translation/Tests/DependencyInjection/fixtures/ServiceMethodCalls.php b/src/Symfony/Component/Translation/Tests/DependencyInjection/Fixtures/ServiceMethodCalls.php similarity index 97% rename from src/Symfony/Component/Translation/Tests/DependencyInjection/fixtures/ServiceMethodCalls.php rename to src/Symfony/Component/Translation/Tests/DependencyInjection/Fixtures/ServiceMethodCalls.php index fe6f44cbe5eaa..063753a33ffa7 100644 --- a/src/Symfony/Component/Translation/Tests/DependencyInjection/fixtures/ServiceMethodCalls.php +++ b/src/Symfony/Component/Translation/Tests/DependencyInjection/Fixtures/ServiceMethodCalls.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Symfony\Component\Translation\Tests\DependencyInjection\fixtures; +namespace Symfony\Component\Translation\Tests\DependencyInjection\Fixtures; use Symfony\Contracts\Translation\TranslatorInterface; diff --git a/src/Symfony/Component/Translation/Tests/DependencyInjection/fixtures/ServiceProperties.php b/src/Symfony/Component/Translation/Tests/DependencyInjection/Fixtures/ServiceProperties.php similarity index 96% rename from src/Symfony/Component/Translation/Tests/DependencyInjection/fixtures/ServiceProperties.php rename to src/Symfony/Component/Translation/Tests/DependencyInjection/Fixtures/ServiceProperties.php index 7b3a7ba6deb17..41f3bf0fdfd65 100644 --- a/src/Symfony/Component/Translation/Tests/DependencyInjection/fixtures/ServiceProperties.php +++ b/src/Symfony/Component/Translation/Tests/DependencyInjection/Fixtures/ServiceProperties.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Symfony\Component\Translation\Tests\DependencyInjection\fixtures; +namespace Symfony\Component\Translation\Tests\DependencyInjection\Fixtures; class ServiceProperties { diff --git a/src/Symfony/Component/Translation/Tests/DependencyInjection/fixtures/ServiceSubscriber.php b/src/Symfony/Component/Translation/Tests/DependencyInjection/Fixtures/ServiceSubscriber.php similarity index 98% rename from src/Symfony/Component/Translation/Tests/DependencyInjection/fixtures/ServiceSubscriber.php rename to src/Symfony/Component/Translation/Tests/DependencyInjection/Fixtures/ServiceSubscriber.php index ad6b081268758..b7a26454c10a3 100644 --- a/src/Symfony/Component/Translation/Tests/DependencyInjection/fixtures/ServiceSubscriber.php +++ b/src/Symfony/Component/Translation/Tests/DependencyInjection/Fixtures/ServiceSubscriber.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Symfony\Component\Translation\Tests\DependencyInjection\fixtures; +namespace Symfony\Component\Translation\Tests\DependencyInjection\Fixtures; use Psr\Container\ContainerInterface; use Symfony\Contracts\Service\ServiceSubscriberInterface; diff --git a/src/Symfony/Component/Translation/Tests/DependencyInjection/TranslationPathsPassTest.php b/src/Symfony/Component/Translation/Tests/DependencyInjection/TranslationPathsPassTest.php index ec46aaa92c578..e017590c9d3b9 100644 --- a/src/Symfony/Component/Translation/Tests/DependencyInjection/TranslationPathsPassTest.php +++ b/src/Symfony/Component/Translation/Tests/DependencyInjection/TranslationPathsPassTest.php @@ -18,11 +18,11 @@ use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\DependencyInjection\ServiceLocator; use Symfony\Component\Translation\DependencyInjection\TranslatorPathsPass; -use Symfony\Component\Translation\Tests\DependencyInjection\fixtures\ControllerArguments; -use Symfony\Component\Translation\Tests\DependencyInjection\fixtures\ServiceArguments; -use Symfony\Component\Translation\Tests\DependencyInjection\fixtures\ServiceMethodCalls; -use Symfony\Component\Translation\Tests\DependencyInjection\fixtures\ServiceProperties; -use Symfony\Component\Translation\Tests\DependencyInjection\fixtures\ServiceSubscriber; +use Symfony\Component\Translation\Tests\DependencyInjection\Fixtures\ControllerArguments; +use Symfony\Component\Translation\Tests\DependencyInjection\Fixtures\ServiceArguments; +use Symfony\Component\Translation\Tests\DependencyInjection\Fixtures\ServiceMethodCalls; +use Symfony\Component\Translation\Tests\DependencyInjection\Fixtures\ServiceProperties; +use Symfony\Component\Translation\Tests\DependencyInjection\Fixtures\ServiceSubscriber; class TranslationPathsPassTest extends TestCase { diff --git a/src/Symfony/Component/Translation/Tests/IdentityTranslatorTest.php b/src/Symfony/Component/Translation/Tests/IdentityTranslatorTest.php index 35389e5872505..cf69a67ed5da8 100644 --- a/src/Symfony/Component/Translation/Tests/IdentityTranslatorTest.php +++ b/src/Symfony/Component/Translation/Tests/IdentityTranslatorTest.php @@ -17,7 +17,7 @@ class IdentityTranslatorTest extends TranslatorTest { - private $defaultLocale; + private string $defaultLocale; protected function setUp(): void { diff --git a/src/Symfony/Component/Translation/Tests/TranslatorCacheTest.php b/src/Symfony/Component/Translation/Tests/TranslatorCacheTest.php index 596b8d4afa982..4db9a4b0d3b8a 100644 --- a/src/Symfony/Component/Translation/Tests/TranslatorCacheTest.php +++ b/src/Symfony/Component/Translation/Tests/TranslatorCacheTest.php @@ -21,7 +21,7 @@ class TranslatorCacheTest extends TestCase { - protected $tmpDir; + protected string $tmpDir; protected function setUp(): void { diff --git a/src/Symfony/Component/Translation/Tests/TranslatorTest.php b/src/Symfony/Component/Translation/Tests/TranslatorTest.php index 716b674ccbd1d..e86d1bcb6e29e 100644 --- a/src/Symfony/Component/Translation/Tests/TranslatorTest.php +++ b/src/Symfony/Component/Translation/Tests/TranslatorTest.php @@ -24,7 +24,7 @@ class TranslatorTest extends TestCase { - private $defaultLocale; + private string $defaultLocale; protected function setUp(): void { diff --git a/src/Symfony/Component/Validator/Tests/ConstraintViolationListTest.php b/src/Symfony/Component/Validator/Tests/ConstraintViolationListTest.php index 3aabf7a2137f6..0d22bd85ee53e 100644 --- a/src/Symfony/Component/Validator/Tests/ConstraintViolationListTest.php +++ b/src/Symfony/Component/Validator/Tests/ConstraintViolationListTest.php @@ -17,18 +17,13 @@ class ConstraintViolationListTest extends TestCase { - protected $list; + protected ConstraintViolationList $list; protected function setUp(): void { $this->list = new ConstraintViolationList(); } - protected function tearDown(): void - { - $this->list = null; - } - public function testInit() { $this->assertCount(0, $this->list); diff --git a/src/Symfony/Component/Validator/Tests/Constraints/CompositeTest.php b/src/Symfony/Component/Validator/Tests/Constraints/CompositeTest.php index b0236c3ec1520..127ad21dd224d 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/CompositeTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/CompositeTest.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Validator\Tests\Constraints; use PHPUnit\Framework\TestCase; +use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\Constraints\Composite; use Symfony\Component\Validator\Constraints\NotBlank; use Symfony\Component\Validator\Constraints\NotNull; @@ -20,7 +21,7 @@ class ConcreteComposite extends Composite { - public $constraints = []; + public array|Constraint $constraints = []; protected function getCompositeOption(): string { diff --git a/src/Symfony/Component/Validator/Tests/Constraints/CountryValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/CountryValidatorTest.php index fd3ed69e219e0..524d0bc540d2b 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/CountryValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/CountryValidatorTest.php @@ -19,7 +19,7 @@ class CountryValidatorTest extends ConstraintValidatorTestCase { - private $defaultLocale; + private string $defaultLocale; protected function setUp(): void { diff --git a/src/Symfony/Component/Validator/Tests/Constraints/CurrencyValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/CurrencyValidatorTest.php index 02ec5e5efd1e8..a0e16ec145fb4 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/CurrencyValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/CurrencyValidatorTest.php @@ -19,7 +19,7 @@ class CurrencyValidatorTest extends ConstraintValidatorTestCase { - private $defaultLocale; + private string $defaultLocale; protected function setUp(): void { diff --git a/src/Symfony/Component/Validator/Tests/Constraints/FileValidatorTestCase.php b/src/Symfony/Component/Validator/Tests/Constraints/FileValidatorTestCase.php index 981d91dbcc5ee..d964e8b62cb23 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/FileValidatorTestCase.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/FileValidatorTestCase.php @@ -20,8 +20,7 @@ abstract class FileValidatorTestCase extends ConstraintValidatorTestCase { - protected $path; - + protected string $path; protected $file; protected function createValidator(): FileValidator @@ -50,7 +49,6 @@ protected function tearDown(): void @unlink($this->path); } - $this->path = null; $this->file = null; } diff --git a/src/Symfony/Component/Validator/Tests/Constraints/ImageValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/ImageValidatorTest.php index 8f26be2facf93..3e646cfa39572 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/ImageValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/ImageValidatorTest.php @@ -23,14 +23,14 @@ */ class ImageValidatorTest extends ConstraintValidatorTestCase { - protected $path; - protected $image; - protected $imageLandscape; - protected $imagePortrait; - protected $image4By3; - protected $image16By9; - protected $imageCorrupted; - protected $notAnImage; + protected string $path; + protected string $image; + protected string $imageLandscape; + protected string $imagePortrait; + protected string $image4By3; + protected string $image16By9; + protected string $imageCorrupted; + protected string $notAnImage; protected function createValidator(): ImageValidator { diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LanguageValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LanguageValidatorTest.php index a882841896d66..9abb9cfc4ecc7 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/LanguageValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/LanguageValidatorTest.php @@ -19,7 +19,7 @@ class LanguageValidatorTest extends ConstraintValidatorTestCase { - private $defaultLocale; + private string $defaultLocale; protected function setUp(): void { diff --git a/src/Symfony/Component/Validator/Tests/Mapping/ClassMetadataTest.php b/src/Symfony/Component/Validator/Tests/Mapping/ClassMetadataTest.php index 6e1c95d54bea0..815f4a1f56680 100644 --- a/src/Symfony/Component/Validator/Tests/Mapping/ClassMetadataTest.php +++ b/src/Symfony/Component/Validator/Tests/Mapping/ClassMetadataTest.php @@ -38,18 +38,13 @@ class ClassMetadataTest extends TestCase private const PROVIDERCLASS = GroupSequenceProviderEntity::class; private const PROVIDERCHILDCLASS = GroupSequenceProviderChildEntity::class; - protected $metadata; + protected ClassMetadata $metadata; protected function setUp(): void { $this->metadata = new ClassMetadata(self::CLASSNAME); } - protected function tearDown(): void - { - $this->metadata = null; - } - public function testAddConstraintDoesNotAcceptValid() { $this->expectException(ConstraintDefinitionException::class); diff --git a/src/Symfony/Component/Validator/Tests/Mapping/Loader/StaticMethodLoaderTest.php b/src/Symfony/Component/Validator/Tests/Mapping/Loader/StaticMethodLoaderTest.php index 4f12a5a696ee7..417056f93ffa4 100644 --- a/src/Symfony/Component/Validator/Tests/Mapping/Loader/StaticMethodLoaderTest.php +++ b/src/Symfony/Component/Validator/Tests/Mapping/Loader/StaticMethodLoaderTest.php @@ -18,7 +18,7 @@ class StaticMethodLoaderTest extends TestCase { - private $errorLevel; + private int $errorLevel; protected function setUp(): void { @@ -119,7 +119,7 @@ public static function loadMetadata(ClassMetadata $metadata) class StaticLoaderEntity { - public static $invokedWith; + public static ClassMetadata $invokedWith; public static function loadMetadata(ClassMetadata $metadata) { diff --git a/src/Symfony/Component/Validator/Tests/Mapping/MemberMetadataTest.php b/src/Symfony/Component/Validator/Tests/Mapping/MemberMetadataTest.php index f115251690d85..33c6fe55f4b69 100644 --- a/src/Symfony/Component/Validator/Tests/Mapping/MemberMetadataTest.php +++ b/src/Symfony/Component/Validator/Tests/Mapping/MemberMetadataTest.php @@ -26,7 +26,7 @@ class MemberMetadataTest extends TestCase { - protected $metadata; + protected MemberMetadata $metadata; protected function setUp(): void { @@ -37,11 +37,6 @@ protected function setUp(): void ); } - protected function tearDown(): void - { - $this->metadata = null; - } - public function testAddConstraintRequiresClassConstraints() { $this->expectException(ConstraintDefinitionException::class); diff --git a/src/Symfony/Component/Validator/Tests/Validator/RecursiveValidatorTest.php b/src/Symfony/Component/Validator/Tests/Validator/RecursiveValidatorTest.php index 469d73bfb08f8..a68f2527f8d65 100644 --- a/src/Symfony/Component/Validator/Tests/Validator/RecursiveValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Validator/RecursiveValidatorTest.php @@ -63,25 +63,10 @@ class RecursiveValidatorTest extends TestCase private const ENTITY_CLASS = Entity::class; private const REFERENCE_CLASS = Reference::class; - /** - * @var FakeMetadataFactory - */ - private $metadataFactory; - - /** - * @var ClassMetadata - */ - private $metadata; - - /** - * @var ClassMetadata - */ - private $referenceMetadata; - - /** - * @var ValidatorInterface - */ - private $validator; + private FakeMetadataFactory $metadataFactory; + private ClassMetadata $metadata; + private ClassMetadata $referenceMetadata; + private ValidatorInterface $validator; protected function setUp(): void { @@ -95,13 +80,6 @@ protected function setUp(): void $this->validator = $this->createValidator($this->metadataFactory); } - protected function tearDown(): void - { - $this->metadataFactory = null; - $this->metadata = null; - $this->referenceMetadata = null; - } - protected function validate($value, $constraints = null, $groups = null) { return $this->validator->validate($value, $constraints, $groups); diff --git a/src/Symfony/Component/Validator/Tests/ValidatorBuilderTest.php b/src/Symfony/Component/Validator/Tests/ValidatorBuilderTest.php index 9d0b1b5140bda..5d844031b3522 100644 --- a/src/Symfony/Component/Validator/Tests/ValidatorBuilderTest.php +++ b/src/Symfony/Component/Validator/Tests/ValidatorBuilderTest.php @@ -34,11 +34,6 @@ protected function setUp(): void $this->builder = new ValidatorBuilder(); } - protected function tearDown(): void - { - unset($this->builder); - } - public function testAddObjectInitializer() { $this->assertSame($this->builder, $this->builder->addObjectInitializer( diff --git a/src/Symfony/Component/Validator/Tests/Violation/ConstraintViolationBuilderTest.php b/src/Symfony/Component/Validator/Tests/Violation/ConstraintViolationBuilderTest.php index 02a0bb2ca923a..d3c614bdea5c4 100644 --- a/src/Symfony/Component/Validator/Tests/Violation/ConstraintViolationBuilderTest.php +++ b/src/Symfony/Component/Validator/Tests/Violation/ConstraintViolationBuilderTest.php @@ -21,10 +21,10 @@ class ConstraintViolationBuilderTest extends TestCase { - private $root; - private $violations; - private $messageTemplate = '%value% is invalid'; - private $builder; + private array $root; + private ConstraintViolationList $violations; + private string $messageTemplate = '%value% is invalid'; + private ConstraintViolationBuilder $builder; protected function setUp(): void { diff --git a/src/Symfony/Component/VarDumper/Tests/Caster/CasterTest.php b/src/Symfony/Component/VarDumper/Tests/Caster/CasterTest.php index 55eb4040f62b8..70e7436176afb 100644 --- a/src/Symfony/Component/VarDumper/Tests/Caster/CasterTest.php +++ b/src/Symfony/Component/VarDumper/Tests/Caster/CasterTest.php @@ -22,7 +22,7 @@ class CasterTest extends TestCase { use VarDumperTestTrait; - private static $referenceArray = [ + private static array $referenceArray = [ 'null' => null, 'empty' => false, 'public' => 'pub', diff --git a/src/Symfony/Component/VarDumper/Tests/Caster/DateCasterTest.php b/src/Symfony/Component/VarDumper/Tests/Caster/DateCasterTest.php index 2dc0c1a5be122..2ce71c550acd0 100644 --- a/src/Symfony/Component/VarDumper/Tests/Caster/DateCasterTest.php +++ b/src/Symfony/Component/VarDumper/Tests/Caster/DateCasterTest.php @@ -25,7 +25,7 @@ class DateCasterTest extends TestCase { use VarDumperTestTrait; - private $previousTimezone; + private string $previousTimezone; protected function setUp(): void { diff --git a/src/Symfony/Component/VarDumper/Tests/Caster/RdKafkaCasterTest.php b/src/Symfony/Component/VarDumper/Tests/Caster/RdKafkaCasterTest.php index 65e8ec3b8fd96..78b78ddc63cfa 100644 --- a/src/Symfony/Component/VarDumper/Tests/Caster/RdKafkaCasterTest.php +++ b/src/Symfony/Component/VarDumper/Tests/Caster/RdKafkaCasterTest.php @@ -30,8 +30,8 @@ class RdKafkaCasterTest extends TestCase private const TOPIC = 'test-topic'; private const GROUP_ID = 'test-group-id'; - private $hasBroker = false; - private $broker; + private bool $hasBroker = false; + private string $broker; protected function setUp(): void { diff --git a/src/Symfony/Component/VarDumper/Tests/Caster/XmlReaderCasterTest.php b/src/Symfony/Component/VarDumper/Tests/Caster/XmlReaderCasterTest.php index 78416f30943b7..0a3c508355d58 100644 --- a/src/Symfony/Component/VarDumper/Tests/Caster/XmlReaderCasterTest.php +++ b/src/Symfony/Component/VarDumper/Tests/Caster/XmlReaderCasterTest.php @@ -21,8 +21,7 @@ class XmlReaderCasterTest extends TestCase { use VarDumperTestTrait; - /** @var \XmlReader */ - private $reader; + private \XmlReader $reader; protected function setUp(): void { diff --git a/src/Symfony/Component/VarDumper/Tests/Command/Descriptor/CliDescriptorTest.php b/src/Symfony/Component/VarDumper/Tests/Command/Descriptor/CliDescriptorTest.php index 209be68f87457..e35722fb2c8b2 100644 --- a/src/Symfony/Component/VarDumper/Tests/Command/Descriptor/CliDescriptorTest.php +++ b/src/Symfony/Component/VarDumper/Tests/Command/Descriptor/CliDescriptorTest.php @@ -20,8 +20,8 @@ class CliDescriptorTest extends TestCase { - private static $timezone; - private static $prevTerminalEmulator; + private static string $timezone; + private static string|false $prevTerminalEmulator; public static function setUpBeforeClass(): void { diff --git a/src/Symfony/Component/VarDumper/Tests/Command/Descriptor/HtmlDescriptorTest.php b/src/Symfony/Component/VarDumper/Tests/Command/Descriptor/HtmlDescriptorTest.php index 09acf149a877b..1600cdcaad19e 100644 --- a/src/Symfony/Component/VarDumper/Tests/Command/Descriptor/HtmlDescriptorTest.php +++ b/src/Symfony/Component/VarDumper/Tests/Command/Descriptor/HtmlDescriptorTest.php @@ -19,7 +19,7 @@ class HtmlDescriptorTest extends TestCase { - private static $timezone; + private static string $timezone; public static function setUpBeforeClass(): void { diff --git a/src/Symfony/Component/WebLink/Tests/HttpHeaderSerializerTest.php b/src/Symfony/Component/WebLink/Tests/HttpHeaderSerializerTest.php index 5371e4b43acf2..f9271125434f2 100644 --- a/src/Symfony/Component/WebLink/Tests/HttpHeaderSerializerTest.php +++ b/src/Symfony/Component/WebLink/Tests/HttpHeaderSerializerTest.php @@ -17,10 +17,7 @@ class HttpHeaderSerializerTest extends TestCase { - /** - * @var HttpHeaderSerializer - */ - private $serializer; + private HttpHeaderSerializer $serializer; protected function setUp(): void { diff --git a/src/Symfony/Component/Workflow/Tests/Dumper/GraphvizDumperTest.php b/src/Symfony/Component/Workflow/Tests/Dumper/GraphvizDumperTest.php index aa4b59e5b67fb..935671517fd02 100644 --- a/src/Symfony/Component/Workflow/Tests/Dumper/GraphvizDumperTest.php +++ b/src/Symfony/Component/Workflow/Tests/Dumper/GraphvizDumperTest.php @@ -20,19 +20,12 @@ class GraphvizDumperTest extends TestCase { use WorkflowBuilderTrait; - private $dumper; - - protected function setUp(): void - { - $this->dumper = new GraphvizDumper(); - } - /** * @dataProvider provideWorkflowDefinitionWithoutMarking */ public function testDumpWithoutMarking($definition, $expected, $withMetadata) { - $dump = $this->dumper->dump($definition, null, ['with-metadata' => $withMetadata]); + $dump = (new GraphvizDumper())->dump($definition, null, ['with-metadata' => $withMetadata]); $this->assertEquals($expected, $dump); } @@ -42,7 +35,7 @@ public function testDumpWithoutMarking($definition, $expected, $withMetadata) */ public function testDumpWithMarking($definition, $marking, $expected, $withMetadata) { - $dump = $this->dumper->dump($definition, $marking, ['with-metadata' => $withMetadata]); + $dump = (new GraphvizDumper())->dump($definition, $marking, ['with-metadata' => $withMetadata]); $this->assertEquals($expected, $dump); } diff --git a/src/Symfony/Component/Workflow/Tests/Dumper/StateMachineGraphvizDumperTest.php b/src/Symfony/Component/Workflow/Tests/Dumper/StateMachineGraphvizDumperTest.php index a45e07c98f126..20b3694f82952 100644 --- a/src/Symfony/Component/Workflow/Tests/Dumper/StateMachineGraphvizDumperTest.php +++ b/src/Symfony/Component/Workflow/Tests/Dumper/StateMachineGraphvizDumperTest.php @@ -20,18 +20,11 @@ class StateMachineGraphvizDumperTest extends TestCase { use WorkflowBuilderTrait; - private $dumper; - - protected function setUp(): void - { - $this->dumper = new StateMachineGraphvizDumper(); - } - public function testDumpWithoutMarking() { $definition = $this->createComplexStateMachineDefinition(); - $dump = $this->dumper->dump($definition); + $dump = (new StateMachineGraphvizDumper())->dump($definition); $expected = <<<'EOGRAPH' digraph workflow { @@ -79,7 +72,7 @@ public function testDumpWithMarking() EOGRAPH; - $dump = $this->dumper->dump($definition, $marking); + $dump = (new StateMachineGraphvizDumper())->dump($definition, $marking); $this->assertEquals($expected, $dump); } diff --git a/src/Symfony/Component/Workflow/Tests/EventListener/AuditTrailListenerTest.php b/src/Symfony/Component/Workflow/Tests/EventListener/AuditTrailListenerTest.php index f499833ed8984..53336ba7a5d08 100644 --- a/src/Symfony/Component/Workflow/Tests/EventListener/AuditTrailListenerTest.php +++ b/src/Symfony/Component/Workflow/Tests/EventListener/AuditTrailListenerTest.php @@ -51,7 +51,7 @@ public function testItWorks() class Logger extends AbstractLogger { - public $logs = []; + public array $logs = []; public function log($level, $message, array $context = []): void { diff --git a/src/Symfony/Component/Workflow/Tests/EventListener/GuardListenerTest.php b/src/Symfony/Component/Workflow/Tests/EventListener/GuardListenerTest.php index a5ff6a01c86fa..776a3ee8470a5 100644 --- a/src/Symfony/Component/Workflow/Tests/EventListener/GuardListenerTest.php +++ b/src/Symfony/Component/Workflow/Tests/EventListener/GuardListenerTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Workflow\Tests\EventListener; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolverInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; @@ -32,10 +33,10 @@ class GuardListenerTest extends TestCase { - private $authenticationChecker; - private $validator; - private $listener; - private $configuration; + private MockObject&AuthorizationCheckerInterface $authenticationChecker; + private MockObject&ValidatorInterface $validator; + private GuardListener $listener; + private array $configuration; protected function setUp(): void { @@ -58,13 +59,6 @@ protected function setUp(): void $this->listener = new GuardListener($this->configuration, $expressionLanguage, $tokenStorage, $this->authenticationChecker, $trustResolver, $roleHierarchy, $this->validator); } - protected function tearDown(): void - { - $this->authenticationChecker = null; - $this->validator = null; - $this->listener = null; - } - public function testWithNotSupportedEvent() { $event = $this->createEvent(); diff --git a/src/Symfony/Component/Workflow/Tests/MarkingStore/MethodMarkingStoreTest.php b/src/Symfony/Component/Workflow/Tests/MarkingStore/MethodMarkingStoreTest.php index 34dbd3bd2d24f..730e0f486d039 100644 --- a/src/Symfony/Component/Workflow/Tests/MarkingStore/MethodMarkingStoreTest.php +++ b/src/Symfony/Component/Workflow/Tests/MarkingStore/MethodMarkingStoreTest.php @@ -114,8 +114,7 @@ public function testGetMarkingWithUninitializedProperty2() private function createValueObject(string $markingValue): object { return new class($markingValue) { - /** @var string */ - private $markingValue; + private string $markingValue; public function __construct(string $markingValue) { diff --git a/src/Symfony/Component/Workflow/Tests/Metadata/InMemoryMetadataStoreTest.php b/src/Symfony/Component/Workflow/Tests/Metadata/InMemoryMetadataStoreTest.php index e2f6d05001e23..817757905c53f 100644 --- a/src/Symfony/Component/Workflow/Tests/Metadata/InMemoryMetadataStoreTest.php +++ b/src/Symfony/Component/Workflow/Tests/Metadata/InMemoryMetadataStoreTest.php @@ -20,8 +20,8 @@ */ class InMemoryMetadataStoreTest extends TestCase { - private $store; - private $transition; + private InMemoryMetadataStore $store; + private Transition $transition; protected function setUp(): void { diff --git a/src/Symfony/Component/Workflow/Tests/RegistryTest.php b/src/Symfony/Component/Workflow/Tests/RegistryTest.php index eb9e83b5027b1..f9a8fe0200318 100644 --- a/src/Symfony/Component/Workflow/Tests/RegistryTest.php +++ b/src/Symfony/Component/Workflow/Tests/RegistryTest.php @@ -23,7 +23,7 @@ class RegistryTest extends TestCase { - private $registry; + private Registry $registry; protected function setUp(): void { @@ -34,11 +34,6 @@ protected function setUp(): void $this->registry->addWorkflow(new Workflow(new Definition([], []), $this->createMock(MarkingStoreInterface::class), $this->createMock(EventDispatcherInterface::class), 'workflow3'), $this->createWorkflowSupportStrategy(Subject2::class)); } - protected function tearDown(): void - { - $this->registry = null; - } - public function testHasWithMatch() { $this->assertTrue($this->registry->has(new Subject1())); diff --git a/src/Symfony/Component/Workflow/Tests/Subject.php b/src/Symfony/Component/Workflow/Tests/Subject.php index 6dd76e1ec51b7..d68d430035f5d 100644 --- a/src/Symfony/Component/Workflow/Tests/Subject.php +++ b/src/Symfony/Component/Workflow/Tests/Subject.php @@ -13,13 +13,12 @@ final class Subject { - private $marking; - private $context; + private string|array|null $marking; + private array $context = []; public function __construct($marking = null) { $this->marking = $marking; - $this->context = []; } public function getMarking(): string|array|null diff --git a/src/Symfony/Component/Workflow/Tests/WorkflowTest.php b/src/Symfony/Component/Workflow/Tests/WorkflowTest.php index 2b3d1ec078bac..f7cb3c7f61a71 100644 --- a/src/Symfony/Component/Workflow/Tests/WorkflowTest.php +++ b/src/Symfony/Component/Workflow/Tests/WorkflowTest.php @@ -780,7 +780,7 @@ public function testGetEnabledTransitionsWithSameNameTransition() class EventDispatcherMock implements \Symfony\Contracts\EventDispatcher\EventDispatcherInterface { - public $dispatchedEvents = []; + public array $dispatchedEvents = []; public function dispatch($event, string $eventName = null): object { diff --git a/src/Symfony/Component/Yaml/Tests/Command/LintCommandTest.php b/src/Symfony/Component/Yaml/Tests/Command/LintCommandTest.php index 8016395875c26..5208f123da871 100644 --- a/src/Symfony/Component/Yaml/Tests/Command/LintCommandTest.php +++ b/src/Symfony/Component/Yaml/Tests/Command/LintCommandTest.php @@ -26,7 +26,7 @@ */ class LintCommandTest extends TestCase { - private $files; + private array $files; public function testLintCorrectFile() {