Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Jan 8, 2020. It is now read-only.
This repository was archived by the owner on Jan 8, 2020. It is now read-only.

Invalid behaviour of classmap_generator_php for PHP >=5.5 ::class constant  #6814

@przemos

Description

@przemos

Hi,

recently on my project I spotted that after introducing PHP >=5.5 ::CLASS constant in our code that is equal to FQCN of the class, autoload_classmap.php is generated incorrectly i.e. contains entries that have nothing to do this FCQN of the class like

MyNamespace/Repository => __DIR__ . '/src/MyNamespace/Repository.php',
'innerJoin'               => __DIR__ . '/src/MyNamespace/Repository.php',
'andwhere'              => __DIR__ . '/src/MyNamespace/Repository.php',

It is because Zend\File\ClassFileLocator is looking for token 'class' (define ('T_CLASS', 356);) which is returned by token_get_all() not only at class declaration but also with ExampleClass::CLASS instruction and picks up whatever token is considered a class name which can be virtually anything around ExampleClass::CLASS instruction like 'innerJoin' or 'andwhere'.

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions