protected function _writePHPStorm($map, $className)
    {
        $fileName = $this->_root . DIRECTORY_SEPARATOR . self::FILE_PHPSTORM;

        if (is_dir($fileName)) {
            $fileName .= DIRECTORY_SEPARATOR . 'pimple.meta.php';
        }

        $list = array();
        foreach ($map as $data) {
            if ($data['type'] === 'class') {
                $list[] = "            '{$data['name']}' instanceof {$data['value']},";
            }
        }

        $tmpl = array(
            '<?php',
            '/**',
            ' * ProcessWire PhpStorm Meta',
            ' *',
            ' * 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.',
            ' * ',
            ' * @see https://confluence.jetbrains.com/display/PhpStorm/PhpStorm+Advanced+Metadata',
            ' */',
            '',
            'namespace PHPSTORM_META {',
            '',
            '    $STATIC_METHOD_TYPES = [',
            '        new \\' . $className . ' => [',
            '            \'\' == \'@\',',
            implode("\n", $list),
            '        ],',
            '    ];',
            '',
            '}',
            '',
        );

        $content = implode("\n", $tmpl);

        $this->_updateFile($fileName, $content);

        return $fileName;
    }