NuSphere Forums Forum Index
NuSphere Forums
Reply to topic


Joined: 21 Nov 2009
Posts: 20
Reply with quote
All problems shown in my previous posts have been fixed in the build 5981 and 5982, but there are still many situations when the code completion fails.

Relative definitions do not work when child class is in different namespace.

Code:

namespace Alpha
{
   class Foo
   {
      public function testA();
   }

   class TestClass
   {
      /** @var \Alpha\Foo */
      public $a;

      /** @var Foo */
      public $b;
   }

   $testClass = new TestClass();
   $testClass->a->testA(); // OK
   $testClass->b->testA(); // OK
}

namespace Beta
{
   class Foo
   {
      public function testB();
   }

   class Child extends \Alpha\TestClass {}

   $child = new Child();
   $child->a->testA(); // OK
   $child->b->testA(); // fails - suggests testB instead of testA
}


Interfaces are not supported
Code:

namespace /* global namespace */
{
   interface TestInterface
   {
      public function someMethod();
   }
}

namespace Alpha
{
   use Beta\Alpha as NamespaceAlias;
   use Beta\Alpha\TestInterface as InterfaceAlias;

   interface TestInterface
   {
      public function anotherMethod();
   }

   class Foo
   {
      /** @var TestInterface */
      public $a;

      /** @var \TestInterface */
      public $b;

      /** @var \Alpha\TestInterface */
      public $c;

      /** @var \Beta\Alpha\TestInterface */
      public $d;

      /** @var NamespaceAlias\TestInterface */
      public $e;

      /** @var InterfaceAlias */
      public $f;

      /** @var \Alpha\TestInterface|\Beta\Alpha\TestInterface|NULL */
      public $g;
   }

   $foo = new Foo(); // OK
   $foo->a->anotherMethod(); // fails - suggests someMethod instead of anotherMethod
   $foo->b->someMethod(); // OK
   $foo->c->anotherMethod(); // fails
   $foo->d->anotherMethodForBeta(); // fails
   $foo->e->anotherMethodForBeta(); // fails
   $foo->f->anotherMethodForBeta(); // fails
   $foo->g->anotherMethod(); // fails
   $foo->g->anotherMethodForBeta(); // fails
}

namespace Beta\Alpha
{
   interface TestInterface
   {
      public function anotherMethodForBeta();
   }
}


@property does not work as well as @var

Code:
namespace
{
   class Foo
   {
      public function testA();
   }
}

namespace Alpha
{
   use Beta\Alpha as NamespaceAlias;
   use Beta\Alpha\Foo as FooAlias;

   class Foo
   {
      public function testB();
   }

   /**
    * @property Foo                 $a
    * @property \Foo                $b   fails
    * @property \Alpha\Foo          $c
    * @property \Beta\Alpha\Foo     $d
    * @property FooAlias            $e   fails
    * @property NamespaceAlias\Foo  $f   fails
    * @property Sub\Foo             $g
    */
   class TestClass
   {
      /** @var FooAlias */
      public $e2;

      /** @var NamespaceAlias\Foo */
      public $f2;
   }

   $testClass = new TestClass(); // OK
   $testClass->a->testB(); // OK
   $testClass->b->testA(); // fails - suggests testB intead of testA
   $testClass->c->testB(); // OK
   $testClass->d->testD(); // OK
   $testClass->e->testD(); // fails
   $testClass->e2->testD(); // OK
   $testClass->f->testD(); // fails
   $testClass->f2->testD(); // OK
   $testClass->g->testC(); // OK
}

namespace Alpha\Sub
{
   class Foo
   {
      public function testC();
   }
}

namespace Beta\Alpha
{
   class Foo
   {
      public function testD();
   }
}
View user's profileFind all posts by Jan TvrdíkSend private message


Joined: 07 Nov 2007
Posts: 44
Reply with quote
Actually those specific cases should be reported directly to our tech support over "contact us" online form, and our support will review those and let engineering know. Forum is not the right place to report specific bugs or issues as per forum rules, we already have bended the rules to continue this discussion on forum, since it started with fairly generic problem. But definitely we need to stop now since it's not the right way to resolve those issues.
Best regards,
Nusphere Customer Care
View user's profileFind all posts by gitmansSend private message
PHP 5.3 namespaces: Support for importing and aliasing
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 2 of 2  

  
  
 Reply to topic