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

[DI] Fix FactoryReturnTypePassTest on PHP 5#29949

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

Closed

Conversation

@przemyslaw-bogusz
Copy link
Contributor

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

One of my PRs failed a Travis CI test on PHP 5 due to a syntax error resulting from loading a class with return type declarations:
https://travis-ci.org/symfony/symfony/jobs/482202091#L2865-L2867

SinceFactoryReturnTypePass works only PHP 7

publicfunctionprocess(ContainerBuilder$container)
{
// works only since php 7.0 and hhvm 3.11
if (!method_exists(\ReflectionMethod::class,'getReturnType')) {
return;
}

I modifiedFactoryReturnTypePassTest accordingly.

$pass =newFactoryReturnTypePass();
$pass->process($container);

if (method_exists(\ReflectionMethod::class,'getReturnType')) {
Copy link
Member

Choose a reason for hiding this comment

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

Seeing this change it looks like the test was expected to pass on older PHP versions too. And since the test doesn't fail always we should probably rather investigate why they sometimes fail and why they pass under other circumstances.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Yes there is an if/else clause in the 3.4 branch, however a few lines above that, there is reference toFactoryDummy fixture, that causes the syntax (parse) error, because it does not have a valid PHP 5 syntax:

$factory->setFactory([FactoryDummy::class,'createFactory']);

AppVeyor CI test also points out the same issue:
https://ci.appveyor.com/project/fabpot/symfony/builds/21760919?fullLog=true#L2048
Anyway, what can I do to help solve this issue? If there is an issue, to begin with ...

@nicolas-grekas
Copy link
Member

This did work before, and this file didn't change recently. I think this change is wrong and that there is an issue in#29944 instead: yes, the referenced factory class is PHP7-only. BUT service/factory classes shouldn't be loaded unless needed. That's what I would look for in#29944: why does it force loading the class now?

@przemyslaw-bogusz
Copy link
ContributorAuthor

You mean that#29944 is forcingFactoryReturnTypePassTest to be loaded, or forcing the test to loadFactoryDummy?

@nicolas-grekasnicolas-grekas added this to the3.4 milestoneJan 30, 2019
@nicolas-grekas
Copy link
Member

Closing as if there is anything to change here (right now I don't think so), it should be done in#29944

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@xabbuhxabbuhxabbuh left review comments

Assignees

No one assigned

Projects

None yet

Milestone

3.4

Development

Successfully merging this pull request may close these issues.

4 participants

@przemyslaw-bogusz@nicolas-grekas@xabbuh@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp