Community
Participate
Working Groups
Hi, while working on Bug 559639, I've fixed namespace declarations for the FFI classes. But our validator cannot resolve FFI\CData and FFI\CType class usages. I think our validator doesn't like classes and namespaces having same name. I'm adding the file as attachement. I know the file looks a bit strange, but it's content is valid and PDT should not warn about unresolved types. Thierry.
Created attachment 281640 [details] generated FFI classes
New Gerrit change created: https://git.eclipse.org/r/161940
Hi, after doing some debugging, I think I found some (hopefully) very uncommon cases that PDT handles wrongly. Take following example: <?php namespace { final class FFI { /** * @return bool whether a \FFI\CData is a null pointer. */ public static function isNull (\FFI\CData &$ptr) {} } } namespace FFI { final class CData { } } For now, in PHPIndexingVisitor#visit(TypeDeclaration), PDT will first (correctly) detect the \FFI (non-namespace) type in the global namespaceand after that will detect the \FFI namespace type but will wrongly share same "index occurence count" for both detected types. In this very specific case, it's necessary to have different "index occurence counts", otherwise PHPElementResolver#resolve() will generate exactly same IndexType(parentElement, elementName, ..., occurrenceCount) for 2 very different element types (i.e. IModelElement.PACKAGE_DECLARATION and IModelElement.TYPE) and "bind" them together! Same problem occurs when there is first a \FFI namespace type and then a \FFI (non-namespace) type inside a global namespace: <?php namespace FFI { } namespace { final class FFI { /** * * @param \FFI\CData $ptr * The handle of the pointer to a C data structure. */ public static function isNull(\FFI\CData &$ptr) { } } } namespace FFI { final class CData { } } https://git.eclipse.org/r/#/c/161940/ should address this issue. Thierry.
Gerrit change https://git.eclipse.org/r/161940 was merged to [master]. Commit: http://git.eclipse.org/c/pdt/org.eclipse.pdt.git/commit/?id=262963bea78861c8d8a6f8c8c76a19522b585f4d
Fixed.