Skip to content

Instantly share code, notes, and snippets.

@irnnr
Last active October 2, 2015 02:14
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save irnnr/79796f77f139b15ebd8f to your computer and use it in GitHub Desktop.
Save irnnr/79796f77f139b15ebd8f to your computer and use it in GitHub Desktop.
TYPO3 Dynamic Return Type code completion
{
"methodCalls": [
{
"class": "\\TYPO3\\CMS\\Core\\Utility\\GeneralUtility",
"method": "makeInstance",
"position": 0
},
{
"class": "\\TYPO3\\CMS\\Extbase\\Object\\ObjectManager",
"method": "get",
"position": 0
},
{
"class": "\\TYPO3\\CMS\\Extbase\\Object\\ObjectManager",
"method": "create",
"position": 0
}
]
}
@etobi
Copy link

etobi commented Sep 12, 2014

Looks almost like mine. Additionally, I've added ObjectManagerInterface, too.

        {
            "class": "\\TYPO3\\CMS\\Extbase\\Object\\ObjectManagerInterface",
            "method": "get",
            "position": 0
        }

@fedir
Copy link

fedir commented Sep 12, 2014

For those, who have deal with 4.5, following snippet could be quite useful :

{
    "class": "t3lib_div",
    "method": "makeInstance",
    "position": 0
},

I will add some explication of the DynamicReturnType plugin :

$view = t3lib_div::makeInstance('Tx_Fluid_View_StandaloneView');

Using the DynamicReturnTypePlugin, PHPStorm will know that '$view' is of type 'Tx_Fluid_View_StandaloneView' and will be able to autosuggest all of the functions available to an object of that type, as well as do code-inspection to pick up any obvious type errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment