Skip to content

System error: "strtolower() expects parameter 1 to be string, bool given #9405

@JoshuaEstes

Description

@JoshuaEstes

Bug Report

Subject Details
Rector version 2.2.0
PHP Version 7.4.33

When running rector on a file, I will get the error:

[ERROR] Could not process "/path/to/file.php" file, due to:                                                                               11:51:04 [93/4883]
         "System error: "strtolower() expects parameter 1 to be string, bool given"

         Stack trace:
         #0
         tools/rector/vendor/rector/rector/rules/CodingStyle/ClassNameImport/ClassNameImportSkipVoter/ClassLikeNameClassNameImportSkipVoter.php(48): strtolower()
         #1 tools/rector/vendor/rector/rector/rules/CodingStyle/ClassNameImport/ClassNameImportSkipper.php(39):
         Rector\CodingStyle\ClassNameImport\ClassNameImportSkipVoter\ClassLikeNameClassNameImportSkipVoter->shouldSkip(
         )
         #2 tools/rector/vendor/rector/rector/rules/CodingStyle/Node/NameImporter.php(94):
         Rector\CodingStyle\ClassNameImport\ClassNameImportSkipper->shouldSkipNameForFullyQualifiedObjectType()
         #3 tools/rector/vendor/rector/rector/rules/CodingStyle/Node/NameImporter.php(55):
         Rector\CodingStyle\Node\NameImporter->importNameAndCollectNewUseStatement()
         #4 tools/rector/vendor/rector/rector/src/PostRector/Rector/NameImportingPostRector.php(52):
         Rector\CodingStyle\Node\NameImporter->importName()

NOTE: The above has been trimmed

Minimal PHP Code Causing Issue

Not able to reproduce the issue there. I did notice that when getClassName and getShortName are the same, this is where it will have a fatal error. Not sure how it gets those, but I can tell you that the name giving me issues is Exception.

Expected Behaviour

Not crash ;p

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions