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

[FrameworkBundle] Lazy configuration of annotations' loader and@required#21837

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:masterfromnicolas-grekas:lazy-annotations
Mar 15, 2017

Conversation

@nicolas-grekas
Copy link
Member

QA
Branch?master
Bug fix?no
New feature?yes
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets-
LicenseMIT
Doc PR-

This would remove the need forsymfony/symfony-standard#1052 and for theautoload.php file altogether.

Tested on symfony-demo with great success so far.

theofidry and apfelbox reacted with thumbs up emojijvasseur reacted with confused emoji
<serviceid="annotations.reader"class="Doctrine\Common\Annotations\AnnotationReader"public="false">
<argument>null</argument>
<argumenttype="service">
<!-- dummy arg to register class_exists as annotation loader only when required-->
Copy link
Member

Choose a reason for hiding this comment

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

such dummy arg could cause issue if the library adds an optional arg in the future.
Thus, I think PHP used to do weird things regarding the evaluation of useless constructor arguments.

We should use a configurator instead of using such hack.

@nicolas-grekas
Copy link
MemberAuthor

@stof I moved the argument to theaddGlobalIgnoredName call, which is a public method on a non-final class, thus can't really change in the future (BC concerns). I'd prefer not adding yet-another-class-to-load for this, unless it's a strong requirement to you.

@fabpot
Copy link
Member

👍 Does the job

@dunglas
Copy link
Member

👍

</argument>
</call>
</service>
<serviceid="Doctrine\Common\Annotations\Reader"alias="annotations.reader"public="false" />
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't this targetannotation_reader?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

it's overridden in FrameworkExtension (but please investigate if you'd like, unrelated to this PR of course)

GuilhemN reacted with thumbs up emoji
Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I just noticed it while reviewing your PR. I'll check it.

Copy link
Contributor

@GuilhemNGuilhemN left a comment

Choose a reason for hiding this comment

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

👍

@fabpot
Copy link
Member

The clean way would be to use a configurator, which means adding one additional class. Would it be better? Do we just merge it like this? In any case, I like the idea of removing the need for anautoload.php file, that would also help with cleaning the code of Flex.

I'm inclined to just merge this PR as is, but some @symfony/deciders might think going the clean way would be preferable. What's your thoughts?

@fabpot
Copy link
Member

Thank you@nicolas-grekas.

@fabpotfabpot merged commitd332b37 intosymfony:masterMar 15, 2017
fabpot added a commit that referenced this pull requestMar 15, 2017
…oader and `@required` (nicolas-grekas)This PR was merged into the 3.3-dev branch.Discussion----------[FrameworkBundle] Lazy configuration of annotations' loader and `@required`| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | yes| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets | -| License       | MIT| Doc PR        | -This would remove the need forsymfony/symfony-standard#1052 and for the `autoload.php` file altogether.Tested on symfony-demo with great success so far.Commits-------d332b37 [FrameworkBundle] Lazy configuration of annotations' loader and `@required`
@nicolas-grekasnicolas-grekas deleted the lazy-annotations branchMarch 15, 2017 17:55
@backbone87
Copy link
Contributor

backbone87 commentedApr 10, 2017
edited
Loading

Its basically a hack?

How about some general container-driven scripted config:

<container ... >  <services>    <serviceid="annotations.reader"class="Doctrine\Common\Annotations\AnnotationReader"public="false">      ...    </service>  <services>  <scripttype="php/closure"depends="annotations.reader"on-missing="skip|force|error"run-on="build|load"><![CDATA[    Doctrine\Common\Annotations\AnnotationRegistry::registerLoader('class_exists');]]></script></container>

Edit: I will create a new ticket for it

fabpot added a commit to sensiolabs/SensioDistributionBundle that referenced this pull requestApr 23, 2017
… is absent (BPScott)This PR was merged into the 5.0.x-dev branch.Discussion----------Allow building bootstrap.php.cache when app/autoload.php is absentIf app/autoload.php is absent then use the autoload.php in Composer'svendor directory.symfony/symfony#21837 opens the door for removing `app/autoload.php` in Symfony apps. I tried removing that and updating the various reference to it in symfony-standard and my app works (:tada:), but when I run composer install/update it complains about the buildBootstrap task expecting to find `app/autoload.php`.This fix tells the buildBootstrap task to use `vendor/autoload.php` if `app/autoload.php` is absent.Commits-------257ee2e Allow building bootstrap.php.cache when app/autoload.php is absent
fabpot added a commit to symfony/symfony-standard that referenced this pull requestApr 24, 2017
This PR was merged into the 3.3-dev branch.Discussion----------Remove app/autoload.phpNow thatsymfony/symfony#21837 is merged, app/autoload.php can be removed and replaced with the standard Composer autoloader.~WAIT! This can't be merged *just* yet, as it throws errors when running the `buildBootstrap` post install/update script. The fix for this is insensiolabs/SensioDistributionBundle#313. That PR must be merged and this PR must be updated to use a version of SensioDistributionBundle that contains the fix before this is good to go.~EDIT:sensiolabs/SensioDistributionBundle#313 is merged (as of 24/04), and this PR has been updated to use the latest version of SensioDistributionBundle. This is now good to mergeCommits-------298f8b2 Remove app/autoload.php
@fabpotfabpot mentioned this pull requestMay 1, 2017
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@stofstofstof requested changes

+1 more reviewer

@GuilhemNGuilhemNGuilhemN approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

3.3

Development

Successfully merging this pull request may close these issues.

7 participants

@nicolas-grekas@fabpot@dunglas@backbone87@stof@GuilhemN@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp