From c62c1fdb9e3d0e69759f4c2c168abde3be59a5db Mon Sep 17 00:00:00 2001 From: Oliver Klee <typo3-coding@oliverklee.de> Date: Fri, 10 Mar 2023 22:48:13 +0100 Subject: [PATCH] [TASK] Use native types for mock objects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also add the missing types and correctly use intersection types. Also reorder the type declarations for consistency. Also drop superfluous type annotations. Resolves: #100139 Releases: main Change-Id: I6b5337a0e02f36be84ff28a861c2afa58341093a Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/78091 Tested-by: Christian Kuhn <lolli@schwarzbu.ch> Tested-by: Stefan Bürk <stefan@buerk.tech> Tested-by: core-ci <typo3@b13.com> Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch> Reviewed-by: Stefan Bürk <stefan@buerk.tech> --- Build/phpstan/phpstan-baseline.neon | 10 ---------- .../Middleware/AdminPanelInitiatorTest.php | 3 +-- .../Page/LocalizationControllerTest.php | 5 +---- .../Controller/Page/TreeControllerTest.php | 6 ++---- .../Drawing/BackendLayoutRendererTest.php | 2 +- .../File/ThumbnailControllerTest.php | 5 +---- .../Controller/SwitchUserControllerTest.php | 5 +---- .../DatabaseDefaultLanguagePageRowTest.php | 5 +---- .../FormDataProvider/DatabaseEditRowTest.php | 5 +---- .../DatabasePageLanguageOverlayRowsTest.php | 5 +---- .../DatabaseParentPageRowTest.php | 5 +---- .../DatabaseRecordTypeValueTest.php | 5 +---- .../Tests/Unit/View/BackendLayoutViewTest.php | 5 +---- .../ConfigurationManagerTest.php | 5 +---- .../Core/SystemEnvironmentBuilderTest.php | 7 +++---- .../Tests/Unit/Database/ConnectionTest.php | 6 ++---- .../Unit/Error/DebugExceptionHandlerTest.php | 6 ++---- .../InstallToolFormProtectionTest.php | 7 +++---- .../Tests/Unit/Locking/LockFactoryTest.php | 5 +---- .../Processor/IntrospectionProcessorTest.php | 5 +---- .../Messaging/FlashMessageServiceTest.php | 7 +------ .../Tests/Unit/Package/PackageManagerTest.php | 5 +---- .../Resource/Index/ExtractorRegistryTest.php | 5 ++--- .../OnlineMedia/Helpers/VimeoHelperTest.php | 5 +---- .../Tests/Unit/Resource/ProcessedFileTest.php | 10 ++-------- .../Rendering/RendererRegistryTest.php | 4 +--- .../Resource/Rendering/VimeoRendererTest.php | 5 +---- .../Rendering/YouTubeRendererTest.php | 5 +---- .../Resource/Service/ExtractorServiceTest.php | 2 -- .../TextExtractorRegistryTest.php | 4 +--- .../Domain/Repository/PageRepositoryTest.php | 7 +++---- .../Parser/TypoScriptParserTest.php | 6 ++---- .../FrontendConfigurationManagerTest.php | 15 +++----------- .../Unit/Mvc/Web/Routing/UriBuilderTest.php | 20 ++++--------------- .../Unit/Persistence/Generic/BackendTest.php | 6 ------ .../Tests/Unit/Persistence/RepositoryTest.php | 5 +---- .../Persistence/RepositoryTest.php | 5 +---- .../Unit/View/AbstractTemplateViewTest.php | 16 ++++----------- .../ContentObjectRendererTest.php | 15 +++----------- .../ContentObject/ImageContentObjectTest.php | 2 +- .../Typolink/AbstractTypolinkBuilderTest.php | 3 +-- .../impexp/Tests/Functional/ExportTest.php | 5 +---- .../Tests/Functional/ImportExportTest.php | 5 +---- typo3/sysext/impexp/Tests/Unit/ExportTest.php | 5 +---- ...ndGroupsExplicitAllowDenyMigrationTest.php | 2 -- .../SysRedirectRootPageMoveMigrationTest.php | 6 ++---- .../WorkspaceNewPlaceholderRemovalTest.php | 6 ++---- .../SilentConfigurationUpgradeServiceTest.php | 5 +---- .../DatabaseCheck/Platform/MySqlTest.php | 2 -- .../Unit/Task/CleanerFieldProviderTest.php | 5 +---- .../Controller/Remote/RemoteServerTest.php | 9 ++++++--- 51 files changed, 75 insertions(+), 234 deletions(-) diff --git a/Build/phpstan/phpstan-baseline.neon b/Build/phpstan/phpstan-baseline.neon index 0ac47d74f803..96c77d1ce926 100644 --- a/Build/phpstan/phpstan-baseline.neon +++ b/Build/phpstan/phpstan-baseline.neon @@ -1420,11 +1420,6 @@ parameters: count: 1 path: ../../typo3/sysext/core/Tests/Unit/Mail/TransportFactoryTest.php - - - message: "#^Property TYPO3\\\\CMS\\\\Core\\\\Tests\\\\Unit\\\\Messaging\\\\FlashMessageServiceTest\\:\\:\\$flashMessageService \\(PHPUnit\\\\Framework\\\\MockObject\\\\MockObject&TYPO3\\\\CMS\\\\Core\\\\Messaging\\\\FlashMessageService&TYPO3\\\\TestingFramework\\\\Core\\\\AccessibleObjectInterface\\) does not accept TYPO3\\\\CMS\\\\Core\\\\Messaging\\\\FlashMessageService\\.$#" - count: 1 - path: ../../typo3/sysext/core/Tests/Unit/Messaging/FlashMessageServiceTest.php - - message: "#^Method TYPO3\\\\CMS\\\\Core\\\\Tests\\\\Unit\\\\Migrations\\\\TcaMigrationTest\\:\\:evalEmailMigratedToTypeDataProvider\\(\\) is unused\\.$#" count: 1 @@ -1805,11 +1800,6 @@ parameters: count: 1 path: ../../typo3/sysext/extbase/Tests/Functional/Property/TypeConverter/PersistentObjectConverterTest.php - - - message: "#^Property TYPO3\\\\CMS\\\\Extbase\\\\Tests\\\\Unit\\\\Configuration\\\\FrontendConfigurationManagerTest\\:\\:\\$mockTypoScriptService \\(PHPUnit\\\\Framework\\\\MockObject\\\\MockObject&TYPO3\\\\CMS\\\\Core\\\\TypoScript\\\\TypoScriptService&TYPO3\\\\TestingFramework\\\\Core\\\\AccessibleObjectInterface\\) does not accept PHPUnit\\\\Framework\\\\MockObject\\\\MockObject&TYPO3\\\\CMS\\\\Core\\\\TypoScript\\\\TypoScriptService\\.$#" - count: 1 - path: ../../typo3/sysext/extbase/Tests/Unit/Configuration/FrontendConfigurationManagerTest.php - - message: "#^Parameter \\#1 \\$error of method TYPO3\\\\CMS\\\\Extbase\\\\Error\\\\Result\\:\\:addError\\(\\) expects TYPO3\\\\CMS\\\\Extbase\\\\Error\\\\Error, PHPUnit\\\\Framework\\\\MockObject\\\\MockObject given\\.$#" count: 3 diff --git a/typo3/sysext/adminpanel/Tests/Unit/Middleware/AdminPanelInitiatorTest.php b/typo3/sysext/adminpanel/Tests/Unit/Middleware/AdminPanelInitiatorTest.php index 168f989b9cc3..d84a1f710e31 100644 --- a/typo3/sysext/adminpanel/Tests/Unit/Middleware/AdminPanelInitiatorTest.php +++ b/typo3/sysext/adminpanel/Tests/Unit/Middleware/AdminPanelInitiatorTest.php @@ -114,8 +114,7 @@ class AdminPanelInitiatorTest extends UnitTestCase $adminPanelInitiator = new AdminPanelInitiator(); $adminPanelInitiator->process($request, $handler); - /** @var MainController&MockObject $controller */ - $controller = GeneralUtility::makeInstance(MainController::class); + GeneralUtility::makeInstance(MainController::class); } protected function getHandlerMock(): RequestHandlerInterface&MockObject diff --git a/typo3/sysext/backend/Tests/Functional/Controller/Page/LocalizationControllerTest.php b/typo3/sysext/backend/Tests/Functional/Controller/Page/LocalizationControllerTest.php index 9126187e176e..8f5d94b3efaa 100644 --- a/typo3/sysext/backend/Tests/Functional/Controller/Page/LocalizationControllerTest.php +++ b/typo3/sysext/backend/Tests/Functional/Controller/Page/LocalizationControllerTest.php @@ -27,10 +27,7 @@ use TYPO3\TestingFramework\Core\AccessibleObjectInterface; class LocalizationControllerTest extends AbstractDataHandlerActionTestCase { - /** - * @var LocalizationController|MockObject|AccessibleObjectInterface - */ - protected $subject; + protected LocalizationController&MockObject&AccessibleObjectInterface $subject; protected BackendUserAuthentication $backendUser; diff --git a/typo3/sysext/backend/Tests/Functional/Controller/Page/TreeControllerTest.php b/typo3/sysext/backend/Tests/Functional/Controller/Page/TreeControllerTest.php index 975f7ef07e97..d51488fb51b3 100644 --- a/typo3/sysext/backend/Tests/Functional/Controller/Page/TreeControllerTest.php +++ b/typo3/sysext/backend/Tests/Functional/Controller/Page/TreeControllerTest.php @@ -17,6 +17,7 @@ declare(strict_types=1); namespace TYPO3\CMS\Backend\Tests\Functional\Controller\Page; +use PHPUnit\Framework\MockObject\MockObject; use Symfony\Component\DependencyInjection\Container; use TYPO3\CMS\Backend\Controller\Event\AfterPageTreeItemsPreparedEvent; use TYPO3\CMS\Backend\Controller\Page\TreeController; @@ -44,10 +45,7 @@ class TreeControllerTest extends FunctionalTestCase protected array $coreExtensionsToLoad = ['workspaces']; - /** - * @var TreeController|AccessibleObjectInterface - */ - private $subject; + private TreeController&MockObject&AccessibleObjectInterface $subject; private BackendUserAuthentication $backendUser; diff --git a/typo3/sysext/backend/Tests/Functional/View/Drawing/BackendLayoutRendererTest.php b/typo3/sysext/backend/Tests/Functional/View/Drawing/BackendLayoutRendererTest.php index d296a2854c2c..c85c37417d80 100644 --- a/typo3/sysext/backend/Tests/Functional/View/Drawing/BackendLayoutRendererTest.php +++ b/typo3/sysext/backend/Tests/Functional/View/Drawing/BackendLayoutRendererTest.php @@ -67,7 +67,7 @@ class BackendLayoutRendererTest extends FunctionalTestCase parent::tearDown(); } - protected function getPageLayoutContext(int $pageId, array $configuration): PageLayoutContext|MockObject + protected function getPageLayoutContext(int $pageId, array $configuration): PageLayoutContext&MockObject { $backendLayout = new BackendLayout('layout1', 'Layout 1', $configuration); return $this->createConfiguredMock( diff --git a/typo3/sysext/backend/Tests/Unit/Controller/File/ThumbnailControllerTest.php b/typo3/sysext/backend/Tests/Unit/Controller/File/ThumbnailControllerTest.php index c7041d9b13e5..107c027925bd 100644 --- a/typo3/sysext/backend/Tests/Unit/Controller/File/ThumbnailControllerTest.php +++ b/typo3/sysext/backend/Tests/Unit/Controller/File/ThumbnailControllerTest.php @@ -29,10 +29,7 @@ use TYPO3\TestingFramework\Core\Unit\UnitTestCase; */ class ThumbnailControllerTest extends UnitTestCase { - /** - * @var ThumbnailController|MockObject - */ - protected MockObject $subject; + protected ThumbnailController&MockObject $subject; protected static array $parameters = [ 'fileId' => 123, diff --git a/typo3/sysext/backend/Tests/Unit/Controller/SwitchUserControllerTest.php b/typo3/sysext/backend/Tests/Unit/Controller/SwitchUserControllerTest.php index e386af1e1b18..3baef9f62f96 100644 --- a/typo3/sysext/backend/Tests/Unit/Controller/SwitchUserControllerTest.php +++ b/typo3/sysext/backend/Tests/Unit/Controller/SwitchUserControllerTest.php @@ -30,10 +30,7 @@ class SwitchUserControllerTest extends UnitTestCase */ protected const RECENT_USERS_LIMIT = 3; - /** - * @var SwitchUserController|MockObject|AccessibleObjectInterface - */ - protected $subject; + protected SwitchUserController&MockObject&AccessibleObjectInterface $subject; protected function setUp(): void { diff --git a/typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/DatabaseDefaultLanguagePageRowTest.php b/typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/DatabaseDefaultLanguagePageRowTest.php index c37b2e8b93c2..af12ed27dd72 100644 --- a/typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/DatabaseDefaultLanguagePageRowTest.php +++ b/typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/DatabaseDefaultLanguagePageRowTest.php @@ -27,10 +27,7 @@ use TYPO3\TestingFramework\Core\Unit\UnitTestCase; class DatabaseDefaultLanguagePageRowTest extends UnitTestCase { - /** - * @var DatabaseDefaultLanguagePageRow|MockObject - */ - protected MockObject $subject; + protected DatabaseDefaultLanguagePageRow&MockObject $subject; protected function setUp(): void { diff --git a/typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/DatabaseEditRowTest.php b/typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/DatabaseEditRowTest.php index 6658b7144d1e..f23ab7573f05 100644 --- a/typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/DatabaseEditRowTest.php +++ b/typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/DatabaseEditRowTest.php @@ -29,10 +29,7 @@ use TYPO3\TestingFramework\Core\Unit\UnitTestCase; class DatabaseEditRowTest extends UnitTestCase { - /** - * @var DatabaseEditRow|MockObject - */ - protected MockObject $subject; + protected DatabaseEditRow&MockObject $subject; protected function setUp(): void { diff --git a/typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/DatabasePageLanguageOverlayRowsTest.php b/typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/DatabasePageLanguageOverlayRowsTest.php index 31f8d09d0767..41678bfbea28 100644 --- a/typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/DatabasePageLanguageOverlayRowsTest.php +++ b/typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/DatabasePageLanguageOverlayRowsTest.php @@ -23,10 +23,7 @@ use TYPO3\TestingFramework\Core\Unit\UnitTestCase; class DatabasePageLanguageOverlayRowsTest extends UnitTestCase { - /** - * @var DatabasePageLanguageOverlayRows|MockObject - */ - protected MockObject $subject; + protected DatabasePageLanguageOverlayRows&MockObject $subject; protected function setUp(): void { diff --git a/typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/DatabaseParentPageRowTest.php b/typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/DatabaseParentPageRowTest.php index 1a23a1ed3f6a..79ed8e4be2ab 100644 --- a/typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/DatabaseParentPageRowTest.php +++ b/typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/DatabaseParentPageRowTest.php @@ -23,10 +23,7 @@ use TYPO3\TestingFramework\Core\Unit\UnitTestCase; class DatabaseParentPageRowTest extends UnitTestCase { - /** - * @var DatabaseParentPageRow|MockObject - */ - protected MockObject $subject; + protected DatabaseParentPageRow&MockObject $subject; protected function setUp(): void { diff --git a/typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/DatabaseRecordTypeValueTest.php b/typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/DatabaseRecordTypeValueTest.php index 438267957849..dc5ec3979170 100644 --- a/typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/DatabaseRecordTypeValueTest.php +++ b/typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/DatabaseRecordTypeValueTest.php @@ -23,10 +23,7 @@ use TYPO3\TestingFramework\Core\Unit\UnitTestCase; class DatabaseRecordTypeValueTest extends UnitTestCase { - /** - * @var DatabaseRecordTypeValue|MockObject - */ - protected MockObject $subject; + protected DatabaseRecordTypeValue&MockObject $subject; protected function setUp(): void { diff --git a/typo3/sysext/backend/Tests/Unit/View/BackendLayoutViewTest.php b/typo3/sysext/backend/Tests/Unit/View/BackendLayoutViewTest.php index 3a44cf1c5245..6b2fee6ce72f 100644 --- a/typo3/sysext/backend/Tests/Unit/View/BackendLayoutViewTest.php +++ b/typo3/sysext/backend/Tests/Unit/View/BackendLayoutViewTest.php @@ -24,10 +24,7 @@ use TYPO3\TestingFramework\Core\Unit\UnitTestCase; class BackendLayoutViewTest extends UnitTestCase { - /** - * @var BackendLayoutView|MockObject|AccessibleObjectInterface - */ - protected $backendLayoutView; + protected BackendLayoutView&MockObject&AccessibleObjectInterface $backendLayoutView; /** * Sets up this test case. diff --git a/typo3/sysext/core/Tests/Unit/Configuration/ConfigurationManagerTest.php b/typo3/sysext/core/Tests/Unit/Configuration/ConfigurationManagerTest.php index 79d5262c030d..7a6e8a7680fb 100644 --- a/typo3/sysext/core/Tests/Unit/Configuration/ConfigurationManagerTest.php +++ b/typo3/sysext/core/Tests/Unit/Configuration/ConfigurationManagerTest.php @@ -26,10 +26,7 @@ use TYPO3\TestingFramework\Core\Unit\UnitTestCase; class ConfigurationManagerTest extends UnitTestCase { - /** - * @var ConfigurationManager|MockObject - */ - protected $subject; + protected ConfigurationManager&MockObject $subject; protected function setUp(): void { diff --git a/typo3/sysext/core/Tests/Unit/Core/SystemEnvironmentBuilderTest.php b/typo3/sysext/core/Tests/Unit/Core/SystemEnvironmentBuilderTest.php index 806e48135d8b..c3d96f5c11bd 100644 --- a/typo3/sysext/core/Tests/Unit/Core/SystemEnvironmentBuilderTest.php +++ b/typo3/sysext/core/Tests/Unit/Core/SystemEnvironmentBuilderTest.php @@ -17,8 +17,10 @@ declare(strict_types=1); namespace TYPO3\CMS\Core\Tests\Unit\Core; +use PHPUnit\Framework\MockObject\MockObject; use TYPO3\CMS\Core\Core\SystemEnvironmentBuilder; use TYPO3\CMS\Core\Utility\StringUtility; +use TYPO3\TestingFramework\Core\AccessibleObjectInterface; use TYPO3\TestingFramework\Core\Unit\UnitTestCase; /** @@ -26,10 +28,7 @@ use TYPO3\TestingFramework\Core\Unit\UnitTestCase; */ class SystemEnvironmentBuilderTest extends UnitTestCase { - /** - * @var \TYPO3\CMS\Core\Core\SystemEnvironmentBuilder|\TYPO3\TestingFramework\Core\AccessibleObjectInterface - */ - protected $subject; + protected SystemEnvironmentBuilder&MockObject&AccessibleObjectInterface $subject; protected function setUp(): void { diff --git a/typo3/sysext/core/Tests/Unit/Database/ConnectionTest.php b/typo3/sysext/core/Tests/Unit/Database/ConnectionTest.php index 8776aafe27b6..f1f79c78defe 100644 --- a/typo3/sysext/core/Tests/Unit/Database/ConnectionTest.php +++ b/typo3/sysext/core/Tests/Unit/Database/ConnectionTest.php @@ -22,6 +22,7 @@ use Doctrine\DBAL\Driver\AbstractMySQLDriver; use Doctrine\DBAL\Platforms\AbstractPlatform; use Doctrine\DBAL\Platforms\MySQLPlatform; use Doctrine\DBAL\Result; +use PHPUnit\Framework\MockObject\MockObject; use TYPO3\CMS\Core\Database\Connection; use TYPO3\CMS\Core\Database\Query\Expression\ExpressionBuilder; use TYPO3\CMS\Core\Database\Query\QueryBuilder; @@ -31,10 +32,7 @@ use TYPO3\TestingFramework\Core\Unit\UnitTestCase; class ConnectionTest extends UnitTestCase { - /** - * @var Connection|\PHPUnit\Framework\MockObject\MockObject - */ - protected $connection; + protected Connection&MockObject $connection; protected ?AbstractPlatform $platform; protected string $testTable = 'testTable'; diff --git a/typo3/sysext/core/Tests/Unit/Error/DebugExceptionHandlerTest.php b/typo3/sysext/core/Tests/Unit/Error/DebugExceptionHandlerTest.php index 992815e8b253..279be65257c7 100644 --- a/typo3/sysext/core/Tests/Unit/Error/DebugExceptionHandlerTest.php +++ b/typo3/sysext/core/Tests/Unit/Error/DebugExceptionHandlerTest.php @@ -17,6 +17,7 @@ declare(strict_types=1); namespace TYPO3\CMS\Core\Tests\Unit\Error; +use PHPUnit\Framework\MockObject\MockObject; use Psr\Log\LoggerInterface; use Psr\Log\LoggerTrait; use TYPO3\CMS\Core\Error\DebugExceptionHandler; @@ -28,10 +29,7 @@ use TYPO3\TestingFramework\Core\Unit\UnitTestCase; */ class DebugExceptionHandlerTest extends UnitTestCase { - /** - * @var \TYPO3\CMS\Core\Error\DebugExceptionHandler|\PHPUnit\Framework\MockObject\MockObject - */ - protected $subject; + protected DebugExceptionHandler&MockObject $subject; /** * Sets up this test case. diff --git a/typo3/sysext/core/Tests/Unit/FormProtection/InstallToolFormProtectionTest.php b/typo3/sysext/core/Tests/Unit/FormProtection/InstallToolFormProtectionTest.php index 90bcb6cd7aa2..22ac69ebbb84 100644 --- a/typo3/sysext/core/Tests/Unit/FormProtection/InstallToolFormProtectionTest.php +++ b/typo3/sysext/core/Tests/Unit/FormProtection/InstallToolFormProtectionTest.php @@ -17,8 +17,10 @@ declare(strict_types=1); namespace TYPO3\CMS\Core\Tests\Unit\FormProtection; +use PHPUnit\Framework\MockObject\MockObject; use TYPO3\CMS\Core\FormProtection\InstallToolFormProtection; use TYPO3\CMS\Core\Utility\GeneralUtility; +use TYPO3\TestingFramework\Core\AccessibleObjectInterface; use TYPO3\TestingFramework\Core\Unit\UnitTestCase; /** @@ -26,10 +28,7 @@ use TYPO3\TestingFramework\Core\Unit\UnitTestCase; */ class InstallToolFormProtectionTest extends UnitTestCase { - /** - * @var \TYPO3\CMS\Core\FormProtection\InstallToolFormProtection|\PHPUnit\Framework\MockObject\MockObject|\TYPO3\TestingFramework\Core\AccessibleObjectInterface - */ - protected $subject; + protected InstallToolFormProtection&MockObject&AccessibleObjectInterface $subject; protected function setUp(): void { diff --git a/typo3/sysext/core/Tests/Unit/Locking/LockFactoryTest.php b/typo3/sysext/core/Tests/Unit/Locking/LockFactoryTest.php index d9065779f388..ab922106405f 100644 --- a/typo3/sysext/core/Tests/Unit/Locking/LockFactoryTest.php +++ b/typo3/sysext/core/Tests/Unit/Locking/LockFactoryTest.php @@ -33,10 +33,7 @@ use TYPO3\TestingFramework\Core\Unit\UnitTestCase; */ class LockFactoryTest extends UnitTestCase { - /** - * @var LockFactory|MockObject|AccessibleObjectInterface - */ - protected $mockFactory; + protected LockFactory&MockObject&AccessibleObjectInterface $mockFactory; /** * @var array diff --git a/typo3/sysext/core/Tests/Unit/Log/Processor/IntrospectionProcessorTest.php b/typo3/sysext/core/Tests/Unit/Log/Processor/IntrospectionProcessorTest.php index ce7c61fa9a56..772c8ddd2773 100644 --- a/typo3/sysext/core/Tests/Unit/Log/Processor/IntrospectionProcessorTest.php +++ b/typo3/sysext/core/Tests/Unit/Log/Processor/IntrospectionProcessorTest.php @@ -25,10 +25,7 @@ use TYPO3\TestingFramework\Core\Unit\UnitTestCase; class IntrospectionProcessorTest extends UnitTestCase { - /** - * @var MockObject|IntrospectionProcessor - */ - protected $processor; + protected IntrospectionProcessor&MockObject $processor; /** * A dummy result for the debug_backtrace function diff --git a/typo3/sysext/core/Tests/Unit/Messaging/FlashMessageServiceTest.php b/typo3/sysext/core/Tests/Unit/Messaging/FlashMessageServiceTest.php index 1e3f8fd0a961..70a209fe6f2e 100644 --- a/typo3/sysext/core/Tests/Unit/Messaging/FlashMessageServiceTest.php +++ b/typo3/sysext/core/Tests/Unit/Messaging/FlashMessageServiceTest.php @@ -17,17 +17,12 @@ declare(strict_types=1); namespace TYPO3\CMS\Core\Tests\Unit\Messaging; -use PHPUnit\Framework\MockObject\MockObject; use TYPO3\CMS\Core\Messaging\FlashMessageService; -use TYPO3\TestingFramework\Core\AccessibleObjectInterface; use TYPO3\TestingFramework\Core\Unit\UnitTestCase; class FlashMessageServiceTest extends UnitTestCase { - /** - * @var FlashMessageService|MockObject|AccessibleObjectInterface - */ - protected $flashMessageService; + protected FlashMessageService $flashMessageService; protected function setUp(): void { diff --git a/typo3/sysext/core/Tests/Unit/Package/PackageManagerTest.php b/typo3/sysext/core/Tests/Unit/Package/PackageManagerTest.php index 92c59f536abf..fcc4e54687d8 100644 --- a/typo3/sysext/core/Tests/Unit/Package/PackageManagerTest.php +++ b/typo3/sysext/core/Tests/Unit/Package/PackageManagerTest.php @@ -40,10 +40,7 @@ use TYPO3\TestingFramework\Core\Unit\UnitTestCase; */ class PackageManagerTest extends UnitTestCase { - /** - * @var PackageManager|MockObject|AccessibleObjectInterface $packageManager - */ - protected $packageManager; + protected PackageManager&MockObject&AccessibleObjectInterface $packageManager; protected string $testRoot; diff --git a/typo3/sysext/core/Tests/Unit/Resource/Index/ExtractorRegistryTest.php b/typo3/sysext/core/Tests/Unit/Resource/Index/ExtractorRegistryTest.php index 3ed57339f5af..c052f711e43a 100644 --- a/typo3/sysext/core/Tests/Unit/Resource/Index/ExtractorRegistryTest.php +++ b/typo3/sysext/core/Tests/Unit/Resource/Index/ExtractorRegistryTest.php @@ -17,6 +17,7 @@ declare(strict_types=1); namespace TYPO3\CMS\Core\Tests\Unit\Resource\Index; +use PHPUnit\Framework\MockObject\MockObject; use TYPO3\CMS\Core\Resource\Index\ExtractorInterface; use TYPO3\CMS\Core\Resource\Index\ExtractorRegistry; use TYPO3\TestingFramework\Core\Unit\UnitTestCase; @@ -205,10 +206,8 @@ class ExtractorRegistryTest extends UnitTestCase /** * Initialize an ExtractorRegistry and mock createExtractorInstance() - * - * @return \PHPUnit\Framework\MockObject\MockObject|\TYPO3\CMS\Core\Resource\Index\ExtractorRegistry */ - protected function getMockExtractorRegistry(array $createsExtractorInstances = []) + protected function getMockExtractorRegistry(array $createsExtractorInstances = []): ExtractorRegistry&MockObject { $extractorRegistry = $this->getMockBuilder(ExtractorRegistry::class) ->onlyMethods(['createExtractorInstance']) diff --git a/typo3/sysext/core/Tests/Unit/Resource/OnlineMedia/Helpers/VimeoHelperTest.php b/typo3/sysext/core/Tests/Unit/Resource/OnlineMedia/Helpers/VimeoHelperTest.php index 56b8c5980217..6972bf2e2ca5 100644 --- a/typo3/sysext/core/Tests/Unit/Resource/OnlineMedia/Helpers/VimeoHelperTest.php +++ b/typo3/sysext/core/Tests/Unit/Resource/OnlineMedia/Helpers/VimeoHelperTest.php @@ -28,10 +28,7 @@ use TYPO3\TestingFramework\Core\Unit\UnitTestCase; */ class VimeoHelperTest extends UnitTestCase { - /** - * @var VimeoHelper|MockObject - */ - protected $subject; + protected VimeoHelper&MockObject $subject; protected ?string $extension; diff --git a/typo3/sysext/core/Tests/Unit/Resource/ProcessedFileTest.php b/typo3/sysext/core/Tests/Unit/Resource/ProcessedFileTest.php index 4f756dafa042..497d3468e515 100644 --- a/typo3/sysext/core/Tests/Unit/Resource/ProcessedFileTest.php +++ b/typo3/sysext/core/Tests/Unit/Resource/ProcessedFileTest.php @@ -33,15 +33,9 @@ class ProcessedFileTest extends UnitTestCase { protected bool $resetSingletonInstances = true; - /** - * @var MockObject|Folder - */ - protected $folderMock; + protected Folder&MockObject $folderMock; - /** - * @var MockObject|ResourceStorage - */ - protected $storageMock; + protected ResourceStorage&MockObject $storageMock; protected array $databaseRow = []; diff --git a/typo3/sysext/core/Tests/Unit/Resource/Rendering/RendererRegistryTest.php b/typo3/sysext/core/Tests/Unit/Resource/Rendering/RendererRegistryTest.php index cb3f9f004ef2..7ae57028506b 100644 --- a/typo3/sysext/core/Tests/Unit/Resource/Rendering/RendererRegistryTest.php +++ b/typo3/sysext/core/Tests/Unit/Resource/Rendering/RendererRegistryTest.php @@ -30,10 +30,8 @@ class RendererRegistryTest extends UnitTestCase { /** * Initialize a RendererRegistry and mock createRendererInstance() - * - * @return MockObject|RendererRegistry */ - protected function getTestRendererRegistry(array $createsRendererInstances = []) + protected function getTestRendererRegistry(array $createsRendererInstances = []): RendererRegistry&MockObject { $rendererRegistry = $this->getMockBuilder(RendererRegistry::class) ->onlyMethods(['createRendererInstance']) diff --git a/typo3/sysext/core/Tests/Unit/Resource/Rendering/VimeoRendererTest.php b/typo3/sysext/core/Tests/Unit/Resource/Rendering/VimeoRendererTest.php index d57bf0645ef0..6d335f454233 100644 --- a/typo3/sysext/core/Tests/Unit/Resource/Rendering/VimeoRendererTest.php +++ b/typo3/sysext/core/Tests/Unit/Resource/Rendering/VimeoRendererTest.php @@ -29,10 +29,7 @@ use TYPO3\TestingFramework\Core\Unit\UnitTestCase; */ class VimeoRendererTest extends UnitTestCase { - /** - * @var VimeoRenderer|MockObject - */ - protected $subject; + protected VimeoRenderer&MockObject $subject; protected function setUp(): void { diff --git a/typo3/sysext/core/Tests/Unit/Resource/Rendering/YouTubeRendererTest.php b/typo3/sysext/core/Tests/Unit/Resource/Rendering/YouTubeRendererTest.php index d37ca2f289a2..7c22f493c1f2 100644 --- a/typo3/sysext/core/Tests/Unit/Resource/Rendering/YouTubeRendererTest.php +++ b/typo3/sysext/core/Tests/Unit/Resource/Rendering/YouTubeRendererTest.php @@ -29,10 +29,7 @@ use TYPO3\TestingFramework\Core\Unit\UnitTestCase; */ class YouTubeRendererTest extends UnitTestCase { - /** - * @var YouTubeRenderer|MockObject - */ - protected $subject; + protected YouTubeRenderer&MockObject $subject; protected function setUp(): void { diff --git a/typo3/sysext/core/Tests/Unit/Resource/Service/ExtractorServiceTest.php b/typo3/sysext/core/Tests/Unit/Resource/Service/ExtractorServiceTest.php index 5954c1aac1df..34fa1cbd938d 100644 --- a/typo3/sysext/core/Tests/Unit/Resource/Service/ExtractorServiceTest.php +++ b/typo3/sysext/core/Tests/Unit/Resource/Service/ExtractorServiceTest.php @@ -227,7 +227,6 @@ class ExtractorServiceTest extends UnitTestCase $storageMock = $this->createMock(ResourceStorage::class); $storageMock->method('getDriverType')->willReturn('Local'); - /** @var ExtractorService|\PHPUnit\Framework\MockObject\MockObject $subject */ $subject = $this->getMockBuilder(ExtractorService::class) ->setMethods(['getExtractorRegistry']) ->getMock() @@ -268,7 +267,6 @@ class ExtractorServiceTest extends UnitTestCase 'baz' => 'second', ]); - /** @var ExtractorRegistry|\PHPUnit\Framework\MockObject\MockObject $extractorRegistryMock */ $extractorRegistryMock = $this->getMockBuilder(ExtractorRegistry::class) ->setMethods(['createExtractorInstance']) ->getMock(); diff --git a/typo3/sysext/core/Tests/Unit/Resource/TextExtraction/TextExtractorRegistryTest.php b/typo3/sysext/core/Tests/Unit/Resource/TextExtraction/TextExtractorRegistryTest.php index 2023cd8168d0..b73eb3ee2daa 100644 --- a/typo3/sysext/core/Tests/Unit/Resource/TextExtraction/TextExtractorRegistryTest.php +++ b/typo3/sysext/core/Tests/Unit/Resource/TextExtraction/TextExtractorRegistryTest.php @@ -30,10 +30,8 @@ class TextExtractorRegistryTest extends UnitTestCase { /** * Initialize a TextExtractorRegistry and mock createTextExtractorInstance() - * - * @return MockObject|TextExtractorRegistry */ - protected function getTextExtractorRegistry(array $createsTextExtractorInstances = []) + protected function getTextExtractorRegistry(array $createsTextExtractorInstances = []): TextExtractorRegistry&MockObject { $textExtractorRegistry = $this->getMockBuilder(TextExtractorRegistry::class) ->onlyMethods(['createTextExtractorInstance']) diff --git a/typo3/sysext/core/Tests/UnitDeprecated/Domain/Repository/PageRepositoryTest.php b/typo3/sysext/core/Tests/UnitDeprecated/Domain/Repository/PageRepositoryTest.php index 6bd687593d6a..488f90f4c956 100644 --- a/typo3/sysext/core/Tests/UnitDeprecated/Domain/Repository/PageRepositoryTest.php +++ b/typo3/sysext/core/Tests/UnitDeprecated/Domain/Repository/PageRepositoryTest.php @@ -17,19 +17,18 @@ declare(strict_types=1); namespace TYPO3\CMS\Core\Tests\UnitDeprecated\Domain\Repository; +use PHPUnit\Framework\MockObject\MockObject; use TYPO3\CMS\Core\Context\Context; use TYPO3\CMS\Core\Core\SystemEnvironmentBuilder; use TYPO3\CMS\Core\Domain\Repository\PageRepository; use TYPO3\CMS\Core\Http\NormalizedParams; use TYPO3\CMS\Core\Http\ServerRequest; +use TYPO3\TestingFramework\Core\AccessibleObjectInterface; use TYPO3\TestingFramework\Core\Unit\UnitTestCase; class PageRepositoryTest extends UnitTestCase { - /** - * @var PageRepository|\TYPO3\TestingFramework\Core\AccessibleObjectInterface - */ - protected $pageSelectObject; + protected PageRepository&MockObject&AccessibleObjectInterface $pageSelectObject; protected array $defaultTcaForPages = [ 'ctrl' => [ diff --git a/typo3/sysext/core/Tests/UnitDeprecated/TypoScript/Parser/TypoScriptParserTest.php b/typo3/sysext/core/Tests/UnitDeprecated/TypoScript/Parser/TypoScriptParserTest.php index 7d1f1e3424c4..fb69ea7779d9 100644 --- a/typo3/sysext/core/Tests/UnitDeprecated/TypoScript/Parser/TypoScriptParserTest.php +++ b/typo3/sysext/core/Tests/UnitDeprecated/TypoScript/Parser/TypoScriptParserTest.php @@ -17,6 +17,7 @@ declare(strict_types=1); namespace TYPO3\CMS\Core\Tests\UnitDeprecated\TypoScript\Parser; +use PHPUnit\Framework\MockObject\MockObject; use TYPO3\CMS\Backend\Configuration\TypoScript\ConditionMatching\ConditionMatcher; use TYPO3\CMS\Core\Cache\CacheManager; use TYPO3\CMS\Core\Cache\Frontend\NullFrontend; @@ -28,10 +29,7 @@ use TYPO3\TestingFramework\Core\Unit\UnitTestCase; class TypoScriptParserTest extends UnitTestCase { - /** - * @var TypoScriptParser|AccessibleObjectInterface - */ - protected $typoScriptParser; + protected TypoScriptParser&MockObject&AccessibleObjectInterface $typoScriptParser; protected function setUp(): void { diff --git a/typo3/sysext/extbase/Tests/Unit/Configuration/FrontendConfigurationManagerTest.php b/typo3/sysext/extbase/Tests/Unit/Configuration/FrontendConfigurationManagerTest.php index 7f667498c15b..2b1d30576793 100644 --- a/typo3/sysext/extbase/Tests/Unit/Configuration/FrontendConfigurationManagerTest.php +++ b/typo3/sysext/extbase/Tests/Unit/Configuration/FrontendConfigurationManagerTest.php @@ -33,20 +33,11 @@ class FrontendConfigurationManagerTest extends UnitTestCase { protected bool $resetSingletonInstances = true; - /** - * @var ContentObjectRenderer|MockObject - */ - protected $mockContentObject; + protected ContentObjectRenderer&MockObject $mockContentObject; - /** - * @var FrontendConfigurationManager|MockObject|AccessibleObjectInterface - */ - protected $frontendConfigurationManager; + protected FrontendConfigurationManager&MockObject&AccessibleObjectInterface $frontendConfigurationManager; - /** - * @var TypoScriptService|MockObject|AccessibleObjectInterface - */ - protected $mockTypoScriptService; + protected TypoScriptService&MockObject $mockTypoScriptService; protected array $testTypoScriptSetup = [ 'foo.' => [ diff --git a/typo3/sysext/extbase/Tests/Unit/Mvc/Web/Routing/UriBuilderTest.php b/typo3/sysext/extbase/Tests/Unit/Mvc/Web/Routing/UriBuilderTest.php index c1f888809836..b9815c3dee68 100644 --- a/typo3/sysext/extbase/Tests/Unit/Mvc/Web/Routing/UriBuilderTest.php +++ b/typo3/sysext/extbase/Tests/Unit/Mvc/Web/Routing/UriBuilderTest.php @@ -58,25 +58,13 @@ class UriBuilderTest extends UnitTestCase */ protected $mockConfigurationManager; - /** - * @var ContentObjectRenderer|MockObject - */ - protected $mockContentObject; + protected ContentObjectRenderer&MockObject $mockContentObject; - /** - * @var Request|MockObject - */ - protected $mockRequest; + protected Request&MockObject $mockRequest; - /** - * @var ExtensionService|MockObject - */ - protected $mockExtensionService; + protected ExtensionService&MockObject $mockExtensionService; - /** - * @var UriBuilder|MockObject|AccessibleObjectInterface - */ - protected $uriBuilder; + protected UriBuilder&MockObject&AccessibleObjectInterface $uriBuilder; /** * @throws \InvalidArgumentException diff --git a/typo3/sysext/extbase/Tests/Unit/Persistence/Generic/BackendTest.php b/typo3/sysext/extbase/Tests/Unit/Persistence/Generic/BackendTest.php index d8a0c74c1d01..85a3cf0ec4c5 100644 --- a/typo3/sysext/extbase/Tests/Unit/Persistence/Generic/BackendTest.php +++ b/typo3/sysext/extbase/Tests/Unit/Persistence/Generic/BackendTest.php @@ -41,17 +41,11 @@ class BackendTest extends UnitTestCase */ public function insertRelationInRelationtableSetsMmMatchFieldsInRow(): void { - /* \TYPO3\CMS\Extbase\Persistence\Generic\Backend|\PHPUnit\Framework\MockObject\MockObject|\TYPO3\TestingFramework\Core\AccessibleObjectInterface */ $fixture = $this->getAccessibleMock(Backend::class, null, [], '', false); - /* \TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper|\PHPUnit\Framework\MockObject\MockObject */ $dataMapFactory = $this->createMock(DataMapFactory::class); - /* \TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMap|\PHPUnit\Framework\MockObject\MockObject */ $dataMap = $this->createMock(DataMap::class); - /* \TYPO3\CMS\Extbase\Persistence\Generic\Mapper\ColumnMap|\PHPUnit\Framework\MockObject\MockObject */ $columnMap = $this->createMock(ColumnMap::class); - /* \TYPO3\CMS\Extbase\Persistence\Generic\Storage\BackendInterface|\PHPUnit\Framework\MockObject\MockObject */ $storageBackend = $this->createMock(BackendInterface::class); - /* \TYPO3\CMS\Extbase\DomainObject\DomainObjectInterface|\PHPUnit\Framework\MockObject\MockObject */ $domainObject = $this->createMock(DomainObjectInterface::class); $mmMatchFields = [ diff --git a/typo3/sysext/extbase/Tests/Unit/Persistence/RepositoryTest.php b/typo3/sysext/extbase/Tests/Unit/Persistence/RepositoryTest.php index dfec862b45d5..4ae2ca33bfab 100644 --- a/typo3/sysext/extbase/Tests/Unit/Persistence/RepositoryTest.php +++ b/typo3/sysext/extbase/Tests/Unit/Persistence/RepositoryTest.php @@ -40,10 +40,7 @@ use TYPO3\TestingFramework\Core\Unit\UnitTestCase; class RepositoryTest extends UnitTestCase { - /** - * @var Repository|MockObject|AccessibleObjectInterface - */ - protected $repository; + protected Repository&MockObject&AccessibleObjectInterface $repository; /** * @var QueryFactory diff --git a/typo3/sysext/extbase/Tests/UnitDeprecated/Persistence/RepositoryTest.php b/typo3/sysext/extbase/Tests/UnitDeprecated/Persistence/RepositoryTest.php index 5382adbb2aa4..d9b94ad3224a 100644 --- a/typo3/sysext/extbase/Tests/UnitDeprecated/Persistence/RepositoryTest.php +++ b/typo3/sysext/extbase/Tests/UnitDeprecated/Persistence/RepositoryTest.php @@ -34,10 +34,7 @@ use TYPO3\TestingFramework\Core\Unit\UnitTestCase; class RepositoryTest extends UnitTestCase { - /** - * @var Repository|MockObject|AccessibleObjectInterface - */ - protected $repository; + protected Repository&MockObject&AccessibleObjectInterface $repository; /** * @var QueryFactory diff --git a/typo3/sysext/fluid/Tests/Unit/View/AbstractTemplateViewTest.php b/typo3/sysext/fluid/Tests/Unit/View/AbstractTemplateViewTest.php index 4a8371774114..cee6f9e1395e 100644 --- a/typo3/sysext/fluid/Tests/Unit/View/AbstractTemplateViewTest.php +++ b/typo3/sysext/fluid/Tests/Unit/View/AbstractTemplateViewTest.php @@ -17,6 +17,7 @@ declare(strict_types=1); namespace TYPO3\CMS\Fluid\Tests\Unit\View; +use PHPUnit\Framework\MockObject\MockObject; use TYPO3\CMS\Fluid\Core\Rendering\RenderingContext; use TYPO3\CMS\Fluid\View\AbstractTemplateView; use TYPO3\TestingFramework\Core\AccessibleObjectInterface; @@ -25,20 +26,11 @@ use TYPO3Fluid\Fluid\Core\ViewHelper\ViewHelperVariableContainer; class AbstractTemplateViewTest extends UnitTestCase { - /** - * @var AbstractTemplateView|AccessibleObjectInterface - */ - protected $view; + protected AbstractTemplateView&MockObject&AccessibleObjectInterface $view; - /** - * @var RenderingContext|\PHPUnit\Framework\MockObject\MockObject - */ - protected $renderingContext; + protected RenderingContext&MockObject $renderingContext; - /** - * @var ViewHelperVariableContainer|\PHPUnit\Framework\MockObject\MockObject - */ - protected $viewHelperVariableContainer; + protected ViewHelperVariableContainer&MockObject $viewHelperVariableContainer; /** * Sets up this test case diff --git a/typo3/sysext/frontend/Tests/Unit/ContentObject/ContentObjectRendererTest.php b/typo3/sysext/frontend/Tests/Unit/ContentObject/ContentObjectRendererTest.php index e90beb9b34f9..68315697e6d1 100644 --- a/typo3/sysext/frontend/Tests/Unit/ContentObject/ContentObjectRendererTest.php +++ b/typo3/sysext/frontend/Tests/Unit/ContentObject/ContentObjectRendererTest.php @@ -103,15 +103,9 @@ class ContentObjectRendererTest extends UnitTestCase protected bool $resetSingletonInstances = true; - /** - * @var MockObject|AccessibleObjectInterface|ContentObjectRenderer - */ - protected MockObject $subject; + protected ContentObjectRenderer&MockObject&AccessibleObjectInterface $subject; - /** - * @var MockObject|TypoScriptFrontendController|AccessibleObjectInterface - */ - protected MockObject $frontendControllerMock; + protected TypoScriptFrontendController&MockObject&AccessibleObjectInterface $frontendControllerMock; /** * Default content object name -> class name map, shipped with TYPO3 CMS @@ -1828,10 +1822,7 @@ class ContentObjectRendererTest extends UnitTestCase $this->subject->render($contentObjectFixture, $configuration); } - /** - * @return MockObject|AbstractContentObject - */ - protected function createContentObjectThrowingExceptionFixture(bool $addProductionExceptionHandlerInstance = true) + protected function createContentObjectThrowingExceptionFixture(bool $addProductionExceptionHandlerInstance = true): AbstractContentObject&MockObject { $contentObjectFixture = $this->getMockBuilder(AbstractContentObject::class) ->getMock(); diff --git a/typo3/sysext/frontend/Tests/Unit/ContentObject/ImageContentObjectTest.php b/typo3/sysext/frontend/Tests/Unit/ContentObject/ImageContentObjectTest.php index 841e14b4d081..87be6255d4f8 100644 --- a/typo3/sysext/frontend/Tests/Unit/ContentObject/ImageContentObjectTest.php +++ b/typo3/sysext/frontend/Tests/Unit/ContentObject/ImageContentObjectTest.php @@ -36,7 +36,7 @@ class ImageContentObjectTest extends UnitTestCase { protected bool $resetSingletonInstances = true; - protected ImageContentObject|MockObject|AccessibleObjectInterface $subject; + protected ImageContentObject&MockObject&AccessibleObjectInterface $subject; protected function setUp(): void { diff --git a/typo3/sysext/frontend/Tests/Unit/Typolink/AbstractTypolinkBuilderTest.php b/typo3/sysext/frontend/Tests/Unit/Typolink/AbstractTypolinkBuilderTest.php index 0410d64aebb6..1b4289920958 100644 --- a/typo3/sysext/frontend/Tests/Unit/Typolink/AbstractTypolinkBuilderTest.php +++ b/typo3/sysext/frontend/Tests/Unit/Typolink/AbstractTypolinkBuilderTest.php @@ -28,7 +28,6 @@ use TYPO3\CMS\Core\Utility\StringUtility; use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer; use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController; use TYPO3\CMS\Frontend\Typolink\AbstractTypolinkBuilder; -use TYPO3\TestingFramework\Core\AccessibleObjectInterface; use TYPO3\TestingFramework\Core\Unit\UnitTestCase; class AbstractTypolinkBuilderTest extends UnitTestCase @@ -37,7 +36,7 @@ class AbstractTypolinkBuilderTest extends UnitTestCase protected bool $backupEnvironment = true; - protected MockObject|TypoScriptFrontendController|AccessibleObjectInterface $frontendControllerMock; + protected TypoScriptFrontendController&MockObject $frontendControllerMock; protected function setUp(): void { diff --git a/typo3/sysext/impexp/Tests/Functional/ExportTest.php b/typo3/sysext/impexp/Tests/Functional/ExportTest.php index ee54bc9879da..c87ee0e98b3d 100644 --- a/typo3/sysext/impexp/Tests/Functional/ExportTest.php +++ b/typo3/sysext/impexp/Tests/Functional/ExportTest.php @@ -31,10 +31,7 @@ class ExportTest extends AbstractImportExportTestCase 'typo3/sysext/impexp/Tests/Functional/Fixtures/Extensions/template_extension', ]; - /** - * @var Export|MockObject|AccessibleObjectInterface - */ - protected $exportMock; + protected Export&MockObject&AccessibleObjectInterface $exportMock; protected array $recordTypesIncludeFields = [ diff --git a/typo3/sysext/impexp/Tests/Functional/ImportExportTest.php b/typo3/sysext/impexp/Tests/Functional/ImportExportTest.php index b6acec8b8555..368cc270dfa4 100644 --- a/typo3/sysext/impexp/Tests/Functional/ImportExportTest.php +++ b/typo3/sysext/impexp/Tests/Functional/ImportExportTest.php @@ -32,10 +32,7 @@ class ImportExportTest extends AbstractImportExportTestCase 'typo3/sysext/core/Tests/Functional/Fixtures/Extensions/test_irre_mnattributesimple', ]; - /** - * @var Export|MockObject|AccessibleObjectInterface - */ - protected $exportMock; + protected Export&MockObject&AccessibleObjectInterface $exportMock; protected function setUp(): void { diff --git a/typo3/sysext/impexp/Tests/Unit/ExportTest.php b/typo3/sysext/impexp/Tests/Unit/ExportTest.php index d7ea3c641a63..63bc4ec0945f 100644 --- a/typo3/sysext/impexp/Tests/Unit/ExportTest.php +++ b/typo3/sysext/impexp/Tests/Unit/ExportTest.php @@ -28,10 +28,7 @@ class ExportTest extends UnitTestCase { protected bool $resetSingletonInstances = true; - /** - * @var Export|MockObject|AccessibleObjectInterface - */ - protected $exportMock; + protected Export&MockObject&AccessibleObjectInterface $exportMock; protected function setUp(): void { diff --git a/typo3/sysext/install/Tests/Functional/Updates/BackendGroupsExplicitAllowDenyMigrationTest.php b/typo3/sysext/install/Tests/Functional/Updates/BackendGroupsExplicitAllowDenyMigrationTest.php index f9fba922e3a6..775ac70ab7f2 100644 --- a/typo3/sysext/install/Tests/Functional/Updates/BackendGroupsExplicitAllowDenyMigrationTest.php +++ b/typo3/sysext/install/Tests/Functional/Updates/BackendGroupsExplicitAllowDenyMigrationTest.php @@ -17,7 +17,6 @@ declare(strict_types=1); namespace TYPO3\CMS\Install\Tests\Functional\Updates; -use PHPUnit\Framework\MockObject\MockObject; use Symfony\Component\Console\Output\OutputInterface; use TYPO3\CMS\Install\Updates\BackendGroupsExplicitAllowDenyMigration; use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; @@ -29,7 +28,6 @@ class BackendGroupsExplicitAllowDenyMigrationTest extends FunctionalTestCase */ public function backendGroupsRowsAreUpdated(): void { - /** @var MockObject&OutputInterface $outputMock */ $outputMock = $this->getMockBuilder(OutputInterface::class)->getMock(); $outputMock->expects(self::atLeastOnce())->method('writeln'); $subject = new BackendGroupsExplicitAllowDenyMigration(); diff --git a/typo3/sysext/install/Tests/Functional/Updates/RowUpdater/SysRedirectRootPageMoveMigrationTest.php b/typo3/sysext/install/Tests/Functional/Updates/RowUpdater/SysRedirectRootPageMoveMigrationTest.php index 92aacc42ceb5..3e1c9a68b359 100644 --- a/typo3/sysext/install/Tests/Functional/Updates/RowUpdater/SysRedirectRootPageMoveMigrationTest.php +++ b/typo3/sysext/install/Tests/Functional/Updates/RowUpdater/SysRedirectRootPageMoveMigrationTest.php @@ -22,6 +22,7 @@ use TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Install\Updates\DatabaseRowsUpdateWizard; use TYPO3\CMS\Install\Updates\RowUpdater\SysRedirectRootPageMoveMigration; +use TYPO3\TestingFramework\Core\AccessibleObjectInterface; use TYPO3\TestingFramework\Core\Functional\Framework\DataHandling\ActionService; use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; @@ -33,10 +34,7 @@ class SysRedirectRootPageMoveMigrationTest extends FunctionalTestCase protected array $coreExtensionsToLoad = ['redirects']; - /** - * @var MockObject|DatabaseRowsUpdateWizard|\TYPO3\TestingFramework\Core\AccessibleObjectInterface - */ - protected $subject; + protected DatabaseRowsUpdateWizard&MockObject&AccessibleObjectInterface $subject; protected ActionService $actionService; diff --git a/typo3/sysext/install/Tests/Functional/Updates/RowUpdater/WorkspaceNewPlaceholderRemovalTest.php b/typo3/sysext/install/Tests/Functional/Updates/RowUpdater/WorkspaceNewPlaceholderRemovalTest.php index b5ecf9ceb7b6..5fa4f4ca24ef 100644 --- a/typo3/sysext/install/Tests/Functional/Updates/RowUpdater/WorkspaceNewPlaceholderRemovalTest.php +++ b/typo3/sysext/install/Tests/Functional/Updates/RowUpdater/WorkspaceNewPlaceholderRemovalTest.php @@ -21,6 +21,7 @@ use PHPUnit\Framework\MockObject\MockObject; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Install\Updates\DatabaseRowsUpdateWizard; use TYPO3\CMS\Install\Updates\RowUpdater\WorkspaceNewPlaceholderRemovalMigration; +use TYPO3\TestingFramework\Core\AccessibleObjectInterface; use TYPO3\TestingFramework\Core\Functional\Framework\DataHandling\ActionService; use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; @@ -33,10 +34,7 @@ class WorkspaceNewPlaceholderRemovalTest extends FunctionalTestCase 'typo3/sysext/core/Tests/Functional/Fixtures/Extensions/test_irre_csv', ]; - /** - * @var MockObject|DatabaseRowsUpdateWizard|\TYPO3\TestingFramework\Core\AccessibleObjectInterface - */ - protected $subject; + protected DatabaseRowsUpdateWizard&MockObject&AccessibleObjectInterface $subject; protected ActionService $actionService; diff --git a/typo3/sysext/install/Tests/Unit/Service/SilentConfigurationUpgradeServiceTest.php b/typo3/sysext/install/Tests/Unit/Service/SilentConfigurationUpgradeServiceTest.php index 5b64c507e76a..3940d320954b 100644 --- a/typo3/sysext/install/Tests/Unit/Service/SilentConfigurationUpgradeServiceTest.php +++ b/typo3/sysext/install/Tests/Unit/Service/SilentConfigurationUpgradeServiceTest.php @@ -36,10 +36,7 @@ use TYPO3\TestingFramework\Core\Unit\UnitTestCase; class SilentConfigurationUpgradeServiceTest extends UnitTestCase { - /** - * @var ConfigurationManager|MockObject - */ - protected $configurationManager; + protected ConfigurationManager&MockObject $configurationManager; /** * @var UnitTestPackageManager A backup of unit test package manager diff --git a/typo3/sysext/install/Tests/Unit/SystemEnvironment/DatabaseCheck/Platform/MySqlTest.php b/typo3/sysext/install/Tests/Unit/SystemEnvironment/DatabaseCheck/Platform/MySqlTest.php index 42bde9e597c7..fc7ae28206bf 100644 --- a/typo3/sysext/install/Tests/Unit/SystemEnvironment/DatabaseCheck/Platform/MySqlTest.php +++ b/typo3/sysext/install/Tests/Unit/SystemEnvironment/DatabaseCheck/Platform/MySqlTest.php @@ -20,7 +20,6 @@ namespace TYPO3\CMS\Install\Tests\Unit\SystemEnvironment\DatabaseCheck\Platform; use Doctrine\DBAL\Platforms\AbstractPlatform; use Doctrine\DBAL\Platforms\MariaDBPlatform; use Doctrine\DBAL\Platforms\MySQLPlatform; -use PHPUnit\Framework\MockObject\MockObject; use TYPO3\CMS\Core\Database\Connection; use TYPO3\CMS\Core\Messaging\FlashMessage; use TYPO3\CMS\Core\Type\ContextualFeedbackSeverity; @@ -90,7 +89,6 @@ class MySqlTest extends UnitTestCase ContextualFeedbackSeverity $expectedSeverity, string $expectedTitle ): void { - /** @var Connection&MockObject $connectionMock */ $connectionMock = $this->getMockBuilder(Connection::class)->disableOriginalConstructor()->getMock(); $connectionMock->method('getServerVersion')->willReturn($serverVersionString); $connectionMock->method('getDatabasePlatform')->willReturn($platform); diff --git a/typo3/sysext/recycler/Tests/Unit/Task/CleanerFieldProviderTest.php b/typo3/sysext/recycler/Tests/Unit/Task/CleanerFieldProviderTest.php index 63e4196fb1cf..104f91d18a31 100644 --- a/typo3/sysext/recycler/Tests/Unit/Task/CleanerFieldProviderTest.php +++ b/typo3/sysext/recycler/Tests/Unit/Task/CleanerFieldProviderTest.php @@ -52,10 +52,7 @@ class CleanerFieldProviderTest extends UnitTestCase $this->subject->method('getLanguageService')->willReturn($languageServiceMock); } - /** - * @return MockObject|SchedulerModuleController - */ - protected function getScheduleModuleControllerMock(array $mockedMethods = []) + protected function getScheduleModuleControllerMock(array $mockedMethods = []): SchedulerModuleController&MockObject { $languageServiceMock = $this->getMockBuilder(LanguageService::class) ->onlyMethods(['sL']) diff --git a/typo3/sysext/workspaces/Tests/Unit/Controller/Remote/RemoteServerTest.php b/typo3/sysext/workspaces/Tests/Unit/Controller/Remote/RemoteServerTest.php index 53c5da136b9c..cb23791fcb25 100644 --- a/typo3/sysext/workspaces/Tests/Unit/Controller/Remote/RemoteServerTest.php +++ b/typo3/sysext/workspaces/Tests/Unit/Controller/Remote/RemoteServerTest.php @@ -31,7 +31,7 @@ class RemoteServerTest extends UnitTestCase protected bool $resetSingletonInstances = true; /** - * @var array<string, MockObject&FileReference> + * @var array<non-empty-string, FileReference&MockObject> */ protected array $fileReferenceMocks; @@ -120,7 +120,7 @@ class RemoteServerTest extends UnitTestCase /** * @param string $idList List of ids - * @return array<string, MockObject&FileReference> + * @return array<non-empty-string, FileReference&MockObject> */ protected function getFileReferenceMocks(string $idList): array { @@ -134,7 +134,10 @@ class RemoteServerTest extends UnitTestCase return $fileReferenceMocks; } - protected function getFileReferenceMock(string $id): MockObject&FileReference + /** + * @param non-empty-string $id + */ + protected function getFileReferenceMock(string $id): FileReference&MockObject { if (isset($this->fileReferenceMocks[$id])) { return $this->fileReferenceMocks[$id]; -- GitLab