Skip to content

Commit

Permalink
Enable rule checkGenericClassInNonGenericObjectType in psalm
Browse files Browse the repository at this point in the history
  • Loading branch information
jkniest committed Jun 3, 2024
1 parent 4741742 commit 48c9399
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 2 deletions.
2 changes: 0 additions & 2 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,3 @@ parameters:

# The level 9 is the highest level
level: 9

checkGenericClassInNonGenericObjectType: false
4 changes: 4 additions & 0 deletions src/Utils/CategoryUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

namespace Basecom\FixturePlugin\Utils;

use Shopware\Core\Content\Category\CategoryCollection;
use Shopware\Core\Content\Category\CategoryEntity;
use Shopware\Core\Framework\Context;
use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository;
Expand All @@ -14,6 +15,9 @@

readonly class CategoryUtils
{
/**
* @param EntityRepository<CategoryCollection> $categoryRepository

Check failure on line 19 in src/Utils/CategoryUtils.php

View workflow job for this annotation

GitHub Actions / Psalm (8.2, lowest)

TooManyTemplateParams

src/Utils/CategoryUtils.php:19:15: TooManyTemplateParams: Shopware\Core\Framework\DataAbstractionLayer\EntityRepository<Shopware\Core\Content\Category\CategoryCollection> has too many template params, expecting 0 (see https://psalm.dev/184)
*/
public function __construct(

Check failure on line 21 in src/Utils/CategoryUtils.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.2, lowest)

PHPDoc tag @param for parameter $categoryRepository contains generic type Shopware\Core\Framework\DataAbstractionLayer\EntityRepository<Shopware\Core\Content\Category\CategoryCollection> but class Shopware\Core\Framework\DataAbstractionLayer\EntityRepository is not generic.
private EntityRepository $categoryRepository,

Check failure on line 22 in src/Utils/CategoryUtils.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.2, lowest)

