Skip to content

Commit aa936fa

Browse files
author
Hugo Hamon
committed
[DependencyInjection] remove autowiring_types feature
1 parent 8514e22 commit aa936fa

21 files changed

+0
-276
lines changed

src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -231,10 +231,6 @@ private function getContainerDefinitionData(Definition $definition, $omitTags =
231231
'autoconfigure' => $definition->isAutoconfigured(),
232232
);
233233

234-
foreach ($definition->getAutowiringTypes(false) as $autowiringType) {
235-
$data['autowiring_types'][] = $autowiringType;
236-
}
237-
238234
if ($showArguments) {
239235
$data['arguments'] = $this->describeValue($definition->getArguments(), $omitTags, $showArguments);
240236
}

src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,6 @@ protected function describeContainerDefinition(Definition $definition, array $op
191191
."\n".'- Autoconfigured: '.($definition->isAutoconfigured() ? 'yes' : 'no')
192192
;
193193

194-
foreach ($definition->getAutowiringTypes(false) as $autowiringType) {
195-
$output .= "\n".'- Autowiring Type: `'.$autowiringType.'`';
196-
}
197-
198194
if (isset($options['show_arguments']) && $options['show_arguments']) {
199195
$output .= "\n".'- Arguments: '.($definition->getArguments() ? 'yes' : 'no');
200196
}

src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -309,10 +309,6 @@ protected function describeContainerDefinition(Definition $definition, array $op
309309
$tableRows[] = array('Autowired', $definition->isAutowired() ? 'yes' : 'no');
310310
$tableRows[] = array('Autoconfigured', $definition->isAutoconfigured() ? 'yes' : 'no');
311311

312-
if ($autowiringTypes = $definition->getAutowiringTypes(false)) {
313-
$tableRows[] = array('Autowiring Types', implode(', ', $autowiringTypes));
314-
}
315-
316312
if ($definition->getFile()) {
317313
$tableRows[] = array('Required File', $definition->getFile() ? $definition->getFile() : '-');
318314
}

src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -370,12 +370,6 @@ private function populateAvailableType($id, Definition $definition)
370370
return;
371371
}
372372

373-
foreach ($definition->getAutowiringTypes(false) as $type) {
374-
$this->definedTypes[$type] = true;
375-
$this->types[$type] = $id;
376-
unset($this->ambiguousServiceTypes[$type]);
377-
}
378-
379373
if ($definition->isDeprecated() || !$reflectionClass = $this->container->getReflectionClass($definition->getClass(), true)) {
380374
return;
381375
}

src/Symfony/Component/DependencyInjection/Compiler/DecoratorServicePass.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,9 @@ public function process(ContainerBuilder $container)
5353
} else {
5454
$decoratedDefinition = $container->getDefinition($inner);
5555
$definition->setTags(array_merge($decoratedDefinition->getTags(), $definition->getTags()));
56-
if ($types = array_merge($decoratedDefinition->getAutowiringTypes(false), $definition->getAutowiringTypes(false))) {
57-
$definition->setAutowiringTypes($types);
58-
}
5956
$public = $decoratedDefinition->isPublic();
6057
$decoratedDefinition->setPublic(false);
6158
$decoratedDefinition->setTags(array());
62-
if ($decoratedDefinition->getAutowiringTypes(false)) {
63-
$decoratedDefinition->setAutowiringTypes(array());
64-
}
6559
$container->setDefinition($renamedId, $decoratedDefinition);
6660
}
6761

src/Symfony/Component/DependencyInjection/Compiler/ResolveDefinitionTemplatesPass.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,6 @@ private function doResolveDefinition(ChildDefinition $definition)
8989
$def->setArguments($parentDef->getArguments());
9090
$def->setMethodCalls($parentDef->getMethodCalls());
9191
$def->setProperties($parentDef->getProperties());
92-
if ($parentDef->getAutowiringTypes(false)) {
93-
$def->setAutowiringTypes($parentDef->getAutowiringTypes(false));
94-
}
9592
if ($parentDef->isDeprecated()) {
9693
$def->setDeprecated(true, $parentDef->getDeprecationMessage('%service_id%'));
9794
}
@@ -162,11 +159,6 @@ private function doResolveDefinition(ChildDefinition $definition)
162159
$def->setMethodCalls(array_merge($def->getMethodCalls(), $calls));
163160
}
164161

165-
// merge autowiring types
166-
foreach ($definition->getAutowiringTypes(false) as $autowiringType) {
167-
$def->addAutowiringType($autowiringType);
168-
}
169-
170162
// these attributes are always taken from the child
171163
$def->setAbstract($definition->isAbstract());
172164
$def->setTags($definition->getTags());

