Skip to content

[DI] Add AutowireRequiredMethodsPass to fix bindings for @required methods #24301

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 25, 2017

Conversation

nicolas-grekas
Copy link
Member

Q A
Branch? 3.4
Bug fix? yes
New feature? yes
BC breaks? yes
Deprecations? no
Tests pass? yes
Fixed tickets -
License MIT
Doc PR -

Spotted while doing a SF4 workshop :)

Discovery of @required methods should be split from AutowirePass so that bindings can apply to these methods also when autowiring is enabled.

@nicolas-grekas nicolas-grekas added this to the 3.4 milestone Sep 23, 2017
@@ -79,4 +82,17 @@ public function testTypedReferenceSupport()
$this->assertEquals(array($typedRef), $container->getDefinition('def1')->getArguments());
$this->assertEquals(array(new Reference('foo')), $container->getDefinition('def2')->getArguments());
}

public function testScalarSetter()
Copy link
Member Author

Choose a reason for hiding this comment

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

Here is the test that backs up the fixed behavior.

// should be called
}

/** @inheritdoc*/
Copy link
Member Author

Choose a reason for hiding this comment

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

this fabbot failure is expected

Copy link
Contributor

@ogizanagi ogizanagi left a comment

Choose a reason for hiding this comment

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

Perhaps AutowireRequiredMethodsPass would be more explicit.

@nicolas-grekas
Copy link
Member Author

@ogizanagi renamed, thanks

@@ -130,7 +130,6 @@ private function doProcessValue($value, $isRoot = false)
return $value;
}

$autowiredMethods = $this->getMethodsToAutowire($reflectionClass);
Copy link
Member

Choose a reason for hiding this comment

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

The getMethodsToAutowire still exists in this class, can be removed now

Copy link
Member Author

Choose a reason for hiding this comment

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

indeed, done, thanks

@nicolas-grekas nicolas-grekas changed the title [DI] Add AutoregisterMethodsPass to fix bindings for @required methods [DI] Add AutowireRequiredMethodsPass to fix bindings for @required methods Sep 25, 2017
@nicolas-grekas nicolas-grekas merged commit dc55dd2 into symfony:3.4 Sep 25, 2017
nicolas-grekas added a commit that referenced this pull request Sep 25, 2017
…or `@required` methods (nicolas-grekas)

This PR was merged into the 3.4 branch.

Discussion
----------

[DI] Add AutowireRequiredMethodsPass to fix bindings for `@required` methods

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | yes
| BC breaks?    | yes
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Spotted while doing a SF4 workshop :)

Discovery of `@required` methods should be split from AutowirePass so that bindings can apply to these methods also when autowiring is enabled.

Commits
-------

dc55dd2 [DI] Add AutowireRequiredMethodsPass to fix bindings for `@required` methods
@nicolas-grekas nicolas-grekas deleted the autoregister-methods branch September 25, 2017 09:25
This was referenced Oct 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants