Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
Deprecate ClassCollectionLoader and Kernel::loadClassCache#20735
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
| */ | ||
| publicfunctionloadClassCache($name ='classes',$extension ='.php') | ||
| { | ||
| @trigger_error('loadClassCache() is deprecated since 3.3, to be removed in 4.0.',E_USER_DEPRECATED); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
extra space beforesince
fabpot commentedDec 3, 2016
That's a good first step, but there are other parts of the code to change, like any usages of |
fabpot commentedDec 3, 2016
The The |
dbrumann commentedDec 3, 2016
I still have some issues in functional tests probably related to deprecating ClassCacheWarmer (seeAppVeyor results). For instance I assume that I have to adjust FrameworkBundle's AddCacheWarmerPass to exclude Another question that remains for me is how we will address deprecation warnings in tests for php versions lower than PHP 7 as these should still use the depreacted class cache. I don't think it's practical to annotate these tests with |
| if (PHP_VERSION_ID >=7000 || !method_exists($this,'addClassesToCompile')) { | ||
| return; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I would wrap the next call instead of returning early here to make the intent clear.
| * | ||
| * @author Tugdual Saunier <tucksaun@gmail.com> | ||
| * | ||
| * @deprecated Deprecated since version 3.3, to be removed in 4.0. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Deprecated
| $loader->load('web.xml'); | ||
| $loader->load('services.xml'); | ||
| if (PHP_VERSION_ID <70000) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
this will still trigger a deprecation warning for PHP 5.6 users. Do we want it ?
| // 'Symfony\\Bundle\\FrameworkBundle\\FrameworkBundle', | ||
| )); | ||
| if (PHP_VERSION_ID <70000) { | ||
| $this->addClassesToCompile(array( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
same here about deprecation warnings
stof commentedDec 6, 2016
|
| <argument>Symfony\Component\HttpFoundation\ServerBag</argument> | ||
| <argument>Symfony\Component\HttpFoundation\Request</argument> | ||
| <argument>Symfony\Component\HttpKernel\Kernel</argument> | ||
| <argument>Symfony\Component\ClassLoader\ClassCollectionLoader</argument> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
you should remove this line
| * | ||
| * @author Fabien Potencier <fabien@symfony.com> | ||
| * | ||
| * @deprecated Deprecated since version 3.3, to be removed in 4.0. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
@deprecated since version 3.3, to be removed in 4.0. (same below: no need to duplicate the "deprecated" word)
stof commentedDec 6, 2016
@nicolas-grekas can you reproduce your benchmark on PHP 5.6 as well ? I would really prefer to stop using it for all PHP versions rather than keeping usage of deprecated APIs in the core on PHP 5.6 (which would mean that users cannot get rid of deprecation warnings) |
| */ | ||
| publicfunctionloadClassCache($name ='classes',$extension ='.php') | ||
| { | ||
| @trigger_error('loadClassCache() is deprecated since version 3.3, to be removed in 4.0.',E_USER_DEPRECATED); |
nicolas-grekasDec 6, 2016 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
The Kernel::loadClassCache() method ... (same below and above)
xabbuh commentedDec 6, 2016
We could think about triggering the deprecations on PHP < 7.0 (or maybe < 5.6) only. Besides that we have to realise that Symfony 4.0 will have to drop support for PHP versions < 7.0 (or < 5.6 if the benchmark turns out to be promising for it too). Otherwise the deprecations wouldn't make much sense. |
nicolas-grekas commentedDec 6, 2016
I don't think so. Why? |
stof commentedDec 6, 2016
@nicolas-grekas isn't it part of the same feature set ? |
nicolas-grekas commentedDec 6, 2016
stof commentedDec 6, 2016
@nicolas-grekas have you tried the same benchmark on PHP 5.6 to see whether we could deprecate the feature for all PHP versions instead, which would be much simpler ? Regarding addAnnotatedClassesToCompile, I was confused about what it does due to its naming: it does not compile the classes at all. These classes are just classes for which the annotation cache is warmed up. |
nicolas-grekas commentedDec 6, 2016
@stof you mean PHP 5.5 (our lowest supported version?) I didn't check but the optims that allow PHP7 to be faster do not exists on 5.5 so I'm pretty sure inlining still wins on 5.5. About addAnnotatedClassesToCompile, you're right. |
stof commentedDec 6, 2016
hmm yeah, I forgot the lowest bound in 5.5.9, not 5.6. |
derrabus commentedDec 6, 2016 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@stof I would not want to give php 5.5 users a sudden performance penalty just because we don't like that feature anymore. People who are pinned to php 5.5 (for whatever reason) are thankful for optimizations like this one. |
dbrumann commentedDec 11, 2016
@xabbuh and@nicolas-grekas is there already a way to trigger deprecation warnings conditionally? If not, what would be the best way to go about it? @stof we had the discussion about performance penalty on older php versions during the SymfonyCon hackday and consensus seemed to be that we should avoid it. |
nicolas-grekas commentedDec 11, 2016
This would be the first time, but it should be just a matter of wrapping the deprecation in a check against |
nicolas-grekas commentedDec 11, 2016
I don't have 5.6 anymore so if someone could give it a try, please do. |
| */ | ||
| publicfunctionaddClassesToCompile(array$classes) | ||
| { | ||
| @trigger_error('Extension::loadClassCache() is deprecated since version 3.3, to be removed in 4.0.',E_USER_DEPRECATED); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Fqcn, + wrong method name, isn't it?
| useSymfony\Component\HttpKernel\Config\FileLocator; | ||
| useSymfony\Component\HttpKernel\DependencyInjection\MergeExtensionConfigurationPass; | ||
| useSymfony\Component\HttpKernel\DependencyInjection\AddClassesToCachePass; | ||
| useSymfony\Component\HttpKernel\DependencyInjection\MergeExtensionConfigurationPass; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
No reorder, to save us some merge conflicts
| */ | ||
| publicfunctionloadClassCache($name ='classes',$extension ='.php') | ||
| { | ||
| @trigger_error('Kernel::loadClassCache() is deprecated since version 3.3, to be removed in 4.0.',E_USER_DEPRECATED); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Fqcn
| */ | ||
| publicfunctionsetClassCache(array$classes) | ||
| { | ||
| @trigger_error('Kernel::setClassCache() is deprecated since version 3.3, to be removed in 4.0.',E_USER_DEPRECATED); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Fqcn
| */ | ||
| protectedfunctiondoLoadClassCache($name,$extension) | ||
| { | ||
| @trigger_error('Kernel::doLoadClassCache() is deprecated since version 3.3, to be removed in 4.0.',E_USER_DEPRECATED); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Fqcn
…ann)This PR was submitted for the master branch but it was merged into the 2.7 branch instead (closes#7243).Discussion----------Removes duplicated Deprecated and adds an example.Removes the duplicate "Deprecated" after `@deprecated` annotation as was asked in my PRsymfony/symfony#20735. Also adds a randomly selected example that shows how the abstract `XXX` should look like and an edge case of `trigger_error()` when deprecating a whole class.Commits-------a2c04e7 Deletes duplicate "Deprecated" and adds a more explicit example.
nicolas-grekas commentedJan 6, 2017
👍 |
fabpot commentedJan 6, 2017
Thank you@dbrumann. |
…ache (dbrumann)This PR was merged into the 3.3-dev branch.Discussion----------Deprecate ClassCollectionLoader and Kernel::loadClassCache| Q | A| ------------- | ---| Branch? | "master"| Bug fix? | no| New feature? | no| BC breaks? | no| Deprecations? | yes| Tests pass? | yes| Fixed tickets |#20668| License | MITAs suggested by@nicolas-grekas in#20668 I added deprecation notices to ClassCollectionLoader and Kernel::loadClassCache.Commits-------660d79a Deprecates ClassCache-cache warmer.
…oCompile() / AddClassesToCachePass (nicolas-grekas)This PR was merged into the 3.3-dev branch.Discussion----------[HttpKernel] Fix deprecation of Extension::addClassesToCompile() / AddClassesToCachePass| Q | A| ------------- | ---| Branch? | 3.3| Bug fix? | yes| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets | -| License | MIT| Doc PR | -As done in#20735Commits-------f4b5784 [HttpKernel] Fix deprecation of Extension::addClassesToCompile() / AddClassesToCachePass
…oCompile() / AddClassesToCachePass (nicolas-grekas)This PR was merged into the 3.3-dev branch.Discussion----------[HttpKernel] Fix deprecation of Extension::addClassesToCompile() / AddClassesToCachePass| Q | A| ------------- | ---| Branch? | 3.3| Bug fix? | yes| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets | -| License | MIT| Doc PR | -As done insymfony/symfony#20735Commits-------f4b5784 [HttpKernel] Fix deprecation of Extension::addClassesToCompile() / AddClassesToCachePass
… & Kernel::loadClassCache (ogizanagi, xabbuh)This PR was merged into the 4.0-dev branch.Discussion----------[ClassLoader][HttpKernel] Remove ClassLoader component & Kernel::loadClassCache| Q | A| ------------- | ---| Branch? | master| Bug fix? | no| New feature? |no| BC breaks? | yes| Deprecations? | no| Tests pass? | yes| Fixed tickets |#20735| License | MIT| Doc PR | N/AAs deprecated in#20735Commits-------551aaef [ClassLoader] remove the component4f8916c [ClassLoader][HttpKernel] Remove ClassCollectionLoader & Kernel::loadClassCache BC layer
As suggested by@nicolas-grekas in#20668 I added deprecation notices to ClassCollectionLoader and Kernel::loadClassCache.