1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

[help] Anyone have suggestions for how to typehint class extensions in IDE?

Discussion in 'XenForo Development Discussions' started by Mike Tougeron, Sep 9, 2011.

  1. Mike Tougeron

    Mike Tougeron Well-Known Member

    I'm using Zend Studio for my IDE and I was hoping someone had a suggestion for how to use variable typehinting with XenForo.

    For example, I have a class that extends XenForo_Model_User:
    PHP:
    class IGN_XenForo_Model_User extends XFCP_IGN_XenForo_Model_User {
        public function 
    loginUserByRememberCookie($userCookie)
        {
            
    //blah
        
    }

        public function 
    createXenforoUserFromIgnUser($ignUser)
        {
            
    //blah
        
    }

        
    //etc
    }
    When I create the user model object, I do:
    PHP:
    /* @var $userModel IGN_XenForo_Model_User */
    $userModel XenForo_Model::create('XenForo_Model_User');
    That tells my IDE to use the IGN_XenForo_Model_User class for code auto-complete. But unfortunately this doesn't include the methods from XenForo_Model_User because it extends the fictional XFCP_IGN_XenForo_Model_User class. If I switch the @var to use XenForo_Model_User it doesn't include the methods that I added in IGN_XenForo_Model_User. Kind of a catch-22 :(

    The only work-around I've been able to come up with is a local file that is part of my project (but isn't actually included or used) that has the XFCP_* classes extend the real XenForo classes to "trick" the IDE into learning the inheritance. That works but feels pretty hacky/improper so I was wondering if someone has come up with a better solution or work-around to this issue?
     

Share This Page