src/Symfony/Component/DependencyInjection/Definition.php

Lines changed: 0 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -792,72 +792,4 @@ public function setAutowired($autowired)
792792

793793
return $this;
794794
}
795-
796-
/**
797-
* Gets autowiring types that will default to this definition.
798-
*
799-
* @return string[]
800-
*
801-
* @deprecated since version 3.3, to be removed in 4.0.
802-
*/
803-
public function getAutowiringTypes(/*$triggerDeprecation = true*/)
804-
{
805-
if (1 > func_num_args() || func_get_arg(0)) {
806-
@trigger_error('Autowiring-types are deprecated since Symfony 3.3 and will be removed in 4.0. Use aliases instead.', E_USER_DEPRECATED);
807-
}
808-
809-
return array_keys($this->autowiringTypes);
810-
}
811-
812-
/**
813-
* Adds a type that will default to this definition.
814-
*
815-
* @param string $type
816-
*
817-
* @return $this
818-
*
819-
* @deprecated since version 3.3, to be removed in 4.0.
820-
*/
821-
public function addAutowiringType($type)
822-
{
823-
@trigger_error(sprintf('Autowiring-types are deprecated since Symfony 3.3 and will be removed in 4.0. Use aliases instead for "%s".', $type), E_USER_DEPRECATED);
824-
825-
$this->autowiringTypes[$type] = true;
826-
827-
return $this;
828-
}
829-
830-
/**
831-
* Removes a type.
832-
*
833-
* @param string $type
834-
*
835-
* @return $this
836-
*
837-
* @deprecated since version 3.3, to be removed in 4.0.
838-
*/
839-
public function removeAutowiringType($type)
840-
{
841-
@trigger_error(sprintf('Autowiring-types are deprecated since Symfony 3.3 and will be removed in 4.0. Use aliases instead for "%s".', $type), E_USER_DEPRECATED);
842-
843-
unset($this->autowiringTypes[$type]);
844-
845-
return $this;
846-
}
847-
848-
/**
849-
* Will this definition default for the given type?
850-
*
851-
* @param string $type
852-
*
853-
* @return bool
854-
*
855-
* @deprecated since version 3.3, to be removed in 4.0.
856-
*/
857-
public function hasAutowiringType($type)
858-
{
859-
@trigger_error(sprintf('Autowiring-types are deprecated since Symfony 3.3 and will be removed in 4.0. Use aliases instead for "%s".', $type), E_USER_DEPRECATED);
860-
861-
return isset($this->autowiringTypes[$type]);
862-
}
863795
}

src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -198,13 +198,6 @@ private function addService($definition, $id, \DOMElement $parent)
198198
$service->setAttribute('autowire', 'true');
199199
}
200200

201-
foreach ($definition->getAutowiringTypes(false) as $autowiringTypeValue) {
202-
$autowiringType = $this->document->createElement('autowiring-type');
203-
$autowiringType->appendChild($this->document->createTextNode($autowiringTypeValue));
204-
205-
$service->appendChild($autowiringType);
206-
}
207-
208201
if ($definition->isAutoconfigured()) {
209202
$service->setAttribute('autoconfigure', 'true');
210203
}

src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,6 @@ private function addService($id, $definition)
109109
$code .= " autowire: true\n";
110110
}
111111

112-
$autowiringTypesCode = '';
113-
foreach ($definition->getAutowiringTypes(false) as $autowiringType) {
114-
$autowiringTypesCode .= sprintf(" - %s\n", $this->dumper->dump($autowiringType));
115-
}
116-
if ($autowiringTypesCode) {
117-
$code .= sprintf(" autowiring_types:\n%s", $autowiringTypesCode);
118-
}
119-
120112
if ($definition->isLazy()) {
121113
$code .= " lazy: true\n";
122114
}

src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -341,10 +341,6 @@ private function parseDefinition(\DOMElement $service, $file, array $defaults)
341341
$definition->addTag($tag->getAttribute('name'), $parameters);
342342
}
343343

344-
foreach ($this->getChildren($service, 'autowiring-type') as $type) {
345-
$definition->addAutowiringType($type->textContent);
346-
}
347-
348344
if ($value = $service->getAttribute('decorates')) {
349345
$renameId = $service->hasAttribute('decoration-inner-name') ? $service->getAttribute('decoration-inner-name') : null;
350346
$priority = $service->hasAttribute('decoration-priority') ? $service->getAttribute('decoration-priority') : 0;

0 commit comments

Comments
 (0)