From e469041db7b982c90533f77948a6be1a332f322c Mon Sep 17 00:00:00 2001 From: Lina Wolf <48202465+linawolf@users.noreply.github.com> Date: Mon, 3 Oct 2022 19:00:55 +0200 Subject: [PATCH] [CLEANUP] Use typed properties instead of `@var` annotations (#599) The `@var` annotations where left where it is not possible yet to replace them in PHP 7.4. Fixes #550 Co-authored-by: lina.wolf --- CHANGELOG.md | 1 + Classes/Controller/TeaController.php | 5 +---- Classes/Domain/Model/Product/Tea.php | 10 ++-------- .../Repository/Traits/StoragePageAgnosticTrait.php | 5 +---- .../Domain/Repository/Product/TeaRepositoryTest.php | 10 ++-------- Tests/Unit/Domain/Model/Product/TeaTest.php | 5 +---- .../Domain/Repository/Product/TeaRepositoryTest.php | 5 +---- 7 files changed, 9 insertions(+), 32 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a021838..afbd77b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ This project adheres to [Semantic Versioning](https://semver.org/). ### Added ### Changed +- Use typed properties instead of `@var` annotations (#599) - Return `ResponseInterface` in controller actions (#597) - Replace switchable controller actions with separate plugins (#575) diff --git a/Classes/Controller/TeaController.php b/Classes/Controller/TeaController.php index 481e4e4..4ca1682 100644 --- a/Classes/Controller/TeaController.php +++ b/Classes/Controller/TeaController.php @@ -14,10 +14,7 @@ use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; */ class TeaController extends ActionController { - /** - * @var TeaRepository - */ - private $teaRepository; + private TeaRepository $teaRepository; public function injectTeaRepository(TeaRepository $teaRepository): void { diff --git a/Classes/Domain/Model/Product/Tea.php b/Classes/Domain/Model/Product/Tea.php index 2a5fe4d..f98aad6 100644 --- a/Classes/Domain/Model/Product/Tea.php +++ b/Classes/Domain/Model/Product/Tea.php @@ -14,15 +14,9 @@ use TYPO3\CMS\Extbase\Persistence\Generic\LazyLoadingProxy; */ class Tea extends AbstractEntity { - /** - * @var string - */ - protected $title = ''; + protected string $title = ''; - /** - * @var string - */ - protected $description = ''; + protected string $description = ''; /** * @phpstan-var \TYPO3\CMS\Extbase\Domain\Model\FileReference|LazyLoadingProxy|null diff --git a/Classes/Domain/Repository/Traits/StoragePageAgnosticTrait.php b/Classes/Domain/Repository/Traits/StoragePageAgnosticTrait.php index 908247e..b6c1331 100644 --- a/Classes/Domain/Repository/Traits/StoragePageAgnosticTrait.php +++ b/Classes/Domain/Repository/Traits/StoragePageAgnosticTrait.php @@ -14,10 +14,7 @@ use TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface; */ trait StoragePageAgnosticTrait { - /** - * @var QuerySettingsInterface - */ - private $querySettings; + private QuerySettingsInterface $querySettings; public function injectQuerySettings(QuerySettingsInterface $querySettings): void { diff --git a/Tests/Functional/Domain/Repository/Product/TeaRepositoryTest.php b/Tests/Functional/Domain/Repository/Product/TeaRepositoryTest.php index 8efaa82..20dccaa 100644 --- a/Tests/Functional/Domain/Repository/Product/TeaRepositoryTest.php +++ b/Tests/Functional/Domain/Repository/Product/TeaRepositoryTest.php @@ -21,15 +21,9 @@ class TeaRepositoryTest extends FunctionalTestCase { protected $testExtensionsToLoad = ['typo3conf/ext/tea']; - /** - * @var TeaRepository - */ - private $subject; + private TeaRepository $subject; - /** - * @var PersistenceManager - */ - private $persistenceManager; + private PersistenceManager $persistenceManager; protected function setUp(): void { diff --git a/Tests/Unit/Domain/Model/Product/TeaTest.php b/Tests/Unit/Domain/Model/Product/TeaTest.php index b38f0be..5bdc812 100644 --- a/Tests/Unit/Domain/Model/Product/TeaTest.php +++ b/Tests/Unit/Domain/Model/Product/TeaTest.php @@ -14,10 +14,7 @@ use TYPO3\TestingFramework\Core\Unit\UnitTestCase; */ class TeaTest extends UnitTestCase { - /** - * @var Tea - */ - private $subject; + private Tea $subject; protected function setUp(): void { diff --git a/Tests/Unit/Domain/Repository/Product/TeaRepositoryTest.php b/Tests/Unit/Domain/Repository/Product/TeaRepositoryTest.php index af63529..f48753f 100644 --- a/Tests/Unit/Domain/Repository/Product/TeaRepositoryTest.php +++ b/Tests/Unit/Domain/Repository/Product/TeaRepositoryTest.php @@ -14,10 +14,7 @@ use TYPO3\TestingFramework\Core\Unit\UnitTestCase; */ class TeaRepositoryTest extends UnitTestCase { - /** - * @var TeaRepository - */ - private $subject; + private TeaRepository $subject; protected function setUp(): void {