PHPDoc type for property Basecom\FixturePlugin\Utils\CategoryUtils::$categoryRepository contains generic type Shopware\Core\Framework\DataAbstractionLayer\EntityRepository<Shopware\Core\Content\Category\CategoryCollection> but class Shopware\Core\Framework\DataAbstractionLayer\EntityRepository is not generic.
) {
Expand Down
4 changes: 4 additions & 0 deletions src/Utils/CmsUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Basecom\FixturePlugin\Utils;

use Shopware\Core\Content\Cms\CmsPageCollection;
use Shopware\Core\Content\Cms\CmsPageEntity;
use Shopware\Core\Framework\Context;
use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository;
Expand All @@ -13,6 +14,9 @@

readonly class CmsUtils
{
/**
* @param EntityRepository<CmsPageCollection> $cmsPageRepository

Check failure on line 18 in src/Utils/CmsUtils.php

View workflow job for this annotation

GitHub Actions / Psalm (8.2, lowest)

TooManyTemplateParams

src/Utils/CmsUtils.php:18:15: TooManyTemplateParams: Shopware\Core\Framework\DataAbstractionLayer\EntityRepository<Shopware\Core\Content\Cms\CmsPageCollection> has too many template params, expecting 0 (see https://psalm.dev/184)
*/
public function __construct(

Check failure on line 20 in src/Utils/CmsUtils.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.2, lowest)

PHPDoc tag @param for parameter $cmsPageRepository contains generic type Shopware\Core\Framework\DataAbstractionLayer\EntityRepository<Shopware\Core\Content\Cms\CmsPageCollection> but class Shopware\Core\Framework\DataAbstractionLayer\EntityRepository is not generic.
private EntityRepository $cmsPageRepository,

Check failure on line 21 in src/Utils/CmsUtils.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.2, lowest)

PHPDoc type for property Basecom\FixturePlugin\Utils\CmsUtils::$cmsPageRepository contains generic type Shopware\Core\Framework\DataAbstractionLayer\EntityRepository<Shopware\Core\Content\Cms\CmsPageCollection> but class Shopware\Core\Framework\DataAbstractionLayer\EntityRepository is not generic.
) {
Expand Down
4 changes: 4 additions & 0 deletions src/Utils/CustomerUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@
use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository;
use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria;
use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\EqualsFilter;
use Shopware\Core\System\Salutation\SalutationCollection;
use Shopware\Core\System\Salutation\SalutationEntity;

readonly class CustomerUtils
{
/**
* @param EntityRepository<SalutationCollection> $salutationRepository

Check failure on line 17 in src/Utils/CustomerUtils.php

View workflow job for this annotation

GitHub Actions / Psalm (8.2, lowest)

TooManyTemplateParams

src/Utils/CustomerUtils.php:17:15: TooManyTemplateParams: Shopware\Core\Framework\DataAbstractionLayer\EntityRepository<Shopware\Core\System\Salutation\SalutationCollection> has too many template params, expecting 0 (see https://psalm.dev/184)
*/
public function __construct(

Check failure on line 19 in src/Utils/CustomerUtils.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.2, lowest)

PHPDoc tag @param for parameter $salutationRepository contains generic type Shopware\Core\Framework\DataAbstractionLayer\EntityRepository<Shopware\Core\System\Salutation\SalutationCollection> but class Shopware\Core\Framework\DataAbstractionLayer\EntityRepository is not generic.
private EntityRepository $salutationRepository,

Check failure on line 20 in src/Utils/CustomerUtils.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.2, lowest)

PHPDoc type for property Basecom\FixturePlugin\Utils\CustomerUtils::$salutationRepository contains generic type Shopware\Core\Framework\DataAbstractionLayer\EntityRepository<Shopware\Core\System\Salutation\SalutationCollection> but class Shopware\Core\Framework\DataAbstractionLayer\EntityRepository is not generic.
) {
Expand Down
6 changes: 6 additions & 0 deletions src/Utils/MediaUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,22 @@

namespace Basecom\FixturePlugin\Utils;

use Shopware\Core\Content\Media\Aggregate\MediaFolder\MediaFolderCollection;
use Shopware\Core\Content\Media\Aggregate\MediaFolder\MediaFolderEntity;
use Shopware\Core\Content\Media\File\FileFetcher;
use Shopware\Core\Content\Media\File\FileSaver;
use Shopware\Core\Content\Media\MediaCollection;
use Shopware\Core\Framework\Context;
use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository;
use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria;
use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\EqualsFilter;

readonly class MediaUtils
{
/**
* @param EntityRepository<MediaCollection> $mediaRepository

Check failure on line 20 in src/Utils/MediaUtils.php

View workflow job for this annotation

GitHub Actions / Psalm (8.2, lowest)

TooManyTemplateParams

src/Utils/MediaUtils.php:20:15: TooManyTemplateParams: Shopware\Core\Framework\DataAbstractionLayer\EntityRepository<Shopware\Core\Content\Media\MediaCollection> has too many template params, expecting 0 (see https://psalm.dev/184)
* @param EntityRepository<MediaFolderCollection> $mediaFolderRepository

Check failure on line 21 in src/Utils/MediaUtils.php

View workflow job for this annotation

GitHub Actions / Psalm (8.2, lowest)

TooManyTemplateParams

src/Utils/MediaUtils.php:21:15: TooManyTemplateParams: Shopware\Core\Framework\DataAbstractionLayer\EntityRepository<Shopware\Core\Content\Media\Aggregate\MediaFolder\MediaFolderCollection> has too many template params, expecting 0 (see https://psalm.dev/184)
*/
public function __construct(

Check failure on line 23 in src/Utils/MediaUtils.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.2, lowest)

PHPDoc tag @param for parameter $mediaFolderRepository contains generic type Shopware\Core\Framework\DataAbstractionLayer\EntityRepository<Shopware\Core\Content\Media\Aggregate\MediaFolder\MediaFolderCollection> but class Shopware\Core\Framework\DataAbstractionLayer\EntityRepository is not generic.

Check failure on line 23 in src/Utils/MediaUtils.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.2, lowest)

PHPDoc tag @param for parameter $mediaRepository contains generic type Shopware\Core\Framework\DataAbstractionLayer\EntityRepository<Shopware\Core\Content\Media\MediaCollection> but class Shopware\Core\Framework\DataAbstractionLayer\EntityRepository is not generic.
private EntityRepository $mediaRepository,

Check failure on line 24 in src/Utils/MediaUtils.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.2, lowest)

PHPDoc type for property Basecom\FixturePlugin\Utils\MediaUtils::$mediaRepository contains generic type Shopware\Core\Framework\DataAbstractionLayer\EntityRepository<Shopware\Core\Content\Media\MediaCollection> but class Shopware\Core\Framework\DataAbstractionLayer\EntityRepository is not generic.
private EntityRepository $mediaFolderRepository,

Check failure on line 25 in src/Utils/MediaUtils.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.2, lowest)

PHPDoc type for property Basecom\FixturePlugin\Utils\MediaUtils::$mediaFolderRepository contains generic type Shopware\Core\Framework\DataAbstractionLayer\EntityRepository<Shopware\Core\Content\Media\Aggregate\MediaFolder\MediaFolderCollection> but class Shopware\Core\Framework\DataAbstractionLayer\EntityRepository is not generic.
Expand Down
4 changes: 4 additions & 0 deletions src/Utils/PaymentMethodUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Basecom\FixturePlugin\Utils;

use Shopware\Core\Checkout\Payment\Cart\PaymentHandler\InvoicePayment;
use Shopware\Core\Checkout\Payment\PaymentMethodCollection;
use Shopware\Core\Checkout\Payment\PaymentMethodEntity;
use Shopware\Core\Framework\Context;
use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository;
Expand All @@ -13,6 +14,9 @@

