Re: my last attempt at sanity with namespaces

From: Date: Fri, 17 Oct 2008 08:07:46 +0000
Subject: Re: my last attempt at sanity with namespaces
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-41201@lists.php.net to get a copy of this message
Hi. Sorry for yet another OT post in this thread. Josh Davis wrote:
I have a question about 3. Where in a script can you use the "use" statement? Could it be used inside conditionals? For example, if ($testing) {
    use class testing::PDO;
} else {
    use class ::PDO;
}
I hope this is a badly chosen example, as code should never behave seperately when under test as compared to production. Use dependency injection to feed a mock object, but don't do this. Regards, Karsten

« previous php.internals (#41201) next »