Created
November 29, 2021 19:23
-
-
Save digitalbricks/d8af4d629964786dc8a8de7e01ae33a8 to your computer and use it in GitHub Desktop.
ProcessWire Typehints for PHPStorm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* ProcessWire PhpStorm Meta | |
* | |
* @source https://processwire.com/talk/topic/10747-phpstorm-autocompletion-and-typehinting-of-wirexx/ | |
* @see https://confluence.jetbrains.com/display/PhpStorm/PhpStorm+Advanced+Metadata | |
* @credits https://processwire.com/talk/profile/560-interrobang/ | |
* | |
* Place the contents of this git in a file name .phpstorm.meta.php in the root of your project | |
* in order to get (some) typehints for ProcessWire methods in PHPStorm. | |
* | |
* | |
* This file is not a CODE, it makes no sense and won't run or validate | |
* Its AST serves PhpStorm IDE as DATA source to make advanced type inference decisions. | |
*/ | |
namespace PHPSTORM_META { | |
$STATIC_METHOD_TYPES = [ | |
\wire('') => [ | |
'' == '@', | |
'config' instanceof Config, | |
'wire' instanceof ProcessWire, | |
'log' instanceof WireLog, | |
'notices' instanceof Notices, | |
'sanitizer' instanceof \Sanitizer, | |
'database' instanceof \WireDatabasePDO, | |
'db' instanceof \DatabaseMysqli, | |
'cache' instanceof \MarkupCache, | |
'modules' instanceof \Modules, | |
'procache' instanceof \ProCache, | |
'fieldtypes' instanceof \Fieldtypes, | |
'fields' instanceof \Fields, | |
'fieldgroups' instanceof \Fieldgroups, | |
'templates' instanceof \Templates, | |
'pages' instanceof \Pages, | |
'permissions' instanceof \ Permissions, | |
'roles' instanceof \Roles, | |
'users' instanceof \Users, | |
'user' instanceof \User, | |
'session' instanceof \Session, | |
'input' instanceof \WireInput, | |
'languages' instanceof \Languages, | |
'page' instanceof \Page, | |
] | |
]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment