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

[6.x] Fixed deprecated "Doctrine/Common/Inflector/Inflector" class #32734

Merged
merged 5 commits into from
May 11, 2020

Conversation

andrey-helldar
Copy link
Contributor

The Inflector class is deprecated, use Doctrine\Common\Inflector\Inflector from doctrine/inflector package instead,

New class is non-static Doctrine\Inflector\Inflector::class

I also changed the minimum version for doctrine/inflector package because the earlier 1.1 supports php 5.6 and higher, while Laravel 6.x supports 7.2+.
Package version 1.4 supports php 7.2+.

Also see #32730

@andrey-helldar
Copy link
Contributor Author

andrey-helldar commented May 9, 2020

@GrahamCampbell,
Thanks, Graham! I constantly forget about doc-blocks 🙁

@taylorotwell taylorotwell merged commit 95b34d4 into laravel:6.x May 11, 2020
@senter-logistics
Copy link

will be this merged to the 7.x version? i'm having this error:
Class 'Doctrine\Inflector\Inflector' not found in
/var/www/html/vendor/laravel/framework/src/Illuminate/Support/Pluralizer.php:135

@GrahamCampbell
Copy link
Member

It was merged into 7.x.

@slackernrrd
Copy link

This broke som code in a Laravel 6.x project for me after doing composer update, because Eloquent suddenly couldn't find a table due to different pluralization rules in 1.4. It was easy enough to fix by setting the table name explicitly in the affected models, but it was pretty sneaky (and perhaps inevitable) that it just broke.

@GrahamCampbell
Copy link
Member

Please report the BC break to the upstream library for them to fix.

@GrahamCampbell
Copy link
Member

GrahamCampbell commented May 14, 2020

Their pluralisation rules should be the same as in the 1.3.x series.

@senter-logistics
Copy link

I downgraded to php 7.2.30 and now it's working as expected.

@tomcastleman
Copy link
Contributor

tomcastleman commented May 19, 2020

IMO changes from this PR will catch people out, as in our case a composer update resulted in doctrine/inflector to be bumped to ^2.0 which breaks BC (in our case with Eloquent model pluralization).

Yes a solution is to manually require doctrine/inflector:^1.4 in the app (or override the table name in the model) but this PR probably shouldn't offer a bump in the major version of that dependency by default.

PHP 7.4.4
Framework update v6.18.10...v6.18.14

@GrahamCampbell
Copy link
Member

Those BC breaks are actually not intended. Please report any pluralisation mistakes to the upstream library to be corrected. v1.4 and v2.0 are meant to be identical apart from deprecated code removed.

@GrahamCampbell
Copy link
Member

Yes a solution is to manually require doctrine/inflector:^1.4

As I said, this won't work, because 1.4 is the same as 2.0.

@GrahamCampbell
Copy link
Member

Please send fix PRs to the upstream library's 1.4 branch or open issues over there if they have broken something. There's nothing we can do here.

@laravel laravel locked as resolved and limited conversation to collaborators May 19, 2020
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.

None yet

6 participants