@@ -66,25 +66,16 @@ class ClassType extends Nette\Object
6666 public static function from ($ from )
6767 {
6868 $ from = $ from instanceof \ReflectionClass ? $ from : new \ReflectionClass ($ from );
69- $ class = new static ($ from ->getShortName ());
69+ $ class = new static ($ from ->getShortName (), new PhpNamespace ( $ from -> getNamespaceName ()) );
7070 $ class ->type = $ from ->isInterface () ? 'interface ' : (PHP_VERSION_ID >= 50400 && $ from ->isTrait () ? 'trait ' : 'class ' );
7171 $ class ->final = $ from ->isFinal () && $ class ->type === 'class ' ;
7272 $ class ->abstract = $ from ->isAbstract () && $ class ->type === 'class ' ;
7373 $ class ->implements = $ from ->getInterfaceNames ();
7474 $ class ->documents = $ from ->getDocComment () ? array (preg_replace ('#^\s*\* ?#m ' , '' , trim ($ from ->getDocComment (), "/* \r\n\t" ))) : array ();
75- $ namespace = $ from ->getNamespaceName ();
7675 if ($ from ->getParentClass ()) {
7776 $ 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- }
8177 $ class ->implements = array_diff ($ class ->implements , $ from ->getParentClass ()->getInterfaceNames ());
8278 }
83- if ($ namespace ) {
84- foreach ($ class ->implements as & $ interface ) {
85- $ interface = Strings::startsWith ($ interface , "$ namespace \\" ) ? substr ($ interface , strlen ($ namespace ) + 1 ) : '\\' . $ interface ;
86- }
87- }
8879 foreach ($ from ->getProperties () as $ prop ) {
8980 if ($ prop ->getDeclaringClass () == $ from ) { // intentionally ==
9081 $ class ->properties [$ prop ->getName ()] = Property::from ($ prop );
0 commit comments