From e5d5e9967fb1768c84d4eec5f6875b4e45fded79 Mon Sep 17 00:00:00 2001 From: Tobias Schultze Date: Wed, 21 Jul 2021 14:55:43 +0200 Subject: [PATCH] fix intersection types in tests --- .../ChoiceList/DoctrineChoiceLoaderTest.php | 10 ++++---- .../Tests/Form/Type/EntityTypeTest.php | 7 ++++-- .../AnnotationsCacheWarmerTest.php | 2 +- .../Command/CachePoolDeleteCommandTest.php | 2 +- .../Tests/Command/CachePruneCommandTest.php | 4 ++-- .../Tests/ImmutableEventDispatcherTest.php | 2 +- .../Component/Form/Tests/AbstractFormTest.php | 18 +++++++-------- .../Factory/CachingFactoryDecoratorTest.php | 2 +- .../Factory/PropertyAccessDecoratorTest.php | 2 +- .../Tests/ChoiceList/LazyChoiceListTest.php | 7 ++++-- .../Csrf/Type/FormTypeCsrfExtensionTest.php | 4 ++-- .../DataCollectorExtensionTest.php | 2 +- .../DataCollector/FormDataCollectorTest.php | 8 +++---- .../DataCollector/FormDataExtractorTest.php | 4 ++-- .../Type/DataCollectorTypeExtensionTest.php | 2 +- .../Component/Form/Tests/FormFactoryTest.php | 8 +++---- .../Component/Form/Tests/FormRegistryTest.php | 6 ++--- .../Form/Tests/ResolvedFormTypeTest.php | 23 +++++++++++++------ .../Handler/MongoDbSessionHandlerTest.php | 9 ++++---- .../Bundle/Reader/BundleEntryReaderTest.php | 2 +- src/Symfony/Component/Ldap/Tests/LdapTest.php | 2 +- .../Lock/Tests/Store/CombinedStoreTest.php | 6 ++--- .../Command/SetupTransportsCommandTest.php | 6 ++--- .../Tests/Encoder/XmlEncoderTest.php | 2 +- .../Normalizer/AbstractNormalizerTest.php | 2 +- .../Normalizer/ArrayDenormalizerTest.php | 2 +- .../JsonSerializableNormalizerTest.php | 2 +- .../Translation/Tests/TranslatorCacheTest.php | 2 +- 28 files changed, 82 insertions(+), 66 deletions(-) diff --git a/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/DoctrineChoiceLoaderTest.php b/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/DoctrineChoiceLoaderTest.php index afe595c7d3..004eec8201 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/DoctrineChoiceLoaderTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/DoctrineChoiceLoaderTest.php @@ -29,17 +29,17 @@ use Symfony\Component\Form\ChoiceList\Factory\ChoiceListFactoryInterface; class DoctrineChoiceLoaderTest extends TestCase { /** - * @var ChoiceListFactoryInterface|MockObject + * @var MockObject&ChoiceListFactoryInterface */ private $factory; /** - * @var ObjectManager|MockObject + * @var MockObject&ObjectManager */ private $om; /** - * @var ObjectRepository|MockObject + * @var MockObject&ObjectRepository */ private $repository; @@ -49,12 +49,12 @@ class DoctrineChoiceLoaderTest extends TestCase private $class; /** - * @var IdReader|MockObject + * @var MockObject&IdReader */ private $idReader; /** - * @var EntityLoaderInterface|MockObject + * @var MockObject&EntityLoaderInterface */ private $objectLoader; diff --git a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php index d082ba5492..7dc883badb 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php @@ -59,7 +59,7 @@ class EntityTypeTest extends BaseTypeTest private $em; /** - * @var MockObject|ManagerRegistry + * @var MockObject&ManagerRegistry */ private $emRegistry; @@ -1312,7 +1312,10 @@ class EntityTypeTest extends BaseTypeTest $this->assertSame($choiceLoader1, $choiceLoader3); } - protected function createRegistryMock($name, $em) + /** + * @return MockObject&ManagerRegistry + */ + protected function createRegistryMock($name, $em): ManagerRegistry { $registry = $this->createMock(ManagerRegistry::class); $registry->expects($this->any()) diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/AnnotationsCacheWarmerTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/AnnotationsCacheWarmerTest.php index d834acb911..d0eb678420 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/AnnotationsCacheWarmerTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/AnnotationsCacheWarmerTest.php @@ -169,7 +169,7 @@ class AnnotationsCacheWarmerTest extends TestCase /** * @return MockObject&Reader */ - private function getReadOnlyReader() + private function getReadOnlyReader(): Reader { $readerMock = $this->createMock(Reader::class); $readerMock->expects($this->exactly(0))->method('getClassAnnotations'); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CachePoolDeleteCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CachePoolDeleteCommandTest.php index 4a32ab9961..b840a538cc 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CachePoolDeleteCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CachePoolDeleteCommandTest.php @@ -86,7 +86,7 @@ class CachePoolDeleteCommandTest extends TestCase /** * @return MockObject&KernelInterface */ - private function getKernel() + private function getKernel(): KernelInterface { $container = $this->createMock(ContainerInterface::class); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CachePruneCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CachePruneCommandTest.php index 060c657ec3..32d60124eb 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CachePruneCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CachePruneCommandTest.php @@ -53,7 +53,7 @@ class CachePruneCommandTest extends TestCase /** * @return MockObject&KernelInterface */ - private function getKernel() + private function getKernel(): KernelInterface { $container = $this->createMock(ContainerInterface::class); @@ -74,7 +74,7 @@ class CachePruneCommandTest extends TestCase /** * @return MockObject&PruneableInterface */ - private function getPruneableInterfaceMock() + private function getPruneableInterfaceMock(): PruneableInterface { $pruneable = $this->createMock(PruneableInterface::class); $pruneable diff --git a/src/Symfony/Component/EventDispatcher/Tests/ImmutableEventDispatcherTest.php b/src/Symfony/Component/EventDispatcher/Tests/ImmutableEventDispatcherTest.php index be91f65d72..9aaaec6e10 100644 --- a/src/Symfony/Component/EventDispatcher/Tests/ImmutableEventDispatcherTest.php +++ b/src/Symfony/Component/EventDispatcher/Tests/ImmutableEventDispatcherTest.php @@ -24,7 +24,7 @@ use Symfony\Component\EventDispatcher\ImmutableEventDispatcher; class ImmutableEventDispatcherTest extends TestCase { /** - * @var MockObject + * @var MockObject&EventDispatcherInterface */ private $innerDispatcher; diff --git a/src/Symfony/Component/Form/Tests/AbstractFormTest.php b/src/Symfony/Component/Form/Tests/AbstractFormTest.php index 78cb985485..193bb31b15 100644 --- a/src/Symfony/Component/Form/Tests/AbstractFormTest.php +++ b/src/Symfony/Component/Form/Tests/AbstractFormTest.php @@ -20,7 +20,6 @@ use Symfony\Component\Form\DataTransformerInterface; use Symfony\Component\Form\FormBuilder; use Symfony\Component\Form\FormFactoryInterface; use Symfony\Component\Form\FormInterface; -use Symfony\Component\Form\FormValidatorInterface; abstract class AbstractFormTest extends TestCase { @@ -30,7 +29,7 @@ abstract class AbstractFormTest extends TestCase protected $dispatcher; /** - * @var FormFactoryInterface + * @var MockObject&FormFactoryInterface */ protected $factory; @@ -60,18 +59,19 @@ abstract class AbstractFormTest extends TestCase return new FormBuilder($name, $dataClass, $dispatcher ?: $this->dispatcher, $this->factory, $options); } - protected function getDataMapper(): MockObject + /** + * @return MockObject&DataMapperInterface + */ + protected function getDataMapper(): DataMapperInterface { return $this->createMock(DataMapperInterface::class); } - protected function getDataTransformer(): MockObject + /** + * @return MockObject&DataTransformerInterface + */ + protected function getDataTransformer(): DataTransformerInterface { return $this->createMock(DataTransformerInterface::class); } - - protected function getFormValidator(): MockObject - { - return $this->createMock(FormValidatorInterface::class); - } } diff --git a/src/Symfony/Component/Form/Tests/ChoiceList/Factory/CachingFactoryDecoratorTest.php b/src/Symfony/Component/Form/Tests/ChoiceList/Factory/CachingFactoryDecoratorTest.php index a7e564475d..38c4041bd7 100644 --- a/src/Symfony/Component/Form/Tests/ChoiceList/Factory/CachingFactoryDecoratorTest.php +++ b/src/Symfony/Component/Form/Tests/ChoiceList/Factory/CachingFactoryDecoratorTest.php @@ -26,7 +26,7 @@ use Symfony\Component\Form\ChoiceList\View\ChoiceListView; class CachingFactoryDecoratorTest extends TestCase { /** - * @var MockObject + * @var MockObject&ChoiceListFactoryInterface */ private $decoratedFactory; diff --git a/src/Symfony/Component/Form/Tests/ChoiceList/Factory/PropertyAccessDecoratorTest.php b/src/Symfony/Component/Form/Tests/ChoiceList/Factory/PropertyAccessDecoratorTest.php index 3d253edddf..16969f3288 100644 --- a/src/Symfony/Component/Form/Tests/ChoiceList/Factory/PropertyAccessDecoratorTest.php +++ b/src/Symfony/Component/Form/Tests/ChoiceList/Factory/PropertyAccessDecoratorTest.php @@ -27,7 +27,7 @@ use Symfony\Component\PropertyAccess\PropertyPath; class PropertyAccessDecoratorTest extends TestCase { /** - * @var MockObject + * @var MockObject&ChoiceListFactoryInterface */ private $decoratedFactory; diff --git a/src/Symfony/Component/Form/Tests/ChoiceList/LazyChoiceListTest.php b/src/Symfony/Component/Form/Tests/ChoiceList/LazyChoiceListTest.php index 4bcb989f04..0c74ae1896 100644 --- a/src/Symfony/Component/Form/Tests/ChoiceList/LazyChoiceListTest.php +++ b/src/Symfony/Component/Form/Tests/ChoiceList/LazyChoiceListTest.php @@ -28,15 +28,18 @@ class LazyChoiceListTest extends TestCase private $list; /** - * @var MockObject + * @var MockObject&ChoiceListInterface */ private $loadedList; /** - * @var MockObject + * @var MockObject&ChoiceLoaderInterface */ private $loader; + /** + * @var \Closure + */ private $value; protected function setUp(): void 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 b9fa3c5ca8..0adaab003b 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Csrf/Type/FormTypeCsrfExtensionTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Csrf/Type/FormTypeCsrfExtensionTest.php @@ -34,12 +34,12 @@ class FormTypeCsrfExtensionTest_ChildType extends AbstractType class FormTypeCsrfExtensionTest extends TypeTestCase { /** - * @var MockObject + * @var MockObject&CsrfTokenManagerInterface */ protected $tokenManager; /** - * @var MockObject + * @var MockObject&TranslatorInterface */ protected $translator; diff --git a/src/Symfony/Component/Form/Tests/Extension/DataCollector/DataCollectorExtensionTest.php b/src/Symfony/Component/Form/Tests/Extension/DataCollector/DataCollectorExtensionTest.php index 6f1b1b1272..9c02d2aff1 100644 --- a/src/Symfony/Component/Form/Tests/Extension/DataCollector/DataCollectorExtensionTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/DataCollector/DataCollectorExtensionTest.php @@ -25,7 +25,7 @@ class DataCollectorExtensionTest extends TestCase private $extension; /** - * @var MockObject + * @var MockObject&FormDataCollectorInterface */ private $dataCollector; diff --git a/src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataCollectorTest.php b/src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataCollectorTest.php index 836d9d8ba6..fd5ac459a6 100644 --- a/src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataCollectorTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataCollectorTest.php @@ -32,7 +32,7 @@ use Symfony\Component\Form\ResolvedFormTypeFactory; class FormDataCollectorTest extends TestCase { /** - * @var MockObject + * @var MockObject&FormDataExtractorInterface */ private $dataExtractor; @@ -42,17 +42,17 @@ class FormDataCollectorTest extends TestCase private $dataCollector; /** - * @var MockObject + * @var EventDispatcher */ private $dispatcher; /** - * @var MockObject + * @var FormFactory */ private $factory; /** - * @var MockObject + * @var PropertyPathMapper */ private $dataMapper; diff --git a/src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataExtractorTest.php b/src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataExtractorTest.php index e56861dead..10f624b1d8 100644 --- a/src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataExtractorTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataExtractorTest.php @@ -41,12 +41,12 @@ class FormDataExtractorTest extends TestCase private $dataExtractor; /** - * @var MockObject + * @var MockObject&EventDispatcherInterface */ private $dispatcher; /** - * @var MockObject + * @var MockObject&FormFactoryInterface */ private $factory; 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 3f5997328f..7c699f9498 100644 --- a/src/Symfony/Component/Form/Tests/Extension/DataCollector/Type/DataCollectorTypeExtensionTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/DataCollector/Type/DataCollectorTypeExtensionTest.php @@ -26,7 +26,7 @@ class DataCollectorTypeExtensionTest extends TestCase private $extension; /** - * @var MockObject + * @var MockObject&FormDataCollectorInterface */ private $dataCollector; diff --git a/src/Symfony/Component/Form/Tests/FormFactoryTest.php b/src/Symfony/Component/Form/Tests/FormFactoryTest.php index c857ca6223..2fa5e6d313 100644 --- a/src/Symfony/Component/Form/Tests/FormFactoryTest.php +++ b/src/Symfony/Component/Form/Tests/FormFactoryTest.php @@ -33,22 +33,22 @@ use Symfony\Component\Form\Test\FormBuilderInterface; class FormFactoryTest extends TestCase { /** - * @var MockObject + * @var MockObject&FormTypeGuesserInterface */ private $guesser1; /** - * @var MockObject + * @var MockObject&FormTypeGuesserInterface */ private $guesser2; /** - * @var MockObject + * @var MockObject&FormRegistryInterface */ private $registry; /** - * @var MockObject + * @var MockObject&FormBuilderInterface */ private $builder; diff --git a/src/Symfony/Component/Form/Tests/FormRegistryTest.php b/src/Symfony/Component/Form/Tests/FormRegistryTest.php index bcffa4dc61..cdf8ea427b 100644 --- a/src/Symfony/Component/Form/Tests/FormRegistryTest.php +++ b/src/Symfony/Component/Form/Tests/FormRegistryTest.php @@ -44,17 +44,17 @@ class FormRegistryTest extends TestCase private $registry; /** - * @var MockObject|ResolvedFormTypeFactoryInterface + * @var MockObject&ResolvedFormTypeFactoryInterface */ private $resolvedTypeFactory; /** - * @var MockObject + * @var MockObject&FormTypeGuesserInterface */ private $guesser1; /** - * @var MockObject + * @var MockObject&FormTypeGuesserInterface */ private $guesser2; diff --git a/src/Symfony/Component/Form/Tests/ResolvedFormTypeTest.php b/src/Symfony/Component/Form/Tests/ResolvedFormTypeTest.php index 9d0fae9725..931b98d144 100644 --- a/src/Symfony/Component/Form/Tests/ResolvedFormTypeTest.php +++ b/src/Symfony/Component/Form/Tests/ResolvedFormTypeTest.php @@ -33,22 +33,22 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class ResolvedFormTypeTest extends TestCase { /** - * @var MockObject|FormTypeInterface + * @var MockObject&FormTypeInterface */ private $parentType; /** - * @var MockObject|FormTypeInterface + * @var MockObject&FormTypeInterface */ private $type; /** - * @var MockObject|FormTypeExtensionInterface + * @var MockObject&FormTypeExtensionInterface */ private $extension1; /** - * @var MockObject|FormTypeExtensionInterface + * @var MockObject&FormTypeExtensionInterface */ private $extension2; @@ -373,17 +373,26 @@ class ResolvedFormTypeTest extends TestCase ]; } - private function getMockFormType($typeClass = AbstractType::class): MockObject + /** + * @return MockObject&FormTypeInterface + */ + private function getMockFormType($typeClass = AbstractType::class): FormTypeInterface { return $this->getMockBuilder($typeClass)->setMethods(['getBlockPrefix', 'configureOptions', 'finishView', 'buildView', 'buildForm'])->getMock(); } - private function getMockFormTypeExtension(): MockObject + /** + * @return MockObject&FormTypeExtensionInterface + */ + private function getMockFormTypeExtension(): FormTypeExtensionInterface { return $this->getMockBuilder(AbstractTypeExtension::class)->setMethods(['getExtendedType', 'configureOptions', 'finishView', 'buildView', 'buildForm'])->getMock(); } - private function getMockFormFactory(): MockObject + /** + * @return MockObject&FormFactoryInterface + */ + private function getMockFormFactory(): FormFactoryInterface { return $this->createMock(FormFactoryInterface::class); } 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 bf8021c155..a96fcc42ad 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler; +use MongoDB\Client; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Session\Storage\Handler\MongoDbSessionHandler; @@ -23,7 +24,7 @@ use Symfony\Component\HttpFoundation\Session\Storage\Handler\MongoDbSessionHandl class MongoDbSessionHandlerTest extends TestCase { /** - * @var MockObject + * @var MockObject&Client */ private $mongo; private $storage; @@ -33,11 +34,11 @@ class MongoDbSessionHandlerTest extends TestCase { parent::setUp(); - if (!class_exists(\MongoDB\Client::class)) { + if (!class_exists(Client::class)) { $this->markTestSkipped('The mongodb/mongodb package is required.'); } - $this->mongo = $this->getMockBuilder(\MongoDB\Client::class) + $this->mongo = $this->getMockBuilder(Client::class) ->disableOriginalConstructor() ->getMock(); @@ -199,7 +200,7 @@ class MongoDbSessionHandlerTest extends TestCase $method = new \ReflectionMethod($this->storage, 'getMongo'); $method->setAccessible(true); - $this->assertInstanceOf(\MongoDB\Client::class, $method->invoke($this->storage)); + $this->assertInstanceOf(Client::class, $method->invoke($this->storage)); } private function createMongoCollectionMock(): \MongoDB\Collection 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 ee23742c7b..bd1ba59f21 100644 --- a/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/BundleEntryReaderTest.php +++ b/src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/BundleEntryReaderTest.php @@ -31,7 +31,7 @@ class BundleEntryReaderTest extends TestCase private $reader; /** - * @var MockObject + * @var MockObject&BundleEntryReaderInterface */ private $readerImpl; diff --git a/src/Symfony/Component/Ldap/Tests/LdapTest.php b/src/Symfony/Component/Ldap/Tests/LdapTest.php index db543d34eb..e8d598a4b6 100644 --- a/src/Symfony/Component/Ldap/Tests/LdapTest.php +++ b/src/Symfony/Component/Ldap/Tests/LdapTest.php @@ -21,7 +21,7 @@ use Symfony\Component\Ldap\Ldap; class LdapTest extends TestCase { - /** @var MockObject */ + /** @var MockObject&AdapterInterface */ private $adapter; /** @var Ldap */ diff --git a/src/Symfony/Component/Lock/Tests/Store/CombinedStoreTest.php b/src/Symfony/Component/Lock/Tests/Store/CombinedStoreTest.php index f24f0aa9fa..a1b6a53fe7 100644 --- a/src/Symfony/Component/Lock/Tests/Store/CombinedStoreTest.php +++ b/src/Symfony/Component/Lock/Tests/Store/CombinedStoreTest.php @@ -51,11 +51,11 @@ class CombinedStoreTest extends AbstractStoreTest return new CombinedStore([new RedisStore($redis)], new UnanimousStrategy()); } - /** @var MockObject */ + /** @var MockObject&StrategyInterface */ private $strategy; - /** @var MockObject */ + /** @var MockObject&BlockingStoreInterface */ private $store1; - /** @var MockObject */ + /** @var MockObject&BlockingStoreInterface */ private $store2; /** @var CombinedStore */ private $store; diff --git a/src/Symfony/Component/Messenger/Tests/Command/SetupTransportsCommandTest.php b/src/Symfony/Component/Messenger/Tests/Command/SetupTransportsCommandTest.php index 2e4d9368b9..33dfd175fc 100644 --- a/src/Symfony/Component/Messenger/Tests/Command/SetupTransportsCommandTest.php +++ b/src/Symfony/Component/Messenger/Tests/Command/SetupTransportsCommandTest.php @@ -24,7 +24,7 @@ class SetupTransportsCommandTest extends TestCase public function testReceiverNames() { // mock a service locator - /** @var MockObject|ServiceLocator $serviceLocator */ + /** @var MockObject&ServiceLocator $serviceLocator */ $serviceLocator = $this->createMock(ServiceLocator::class); // get method must be call twice and will return consecutively a setup-able transport and a non setup-able transport $serviceLocator->expects($this->exactly(2)) @@ -49,7 +49,7 @@ class SetupTransportsCommandTest extends TestCase public function testReceiverNameArgument() { // mock a service locator - /** @var MockObject|ServiceLocator $serviceLocator */ + /** @var MockObject&ServiceLocator $serviceLocator */ $serviceLocator = $this->createMock(ServiceLocator::class); // get method must be call twice and will return consecutively a setup-able transport and a non setup-able transport $serviceLocator->expects($this->exactly(1)) @@ -74,7 +74,7 @@ class SetupTransportsCommandTest extends TestCase $this->expectException(\RuntimeException::class); $this->expectExceptionMessage('The "not_found" transport does not exist.'); // mock a service locator - /** @var MockObject|ServiceLocator $serviceLocator */ + /** @var MockObject&ServiceLocator $serviceLocator */ $serviceLocator = $this->createMock(ServiceLocator::class); // get method must be call twice and will return consecutively a setup-able transport and a non setup-able transport $serviceLocator->expects($this->exactly(0)) diff --git a/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php b/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php index e3b7376d2f..0752021605 100644 --- a/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php +++ b/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php @@ -933,7 +933,7 @@ XML; /** * @return MockObject&NormalizerInterface */ - private function createMockDateTimeNormalizer() + private function createMockDateTimeNormalizer(): NormalizerInterface { $mock = $this->createMock(CustomNormalizer::class); diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractNormalizerTest.php index 7b3c0a0b04..5655b1643f 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractNormalizerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractNormalizerTest.php @@ -36,7 +36,7 @@ class AbstractNormalizerTest extends TestCase private $normalizer; /** - * @var ClassMetadataFactoryInterface|MockObject + * @var MockObject&ClassMetadataFactoryInterface */ private $classMetadata; diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/ArrayDenormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/ArrayDenormalizerTest.php index ff1f85a452..ffdb943c05 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/ArrayDenormalizerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/ArrayDenormalizerTest.php @@ -25,7 +25,7 @@ class ArrayDenormalizerTest extends TestCase private $denormalizer; /** - * @var SerializerInterface|MockObject + * @var MockObject&SerializerInterface */ private $serializer; diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/JsonSerializableNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/JsonSerializableNormalizerTest.php index 7731b9c500..e0222a5fa0 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/JsonSerializableNormalizerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/JsonSerializableNormalizerTest.php @@ -31,7 +31,7 @@ class JsonSerializableNormalizerTest extends TestCase private $normalizer; /** - * @var MockObject|SerializerInterface + * @var MockObject&JsonSerializerNormalizer */ private $serializer; diff --git a/src/Symfony/Component/Translation/Tests/TranslatorCacheTest.php b/src/Symfony/Component/Translation/Tests/TranslatorCacheTest.php index a490687833..79075b35bc 100644 --- a/src/Symfony/Component/Translation/Tests/TranslatorCacheTest.php +++ b/src/Symfony/Component/Translation/Tests/TranslatorCacheTest.php @@ -100,7 +100,7 @@ class TranslatorCacheTest extends TestCase $catalogue = new MessageCatalogue($locale, []); $catalogue->addResource(new StaleResource()); // better use a helper class than a mock, because it gets serialized in the cache and re-loaded - /** @var LoaderInterface|MockObject $loader */ + /** @var MockObject&LoaderInterface $loader */ $loader = $this->createMock(LoaderInterface::class); $loader ->expects($this->exactly(2))