cloudflare
cloudflare copied to clipboard
[CS] PSR-2 compliance: breaks compatibility (snake case => camel case)
This PR is only about code style and introducing compliance to PSR-2 standards, which is the de facto standard for libraries.
When reading the PR files, please consider using SourceTree
or any software that allows you to Ignore whitespace
, because the indentation moved from tab to spaces and you wouldn't be able to check the real changes easily.
It has been tested with both phpcs and php-cs-fixer.
Major BC problem:
Unfortunately, due to the renaming of the methods from snake case to camel case, all the user calls would be broken.
I can see 2 solutions to this problem:
-
Proper solution: Tag the latest commit before merging this PR, with a non-stable version number such as v0.0.1, then merge the PR and edit
readme.md
to add a warning and tell people to change their composer.json file requirements to v0.0.1if they do not want to change their calls yet. Maybe even add a post update / post install script that echoes something into the terminal during operations. -
Dirty solution: use the magic method
__call
in every files to map from snake to camel case. We can useZend\Filter\Word\UnderscoreToCamelCase
(doc) andmethod-exists($this, $filter->filter($methodCalled));
(doc).
Thanks @tdutrion and apologises for the lengthy delay in getting back to you on this. I finally have some time to look at this project again and I'm making some changes in the next few weeks. One of those will be the bring it up to PSR-2 standards.
Thanks, James
Let me know if you need any help (mainly after January 7th though).