2012/4/16 Ralph Schindler <[email protected]> > > ... PHP does not invoke the autoloader to determine if the class name > actually exists as a declaration somewhere, it simply resolves it according > to some very specific rules (in the case of this patch, carried out by > zend_resolve_class_name()). > > If I am within a namespace and am using a short name without a preceding > "\", it means the class I am referencing exists in the current namespace. > Whether or not that class exists is irrelevant as my short name can only > mean "a class by this name in the current namespace". In this code: > > namespace Foo\Bar { > global $foo; > if ($foo && $foo instance Bar) { > // ... > } > } > > ... that you, the developer, intend that your reference to Baz actually > means "Foo\Bar\Baz", it can never mean anything else. > > So, in a nutshell, there is no guessing going on ;) > -ralph
Hi, Ralph Agree on that. I'd like to have a comment in the test, specially for this line where you're checking for non-existing classes. It does not seem to be obvious what should be tested here (at least it was not obvious for me). This may make it easier to fix stuff if this test should fail in future. I don't know if this here is the right test to put the comment in, but it's at least relying on something global that may change. Thanks for giving me a deeper knowledge here :) Bye Simon -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