readonly class PaymentMethodUtils
{
/**
* @param EntityRepository<PaymentMethodCollection> $paymentMethodRepository

Check failure on line 18 in src/Utils/PaymentMethodUtils.php

View workflow job for this annotation

GitHub Actions / Psalm (8.2, lowest)

TooManyTemplateParams

src/Utils/PaymentMethodUtils.php:18:15: TooManyTemplateParams: Shopware\Core\Framework\DataAbstractionLayer\EntityRepository<Shopware\Core\Checkout\Payment\PaymentMethodCollection> has too many template params, expecting 0 (see https://psalm.dev/184)
*/
public function __construct(
private EntityRepository $paymentMethodRepository,
) {
Expand Down
16 changes: 16 additions & 0 deletions src/Utils/SalesChannelUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,32 @@
use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository;
use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria;
use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\EqualsFilter;
use Shopware\Core\System\Country\CountryCollection;
use Shopware\Core\System\Country\CountryEntity;
use Shopware\Core\System\Currency\CurrencyCollection;
use Shopware\Core\System\Currency\CurrencyEntity;
use Shopware\Core\System\Language\LanguageCollection;
use Shopware\Core\System\Language\LanguageEntity;
use Shopware\Core\System\Locale\LocaleCollection;
use Shopware\Core\System\Locale\LocaleEntity;
use Shopware\Core\System\SalesChannel\SalesChannelCollection;
use Shopware\Core\System\SalesChannel\SalesChannelEntity;
use Shopware\Core\System\Snippet\Aggregate\SnippetSet\SnippetSetCollection;
use Shopware\Core\System\Snippet\Aggregate\SnippetSet\SnippetSetEntity;
use Shopware\Core\System\Tax\TaxCollection;
use Shopware\Core\System\Tax\TaxEntity;

readonly class SalesChannelUtils
{
/**
* @param EntityRepository<SalesChannelCollection> $salesChannelRepository

Check failure on line 30 in src/Utils/SalesChannelUtils.php

View workflow job for this annotation

GitHub Actions / Psalm (8.2, lowest)

TooManyTemplateParams

src/Utils/SalesChannelUtils.php:30:15: TooManyTemplateParams: Shopware\Core\Framework\DataAbstractionLayer\EntityRepository<Shopware\Core\System\SalesChannel\SalesChannelCollection> has too many template params, expecting 0 (see https://psalm.dev/184)
* @param EntityRepository<SnippetSetCollection> $snippetSetRepository

Check failure on line 31 in src/Utils/SalesChannelUtils.php

View workflow job for this annotation

GitHub Actions / Psalm (8.2, lowest)

TooManyTemplateParams

src/Utils/SalesChannelUtils.php:31:15: TooManyTemplateParams: Shopware\Core\Framework\DataAbstractionLayer\EntityRepository<Shopware\Core\System\Snippet\Aggregate\SnippetSet\SnippetSetCollection> has too many template params, expecting 0 (see https://psalm.dev/184)
* @param EntityRepository<TaxCollection> $taxRepository

Check failure on line 32 in src/Utils/SalesChannelUtils.php

View workflow job for this annotation

GitHub Actions / Psalm (8.2, lowest)

TooManyTemplateParams

src/Utils/SalesChannelUtils.php:32:15: TooManyTemplateParams: Shopware\Core\Framework\DataAbstractionLayer\EntityRepository<Shopware\Core\System\Tax\TaxCollection> has too many template params, expecting 0 (see https://psalm.dev/184)
* @param EntityRepository<CountryCollection> $countryRepository

Check failure on line 33 in src/Utils/SalesChannelUtils.php

View workflow job for this annotation

GitHub Actions / Psalm (8.2, lowest)

TooManyTemplateParams

src/Utils/SalesChannelUtils.php:33:15: TooManyTemplateParams: Shopware\Core\Framework\DataAbstractionLayer\EntityRepository<Shopware\Core\System\Country\CountryCollection> has too many template params, expecting 0 (see https://psalm.dev/184)
* @param EntityRepository<LanguageCollection> $languageRepository
* @param EntityRepository<CurrencyCollection> $currencyRepository
* @param EntityRepository<LocaleCollection> $localeRepository
*/
public function __construct(
private EntityRepository $salesChannelRepository,
private EntityRepository $snippetSetRepository,
Expand Down
4 changes: 4 additions & 0 deletions src/Utils/ShippingMethodUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Basecom\FixturePlugin\Utils;

use Shopware\Core\Checkout\Shipping\ShippingMethodCollection;
use Shopware\Core\Checkout\Shipping\ShippingMethodEntity;
use Shopware\Core\Framework\Context;
use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository;
Expand All @@ -12,6 +13,9 @@

readonly class ShippingMethodUtils
{
/**
* @param EntityRepository<ShippingMethodCollection> $shippingMethodRepository
*/
public function __construct(
private EntityRepository $shippingMethodRepository,
) {
Expand Down

0 comments on commit 48c9399

Please sign in to comment.