Skip to content

Commit c2042ef

Browse files
committed
Namespace aliases are not returned
When we try to retrieve the namespace aliases in the FileReflector we have noticed that we did not receive any results despite that there are namespace aliases present in a file. During a previous refactoring the concept of a DocBlock Context was introduced but the getters for namespace and namespace aliases were not changed to retrieve their information from that context class. In this commit I have altered the FileReflector to use the context and I have cleaned up a few parts. This change fixes phpDocumentor/phpDocumentor#1313.
1 parent df82db6 commit c2042ef

File tree

1 file changed

+26
-23
lines changed

1 file changed

+26
-23
lines changed

src/phpDocumentor/Reflection/FileReflector.php

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -49,34 +49,37 @@
4949
*/
5050
class FileReflector extends ReflectionAbstract implements PHPParser_NodeVisitor
5151
{
52+
/** @var string An MD5 hashed representation of the contents of this file */
5253
protected $hash;
53-
protected $contents = 1;
54-
/**
55-
* @var IncludeReflector[]
56-
*/
54+
55+
/** @var string The contents of this file. */
56+
protected $contents = '';
57+
58+
/** @var IncludeReflector[] */
5759
protected $includes = array();
58-
/**
59-
* @var ConstantReflector[]
60-
*/
60+
61+
/** @var ConstantReflector[] */
6162
protected $constants = array();
62-
/**
63-
* @var ClassReflector[]
64-
*/
63+
64+
/** @var ClassReflector[] */
6565
protected $classes = array();
66-
/**
67-
* @var TraitReflector[]
68-
*/
66+
67+
/** @var TraitReflector[] */
6968
protected $traits = array();
70-
/**
71-
* @var InterfaceReflector[]
72-
*/
69+
70+
/** @var InterfaceReflector[] */
7371
protected $interfaces = array();
74-
/**
75-
* @var FunctionReflector[]
76-
*/
72+
73+
/** @var FunctionReflector[] */
7774
protected $functions = array();
75+
76+
/** @var string The name of the file associated with this reflection object. */
7877
protected $filename = '';
78+
79+
/** @var DocBlock */
7980
protected $doc_block;
81+
82+
/** @var string The package name that should be used if none is present in the file */
8083
protected $default_package_name = 'Default';
8184

8285
/** @var string[] A list of markers contained in this file. */
@@ -88,8 +91,8 @@ class FileReflector extends ReflectionAbstract implements PHPParser_NodeVisitor
8891
/** @var string[] A list of all marker types to search for in this file. */
8992
protected $marker_terms = array('TODO', 'FIXME');
9093

91-
protected $namespace_aliases = array();
92-
protected $current_namespace = '';
94+
/** @var Context */
95+
protected $context;
9396

9497
/**
9598
* Opens the file and retrieves its contents.
@@ -453,12 +456,12 @@ public function getParseErrors()
453456

454457
public function getNamespace()
455458
{
456-
return $this->current_namespace;
459+
return $this->context->getNamespace();
457460
}
458461

459462
public function getNamespaceAliases()
460463
{
461-
return $this->namespace_aliases;
464+
return $this->context->getNamespaceAliases();
462465
}
463466

464467
public function getContents()

0 commit comments

Comments
 (0)