소스 검색

use array as default value

rather than assigning empty array in constructor. the latter can cause
issues with mocks in some scenarios (if constructor does not get called)
Rob Bast 8 년 전
부모
커밋
611d6a0364
1개의 변경된 파일5개의 추가작업 그리고 4개의 파일을 삭제
  1. 5 4
      src/Composer/Package/BasePackage.php

+ 5 - 4
src/Composer/Package/BasePackage.php

@@ -49,12 +49,14 @@ abstract class BasePackage implements PackageInterface
      * @var int
      */
     public $id;
-
+    /** @var string */
     protected $name;
+    /** @var string */
     protected $prettyName;
-
+    /** @var RepositoryInterface */
     protected $repository;
-    protected $transportOptions;
+    /** @var array */
+    protected $transportOptions = array();
 
     /**
      * All descendants' constructors should call this parent constructor
@@ -66,7 +68,6 @@ abstract class BasePackage implements PackageInterface
         $this->prettyName = $name;
         $this->name = strtolower($name);
         $this->id = -1;
-        $this->transportOptions = array();
     }
 
     /**