Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type error in mapper() when calling current() on an empty collection #42

Conversation

dbrumann
Copy link
Contributor

@dbrumann dbrumann commented Aug 4, 2021

⚠️ This is currently only a reproducer for the issue. I get the following output when running the test:

vendor/bin/phpunit test/unit/CurrentOnEmptyCollectionTest.php              
PHPUnit 9.5.4 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.0.8
Configuration: /Users/dbr/workspace/commercetools/commercetools-sdk-php-v2/phpunit.xml.dist

E                                                                   1 / 1 (100%)

Time: 00:00.004, Memory: 6.00 MB

There was 1 error:

1) Commercetools\UnitTest\CurrentOnEmptyCollectionTest::testCurrentOnEmptyCollection
TypeError: Commercetools\Api\Models\Common\BaseResourceCollection::Commercetools\Api\Models\Common\{closure}(): Argument #1 ($index) must be of type int, null given

/Users/dbr/workspace/commercetools/commercetools-sdk-php-v2/lib/commercetools-api/src/Models/Common/BaseResourceCollection.php:47
/Users/dbr/workspace/commercetools/commercetools-sdk-php-v2/lib/commercetools-base/src/Base/MapperIterator.php:28
/Users/dbr/workspace/commercetools/commercetools-sdk-php-v2/lib/commercetools-base/src/Base/MapperSequence.php:161
/Users/dbr/workspace/commercetools/commercetools-sdk-php-v2/test/unit/CurrentOnEmptyCollectionTest.php:16

ERRORS!
Tests: 1, Assertions: 0, Errors: 1.

Fixes #41

@jenschude jenschude merged commit 20d8f1e into commercetools:master Aug 4, 2021
@dbrumann dbrumann deleted the type_error_current_on_empty_collection branch August 4, 2021 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TypeError caused by mapper() in MapperSequence
2 participants