@@ -66,25 +66,16 @@ class ClassType extends Nette\Object
66
66
public static function from ($ from )
67
67
{
68
68
$ from = $ from instanceof \ReflectionClass ? $ from : new \ReflectionClass ($ from );
69
- $ class = new static ($ from ->getShortName ());
69
+ $ class = new static ($ from ->getShortName (), new PhpNamespace ( $ from -> getNamespaceName ()) );
70
70
$ class ->type = $ from ->isInterface () ? 'interface ' : (PHP_VERSION_ID >= 50400 && $ from ->isTrait () ? 'trait ' : 'class ' );
71
71
$ class ->final = $ from ->isFinal () && $ class ->type === 'class ' ;
72
72
$ class ->abstract = $ from ->isAbstract () && $ class ->type === 'class ' ;
73
73
$ class ->implements = $ from ->getInterfaceNames ();
74
74
$ class ->documents = $ from ->getDocComment () ? array (preg_replace ('#^\s*\* ?#m ' , '' , trim ($ from ->getDocComment (), "/* \r\n\t" ))) : array ();
75
- $ namespace = $ from ->getNamespaceName ();
76
75
if ($ from ->getParentClass ()) {
77
76
$ class ->extends = $ from ->getParentClass ()->getName ();
78
- if ($ namespace ) {
79
- $ class ->extends = Strings::startsWith ($ class ->extends , "$ namespace \\" ) ? substr ($ class ->extends , strlen ($ namespace ) + 1 ) : '\\' . $ class ->extends ;
80
- }
81
77
$ class ->implements = array_diff ($ class ->implements , $ from ->getParentClass ()->getInterfaceNames ());
82
78
}
83
- if ($ namespace ) {
84
- foreach ($ class ->implements as & $ interface ) {
85
- $ interface = Strings::startsWith ($ interface , "$ namespace \\" ) ? substr ($ interface , strlen ($ namespace ) + 1 ) : '\\' . $ interface ;
86
- }
87
- }
88
79
foreach ($ from ->getProperties () as $ prop ) {
89
80
if ($ prop ->getDeclaringClass () == $ from ) { // intentionally ==
90
81
$ class ->properties [$ prop ->getName ()] = Property::from ($ prop );
0 commit comments