Fixed PHPstan issues

This commit is contained in:
Jan Böhmer 2023-07-23 00:14:29 +02:00
parent d59b8817c3
commit cd80552ce7
3 changed files with 8 additions and 5 deletions

View file

@ -41,6 +41,7 @@ class AttachmentContainingDBElementRepository extends NamedDBElementRepository
* Similar to the findByIDInMatchingOrder function, but it also hints to doctrine that the master picture attachment should be fetched eagerly. * Similar to the findByIDInMatchingOrder function, but it also hints to doctrine that the master picture attachment should be fetched eagerly.
* @param array $ids * @param array $ids
* @return array * @return array
* @phpstan-return array<int, TEntityClass>
*/ */
public function getElementsAndPreviewAttachmentByIDs(array $ids): array public function getElementsAndPreviewAttachmentByIDs(array $ids): array
{ {

View file

@ -30,7 +30,7 @@ use RecursiveIteratorIterator;
/** /**
* @see \App\Tests\Repository\StructuralDBElementRepositoryTest * @see \App\Tests\Repository\StructuralDBElementRepositoryTest
* @template TEntityClass of AbstractStructuralDBElement * @template TEntityClass of AbstractStructuralDBElement
* @extends NamedDBElementRepository<TEntityClass> * @extends AttachmentContainingDBElementRepository<TEntityClass>
*/ */
class StructuralDBElementRepository extends AttachmentContainingDBElementRepository class StructuralDBElementRepository extends AttachmentContainingDBElementRepository
{ {

View file

@ -48,10 +48,14 @@ class NodesListBuilder
* Gets a flattened hierarchical tree. Useful for generating option lists. * Gets a flattened hierarchical tree. Useful for generating option lists.
* In difference to the Repository Function, the results here are cached. * In difference to the Repository Function, the results here are cached.
* *
* @template T of AbstractDBElement
*
* @param string $class_name the class name of the entity you want to retrieve * @param string $class_name the class name of the entity you want to retrieve
* @phpstan-param class-string<T> $class_name
* @param AbstractStructuralDBElement|null $parent This entity will be used as root element. Set to null, to use global root * @param AbstractStructuralDBElement|null $parent This entity will be used as root element. Set to null, to use global root
* *
* @return AbstractStructuralDBElement[] a flattened list containing the tree elements * @return AbstractDBElement[] a flattened list containing the tree elements
* @phpstan-return list<T>
*/ */
public function typeToNodesList(string $class_name, ?AbstractStructuralDBElement $parent = null): array public function typeToNodesList(string $class_name, ?AbstractStructuralDBElement $parent = null): array
{ {
@ -76,7 +80,7 @@ class NodesListBuilder
* This functions returns the (cached) list of the IDs of the elements for the flattened tree. * This functions returns the (cached) list of the IDs of the elements for the flattened tree.
* @param string $class_name * @param string $class_name
* @param AbstractStructuralDBElement|null $parent * @param AbstractStructuralDBElement|null $parent
* @return array * @return int[]
*/ */
private function getFlattenedIDs(string $class_name, ?AbstractStructuralDBElement $parent = null): array private function getFlattenedIDs(string $class_name, ?AbstractStructuralDBElement $parent = null): array
{ {
@ -101,9 +105,7 @@ class NodesListBuilder
* The value is cached for performance reasons. * The value is cached for performance reasons.
* *
* @template T of AbstractStructuralDBElement * @template T of AbstractStructuralDBElement
*
* @param T $element * @param T $element
*
* @return AbstractStructuralDBElement[] * @return AbstractStructuralDBElement[]
* *
* @phpstan-return list<T> * @phpstan-return list<T>