plugin-php
plugin-php copied to clipboard
Case build-in classes
Ref: http://php.net/manual/en/reserved.classes.php In php allowed use any case of build-in class:
$exception = new Exception('Message');
$exception = new EXCEPTION('Message');
$exception = new eXcEpTiOn('Message');
Always return exception build-in class.
Should we prettify class names? Also don't forget about namespaces.
- File without namespace -
new Exception()===new \Exception();. - File with namespace -
new Exception!==new \Exception.
In theory we can do it:
- If namespace exists only correct
new \Exception(); - If namespace doesn't exists correct and
new Exception()andnew \Exception();
I think there is too much complexity to do this here. To fix this the parser would have to be aware of all built-in classes and be able to resolve the namespaces correctly, which is impossible in some situations currently as only single files are parsed.
As cool as it would be, I don't think this is the right tool for that job.