Closed akomm closed 8 years ago
@akomm seems like an interesting/useful change. Give it a spin, and then we discuss on a PR directly.
The PR doesn't seems to contain the autoloading feature :/
For example, when I want to write a FQCN with the ::class
I would like to change the context from autoload because my CLI application create some config file (factories for example) and obiously the checkStringIsFqn method return always false because my class doesn't exists in my autoloader.
@florentsorel I can't quite follow you in a way which would make this feature being responsible to handle it. this feature is and should not be aware of how your classes are loaded and made available. You either include/require them manually or use any autoloading feature. If you do not make your classes available, they can not be verified.
If you meant something different, please explain it with an example.
Similar to the use_bracket_array_syntax-option, I would propose to add a use_class_contant-option.
If enabled, string keys and values should be checked for being a known full qualified class- or-interface name, using class_exists and interface_exists.
Additional option use_class_constant_autoload might be added, to set whether autoload should be used.
It only works if the names are defined in the main file, were included/required from another script or a registered autoloader can resolve them.
I'v tried it on some packages, which use this writer and it worked well without breaking anything.
Possible issues:
Writing config in a different context than reading it (e. G. different autoloader configs). But since it is an option you don't have to use it. Depending on usage context you can localy enable this option for development and disable for deployment.