Skip to content

Instantly share code, notes, and snippets.

@deviantintegral
Created January 7, 2015 21:28
Show Gist options
  • Select an option

  • Save deviantintegral/6ba68d6bfcb0d27d1a92 to your computer and use it in GitHub Desktop.

Select an option

Save deviantintegral/6ba68d6bfcb0d27d1a92 to your computer and use it in GitHub Desktop.
<?php
// Find all entity controller classes.
$info = entity_get_info();
$controller_meta = array();
foreach ($info as $entity_type => $data) {
$controller_meta[] = "'$entity_type' instanceof \\" . $data['controller class'] . ',';
}
$mappings = implode("\n ", $controller_meta);
$meta = <<<EOD
<?php
/**
* Place this file somewhere within your project. JetBrains recommends naming
* the file .phpstorm.meta.php. Multiple files can be used to split this
* metadata among different modules
*
* PHPStorm 8 is required. It should automatically updates when this file is
* changed, but if it doesn't use File -> Invalidate Caches to rebuild the
* completion index.
*/
namespace PHPSTORM_META {
/** @noinspection PhpUnusedLocalVariableInspection */
/** @noinspection PhpIllegalArrayKeyTypeInspection */
\$STATIC_METHOD_TYPES = [
\\entity_get_controller('') => [
$mappings
],
];
}
EOD;
print $meta;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment