Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a BC layer for Inflector 1.0 #132

Merged
merged 1 commit into from
Oct 31, 2019
Merged

Conversation

alcaeus
Copy link
Member

@alcaeus alcaeus commented Oct 30, 2019

With around 150k downloads per day (according to Packagist), Inflector 1.x is a very popular package, with some large Open-Source projects depending on it. While we are working on 2.0, releasing it into the wild can cause a load of problems for our users: as soon as one library updates to Inflector 2.0, users may end up in dependency hell because it forces other libraries to update as well.

To ease the transition to the new API of Inflector 2.0, this PR adds a backward compatibility layer to provide the 1.x API in 2.0. This allows for a staggered upgrade, where libraries first upgrade their composer dependency constraint to "doctrine/inflector": "^1.3.0 || ^2.0" while keeping the old API. Once enough of the large libraries have migrated (e.g. doctrine/common, doctrine/orm, laravel/framework, symfony/maker-bundle, they can start dropping support for 1.x and make use of the new API.

This allows users the choice of using the 2.0 API in their projects without having to wait for other libraries to upgrade to Inflector 2.0.


The BC layer is excluded from PHPStan and phpcs analysis to allow for easier merging up of the 1.x branches. This helps to make sure that all bug fixes made in 1.3.x were also ported to 2.0.

The old API is marked as @deprecated via PHPDoc comments, with all methods triggering E_USER_DEPRECATED errors to allow tracing their origin with the Symfony PHPUnit Bridge.

Note that support for custom rules is not part of the BC layer as it still needs to be implemented in 2.0 (see #100). The BC layer can be updated once custom rulesets are supported.

@alcaeus alcaeus added this to the v2.0.0 milestone Oct 30, 2019
@alcaeus alcaeus self-assigned this Oct 30, 2019
@alcaeus alcaeus requested a review from jwage October 30, 2019 21:20
@alcaeus alcaeus merged commit 2110166 into doctrine:master Oct 31, 2019
@alcaeus alcaeus deleted the bc-layer branch October 31, 2019 07:45
@alcaeus alcaeus modified the milestones: 2.0.0, 1.4.0 May 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants