Skip to content
This repository has been archived by the owner on Nov 2, 2022. It is now read-only.

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

tdutrion
Copy link

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).

@jamesryanbell
Copy link
Owner

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

@tdutrion
Copy link
Author

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants