diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ae99bd1c..ef25f537e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -53,7 +53,7 @@ This project adheres to [Semantic Versioning](https://semver.org/). - Allow `DateTimeImmutable` as change and creation date (#734) - Update the usage of the Fluid view helper classes (#732) - Stop using patches for dependencies (713) -- Improve some type annotations (#712, #769, #776, #792) +- Improve some type annotations (#712, #769, #776, #792, #793) ## 3.6.1 diff --git a/Classes/DataStructures/Collection.php b/Classes/DataStructures/Collection.php index 767f80669..86bd422a8 100644 --- a/Classes/DataStructures/Collection.php +++ b/Classes/DataStructures/Collection.php @@ -9,6 +9,8 @@ /** * This class represents a list of models. + * + * @extends \SplObjectStorage */ class Collection extends \SplObjectStorage { @@ -162,9 +164,9 @@ private function rebuildUidCache(): void * second one, 1 means that the second parameter is sorted before the first * one and 0 means the parameters stay in order. * - * @param mixed $callbackFunction a callback function to use with the models stored in the list, must not be empty + * @param callable $callbackFunction callback function to use with the models stored in the list, must not be empty */ - public function sort($callbackFunction): void + public function sort(callable $callbackFunction): void { $items = iterator_to_array($this, false); usort($items, $callbackFunction); diff --git a/Classes/Logging/Interfaces/LoggingAware.php b/Classes/Logging/Interfaces/LoggingAware.php index 1c6e500eb..6f884e945 100644 --- a/Classes/Logging/Interfaces/LoggingAware.php +++ b/Classes/Logging/Interfaces/LoggingAware.php @@ -13,5 +13,5 @@ */ interface LoggingAware { - public function injectLogManager(LogManagerInterface $logManager); + public function injectLogManager(LogManagerInterface $logManager): void; } diff --git a/Tests/Functional/Mapper/AbstractDataMapperTest.php b/Tests/Functional/Mapper/AbstractDataMapperTest.php index dcb42093b..85a75896b 100644 --- a/Tests/Functional/Mapper/AbstractDataMapperTest.php +++ b/Tests/Functional/Mapper/AbstractDataMapperTest.php @@ -20,6 +20,9 @@ use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Utility\GeneralUtility; +/** + * @covers \OliverKlee\Oelib\Mapper\AbstractDataMapper + */ class AbstractDataMapperTest extends FunctionalTestCase { /** @@ -353,11 +356,12 @@ public function getListOfModelsReturnsListOfModelInstances(): void */ public function getListOfModelsReturnsListOfModelWithProvidedTitle(): void { - self::assertSame( - 'foo', - $this->subject->getListOfModels([['uid' => 1, 'title' => 'foo']]) - ->current()->getTitle() - ); + /** @var Collection $models */ + $models = $this->subject->getListOfModels([['uid' => 1, 'title' => 'foo']]); + + /** @var TestingModel $current */ + $current = $models->current(); + self::assertSame('foo', $current->getTitle()); } // Tests concerning load and reload diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index f37a3ed36..bde81d26f 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -10,21 +10,11 @@ parameters: count: 1 path: Classes/Authentication/FrontEndLoginManager.php - - - message: "#^Class OliverKlee\\\\Oelib\\\\DataStructures\\\\Collection extends generic class SplObjectStorage but does not specify its types\\: TObject, TData$#" - count: 1 - path: Classes/DataStructures/Collection.php - - message: "#^Method OliverKlee\\\\Oelib\\\\Interfaces\\\\LoginManager\\:\\:getLoggedInUser\\(\\) has parameter \\$mapperName with generic class OliverKlee\\\\Oelib\\\\Mapper\\\\AbstractDataMapper but does not specify its types\\: M$#" count: 1 path: Classes/Interfaces/LoginManager.php - - - message: "#^Method OliverKlee\\\\Oelib\\\\Logging\\\\Interfaces\\\\LoggingAware\\:\\:injectLogManager\\(\\) has no return typehint specified\\.$#" - count: 1 - path: Classes/Logging/Interfaces/LoggingAware.php - - message: "#^Method OliverKlee\\\\Oelib\\\\Mapper\\\\AbstractDataMapper\\:\\:saveManyToManyAndCommaSeparatedRelatedModels\\(\\) has parameter \\$mapper with generic class OliverKlee\\\\Oelib\\\\Mapper\\\\AbstractDataMapper but does not specify its types\\: M$#" count: 1