What are the Slack Archives?

Itโ€™s a history of our time together in the Slack Community! Thereโ€™s a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.

Because this space is not active, you wonโ€™t be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..

I get plenty of these errors while running phpstan: ``` 26 Method Pyz\Zed\ProductLabel

U018XELUZS9
U018XELUZS9 Posts: 167 ๐Ÿง‘๐Ÿปโ€๐Ÿš€ - Cadet

I get plenty of these errors while running phpstan:

  26     Method
         Pyz\Zed\ProductLabelStorage\Persistence\ProductLabelStorageQuery
         ContainerInterface::queryProductConcreteLocalizedByIds() return
         type has no value type specified in iterable type
         Orm\Zed\Product\Persistence\SpyProductLocalizedAttributesQuery.
         ๐Ÿ’ก Consider adding something like
         Orm\Zed\Product\Persistence\SpyProductLocalizedAttribut
         esQuery<Foo> to the PHPDoc.
         You can turn off this check by setting
         checkMissingIterableValueType: false in your
         phpstan.neon.

Has anyone a solution to that or should I just add checkMissingIterableValueType: false to my config?

Comments

  • sebastian.larisch
    sebastian.larisch Spryker Customer Posts: 143 ๐Ÿง‘๐Ÿปโ€๐Ÿš€ - Cadet

    it should work just adding this to your phpstan.neon file:

    parameters:
       ...
       checkMissingIterableValueType: false
    

    or just add the missing return type if Pyz is your project directory? you can also exclude the directories in the neon fil e if this an option:

    parameters:
        excludes_analyse:
            - %rootDir%/../src/Pyz/*
    
  • U018XELUZS9
    U018XELUZS9 Posts: 167 ๐Ÿง‘๐Ÿปโ€๐Ÿš€ - Cadet

    I know how to ignore or disable that, was looking into fixing the issue. The code looks like this:

    <?php declare(strict_types = 1);
    
    namespace Pyz\Zed\ProductLabelStorage\Persistence;
    
    use Orm\Zed\Product\Persistence\SpyProductLocalizedAttributesQuery;
    use Spryker\Zed\ProductLabelStorage\Persistence\ProductLabelStorageQueryContainerInterface as SprykerProductLabelStorageQueryContainerInterface;
    
    interface ProductLabelStorageQueryContainerInterface extends SprykerProductLabelStorageQueryContainerInterface
    {
        /**
         * @param array $productConcreteIds
         *
         * @return \Orm\Zed\Product\Persistence\SpyProductLocalizedAttributesQuery
         */
        public function queryProductConcreteLocalizedByIds(array $productConcreteIds): SpyProductLocalizedAttributesQuery;
    }
    
  • U01A5ARAXP0
    U01A5ARAXP0 Posts: 119 ๐Ÿง‘๐Ÿปโ€๐Ÿš€ - Cadet

    could it be that the interface implementation has a slight different phpDoc?

  • U018XELUZS9
    U018XELUZS9 Posts: 167 ๐Ÿง‘๐Ÿปโ€๐Ÿš€ - Cadet

    No, it's the same

  • U018XELUZS9
    U018XELUZS9 Posts: 167 ๐Ÿง‘๐Ÿปโ€๐Ÿš€ - Cadet

    I fixed this like so:

        /**
         * @param array<int> $productConcreteIds
         *
         * @return \Orm\Zed\Product\Persistence\SpyProductLocalizedAttributesQuery<\ArrayIterator|\Traversable>
         */
        public function queryProductConcreteLocalizedByIds(array $productConcreteIds): SpyProductLocalizedAttributesQuery;