@@ -28,7 +28,7 @@ |
||
| 28 | 28 | /** |
| 29 | 29 | * Initializes reflection instance |
| 30 | 30 | * |
| 31 | - * @param string|object $argument Class name or instance of object |
|
| 31 | + * @param string|null $argument Class name or instance of object |
|
| 32 | 32 | * @param ClassLike $classLikeNode AST node for class |
| 33 | 33 | * @param ReflectionParser $reflectionParser AST parser |
| 34 | 34 | */ |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | unset($this->name); |
| 42 | 42 | |
| 43 | 43 | $this->namespaceName = join('\\', $namespaceParts); |
| 44 | - $this->reflectionParser = $reflectionParser ?: ReflectionEngine::getReflectionParser(); |
|
| 44 | + $this->reflectionParser = $reflectionParser ?: ReflectionEngine::getReflectionParser(); |
|
| 45 | 45 | |
| 46 | 46 | $this->classLikeNode = $classLikeNode ?: $this->reflectionParser->parseClass($fullClassName); |
| 47 | 47 | } |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | * |
| 94 | 94 | * @param string $fullName Full name of the class |
| 95 | 95 | * |
| 96 | - * @return void |
|
| 96 | + * @return \ReflectionClass |
|
| 97 | 97 | */ |
| 98 | 98 | public function getClassReflection($fullName) |
| 99 | 99 | { |
@@ -267,6 +267,9 @@ discard block |
||
| 267 | 267 | |
| 268 | 268 | /** |
| 269 | 269 | * Provides back compatibility with static ReflectionEngine |
| 270 | + * @param null|integer $maximumCachedFiles |
|
| 271 | + * @param null|Parser $parser |
|
| 272 | + * @param null|NodeTraverser $traverser |
|
| 270 | 273 | * @return void |
| 271 | 274 | */ |
| 272 | 275 | public function initStaticEngine(&$parsedFiles, &$maximumCachedFiles, &$parser, &$traverser) |
@@ -95,8 +95,8 @@ discard block |
||
| 95 | 95 | * |
| 96 | 96 | * @return void |
| 97 | 97 | */ |
| 98 | - public function getClassReflection($fullName) |
|
| 99 | - { |
|
| 98 | + public function getClassReflection($fullName) |
|
| 99 | + { |
|
| 100 | 100 | if (class_exists($fullName, false) |
| 101 | 101 | || interface_exists($fullName, false) |
| 102 | 102 | || trait_exists($fullName, false) |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | return new \ReflectionClass($fullName); |
| 105 | 105 | } |
| 106 | 106 | return new ReflectionClass($fullName, null, $this); |
| 107 | - } |
|
| 107 | + } |
|
| 108 | 108 | |
| 109 | 109 | /** |
| 110 | 110 | * Locates a file name for class |
@@ -271,14 +271,14 @@ discard block |
||
| 271 | 271 | */ |
| 272 | 272 | public function initStaticEngine(&$parsedFiles, &$maximumCachedFiles, &$parser, &$traverser) |
| 273 | 273 | { |
| 274 | - $parsedFiles = $this->parsedFiles; |
|
| 275 | - $maximumCachedFiles = $this->maximumCachedFiles; |
|
| 276 | - $parser = $this->parser; |
|
| 277 | - $traverser = $this->traverser; |
|
| 278 | - $this->parsedFiles = &$parsedFiles; |
|
| 279 | - $this->maximumCachedFiles = &$maximumCachedFiles; |
|
| 280 | - $this->parser = &$parser; |
|
| 281 | - $this->traverser = &$traverser; |
|
| 274 | + $parsedFiles = $this->parsedFiles; |
|
| 275 | + $maximumCachedFiles = $this->maximumCachedFiles; |
|
| 276 | + $parser = $this->parser; |
|
| 277 | + $traverser = $this->traverser; |
|
| 278 | + $this->parsedFiles = &$parsedFiles; |
|
| 279 | + $this->maximumCachedFiles = &$maximumCachedFiles; |
|
| 280 | + $this->parser = &$parser; |
|
| 281 | + $this->traverser = &$traverser; |
|
| 282 | 282 | } |
| 283 | 283 | |
| 284 | 284 | } |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | //for some reason, ReflectionMethod->getNamespaceName in php always returns '', so we shouldn't use it too |
| 57 | 57 | $this->className = $className; |
| 58 | 58 | $this->declaringClass = $declaringClass; |
| 59 | - $this->reflectionParser = $reflectionParser ?: ReflectionEngine::getReflectionParser(); |
|
| 59 | + $this->reflectionParser = $reflectionParser ?: ReflectionEngine::getReflectionParser(); |
|
| 60 | 60 | $this->functionLikeNode = $classMethodNode ?: $this->reflectionParser->parseClassMethod($className, $methodName); |
| 61 | 61 | |
| 62 | 62 | // Let's unset original read-only properties to have a control over them via __get |
@@ -137,8 +137,8 @@ discard block |
||
| 137 | 137 | public function getDeclaringClass() |
| 138 | 138 | { |
| 139 | 139 | return isset($this->declaringClass) |
| 140 | - ? $this->declaringClass |
|
| 141 | - : $this->reflectionParser->getClassReflection($this->className); |
|
| 140 | + ? $this->declaringClass |
|
| 141 | + : $this->reflectionParser->getClassReflection($this->className); |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | /** |
@@ -68,7 +68,7 @@ |
||
| 68 | 68 | ReflectionParser $reflectionParser = null |
| 69 | 69 | ) { |
| 70 | 70 | $this->className = $className; |
| 71 | - $this->reflectionParser = $reflectionParser ?: ReflectionEngine::getReflectionParser(); |
|
| 71 | + $this->reflectionParser = $reflectionParser ?: ReflectionEngine::getReflectionParser(); |
|
| 72 | 72 | if (!$propertyType || !$propertyNode) { |
| 73 | 73 | list ($propertyType, $propertyNode) = $this->reflectionParser->parseClassProperty($className, $propertyName); |
| 74 | 74 | } |
@@ -95,7 +95,7 @@ |
||
| 95 | 95 | $this->parameterNode = $parameterNode; |
| 96 | 96 | $this->parameterIndex = $parameterIndex; |
| 97 | 97 | $this->declaringFunction = $declaringFunction; |
| 98 | - $this->reflectionParser = $reflectionParser ?: ReflectionEngine::getReflectionParser(); |
|
| 98 | + $this->reflectionParser = $reflectionParser ?: ReflectionEngine::getReflectionParser(); |
|
| 99 | 99 | |
| 100 | 100 | if ($this->isDefaultValueAvailable()) { |
| 101 | 101 | if ($declaringFunction instanceof \ReflectionMethod) { |
@@ -50,13 +50,13 @@ discard block |
||
| 50 | 50 | public static function init(LocatorInterface $locator) |
| 51 | 51 | { |
| 52 | 52 | self::$locator = $locator; |
| 53 | - self::$reflectionParser = new ReflectionParser($locator); |
|
| 54 | - self::$reflectionParser->initStaticEngine( |
|
| 55 | - self::$parsedFiles, |
|
| 56 | - self::$maximumCachedFiles, |
|
| 57 | - self::$parser, |
|
| 58 | - self::$traverser |
|
| 59 | - ); |
|
| 53 | + self::$reflectionParser = new ReflectionParser($locator); |
|
| 54 | + self::$reflectionParser->initStaticEngine( |
|
| 55 | + self::$parsedFiles, |
|
| 56 | + self::$maximumCachedFiles, |
|
| 57 | + self::$parser, |
|
| 58 | + self::$traverser |
|
| 59 | + ); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | /** |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | */ |
| 65 | 65 | public static function getReflectionParser() |
| 66 | 66 | { |
| 67 | - return self::$reflectionParser; |
|
| 67 | + return self::$reflectionParser; |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | /** |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | */ |
| 77 | 77 | public static function setMaximumCachedFiles($newLimit) |
| 78 | 78 | { |
| 79 | - self::$reflectionParser->setMaximumCachedFiles($newLimit); |
|
| 79 | + self::$reflectionParser->setMaximumCachedFiles($newLimit); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | /** |
@@ -58,7 +58,7 @@ |
||
| 58 | 58 | { |
| 59 | 59 | $fileName = PathResolver::realpath($fileName); |
| 60 | 60 | $this->fileName = $fileName; |
| 61 | - $this->reflectionParser = $reflectionParser ?: ReflectionEngine::getReflectionParser(); |
|
| 61 | + $this->reflectionParser = $reflectionParser ?: ReflectionEngine::getReflectionParser(); |
|
| 62 | 62 | $this->topLevelNodes = $topLevelNodes ?: $this->reflectionParser->parseFile($fileName); |
| 63 | 63 | } |
| 64 | 64 | |
@@ -90,7 +90,7 @@ |
||
| 90 | 90 | public function __construct($fileName, $namespaceName, Namespace_ $namespaceNode = null, ReflectionParser $reflectionParser = null) |
| 91 | 91 | { |
| 92 | 92 | $fileName = PathResolver::realpath($fileName); |
| 93 | - $this->reflectionParser = $reflectionParser ?: ReflectionEngine::getReflectionParser(); |
|
| 93 | + $this->reflectionParser = $reflectionParser ?: ReflectionEngine::getReflectionParser(); |
|
| 94 | 94 | if (!$namespaceNode) { |
| 95 | 95 | $namespaceNode = $this->reflectionParser->parseFileNamespace($fileName, $namespaceName); |
| 96 | 96 | } |