Merge branch '2.0' into bootstrap-shop

* 2.0:
  Minor improvements in PHPStan configuration
  [Taxonomy] Fix Taxon spec
  [PHPStan] Support both sylius/resource-bundle 1.10 and 1.11
This commit is contained in:
Grzegorz Sadowski 2024-09-02 08:39:05 +02:00
commit 79cfff73e9
No known key found for this signature in database
GPG key ID: EF87FF4E6E3BD364
2 changed files with 47 additions and 12 deletions

View file

@ -36,6 +36,35 @@ parameters:
# Random errors related to Template Events (we're going to replace them with Twig Events anyway) # Random errors related to Template Events (we're going to replace them with Twig Events anyway)
- 'src/Sylius/Bundle/UiBundle/Console/Command/DebugTemplateEventCommand.php' - 'src/Sylius/Bundle/UiBundle/Console/Command/DebugTemplateEventCommand.php'
# To support both sylius/resource-bundle 1.11 and older versions
- 'src/Sylius/Bundle/AdminBundle/Controller/RedirectHandler.php'
- 'src/Sylius/Bundle/ApiBundle/OpenApi/Documentation/AcceptLanguageHeaderDocumentationModifier.php'
- 'src/Sylius/Bundle/CoreBundle/Doctrine/ORM/Handler/ResourceDeleteHandler.php'
- 'src/Sylius/Bundle/CoreBundle/Doctrine/ORM/Handler/ResourceUpdateHandler.php'
- 'src/Sylius/Bundle/CoreBundle/Fixture/Factory/PromotionExampleFactory.php'
- 'src/Sylius/Bundle/CoreBundle/Resource/StateMachine/Controller/CompositeStateMachine.php'
- 'src/Sylius/Bundle/CoreBundle/Validator/Constraints/ChannelCodeCollectionValidator.php'
- 'src/Sylius/Bundle/CoreBundle/Validator/Constraints/CountryCodeExistsValidator.php'
- 'src/Sylius/Bundle/CoreBundle/Validator/Constraints/ResendOrderConfirmationEmailWithValidOrderStateValidator.php'
- 'src/Sylius/Bundle/CoreBundle/Validator/Constraints/ResendShipmentConfirmationEmailWithValidShipmentStateValidator.php'
- 'src/Sylius/Bundle/PromotionBundle/Form/Type/PromotionCouponToCodeType.php'
- 'src/Sylius/Bundle/TaxonomyBundle/Controller/TaxonSlugController.php'
- 'src/Sylius/Bundle/UserBundle/Factory/UserWithEncoderFactory.php'
- 'src/Sylius/Component/Addressing/Matcher/ZoneMatcher.php'
- 'src/Sylius/Component/Core/Customer/Statistics/CustomerStatisticsProvider.php'
- 'src/Sylius/Component/Core/Factory/ChannelFactory.php'
- 'src/Sylius/Component/Core/Factory/PaymentMethodFactory.php'
- 'src/Sylius/Component/Core/Factory/PromotionActionFactory.php'
- 'src/Sylius/Component/Core/Promotion/Checker/ProductInPromotionRuleChecker.php'
- 'src/Sylius/Component/Core/Promotion/Checker/TaxonInPromotionRuleChecker.php'
- 'src/Sylius/Component/Core/Provider/TranslationLocaleProvider.php'
- 'src/Sylius/Component/Core/Test/Tests/Taxation/Applicator/OrderItemUnitsTaxesApplicatorTest.php'
- 'src/Sylius/Component/Core/Test/Tests/Taxation/Applicator/OrderItemsTaxesApplicatorTest.php'
- 'src/Sylius/Component/Core/Translation/TranslatableEntityLocaleAssigner.php'
- 'src/Sylius/Component/Locale/Provider/LocaleCollectionProvider.php'
- 'src/Sylius/Component/Locale/Provider/LocaleProvider.php'
ignoreErrors: ignoreErrors:
- '/(Interface|Class) [a-zA-Z\\]+ specifies template type (\w+) of interface [a-zA-Z\\]+ as [a-zA-Z\\]+ (of [a-zA-Z\\]+ )?but it''s already specified as/' # turns off a weird generics check behavior, we are basing on Psalm for generics checks - '/(Interface|Class) [a-zA-Z\\]+ specifies template type (\w+) of interface [a-zA-Z\\]+ as [a-zA-Z\\]+ (of [a-zA-Z\\]+ )?but it''s already specified as/' # turns off a weird generics check behavior, we are basing on Psalm for generics checks
- '/Access to an undefined property Doctrine\\Common\\Collections\\ArrayCollection/' - '/Access to an undefined property Doctrine\\Common\\Collections\\ArrayCollection/'
@ -49,3 +78,12 @@ parameters:
- '/Method [a-zA-z\\]+Persister\:\:(persist|remove|supports)\(\) has parameter \$data with no type specified./' - '/Method [a-zA-z\\]+Persister\:\:(persist|remove|supports)\(\) has parameter \$data with no type specified./'
- '/Method Sylius\\Bundle\\AdminBundle\\Twig\\Component\\[a-zA-Z\\]+\:\:getDataModelValue\(\) is unused./' - '/Method Sylius\\Bundle\\AdminBundle\\Twig\\Component\\[a-zA-Z\\]+\:\:getDataModelValue\(\) is unused./'
- '/Method Sylius\\Bundle\\ShopBundle\\Twig\\Component\\[a-zA-Z\\]+\:\:getDataModelValue\(\) is unused./' - '/Method Sylius\\Bundle\\ShopBundle\\Twig\\Component\\[a-zA-Z\\]+\:\:getDataModelValue\(\) is unused./'
# To support both sylius/resource-bundle 1.11 and older versions
- '/Call to an undefined method Sylius\\Resource\\Model\\ResourceInterface::\w+\(\)\./'
- '/Method Sylius\\Component\\Payment\\Resolver\\PaymentMethodsResolver::getSupportedMethods\(\) should return array<Sylius\\Component\\Payment\\Model\\PaymentMethodInterface> but returns array<int, Sylius\\Resource\\Model\\ResourceInterface>\./'
- '/Method Sylius\\Component\\Taxation\\Resolver\\TaxRateResolver::resolve\(\) should return Sylius\\Component\\Taxation\\Model\\TaxRateInterface\|null but returns Sylius\\Resource\\Model\\ResourceInterface\|null\./'
- '/Parameter #\d+ \$(\w+) \(Sylius\\Component\\\w+\\Model\\\w+(\|null)?\) of method Sylius\\Bundle\\\w+\\Controller\\\w+::\w+\(\) is not contravariant with parameter #\d+ \$(\w+) \(Sylius\\Resource\\Model\\\w+(\|null)?\) of method Sylius\\Bundle\\\w+\\Controller\\\w+\::\w+\(\)\./'
- '/PHPDoc tag @extends contains generic type Sylius\\Component\\Resource\\\w+\\\w+<Sylius\\Component\\\w+\\Model\\\w+> but interface Sylius\\Component\\Resource\\\w+\\\w+ is not generic\./'
- '/PHPDoc tag @param for parameter \$(\w+) contains generic type Sylius\\Component\\Resource\\\w+\\\w+<Sylius\\Component\\\w+\\Model\\\w+> but interface Sylius\\Component\\Resource\\\w+\\\w+ is not generic\./'
- '/PHPDoc type for property Sylius\\Bundle\\\w+\\\w+\\\w+::\$(\w+) contains generic type Sylius\\Component\\Resource\\\w+\\\w+<Sylius\\Component\\\w+\\Model\\\w+> but interface Sylius\\Component\\Resource\\\w+\\\w+ is not generic\./'

View file

@ -129,23 +129,20 @@ final class TaxonSpec extends ObjectBehavior
$this->getFullname()->shouldReturn('Category'); $this->getFullname()->shouldReturn('Category');
} }
function its_fullname_prepends_with_parents_fullname(): void function its_fullname_prepends_with_parents_fullname(
{ TaxonInterface $clothesTaxon,
$rootTaxon = new Taxon(); TaxonInterface $rootTaxon,
$rootTaxon->setCurrentLocale('en_US'); ): void {
$rootTaxon->setName('Category'); $rootTaxon->getFullname(' / ')->willReturn('Category');
$clothesTaxon = new Taxon(); $clothesTaxon->getFullname(' / ')->willReturn('Category / Clothes');
$clothesTaxon->setCurrentLocale('en_US'); $clothesTaxon->getParent()->willReturn($rootTaxon);
$clothesTaxon->setName('Clothes'); $clothesTaxon->addChild($this)->shouldBeCalled();
$clothesTaxon->setParent($rootTaxon);
$this->setCurrentLocale('en_US');
$this->setName('T-shirts');
$this->setParent($clothesTaxon); $this->setParent($clothesTaxon);
$this->setName('T-shirts');
$this->getFullname()->shouldReturn('Category / Clothes / T-shirts'); $this->getFullname()->shouldReturn('Category / Clothes / T-shirts');
$this->getFullname(' -- ')->shouldReturn('Category -- Clothes -- T-shirts');
} }
function it_has_no_description_by_default(): void function it_has_no_description_by_default(): void