Skip to content

Instantly share code, notes, and snippets.

@dmitryd
Last active April 19, 2017 08:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmitryd/18ddad4b6ff80622d89b119b5d0abda8 to your computer and use it in GitHub Desktop.
Save dmitryd/18ddad4b6ff80622d89b119b5d0abda8 to your computer and use it in GitHub Desktop.
Let PhpStorm recognise types of objects created by GeneralUtility::makeInstance(), ObjectManager::get(), etc
<?php
/*
* This file configures factory methods in TYPO3 CMS.
* The file should be dropped to project root. You may need
* to restart PhpStorm.
*
* PhpStorm will now correctly recognise types of objects
* returned by TYPO3 methods listed below.
*
* (c) 2017 Dmitry Dulepov <dmitry.dulepov@gmail.com>
*/
namespace PHPSTORM_META {
/** @noinspection PhpUnusedLocalVariableInspection */
/** @noinspection PhpIllegalArrayKeyTypeInspection */
/** @noinspection PhpUnnecessaryFullyQualifiedNameInspection */
$STATIC_METHOD_TYPES = [
\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('') => [
'' == '@',
],
\TYPO3\CMS\Extbase\Object\ObjectManagerInterface::get('') => [
'' == '@',
],
\TYPO3\CMS\Extbase\Object\ObjectManagerInterface::getEmptyObject('') => [
'' == '@',
],
];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment