NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
Valid evaluation of namespace Aliases


Joined: 24 Mar 2010
Posts: 27
Reply with quote
The evaluation of Namespace Aliase (use Statements) does not properly work.

It Results in an "Uncaught exception Error". In the watch list, the mouse over evaluation so as the immediate evaluation window.
View user's profileFind all posts by eutychusSend private message
Guru master

Joined: 24 Jul 2009
Posts: 701
Reply with quote
If you think it is a bug, you should report it rather than put it into Feature Requests Wink
View user's profileFind all posts by plugnplaySend private message
Site Admin

Joined: 13 Jul 2003
Posts: 7823
Reply with quote
As far I'm aware, there are no php statements/functions to check namespace aliases. How do you do this in Watch?

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 24 Mar 2010
Posts: 27
Reply with quote
dmitri wrote:
As far I'm aware, there are no php statements/functions to check namespace aliases. How do you do this in Watch?


If I define something like that:
Code:

namespace Blih\Blah;

class Blub {
    static function say()
    {
        return "Hello world!";
    }
}



Code:


use Blih\Blah\Blub As Sausage;



A call to Sausage::say() in Immediate Window is not evaluated.

I think the problem is to use the Context of the Active Window.


Last edited by eutychus on Thu Oct 27, 2016 10:51 am; edited 2 times in total
View user's profileFind all posts by eutychusSend private message


Joined: 07 May 2014
Posts: 51
Reply with quote
I'd asked for this a while ago. The answer was "not supported".

Maybe it's time to support it now, dmitri?
View user's profileFind all posts by temuri416Send private message
Site Admin

Joined: 13 Jul 2003
Posts: 7823
Reply with quote
Alias is an identifier that is valid in the context it's imported to. Anywhere else, including debugger context, it's invalid. Moreover, it's invalid at run-time.
Try the following without any debuggers:

Code:

<?php
namespace Blih\Blah {

    class Blub {
        static function say()
        {
            return "Hello world!";
        }
    }
}
namespace {
    use Blih\Blah\Blub As Sausage;
    try {
        eval("Sausage::say();");
    }
    catch (Error $e) {
        echo $e->getMessage();
    }
}   

?>


and you'll get:
"Class 'Sausage' not found"
that's it.

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website
Valid evaluation of namespace Aliases
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 1 of 1  

  
  
 Reply to topic