cloudflare icon indicating copy to clipboard operation
cloudflare copied to clipboard

[CS] PSR-2 compliance: breaks compatibility (snake case => camel case)

Open tdutrion opened this issue 9 years ago • 2 comments

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:

  1. 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.
  2. Dirty solution: use the magic method __call in every files to map from snake to camel case. We can use Zend\Filter\Word\UnderscoreToCamelCase (doc) and method-exists($this, $filter->filter($methodCalled)); (doc).

tdutrion avatar Aug 15 '15 09:08 tdutrion

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

jamesryanbell avatar Dec 13 '15 22:12 jamesryanbell

Let me know if you need any help (mainly after January 7th though).

tdutrion avatar Dec 14 '15 09:12 tdutrion