Dummy XFCP class cannot be resolved to a type

Myke623

Well-known member
When extending a class via the XenForo Class Proxy (XFCP) system, eclipse reports that it cannot resolve the type of the XFCP reference class:

xfcp-unresolved.webp

Is there a way to have eclipse not report these errors? Kind of bums me out seeing red x's all over the place!
 
If you enable development mode, we will automatically write out a file that resolves this -- or it should. For example:
PHP:
<?php

// ################## THIS IS A GENERATED FILE ##################
// DO NOT EDIT DIRECTLY. EDIT THE CLASS EXTENSIONS IN THE CONTROL PANEL.

namespace XFRM\XF\Entity
{
   class XFCP_User extends \XF\Entity\User {}
}

namespace XFRM\XF\Pub\Controller
{
   class XFCP_Watched extends \XF\Pub\Controller\Watched {}
}
It does depend on the necessary extensions being defined in the control panel.
 
Development mode is enabled and it appears to be correctly written out to extension_hint.php located within my addon's _output directory:
PHP:
<?php

// ################## THIS IS A GENERATED FILE ##################
// DO NOT EDIT DIRECTLY. EDIT THE CLASS EXTENSIONS IN THE CONTROL PANEL.

namespace Demo\Portal\XF\Admin\Controller
{
    class XFCP_Forum extends \XF\Admin\Controller\Forum {}
}

<snip>

Would you happen to know how to configure Eclipse to be aware of this? Or, what's the correct term or setting to look for?
 
I can't really speak for Eclipse specifically. It works as expected with PHPStorm. Because of the code in question and that extension hint file, the parent of the extended class (from an IDE perspective) should be clear and unambiguous.
 
I seemed to have fixed the error by forcing an update to the build path (or workspace) when I temporarily renamed _output to something and back again. It probably wasn't in the build path to begin with but it seems fine now -- all the dummy XFCP classes now resolve.
 
Just to dig into this a bit further, because let's face it, having to refactor/rename something temporarily is not an elegant solution, in my second dev environment where I experienced the same issue I found that the "Automatically Build" option (under the Projects menu) was enabled. If I disable this option, and either Clean or Build Project again, the XFCP classes are resolved.

Must be something weird (or that I don't fully understand) about Eclipse's "Automatically Build" option.
 
Top Bottom