Skip to content

Commit

Permalink
Fix NestedTreeRepository phpstan issues generics (sulu#7230)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-schranz authored Dec 9, 2023
1 parent 99ccc9a commit 347f095
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 42 deletions.
42 changes: 1 addition & 41 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -4215,11 +4215,6 @@ parameters:
count: 1
path: src/Sulu/Bundle/CategoryBundle/DependencyInjection/SuluCategoryExtension.php

-
message: "#^Method Sulu\\\\Bundle\\\\CategoryBundle\\\\Entity\\\\CategoryRepository\\:\\:createNew\\(\\) should return Sulu\\\\Bundle\\\\CategoryBundle\\\\Entity\\\\CategoryInterface but returns object\\.$#"
count: 1
path: src/Sulu/Bundle/CategoryBundle/Entity/CategoryRepository.php

-
message: "#^Method Sulu\\\\Bundle\\\\CategoryBundle\\\\Entity\\\\CategoryRepository\\:\\:findCategories\\(\\) should return array\\<Sulu\\\\Bundle\\\\CategoryBundle\\\\Entity\\\\CategoryInterface\\> but returns mixed\\.$#"
count: 1
Expand Down Expand Up @@ -4265,11 +4260,6 @@ parameters:
count: 1
path: src/Sulu/Bundle/CategoryBundle/Entity/CategoryRepository.php

-
message: "#^Method Sulu\\\\Bundle\\\\CategoryBundle\\\\Entity\\\\CategoryRepository\\:\\:findChildren\\(\\) should return array\\<Sulu\\\\Bundle\\\\CategoryBundle\\\\Entity\\\\CategoryInterface\\> but returns mixed\\.$#"
count: 1
path: src/Sulu/Bundle/CategoryBundle/Entity/CategoryRepository.php

-
message: "#^Method Sulu\\\\Bundle\\\\CategoryBundle\\\\Entity\\\\CategoryRepository\\:\\:findChildrenCategoriesByParentId\\(\\) should return array\\<Sulu\\\\Bundle\\\\CategoryBundle\\\\Entity\\\\CategoryInterface\\> but returns mixed\\.$#"
count: 1
Expand Down Expand Up @@ -8835,11 +8825,6 @@ parameters:
count: 1
path: src/Sulu/Bundle/ContactBundle/Entity/AccountRepository.php

-
message: "#^Method Sulu\\\\Bundle\\\\ContactBundle\\\\Entity\\\\AccountRepository\\:\\:createNew\\(\\) should return Sulu\\\\Bundle\\\\ContactBundle\\\\Entity\\\\AccountInterface but returns object\\.$#"
count: 1
path: src/Sulu/Bundle/ContactBundle/Entity/AccountRepository.php

-
message: "#^Method Sulu\\\\Bundle\\\\ContactBundle\\\\Entity\\\\AccountRepository\\:\\:findAccountById\\(\\) should return Sulu\\\\Bundle\\\\ContactBundle\\\\Entity\\\\AccountInterface\\|null but returns mixed\\.$#"
count: 1
Expand All @@ -8865,11 +8850,6 @@ parameters:
count: 1
path: src/Sulu/Bundle/ContactBundle/Entity/AccountRepository.php

-
message: "#^Method Sulu\\\\Bundle\\\\ContactBundle\\\\Entity\\\\AccountRepository\\:\\:findByFilter\\(\\) should return array\\<Sulu\\\\Bundle\\\\ContactBundle\\\\Entity\\\\AccountInterface\\>\\|null but returns mixed\\.$#"
count: 1
path: src/Sulu/Bundle/ContactBundle/Entity/AccountRepository.php

-
message: "#^Method Sulu\\\\Bundle\\\\ContactBundle\\\\Entity\\\\AccountRepository\\:\\:findByFilters\\(\\) has parameter \\$filters with no value type specified in iterable type array\\.$#"
count: 1
Expand Down Expand Up @@ -8910,21 +8890,11 @@ parameters:
count: 1
path: src/Sulu/Bundle/ContactBundle/Entity/AccountRepository.php

-
message: "#^Method Sulu\\\\Bundle\\\\ContactBundle\\\\Entity\\\\AccountRepository\\:\\:findById\\(\\) should return Sulu\\\\Bundle\\\\ContactBundle\\\\Entity\\\\AccountInterface\\|null but returns object\\|null\\.$#"
count: 1
path: src/Sulu/Bundle/ContactBundle/Entity/AccountRepository.php

-
message: "#^Method Sulu\\\\Bundle\\\\ContactBundle\\\\Entity\\\\AccountRepository\\:\\:findByIds\\(\\) should return array\\<Sulu\\\\Bundle\\\\ContactBundle\\\\Entity\\\\AccountInterface\\> but returns mixed\\.$#"
count: 1
path: src/Sulu/Bundle/ContactBundle/Entity/AccountRepository.php

-
message: "#^Method Sulu\\\\Bundle\\\\ContactBundle\\\\Entity\\\\AccountRepository\\:\\:findChildAccounts\\(\\) should return array\\<Sulu\\\\Bundle\\\\ContactBundle\\\\Entity\\\\AccountInterface\\> but returns mixed\\.$#"
count: 1
path: src/Sulu/Bundle/ContactBundle/Entity/AccountRepository.php

-
message: "#^Method Sulu\\\\Bundle\\\\ContactBundle\\\\Entity\\\\AccountRepository\\:\\:findChildrenAndContacts\\(\\) should return Sulu\\\\Bundle\\\\ContactBundle\\\\Entity\\\\AccountInterface\\|null but returns mixed\\.$#"
count: 1
Expand Down Expand Up @@ -14890,11 +14860,6 @@ parameters:
count: 1
path: src/Sulu/Bundle/MediaBundle/Entity/CollectionRepository.php

-
message: "#^Method Sulu\\\\Bundle\\\\MediaBundle\\\\Entity\\\\CollectionRepository\\:\\:findCollectionSet\\(\\) should return array\\<Sulu\\\\Bundle\\\\MediaBundle\\\\Entity\\\\Collection\\> but returns mixed\\.$#"
count: 1
path: src/Sulu/Bundle/MediaBundle/Entity/CollectionRepository.php

-
message: "#^Method Sulu\\\\Bundle\\\\MediaBundle\\\\Entity\\\\CollectionRepository\\:\\:findCollections\\(\\) has parameter \\$filter with no value type specified in iterable type array\\.$#"
count: 1
Expand All @@ -14911,7 +14876,7 @@ parameters:
path: src/Sulu/Bundle/MediaBundle/Entity/CollectionRepository.php

-
message: "#^Method Sulu\\\\Bundle\\\\MediaBundle\\\\Entity\\\\CollectionRepository\\:\\:findCollections\\(\\) should return array\\<Sulu\\\\Bundle\\\\MediaBundle\\\\Entity\\\\Collection\\> but returns Doctrine\\\\ORM\\\\Tools\\\\Pagination\\\\Paginator\\<mixed\\>\\.$#"
message: "#^Method Sulu\\\\Bundle\\\\MediaBundle\\\\Entity\\\\CollectionRepository\\:\\:findCollections\\(\\) should return array\\<Sulu\\\\Bundle\\\\MediaBundle\\\\Entity\\\\Collection\\> but returns Doctrine\\\\ORM\\\\Tools\\\\Pagination\\\\Paginator\\<Sulu\\\\Bundle\\\\MediaBundle\\\\Entity\\\\Collection\\>\\.$#"
count: 1
path: src/Sulu/Bundle/MediaBundle/Entity/CollectionRepository.php

Expand All @@ -14920,11 +14885,6 @@ parameters:
count: 1
path: src/Sulu/Bundle/MediaBundle/Entity/CollectionRepository.php

-
message: "#^Method Sulu\\\\Bundle\\\\MediaBundle\\\\Entity\\\\CollectionRepository\\:\\:findTree\\(\\) should return array\\<Sulu\\\\Bundle\\\\MediaBundle\\\\Entity\\\\Collection\\> but returns mixed\\.$#"
count: 1
path: src/Sulu/Bundle/MediaBundle/Entity/CollectionRepository.php

-
message: "#^Method Sulu\\\\Bundle\\\\MediaBundle\\\\Entity\\\\CollectionRepository\\:\\:getIdsQuery\\(\\) has parameter \\$filter with no value type specified in iterable type array\\.$#"
count: 1
Expand Down
3 changes: 3 additions & 0 deletions src/Sulu/Bundle/CategoryBundle/Entity/CategoryRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
use Doctrine\ORM\QueryBuilder;
use Gedmo\Tree\Entity\Repository\NestedTreeRepository;

/**
* @extends NestedTreeRepository<CategoryInterface>
*/
class CategoryRepository extends NestedTreeRepository implements CategoryRepositoryInterface
{
public function createNew()
Expand Down
5 changes: 4 additions & 1 deletion src/Sulu/Bundle/ContactBundle/Entity/AccountRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
use Sulu\Component\SmartContent\Orm\DataProviderRepositoryInterface;
use Sulu\Component\SmartContent\Orm\DataProviderRepositoryTrait;

/**
* @extends NestedTreeRepository<AccountInterface>
*/
class AccountRepository extends NestedTreeRepository implements DataProviderRepositoryInterface, AccountRepositoryInterface
{
use DataProviderRepositoryTrait;
Expand All @@ -33,7 +36,7 @@ public function findOneByContactId(int $contactId): AccountInterface
'a.accountContacts',
'accountContacts',
'WITH',
'accountContacts.idContacts = :contactId AND accountContacts.main = TRUE'
'IDENTITY(accountContacts.contact) = :contactId AND accountContacts.main = TRUE'
)
->setParameter('contactId', $contactId);
$query = $qb->getQuery();
Expand Down
2 changes: 2 additions & 0 deletions src/Sulu/Bundle/MediaBundle/Entity/CollectionRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*
* @extends NestedTreeRepository<CollectionInterface>
*/
class CollectionRepository extends NestedTreeRepository implements CollectionRepositoryInterface, DescendantProviderInterface
{
Expand Down

0 comments on commit 347f095

Please sign in to comment.