nelmio / alice

Expressive fixtures generator
MIT License
2.5k stars 328 forks source link

PHP 8.0 invalid scalar type in NullRangeNameDenormalizer #1056

Closed dotdevio closed 4 years ago

dotdevio commented 4 years ago

On php 8.0 function str_replace called with $currentIndex which is int, but in php 8 it should be exactly string:

str_replace(): Argument #2 ($replace) must be of type array|string, int given

vendor/nelmio/alice/src/FixtureBuilder/Denormalizer/Fixture/Chainable/NullRangeNameDenormalizer.php:81
vendor/nelmio/alice/src/FixtureBuilder/Denormalizer/Fixture/Chainable/CollectionDenormalizerWithTemporaryFixture.php:83
vendor/nelmio/alice/src/FixtureBuilder/Denormalizer/Fixture/Chainable/CollectionDenormalizerWithTemporaryFixture.php:115
vendor/nelmio/alice/src/FixtureBuilder/Denormalizer/Fixture/Chainable/SimpleCollectionDenormalizer.php:104
vendor/nelmio/alice/src/FixtureBuilder/Denormalizer/Fixture/FixtureDenormalizerRegistry.php:60
vendor/nelmio/alice/src/FixtureBuilder/Denormalizer/Fixture/TolerantFixtureDenormalizer.php:43
vendor/nelmio/alice/src/FixtureBuilder/Denormalizer/Fixture/SimpleFixtureBagDenormalizer.php:83
vendor/nelmio/alice/src/FixtureBuilder/Denormalizer/SimpleDenormalizer.php:46
vendor/nelmio/alice/src/FixtureBuilder/SimpleBuilder.php:39
vendor/nelmio/alice/src/Loader/SimpleDataLoader.php:45
vendor/nelmio/alice/src/Loader/SimpleFileLoader.php:47
vendor/nelmio/alice/src/Loader/NativeLoader.php:259
tests/DataForm/Api/FormDocument/FormDocumentApiTest.php:63
vendor/phpunit/phpunit/src/Util/Annotation/DocBlock.php:427
vendor/phpunit/phpunit/src/Util/Annotation/DocBlock.php:284
vendor/phpunit/phpunit/src/Util/Test.php:319
vendor/phpunit/phpunit/src/Framework/TestBuilder.php:74
vendor/phpunit/phpunit/src/Framework/TestSuite.php:875
vendor/phpunit/phpunit/src/Framework/TestSuite.php:235
vendor/phpunit/phpunit/src/Framework/TestSuite.php:365
vendor/phpunit/phpunit/src/Framework/TestSuite.php:504
vendor/phpunit/phpunit/src/Framework/TestSuite.php:529
vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/TestSuite/TestSuiteMapper.php:50

vendor/phpunit/phpunit/src/Framework/WarningTestCase.php:71
vendor/phpunit/phpunit/src/Framework/TestResult.php:730
vendor/phpunit/phpunit/src/Framework/TestSuite.php:669
vendor/phpunit/phpunit/src/Framework/TestSuite.php:669
vendor/phpunit/phpunit/src/Framework/TestSuite.php:669
vendor/phpunit/phpunit/src/Framework/TestSuite.php:669
vendor/phpunit/phpunit/src/TextUI/TestRunner.php:673
        for ($currentIndex = $from; $currentIndex <= $to; $currentIndex += $step) {
            $ids[
                str_replace(
                    $this->token,
                    //$currentIndex,
                    (string)$currentIndex,
                    $range->getName()
                )
            ] = $currentIndex;
        }
theofidry commented 4 years ago

Thanks for the report, would you mind opening a PR with the fix? šŸ™