Selaa lähdekoodia

[DI XmlLoader] Add missing type hints

Victor Berchet 14 vuotta sitten
vanhempi
commit
22f04f50a6

+ 9 - 9
src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php

@@ -71,7 +71,7 @@ class XmlFileLoader extends FileLoader
         return is_string($resource) && 'xml' === pathinfo($resource, PATHINFO_EXTENSION);
     }
 
-    protected function parseParameters($xml, $file)
+    protected function parseParameters(SimpleXMLElement $xml, $file)
     {
         if (!$xml->parameters) {
             return;
@@ -80,7 +80,7 @@ class XmlFileLoader extends FileLoader
         $this->container->getParameterBag()->add($xml->parameters->getArgumentsAsPhp('parameter'));
     }
 
-    protected function parseImports($xml, $file)
+    protected function parseImports(SimpleXMLElement $xml, $file)
     {
         if (!$xml->imports) {
             return;
@@ -92,7 +92,7 @@ class XmlFileLoader extends FileLoader
         }
     }
 
-    protected function parseInterfaceInjectors($xml, $file)
+    protected function parseInterfaceInjectors(SimpleXMLElement $xml, $file)
     {
         if (!$xml->interfaces) {
             return;
@@ -112,7 +112,7 @@ class XmlFileLoader extends FileLoader
         $this->container->addInterfaceInjector($injector);
     }
 
-    protected function parseDefinitions($xml, $file)
+    protected function parseDefinitions(SimpleXMLElement $xml, $file)
     {
         if (!$xml->services) {
             return;
@@ -202,7 +202,7 @@ class XmlFileLoader extends FileLoader
         return simplexml_import_dom($dom, 'Symfony\\Component\\DependencyInjection\\SimpleXMLElement');
     }
 
-    protected function processAnonymousServices($xml, $file)
+    protected function processAnonymousServices(SimpleXMLElement $xml, $file)
     {
         $definitions = array();
         $count = 0;
@@ -248,7 +248,7 @@ class XmlFileLoader extends FileLoader
         return $xml;
     }
 
-    protected function validate($dom, $file)
+    protected function validate(\DOMDocument $dom, $file)
     {
         $this->validateSchema($dom, $file);
         $this->validateExtensions($dom, $file);
@@ -258,7 +258,7 @@ class XmlFileLoader extends FileLoader
      * @throws \RuntimeException         When extension references a non-existent XSD file
      * @throws \InvalidArgumentException When xml doesn't validate its xsd schema
      */
-    protected function validateSchema($dom, $file)
+    protected function validateSchema(\DOMDocument $dom, $file)
     {
         $schemaLocations = array('http://www.symfony-project.org/schema/dic/services' => str_replace('\\', '/', __DIR__.'/schema/dic/services/services-1.0.xsd'));
 
@@ -326,7 +326,7 @@ EOF
     /**
      * @throws  \InvalidArgumentException When non valid tag are found or no extension are found
      */
-    protected function validateExtensions($dom, $file)
+    protected function validateExtensions(\DOMDocument $dom, $file)
     {
         foreach ($dom->documentElement->childNodes as $node) {
             if (!$node instanceof \DOMElement || in_array($node->tagName, array('imports', 'parameters', 'services', 'interfaces'))) {
@@ -359,7 +359,7 @@ EOF
         return $errors;
     }
 
-    protected function loadFromExtensions($xml)
+    protected function loadFromExtensions(SimpleXMLElement $xml)
     {
         foreach (dom_import_simplexml($xml)->childNodes as $node) {
             if (!$node instanceof \DOMElement || $node->namespaceURI === 'http://www.symfony-project.org/schema/dic/services') {