Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Merged
fabpot merged 1 commit intosymfony:masterfromdbrumann:class_cache_deprecations
Jan 6, 2017
Merged

Deprecate ClassCollectionLoader and Kernel::loadClassCache#20735

fabpot merged 1 commit intosymfony:masterfromdbrumann:class_cache_deprecations
Jan 6, 2017

Conversation

@dbrumann
Copy link
Contributor

QA
Branch?"master"
Bug fix?no
New feature?no
BC breaks?no
Deprecations?yes
Tests pass?yes
Fixed tickets#20668
LicenseMIT

As suggested by@nicolas-grekas in#20668 I added deprecation notices to ClassCollectionLoader and Kernel::loadClassCache.

@dbrumanndbrumann changed the title#20668 Deprecate ClassCollectionLoader and Kernel::loadC…Deprecate ClassCollectionLoader and Kernel::loadClassCacheDec 3, 2016
*/
publicfunctionloadClassCache($name ='classes',$extension ='.php')
{
@trigger_error('loadClassCache() is deprecated since 3.3, to be removed in 4.0.',E_USER_DEPRECATED);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

extra space beforesince

@fabpot
Copy link
Member

That's a good first step, but there are other parts of the code to change, like any usages ofClassCollectionLoader like inClassCacheCacheWarmer.

@fabpot
Copy link
Member

TheClassCacheCacheWarmer should be deprecated as well, and the same goes forKernel::setClassCache().

TheSymfony\Component\HttpKernel\DependencyInjection\Extension::addClassesToCompile() method should also be deprecated.

@dbrumann
Copy link
ContributorAuthor

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 excludekernel.class_cache.cache_warmer when PHP 7.x is being used?

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@group legacy.@nicolas-grekas maybe you have an advice how to approach this?


if (PHP_VERSION_ID >=7000 || !method_exists($this,'addClassesToCompile')) {
return;
}
Copy link
Member

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.

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) {
Copy link
Member

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(
Copy link
Member

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
Copy link
Member

stof commentedDec 6, 2016

Kernel::addAnnotatedClassesToCompile must also be deprecated

<argument>Symfony\Component\HttpFoundation\ServerBag</argument>
<argument>Symfony\Component\HttpFoundation\Request</argument>
<argument>Symfony\Component\HttpKernel\Kernel</argument>
<argument>Symfony\Component\ClassLoader\ClassCollectionLoader</argument>

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.

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
Copy link
Member

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);
Copy link
Member

@nicolas-grekasnicolas-grekasDec 6, 2016
edited
Loading

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
Copy link
Member

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
Copy link
Member

Kernel::addAnnotatedClassesToCompile must also be deprecated

I don't think so. Why?

@stof
Copy link
Member

stof commentedDec 6, 2016

@nicolas-grekas isn't it part of the same feature set ?

@nicolas-grekas
Copy link
Member

@xabbuh do you mean triggering them on PHP >= 7.0? That's a good idea! Moving to 4.0 is going to require moving to PHP 7 before so it really makes sense.@dbrumann can you take care of that also please?

@stof Kernel::addAnnotatedClassesToCompile is especially usefull on PHP 7, so we should keep it.

@stof
Copy link
Member

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
Copy link
Member

@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
Copy link
Member

stof commentedDec 6, 2016

hmm yeah, I forgot the lowest bound in 5.5.9, not 5.6.
Would still be good to know what happens on 5.6 (which has the composer classmap optimization).
If we only need it for PHP 5.5, we might stop using the deprecated feature for it IMO, as PHP 5.5 is already EOLed (and people really caring about such autoloading performance improvement should update to 5.6+ to have the composer optims)

@nicolas-grekasnicolas-grekas added this to the3.x milestoneDec 6, 2016
@derrabus
Copy link
Member

derrabus commentedDec 6, 2016
edited
Loading

@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
Copy link
ContributorAuthor

@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
Copy link
Member

This would be the first time, but it should be just a matter of wrapping the deprecation in a check againstPHP_VERSION_ID as you already did in other places.
For php 5.5, I don't have recent numbers, but I saw several benchs that demonstrated the benefit of inlining, so we should keep it I agree.

@nicolas-grekas
Copy link
Member

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

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;

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

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

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Fqcn

xabbuh added a commit to symfony/symfony-docs that referenced this pull requestDec 13, 2016
…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
Copy link
Member

👍

@nicolas-grekasnicolas-grekas modified the milestones:3.3,3.xJan 6, 2017
@fabpot
Copy link
Member

Thank you@dbrumann.

@fabpotfabpot merged commit660d79a intosymfony:masterJan 6, 2017
fabpot added a commit that referenced this pull requestJan 6, 2017
…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.
fabpot added a commit that referenced this pull requestApr 19, 2017
…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
symfony-splitter pushed a commit to symfony/http-kernel that referenced this pull requestApr 19, 2017
…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
@fabpotfabpot mentioned this pull requestMay 1, 2017
nicolas-grekas added a commit that referenced this pull requestMay 21, 2017
… & 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
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@fabpotfabpotfabpot left review comments

@nicolas-grekasnicolas-grekasnicolas-grekas left review comments

@stofstofstof left review comments

Assignees

No one assigned

Projects

None yet

Milestone

3.3

Development

Successfully merging this pull request may close these issues.

7 participants

@dbrumann@fabpot@stof@xabbuh@nicolas-grekas@derrabus@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp