Last active
August 29, 2015 14:04
-
-
Save rainder/6a1307aeca209211ef19 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
fs = require 'fs' | |
_ = require 'lodash' | |
### | |
* @link http://confluence.jetbrains.com/display/PhpStorm/PhpStorm+Advanced+Metadata | |
### | |
wrap = (data) -> """ | |
<?php | |
/** | |
* @AUTOGENERATED | |
* DO NOT EDIT | |
*/ | |
namespace PHPSTORM_META { | |
/** @noinspection PhpUnusedLocalVariableInspection */ | |
/** @noinspection PhpIllegalArrayKeyTypeInspection */ | |
$STATIC_METHOD_TYPES = [ | |
\\Doctrine::getTable('') => [ | |
#{data} | |
], | |
]; | |
} | |
""" | |
generate = (files) -> | |
_(files) | |
.filter (name) -> | |
name.match /Table.class.php$/ | |
.map (name) -> | |
key = name.replace 'Table.class.php', '' | |
value = name.replace '.class.php', '' | |
"'#{key}' instanceof \\#{value}" | |
.value() | |
.join(',\n ') | |
fs.readdir "#{__dirname}/lib/model/doctrine", (err, files) -> | |
throw err if err | |
fs.writeFile "#{__dirname}/.phpstorm.meta.php", wrap generate files |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment