8000 [WIP] Annotation support for Services by weaverryan · Pull Request #21376 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[WIP] Annotation support for Services #21376

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

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Thanks fabbot!
  • Loading branch information
weaverryan committed Jan 23, 2017
commit f679a2ae47e5645b59b761d134f8cffcdd40bace
8000
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,13 @@ private function updateMethodArguments(Definition $definition, \ReflectionMethod

/**
* @param \ReflectionMethod $method
*
* @return Annotations\Argument[]
*/
private function getArgumentAnnotationsForMethod(\ReflectionMethod $method)
{
$annotations = $this->reader->getMethodAnnotations($method);
$argAnnotations = [];
$argAnnotations = array();
foreach ($annotations as $annotation) {
if ($annotation instanceof Annotations\Argument) {
$argAnnotations[] = $annotation;
Expand All @@ -166,16 +167,17 @@ private function getArgumentAnnotationsForMethod(\ReflectionMethod $method)
* of the argument and the value is its index.
*
* @param \ReflectionMethod $method
*
* @return array
*/
private function getMethodArguments(\ReflectionMethod $method)
{
$arguments = [];
$arguments = array();
$i = 0;
foreach ($method->getParameters() as $parameter) {
Copy link
Member

Choose a reason for hiding this comment

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

Why not using the key instead of the $i variable?

foreach($method->getParameters() as $i => $parameter) {
    $arguments[$parameter->getName()] = $i;
}

It should do the same thing: https://3v4l.org/Zpq4W

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated!

$arguments[$parameter->getName()] = $i;

$i++;
++$i;
}

return $arguments;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,4 @@ class ClassWithConstructorArgAnnotations
public function __construct($firstArg, $secondArg, $thirdArg)
{
}
}
}
0