Rewrite static access to Inflector as it has been deprecated#3560
Conversation
3fd10ff to
4d8bda6
Compare
|
Thank you for your PR.
|
I could do that by detecting if |
|
This PR recreates the inflector everytime it's used while the library's own compat layer maintains an instance for subsequent calls. I haven't measured how expensive the new factory logic actually is but I don't think we should call it everytime we want to inflect something. I had to fix this issue for one of my projects as well, so I c&p'ed my solution to #3564. Here I'm using a static facade to switch between old and new implementation. |
|
The factory has an internal cache as well, so likely very little overhead. |
doctrine/inflectorraised to^1.4 || ^2.0doctrine/inflectordeprecated the use ofDoctrine\Common\Inflector\Inflectorwhen they released version 2.0 (where the class has been removed).They suggest to use a factory pattern like this: https://github.com/doctrine/inflector/blob/master/docs/en/index.rst#usage