PSR-4 / PSR-1 Compliance
njuneau opened this issue · comments
Hello,
This is just a suggestion, I'm not a compiler expert - you be the judge of the pertinence of the issue!
Would it be a good idea to make sure that the generated PHP sources are PSR-4 compliant ( http://www.php-fig.org/psr/psr-4/ )? This could increase interoperability between Haxe-generated code and "native" PHP code. I looked at the sample generated file here ( https://gist.github.com/RealyUniqueName/2dc44c3d7a5e1f02df71c3a8186e5f43#file-test-php ) and the namespace use seems correct. It would just be a matter of validating that the output folders are compliant. Being able to use a Haxe library in a native PHP project (and vice-versa) using a standard class loader would be fun.
Once this is tackled, other PSRs could be added in order to ease debugging and increase familiarity with existing PHP developers. For example, PSR-1 covers basic code style ( http://www.php-fig.org/psr/psr-1/ ). Whether or not this is pertinent in a compiled environment, I'm not sure. The code itself can violate certain style rules. But the compiler could be implemented in a way that, by itself, it doesn't introduce more inconsistencies than the actual compiled code does.
What do you think?
Now everything should be 100% PSR-1/PSR-4 compliant