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

Exception thrown when using ReturnTypeDeclarationRector::class and bcmath extension #6896

Closed
internalsystemerror opened this issue Dec 29, 2021 · 4 comments · Fixed by rectorphp/rector-src#1588
Labels

Comments

@internalsystemerror
Copy link

internalsystemerror commented Dec 29, 2021

Bug Report

Subject Details
Rector version 0.12.9

When running rector set to PHP 8.1, and using the SetList::TYPE_DECLARATION an exception is thrown for @return numeric-string (Edit: I've just tried this with @return string and the same still applies so I'm not sure what at all is happening here). I've tried to recreate the problem using the demo below, however this doesn't show an exception, it just returns the page with no output whereas normally there would be a rector output saying "no changes".

Minimal PHP Code Causing Issue

Demo: https://getrector.org/demo/1ec68b36-cdab-6cc4-99a7-55325363ad15
(Edit: I don't think this demo is helpful and it could be just because the bcmath extension is not included in demo)

Expected Behaviour

Rector should not throw an exception and should either refactor the code, report an error for me to change my code, or it should skip it.

Further information

The specific error in console is:

> rector process
  118/1138 [▓▓░░░░░░░░░░░░░░░░░░░░░░░░░░]  10%
In PHPStanStaticTypeMapper.php line 57:

  Rector\PHPStanStaticTypeMapper\PHPStanStaticTypeMapper::mapToPhpParserNode for PHPStan\Type\Accessory\AccessoryNumericStringType  


process [-o|--output-format [OUTPUT-FORMAT]] [-n|--dry-run] [-a|--autoload-file AUTOLOAD-FILE] [--no-progress-bar] [--no-diffs] [--clear-cache] [--port PORT] [--ide
ntifier IDENTIFIER] [--] [<source>...]

Script rector process handling the rector event returned with error code 1

and the full exception when debugging:

PHP Fatal error:  Uncaught Rector\Core\Exception\NotImplementedYetException: Rector\PHPStanStaticTypeMapper\PHPStanStaticTypeMapper::mapToPhpParserNode for PHPStan\
Type\Accessory\AccessoryNumericStringType in /home/ise/projects/creativecow/stratum-monorepo-php/vendor/rector/rector/packages/PHPStanStaticTypeMapper/PHPStanStatic
TypeMapper.php:57

Thank you for making rector, I hope I will give back in contributions over time.

@internalsystemerror
Copy link
Author

The relevant debug output is:

[parsing] lib/carlease/driver/src/Deal/Parser.php
[refactoring] lib/carlease/driver/src/Deal/Parser.php
    [applying] Rector\Php74\Rector\LNumber\AddLiteralSeparatorToNumberRector
    [applying] Rector\PSR4\Rector\FileWithoutNamespace\NormalizeNamespaceByPSR4ComposerAutoloadRector
    [applying] Rector\PSR4\Rector\Namespace_\MultipleClassFileToPsr4ClassesRector
    [applying] Rector\Renaming\Rector\Name\RenameClassRector
    [applying] Rector\CodingStyle\Rector\Use_\SeparateMultiUseImportsRector
    [applying] Rector\Php80\Rector\Class_\StringableForToStringRector
    [applying] Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector
    [applying] Rector\Php81\Rector\Class_\MyCLabsClassToEnumRector
    [applying] Rector\Php81\Rector\Class_\SpatieEnumClassToEnumRector
    [applying] Rector\DependencyInjection\Rector\Class_\ActionInjectionToConstructorInjectionRector
    [applying] Rector\CodeQuality\Rector\Class_\CompleteDynamicPropertiesRector
    [applying] Rector\CodingStyle\Rector\Class_\AddArrayDefaultToArrayPropertyRector
    [applying] Rector\Order\Rector\Class_\OrderPrivateMethodsByUseRector
    [applying] Rector\Php52\Rector\Property\VarToPublicPropertyRector
    [applying] Rector\Php71\Rector\Assign\AssignArrayToStringRector
    [applying] Rector\Php74\Rector\Property\TypedPropertyRector
    [applying] Rector\Php74\Rector\Property\RestoreDefaultNullToNullableTypePropertyRector
    [applying] Rector\Php81\Rector\Property\ReadOnlyPropertyRector
    [applying] Rector\CodeQuality\Rector\ClassMethod\DateTimeToDateTimeInterfaceRector
    [applying] Rector\CodingStyle\Rector\ClassConst\SplitGroupedConstantsAndPropertiesRector
    [applying] Rector\CodingStyle\Rector\Property\AddFalseDefaultToBoolPropertyRector
    [applying] Rector\TypeDeclaration\Rector\Property\PropertyTypeDeclarationRector
    [applying] Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictConstructorRector
    [applying] Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictGetterMethodReturnTypeRector
    [applying] Rector\CodeQuality\Rector\Array_\CallableThisArrayToAnonymousFunctionRector
    [applying] Rector\CodeQuality\Rector\Array_\ArrayThisCallToThisMethodCallRector
    [applying] Rector\Php56\Rector\FunctionLike\AddDefaultValueForUndefinedVariableRector
    [applying] Rector\Php70\Rector\ClassMethod\Php4ConstructorRector
    [applying] Rector\Php70\Rector\FunctionLike\ExceptionHandlerTypehintRector
    [applying] Rector\Php80\Rector\FunctionLike\UnionTypesRector
    [applying] Rector\Arguments\Rector\ClassMethod\ArgumentAdderRector
    [applying] Rector\Php80\Rector\ClassMethod\SetStateToStaticRector
    [applying] Rector\Php80\Rector\ClassMethod\FinalPrivateToPrivateVisibilityRector
    [applying] Rector\Php80\Rector\ClassMethod\OptionalParametersAfterRequiredRector
    [applying] Rector\Php80\Rector\ClassMethod\AddParamBasedOnParentClassMethodRector
    [applying] Rector\TypeDeclaration\Rector\ClassMethod\ReturnNeverTypeRector
    [applying] Rector\Php81\Rector\ClassMethod\NewInInitializerRector
    [applying] Rector\Php81\Rector\FunctionLike\IntersectionTypesRector
    [applying] Rector\Renaming\Rector\MethodCall\RenameMethodRector
    [applying] Rector\CodeQuality\Rector\FunctionLike\RemoveAlwaysTrueConditionSetInConstructorRector
    [applying] Rector\CodeQuality\Rector\ClassMethod\NarrowUnionTypeDocRector
    [applying] Rector\CodingStyle\Rector\ClassMethod\FuncGetArgsToVariadicParamRector
    [applying] Rector\CodingStyle\Rector\ClassMethod\NewlineBeforeNewAssignSetRector
    [applying] Rector\CodingStyle\Rector\ClassMethod\MakeInheritedMethodVisibilitySameAsParentRector
    [applying] Rector\CodingStyle\Rector\ClassMethod\RemoveDoubleUnderscoreInMethodNameRector
    [applying] Rector\CodingStyle\Rector\ClassMethod\UnSpreadOperatorRector
    [applying] Rector\TypeDeclaration\Rector\FunctionLike\ParamTypeDeclarationRector
    [applying] Rector\TypeDeclaration\Rector\FunctionLike\ReturnTypeDeclarationRector
    [applying] Rector\TypeDeclaration\Rector\ClassMethod\AddArrayParamDocTypeRector
    [applying] Rector\TypeDeclaration\Rector\ClassMethod\AddArrayReturnDocTypeRector
    [applying] Rector\TypeDeclaration\Rector\ClassMethod\ParamTypeByParentCallTypeRector
    [applying] Rector\TypeDeclaration\Rector\ClassMethod\ParamTypeByMethodCallTypeRector
    [applying] Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictTypedPropertyRector
    [applying] Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictTypedCallRector
    [applying] Rector\TypeDeclaration\Rector\ClassMethod\AddVoidReturnTypeWhereNoReturnRector
    [applying] Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromReturnNewRector
    [applying] Rector\TypeDeclaration\Rector\ClassMethod\AddMethodCallBasedStrictParamTypeRector
    [applying] Rector\TypeDeclaration\Rector\Param\ParamTypeFromStrictTypedPropertyRector
    [applying] Rector\Php53\Rector\Variable\ReplaceHttpServerVarsByServerRector
    [applying] Rector\Php70\Rector\Variable\WrapVariableVariableNameInCurlyBracesRector
    [applying] Rector\CodeQuality\Rector\Expression\InlineIfToExplicitIfRector
    [applying] Rector\MysqlToMysqli\Rector\Assign\MysqlAssignToMysqliRector
    [applying] Rector\Php70\Rector\Assign\ListSplitStringRector
    [applying] Rector\Php70\Rector\Assign\ListSwapArrayOrderRector
    [applying] Rector\Php72\Rector\Assign\ListEachRector
    [applying] Rector\Php72\Rector\Assign\ReplaceEachAssignmentWithKeyCurrentRector
    [applying] Rector\Php72\Rector\Unset_\UnsetCastRector
    [applying] Rector\Php74\Rector\Assign\NullCoalescingOperatorRector
    [applying] Rector\CodeQuality\Rector\Assign\CombinedAssignRector
    [applying] Rector\CodeQuality\Rector\Assign\SplitListAssignToSeparateLineRector
    [applying] Rector\CodeQuality\Rector\PropertyFetch\ExplicitMethodCallOverMagicGetSetRector
    [applying] Rector\CodingStyle\Rector\Assign\PHPStormVarAnnotationRector
    [applying] Rector\CodingStyle\Rector\Assign\SplitDoubleAssignRector
    [applying] Rector\Php70\Rector\MethodCall\ThisCallOnStaticMethodToStaticCallRector
    [applying] Rector\Php70\Rector\FuncCall\NonVariableToVariableOnFunctionCallRector
    [applying] Rector\Php71\Rector\FuncCall\RemoveExtraParametersRector
    [applying] Rector\Php74\Rector\MethodCall\ChangeReflectionTypeToStringToGetNameRector
    [applying] Rector\Php81\Rector\MethodCall\MyCLabsMethodCallToEnumConstRector
    [applying] Rector\Php55\Rector\String_\StringClassNameToClassConstantRector
    [applying] Rector\Php73\Rector\String_\SensitiveHereNowDocRector
    [applying] Rector\CodingStyle\Rector\String_\SymplifyQuoteEscapeRector
    [applying] Rector\Renaming\Rector\ConstFetch\RenameConstantRector
    [applying] Rector\Php73\Rector\ConstFetch\SensitiveConstantNameRector
    [applying] Rector\CodeQuality\Rector\New_\NewStaticToNewSelfRector
    [applying] Rector\CodeQuality\Rector\Return_\SimplifyUselessVariableRector
    [applying] Rector\Php70\Rector\If_\IfToSpaceshipRector
    [applying] Rector\CodeQuality\Rector\If_\SimplifyIfNotNullReturnRector
    [applying] Rector\CodeQuality\Rector\If_\SimplifyIfReturnBoolRector
    [applying] Rector\CodeQuality\Rector\If_\SimplifyIfElseToTernaryRector
    [applying] Rector\CodeQuality\Rector\If_\ConsecutiveNullCompareReturnsToNullCoalesceQueueRector
    [applying] Rector\CodeQuality\Rector\If_\SimplifyIfIssetToNullCoalescingRector
    [applying] Rector\CodeQuality\Rector\If_\ExplicitBoolCompareRector
    [applying] Rector\CodeQuality\Rector\If_\CombineIfRector
    [applying] Rector\CodeQuality\Rector\If_\ShortenElseIfRector
    [applying] Rector\CodeQuality\Rector\If_\SimplifyIfNullableReturnRector
    [applying] Rector\CodingStyle\Rector\If_\NullableCompareToNullRector
    [applying] Rector\CodeQuality\Rector\BooleanNot\ReplaceMultipleBooleanNotRector
    [applying] Rector\CodeQuality\Rector\Identical\SimplifyConditionsRector
    [applying] Rector\CodeQuality\Rector\BooleanNot\SimplifyDeMorganBinaryRector
    [applying] Rector\CodeQuality\Rector\Identical\BooleanNotIdenticalToNotIdenticalRector
    [applying] Rector\CodingStyle\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector
    [applying] Rector\CodeQuality\Rector\Foreach_\ForeachToInArrayRector
    [applying] Rector\CodeQuality\Rector\Foreach_\SimplifyForeachToCoalescingRector
    [applying] Rector\CodeQuality\Rector\Foreach_\SimplifyForeachToArrayFilterRector
    [applying] Rector\CodeQuality\Rector\Foreach_\ForeachItemsAssignToEmptyArrayToAssignRector
    [applying] Rector\CodeQuality\Rector\Foreach_\UnusedForeachValueToArrayKeysRector
    [applying] Rector\Php71\Rector\BinaryOp\BinaryOpBetweenNumberAndStringRector
    [applying] Rector\CodeQuality\Rector\Concat\JoinStringConcatRector
    [applying] Rector\CodeQuality\Rector\BooleanAnd\SimplifyEmptyArrayCheckRector
    [applying] Rector\Php80\Rector\NotIdentical\StrContainsRector
    [applying] Rector\Php80\Rector\Identical\StrStartsWithRector
    [applying] Rector\Php80\Rector\Identical\StrEndsWithRector
    [applying] Rector\CodeQuality\Rector\Identical\GetClassToInstanceOfRector
    [applying] Rector\CodeQuality\Rector\Identical\SimplifyArraySearchRector
    [applying] Rector\CodeQuality\Rector\Identical\SimplifyBoolIdenticalTrueRector
PHP Fatal error:  Uncaught Rector\Core\Exception\NotImplementedYetException: Rector\PHPStanStaticTypeMapper\PHPStanStaticTypeMapper::mapToPhpParserNode for PHPStan\
Type\Accessory\AccessoryNumericStringType in /home/ise/projects/creativecow/stratum-monorepo-php/vendor/rector/rector/packages/PHPStanStaticTypeMapper/PHPStanStatic
TypeMapper.php:57
Stack trace:
#0 /home/ise/projects/creativecow/stratum-monorepo-php/vendor/rector/rector/packages/PHPStanStaticTypeMapper/TypeMapper/IntersectionTypeMapper.php(76): Rector\PHPSt
anStaticTypeMapper\PHPStanStaticTypeMapper->mapToPhpParserNode()
#1 /home/ise/projects/creativecow/stratum-monorepo-php/vendor/rector/rector/packages/PHPStanStaticTypeMapper/PHPStanStaticTypeMapper.php(55): Rector\PHPStanStaticTy
peMapper\TypeMapper\IntersectionTypeMapper->mapToPhpParserNode()
#2 /home/ise/projects/creativecow/stratum-monorepo-php/vendor/rector/rector/packages/StaticTypeMapper/StaticTypeMapper.php(69): Rector\PHPStanStaticTypeMapper\PHPSt
anStaticTypeMapper->mapToPhpParserNode()
#3 /home/ise/projects/creativecow/stratum-monorepo-php/vendor/rector/rector/rules/TypeDeclaration/TypeAlreadyAddedChecker/ReturnTypeAlreadyAddedChecker.php(73): Rec
tor\StaticTypeMapper\StaticTypeMapper->mapPHPStanTypeToPhpParserNode()
#4 /home/ise/projects/creativecow/stratum-monorepo-php/vendor/rector/rector/rules/TypeDeclaration/Rector/FunctionLike/ReturnTypeDeclarationRector.php(129): Rector\T
ypeDeclaration\TypeAlreadyAddedChecker\ReturnTypeAlreadyAddedChecker->isSameOrBetterReturnTypeAlreadyAdded()
#5 /home/ise/projects/creativecow/stratum-monorepo-php/vendor/rector/rector/src/Rector/AbstractRector.php(237): Rector\TypeDeclaration\Rector\FunctionLike\ReturnTyp
eDeclarationRector->refactor()
#6 /home/ise/projects/creativecow/stratum-monorepo-php/vendor/rector/rector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php(176): Rector\Core\Rector\Abstrac
tRector->enterNode()
#7 /home/ise/projects/creativecow/stratum-monorepo-php/vendor/rector/rector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php(105): PhpParser\NodeTraverser->t
raverseArray()
#8 /home/ise/projects/creativecow/stratum-monorepo-php/vendor/rector/rector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php(196): PhpParser\NodeTraverser->t
raverseNode()
#9 /home/ise/projects/creativecow/stratum-monorepo-php/vendor/rector/rector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php(105): PhpParser\NodeTraverser->t
raverseArray()
#10 /home/ise/projects/creativecow/stratum-monorepo-php/vendor/rector/rector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php(196): PhpParser\NodeTraverser->
traverseNode()
#11 /home/ise/projects/creativecow/stratum-monorepo-php/vendor/rector/rector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php(85): PhpParser\NodeTraverser->t
raverseArray()
#12 /home/ise/projects/creativecow/stratum-monorepo-php/vendor/rector/rector/src/PhpParser/NodeTraverser/RectorNodeTraverser.php(56): PhpParser\NodeTraverser->trave
rse()
#13 /home/ise/projects/creativecow/stratum-monorepo-php/vendor/rector/rector/src/Application/FileProcessor.php(57): Rector\Core\PhpParser\NodeTraverser\RectorNodeTr
averser->traverse()
#14 /home/ise/projects/creativecow/stratum-monorepo-php/vendor/rector/rector/src/Application/FileProcessor/PhpFileProcessor.php(137): Rector\Core\Application\FilePr
ocessor->refactor()
#15 /home/ise/projects/creativecow/stratum-monorepo-php/vendor/rector/rector/src/Application/FileProcessor/PhpFileProcessor.php(101): Rector\Core\Application\FilePr
ocessor\PhpFileProcessor->refactorNodesWithRectors()
#16 /home/ise/projects/creativecow/stratum-monorepo-php/vendor/rector/rector/src/Application/ApplicationFileProcessor.php(96): Rector\Core\Application\FileProcessor
\PhpFileProcessor->process()
#17 /home/ise/projects/creativecow/stratum-monorepo-php/vendor/rector/rector/src/Application/ApplicationFileProcessor.php(74): Rector\Core\Application\ApplicationFi
leProcessor->processFiles()
#18 /home/ise/projects/creativecow/stratum-monorepo-php/vendor/rector/rector/src/Console/Command/ProcessCommand.php(161): Rector\Core\Application\ApplicationFilePro
cessor->run()
#19 /home/ise/projects/creativecow/stratum-monorepo-php/vendor/rector/rector/vendor/symfony/console/Command/Command.php(282): Rector\Core\Console\Command\ProcessCom
mand->execute()
#20 /home/ise/projects/creativecow/stratum-monorepo-php/vendor/rector/rector/vendor/symfony/console/Application.php(853): RectorPrefix20211221\Symfony\Component\Con
sole\Command\Command->run()
#21 /home/ise/projects/creativecow/stratum-monorepo-php/vendor/rector/rector/vendor/symfony/console/Application.php(289): RectorPrefix20211221\Symfony\Component\Con
sole\Application->doRunCommand()
#22 /home/ise/projects/creativecow/stratum-monorepo-php/vendor/rector/rector/src/Console/ConsoleApplication.php(67): RectorPrefix20211221\Symfony\Component\Console\
Application->doRun()
#23 /home/ise/projects/creativecow/stratum-monorepo-php/vendor/rector/rector/vendor/symfony/console/Application.php(187): Rector\Core\Console\ConsoleApplication->do
Run()
#24 /home/ise/projects/creativecow/stratum-monorepo-php/vendor/rector/rector/bin/rector.php(56): RectorPrefix20211221\Symfony\Component\Console\Application->run()  
#25 /home/ise/projects/creativecow/stratum-monorepo-php/vendor/rector/rector/bin/rector(5): require_once('...')
#26 /home/ise/projects/creativecow/stratum-monorepo-php/vendor/bin/rector(97): include('...')
#27 {main}
  thrown in /home/ise/projects/creativecow/stratum-monorepo-php/vendor/rector/rector/packages/PHPStanStaticTypeMapper/PHPStanStaticTypeMapper.php on line 57        
Fatal error: Uncaught Rector\Core\Exception\NotImplementedYetException: Rector\PHPStanStaticTypeMapper\PHPStanStaticTypeMapper::mapToPhpParserNode for PHPStan\Type\
Accessory\AccessoryNumericStringType in /home/ise/projects/creativecow/stratum-monorepo-php/vendor/rector/rector/packages/PHPStanStaticTypeMapper/PHPStanStaticTypeM
apper.php:57
Stack trace:
#0 /home/ise/projects/creativecow/stratum-monorepo-php/vendor/rector/rector/packages/PHPStanStaticTypeMapper/TypeMapper/IntersectionTypeMapper.php(76): Rector\PHPSt
anStaticTypeMapper\PHPStanStaticTypeMapper->mapToPhpParserNode()
#1 /home/ise/projects/creativecow/stratum-monorepo-php/vendor/rector/rector/packages/PHPStanStaticTypeMapper/PHPStanStaticTypeMapper.php(55): Rector\PHPStanStaticTy
peMapper\TypeMapper\IntersectionTypeMapper->mapToPhpParserNode()
#2 /home/ise/projects/creativecow/stratum-monorepo-php/vendor/rector/rector/packages/StaticTypeMapper/StaticTypeMapper.php(69): Rector\PHPStanStaticTypeMapper\PHPSt
anStaticTypeMapper->mapToPhpParserNode()
#3 /home/ise/projects/creativecow/stratum-monorepo-php/vendor/rector/rector/rules/TypeDeclaration/TypeAlreadyAddedChecker/ReturnTypeAlreadyAddedChecker.php(73): Rec
tor\StaticTypeMapper\StaticTypeMapper->mapPHPStanTypeToPhpParserNode()
#4 /home/ise/projects/creativecow/stratum-monorepo-php/vendor/rector/rector/rules/TypeDeclaration/Rector/FunctionLike/ReturnTypeDeclarationRector.php(129): Rector\T
ypeDeclaration\TypeAlreadyAddedChecker\ReturnTypeAlreadyAddedChecker->isSameOrBetterReturnTypeAlreadyAdded()
#5 /home/ise/projects/creativecow/stratum-monorepo-php/vendor/rector/rector/src/Rector/AbstractRector.php(237): Rector\TypeDeclaration\Rector\FunctionLike\ReturnTyp
eDeclarationRector->refactor()
#6 /home/ise/projects/creativecow/stratum-monorepo-php/vendor/rector/rector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php(176): Rector\Core\Rector\Abstrac
tRector->enterNode()
#7 /home/ise/projects/creativecow/stratum-monorepo-php/vendor/rector/rector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php(105): PhpParser\NodeTraverser->t
raverseArray()
#8 /home/ise/projects/creativecow/stratum-monorepo-php/vendor/rector/rector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php(196): PhpParser\NodeTraverser->t
raverseNode()
#9 /home/ise/projects/creativecow/stratum-monorepo-php/vendor/rector/rector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php(105): PhpParser\NodeTraverser->t
raverseArray()
#10 /home/ise/projects/creativecow/stratum-monorepo-php/vendor/rector/rector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php(196): PhpParser\NodeTraverser->
traverseNode()
#11 /home/ise/projects/creativecow/stratum-monorepo-php/vendor/rector/rector/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php(85): PhpParser\NodeTraverser->t
raverseArray()
#12 /home/ise/projects/creativecow/stratum-monorepo-php/vendor/rector/rector/src/PhpParser/NodeTraverser/RectorNodeTraverser.php(56): PhpParser\NodeTraverser->trave
rse()
#13 /home/ise/projects/creativecow/stratum-monorepo-php/vendor/rector/rector/src/Application/FileProcessor.php(57): Rector\Core\PhpParser\NodeTraverser\RectorNodeTr
averser->traverse()
#14 /home/ise/projects/creativecow/stratum-monorepo-php/vendor/rector/rector/src/Application/FileProcessor/PhpFileProcessor.php(137): Rector\Core\Application\FilePr
ocessor->refactor()
#15 /home/ise/projects/creativecow/stratum-monorepo-php/vendor/rector/rector/src/Application/FileProcessor/PhpFileProcessor.php(101): Rector\Core\Application\FilePr
ocessor\PhpFileProcessor->refactorNodesWithRectors()
#16 /home/ise/projects/creativecow/stratum-monorepo-php/vendor/rector/rector/src/Application/ApplicationFileProcessor.php(96): Rector\Core\Application\FileProcessor
\PhpFileProcessor->process()
#17 /home/ise/projects/creativecow/stratum-monorepo-php/vendor/rector/rector/src/Application/ApplicationFileProcessor.php(74): Rector\Core\Application\ApplicationFi
leProcessor->processFiles()
#18 /home/ise/projects/creativecow/stratum-monorepo-php/vendor/rector/rector/src/Console/Command/ProcessCommand.php(161): Rector\Core\Application\ApplicationFilePro
cessor->run()
#19 /home/ise/projects/creativecow/stratum-monorepo-php/vendor/rector/rector/vendor/symfony/console/Command/Command.php(282): Rector\Core\Console\Command\ProcessCom
mand->execute()
#20 /home/ise/projects/creativecow/stratum-monorepo-php/vendor/rector/rector/vendor/symfony/console/Application.php(853): RectorPrefix20211221\Symfony\Component\Con
sole\Command\Command->run()
#21 /home/ise/projects/creativecow/stratum-monorepo-php/vendor/rector/rector/vendor/symfony/console/Application.php(289): RectorPrefix20211221\Symfony\Component\Con
sole\Application->doRunCommand()
#22 /home/ise/projects/creativecow/stratum-monorepo-php/vendor/rector/rector/src/Console/ConsoleApplication.php(67): RectorPrefix20211221\Symfony\Component\Console\
Application->doRun()
#23 /home/ise/projects/creativecow/stratum-monorepo-php/vendor/rector/rector/vendor/symfony/console/Application.php(187): Rector\Core\Console\ConsoleApplication->do
Run()
#24 /home/ise/projects/creativecow/stratum-monorepo-php/vendor/rector/rector/bin/rector.php(56): RectorPrefix20211221\Symfony\Component\Console\Application->run()  
#25 /home/ise/projects/creativecow/stratum-monorepo-php/vendor/rector/rector/bin/rector(5): require_once('...')
#26 /home/ise/projects/creativecow/stratum-monorepo-php/vendor/bin/rector(97): include('...')
#27 {main}
  thrown in /home/ise/projects/creativecow/stratum-monorepo-php/vendor/rector/rector/packages/PHPStanStaticTypeMapper/PHPStanStaticTypeMapper.php on line 57        
ise@ise-surface:~/projects/creativecow/stratum-monorepo-php$ 

I've tried copying my code into the demo and removing methods to see when it works and when it doesnt, but I would appreciate any suggestions to help me reproduce this using the playground.

@internalsystemerror internalsystemerror changed the title Exception thrown when using SetList::TYPE_DECLARATION and @return numeric-string Exception thrown when using SetList::TYPE_DECLARATION and numeric-string Dec 29, 2021
@TomasVotruba
Copy link
Member

Hi, thanks for reporting.

Could you share minimal content of lib/carlease/driver/src/Deal/Parser.php that is causing this error?

Ideally in failing example on: https://getrector.org/demo

@internalsystemerror
Copy link
Author

@TomasVotruba Thanks for looking at this. I've confirmed locally that the minimal content supplied in the original description causes the exception locally.

@internalsystemerror
Copy link
Author

I've managed to narrow it down some more: https://getrector.org/demo/1ec68bfe-aab7-6998-9433-611a2d6f4b08

The exception occurs when using bcmath functions and ReturnTypeDeclarationRector.

@internalsystemerror internalsystemerror changed the title Exception thrown when using SetList::TYPE_DECLARATION and numeric-string Exception thrown when using ReturnTypeDeclarationRector::class and bcmath extension Dec 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants