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

Appearance settings

Commit fe09530

Browse filesBrowse files
committed
[PropertyInfo] Use iterators for PropertyInfoExtractor
1 parent c3230f0 commit fe09530
Copy full SHA for fe09530

File tree

2 files changed

+14
-28
lines changed
Filter options

2 files changed

+14
-28
lines changed

‎src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/PropertyInfoPass.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/PropertyInfoPass.php
+5-4Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler;
1313

14+
use Symfony\Component\DependencyInjection\Argument\IteratorArgument;
1415
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
1516
use Symfony\Component\DependencyInjection\Compiler\PriorityTaggedServiceTrait;
1617
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -36,15 +37,15 @@ public function process(ContainerBuilder $container)
3637
$definition = $container->getDefinition('property_info');
3738

3839
$listExtractors = $this->findAndSortTaggedServices('property_info.list_extractor', $container);
39-
$definition->replaceArgument(0, $listExtractors);
40+
$definition->replaceArgument(0, new IteratorArgument($listExtractors));
4041

4142
$typeExtractors = $this->findAndSortTaggedServices('property_info.type_extractor', $container);
42-
$definition->replaceArgument(1, $typeExtractors);
43+
$definition->replaceArgument(1, new IteratorArgument($typeExtractors));
4344

4445
$descriptionExtractors = $this->findAndSortTaggedServices('property_info.description_extractor', $container);
45-
$definition->replaceArgument(2, $descriptionExtractors);
46+
$definition->replaceArgument(2, new IteratorArgument($descriptionExtractors));
4647

4748
$accessExtractors = $this->findAndSortTaggedServices('property_info.access_extractor', $container);
48-
$definition->replaceArgument(3, $accessExtractors);
49+
$definition->replaceArgument(3, new IteratorArgument($accessExtractors));
4950
}
5051
}

‎src/Symfony/Component/PropertyInfo/PropertyInfoExtractor.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/PropertyInfo/PropertyInfoExtractor.php
+9-24Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -18,33 +18,18 @@
1818
*/
1919
class PropertyInfoExtractor implements PropertyInfoExtractorInterface
2020
{
21-
/**
22-
* @var PropertyListExtractorInterface[]
23-
*/
2421
private $listExtractors;
25-
26-
/**
27-
* @var PropertyTypeExtractorInterface[]
28-
*/
2922
private $typeExtractors;
30-
31-
/**
32-
* @var PropertyDescriptionExtractorInterface[]
33-
*/
3423
private $descriptionExtractors;
35-
36-
/**
37-
* @var PropertyAccessExtractorInterface[]
38-
*/
3924
private $accessExtractors;
4025

4126
/**
42-
* @param PropertyListExtractorInterface[] $listExtractors
43-
* @param PropertyTypeExtractorInterface[] $typeExtractors
44-
* @param PropertyDescriptionExtractorInterface[] $descriptionExtractors
45-
* @param PropertyAccessExtractorInterface[] $accessExtractors
27+
* @param \Traversable|PropertyListExtractorInterface[] $listExtractors
28+
* @param \Traversable|PropertyTypeExtractorInterface[] $typeExtractors
29+
* @param \Traversable|PropertyDescriptionExtractorInterface[] $descriptionExtractors
30+
* @param \Traversable|PropertyAccessExtractorInterface[] $accessExtractors
4631
*/
47-
public function __construct(array $listExtractors = array(), array $typeExtractors = array(), array $descriptionExtractors = array(), array $accessExtractors = array())
32+
public function __construct($listExtractors = array(), $typeExtractors = array(), $descriptionExtractors = array(), $accessExtractors = array())
4833
{
4934
$this->listExtractors = $listExtractors;
5035
$this->typeExtractors = $typeExtractors;
@@ -103,13 +88,13 @@ public function isWritable($class, $property, array $context = array())
10388
/**
10489
* Iterates over registered extractors and return the first value found.
10590
*
106-
* @param array $extractors
107-
* @param string $method
108-
* @param array $arguments
91+
* @param array|\Traversable $extractors
92+
* @param string $method
93+
* @param array $arguments
10994
*
11095
* @return mixed
11196
*/
112-
private function extract(array $extractors, $method, array $arguments)
97+
private function extract($extractors, $method, array $arguments)
11398
{
11499
foreach ($extractors as $extractor) {
115100
$value = call_user_func_array(array($extractor, $method), $arguments);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.