浏览代码

[DependencyInjection] fixed coding standards

Fabien Potencier 15 年之前
父节点
当前提交
e127c39f29

+ 3 - 4
src/Symfony/Components/DependencyInjection/Builder.php

@@ -20,10 +20,9 @@ namespace Symfony\Components\DependencyInjection;
  */
 class Builder extends Container
 {
-  protected
-    $definitions = array(),
-    $aliases     = array(),
-    $loading     = array();
+  protected $definitions = array();
+  protected $aliases     = array();
+  protected $loading     = array();
 
   /**
    * Sets a service.

+ 4 - 5
src/Symfony/Components/DependencyInjection/Container.php

@@ -52,11 +52,10 @@ namespace Symfony\Components\DependencyInjection;
  */
 class Container implements ContainerInterface, \ArrayAccess, \Iterator
 {
-  protected
-    $serviceIds = array(),
-    $parameters = array(),
-    $services   = array(),
-    $count      = 0;
+  protected $serviceIds = array();
+  protected $parameters = array();
+  protected $services   = array();
+  protected $count      = 0;
 
   const EXCEPTION_ON_INVALID_REFERENCE = 1;
   const NULL_ON_INVALID_REFERENCE      = 2;

+ 20 - 19
src/Symfony/Components/DependencyInjection/Definition.php

@@ -20,14 +20,13 @@ namespace Symfony\Components\DependencyInjection;
  */
 class Definition
 {
-  protected
-    $class        = null,
-    $file         = null,
-    $constructor  = null,
-    $shared       = true,
-    $arguments    = array(),
-    $calls        = array(),
-    $configurator = null;
+  protected $class;
+  protected $file;
+  protected $constructor;
+  protected $shared;
+  protected $arguments;
+  protected $calls;
+  protected $configurator;
 
   /**
    * Constructor.
@@ -37,14 +36,16 @@ class Definition
    */
   public function __construct($class, array $arguments = array())
   {
-    $this->class     = $class;
+    $this->class = $class;
     $this->arguments = $arguments;
+    $this->calls = array();
+    $this->shared = true;
   }
 
   /**
    * Sets the constructor method.
    *
-   * @param  string              $method The method name
+   * @param  string $method The method name
    *
    * @return Definition The current instance
    */
@@ -68,7 +69,7 @@ class Definition
   /**
    * Sets the service class.
    *
-   * @param  string              $class The service class
+   * @param  string $class The service class
    *
    * @return Definition The current instance
    */
@@ -92,7 +93,7 @@ class Definition
   /**
    * Sets the constructor arguments to pass to the service constructor.
    *
-   * @param  array               $arguments An array of arguments
+   * @param  array $arguments An array of arguments
    *
    * @return Definition The current instance
    */
@@ -106,7 +107,7 @@ class Definition
   /**
    * Adds a constructor argument to pass to the service constructor.
    *
-   * @param  mixed               $argument An argument
+   * @param  mixed $argument An argument
    *
    * @return Definition The current instance
    */
@@ -130,7 +131,7 @@ class Definition
   /**
    * Sets the methods to call after service initialization.
    *
-   * @param  array               $calls An array of method calls
+   * @param  array $calls An array of method calls
    *
    * @return Definition The current instance
    */
@@ -148,8 +149,8 @@ class Definition
   /**
    * Adds a method to call after service initialization.
    *
-   * @param  string              $method    The method name to call
-   * @param  array               $arguments An array of arguments to pass to the method call
+   * @param  string $method    The method name to call
+   * @param  array  $arguments An array of arguments to pass to the method call
    *
    * @return Definition The current instance
    */
@@ -173,7 +174,7 @@ class Definition
   /**
    * Sets a file to require before creating the service.
    *
-   * @param  string              $file A full pathname to include
+   * @param  string $file A full pathname to include
    *
    * @return Definition The current instance
    */
@@ -197,7 +198,7 @@ class Definition
   /**
    * Sets if the service must be shared or not.
    *
-   * @param  Boolean             $shared Whether the service must be shared or not
+   * @param  Boolean $shared Whether the service must be shared or not
    *
    * @return Definition The current instance
    */
@@ -221,7 +222,7 @@ class Definition
   /**
    * Sets a configurator to call after the service is fully initialized.
    *
-   * @param  mixed               $callable A PHP callable
+   * @param  mixed $callable A PHP callable
    *
    * @return Definition The current instance
    */

+ 2 - 1
src/Symfony/Components/DependencyInjection/Dumper/GraphvizDumper.php

@@ -29,7 +29,8 @@ use Symfony\Components\DependencyInjection\Builder;
  */
 class GraphvizDumper extends Dumper
 {
-  protected $nodes, $edges;
+  protected $nodes;
+  protected $edges;
 
   /**
    * Dumps the service container as a graphviz graph.

+ 1 - 1
src/Symfony/Components/DependencyInjection/Loader/XmlFileLoader.php

@@ -138,9 +138,9 @@ class XmlFileLoader extends FileLoader
 
     foreach (array('shared', 'constructor') as $key)
     {
-      $method = 'set'.ucfirst($key);
       if (isset($service[$key]))
       {
+        $method = 'set'.ucfirst($key);
         $definition->$method((string) $service->getAttributeAsPhp($key));
       }
     }

+ 1 - 2
src/Symfony/Components/DependencyInjection/Parameter.php

@@ -20,8 +20,7 @@ namespace Symfony\Components\DependencyInjection;
  */
 class Parameter
 {
-  protected
-    $id = null;
+  protected $id;
 
   /**
    * Constructor.

+ 2 - 1
src/Symfony/Components/DependencyInjection/Reference.php

@@ -20,7 +20,8 @@ namespace Symfony\Components\DependencyInjection;
  */
 class Reference
 {
-  protected $id, $invalidBehavior;
+  protected $id;
+  protected $invalidBehavior;
 
   /**
    * Constructor.