├── .gitignore ├── README.MD ├── develop.MD ├── doc_handler ├── attacher.php ├── handler.php ├── simple_html_dom.php └── test.php ├── doc_plugin ├── doc_plugin.iml ├── doc_plugin.jar ├── doc_plugin_en.jar ├── out │ └── production │ │ └── doc_plugin │ │ └── META-INF │ │ └── plugin.xml ├── resources │ └── META-INF │ │ └── plugin.xml └── src │ └── library │ ├── .travis.yml │ ├── CONTRIBUTING.md │ ├── Core │ ├── Core.php │ ├── Core_c.php │ └── Core_d.php │ ├── Ev │ └── Ev.php │ ├── PDO │ └── PDO.php │ ├── Parle │ ├── ErrorInfo.php │ ├── Lexer.php │ ├── LexerException.php │ ├── Parser.php │ ├── ParserException.php │ ├── RLexer.php │ ├── RParser.php │ ├── Stack.php │ └── Token.php │ ├── Phar │ └── Phar.php │ ├── README.md │ ├── Reflection │ └── Reflection.php │ ├── SPL │ ├── SPL.php │ ├── SPL_c1.php │ └── SPL_f.php │ ├── SQLite │ └── SQLite.php │ ├── SimpleXML │ └── SimpleXML.php │ ├── SplType │ └── SplType.php │ ├── Zend OPcache │ └── OPcache.php │ ├── ZendCache │ └── ZendCache.php │ ├── ZendDebugger │ └── ZendDebugger.php │ ├── ZendUtils │ └── ZendUtils.php │ ├── amqp │ └── amqp.php │ ├── apache │ └── apache.php │ ├── apc │ └── apc.php │ ├── apcu │ └── apcu.php │ ├── bcmath │ └── bcmath.php │ ├── bz2 │ └── bz2.php │ ├── calendar │ └── calendar.php │ ├── com │ └── com.php │ ├── composer.json │ ├── couchbase │ ├── couchbase.php │ └── toplevel.php │ ├── csprng │ └── CSPRNG.php │ ├── ctype │ └── ctype.php │ ├── cubrid │ └── cubrid.php │ ├── curl │ ├── curl.php │ └── curl_d.php │ ├── date │ ├── date.php │ ├── date_c.php │ └── date_d.php │ ├── dba │ └── dba.php │ ├── dom │ ├── dom.php │ └── dom_c.php │ ├── enchant │ └── enchant.php │ ├── exif │ └── exif.php │ ├── fann │ └── fann.php │ ├── ffmpeg │ └── ffmpeg.php │ ├── fileinfo │ └── fileinfo.php │ ├── filter │ └── filter.php │ ├── ftp │ └── ftp.php │ ├── gd │ └── gd.php │ ├── gearman │ └── gearman.php │ ├── geoip │ └── geoip.php │ ├── gettext │ └── gettext.php │ ├── gmagick │ └── gmagick.php │ ├── gmp │ └── gmp.php │ ├── gnupg │ └── gnupg.php │ ├── grpc │ └── grpc.php │ ├── hash │ └── hash.php │ ├── http │ ├── http.php │ └── http3.php │ ├── ibm_db2 │ └── ibm_db2.php │ ├── iconv │ └── iconv.php │ ├── igbinary │ └── igbinary.php │ ├── imagick │ └── imagick.php │ ├── imap │ └── imap.php │ ├── inotify │ └── inotify.php │ ├── interbase │ └── interbase.php │ ├── intl │ ├── IntlChar.php │ └── intl.php │ ├── json │ └── json.php │ ├── judy │ └── judy.php │ ├── ldap │ └── ldap.php │ ├── libevent │ └── libevent.php │ ├── libsodium │ └── libsodium.php │ ├── libxml │ └── libxml.php │ ├── mailparse │ └── mailparse.php │ ├── mapscript │ └── mapscript.php │ ├── mbstring │ └── mbstring.php │ ├── mcrypt │ └── mcrypt.php │ ├── memcache │ └── memcache.php │ ├── memcached │ └── memcached.php │ ├── meta │ └── .phpstorm.meta.php │ ├── ming │ └── ming.php │ ├── mongo │ └── mongo.php │ ├── mongodb │ └── mongodb.php │ ├── mqseries │ └── mqseries.php │ ├── mssql │ └── mssql.php │ ├── mysql │ └── mysql.php │ ├── mysqli │ └── mysqli.php │ ├── ncurses │ └── ncurses.php │ ├── newrelic │ └── newrelic.php │ ├── oauth │ └── oauth.php │ ├── oci8 │ └── oci8.php │ ├── odbc │ └── odbc.php │ ├── openssl │ └── openssl.php │ ├── password │ └── password.php │ ├── pcntl │ └── pcntl.php │ ├── pcre │ └── pcre.php │ ├── pdo_ibm │ └── pdo_ibm.php │ ├── pdo_mysql │ └── pdo_mysql.php │ ├── pdo_pgsql │ └── pdo_pgsql.php │ ├── pdo_sqlite │ └── pdo_sqlite.php │ ├── pgsql │ └── pgsql.php │ ├── posix │ └── posix.php │ ├── pspell │ └── pspell.php │ ├── pthreads │ └── pthreads.php │ ├── rar │ └── rar.php │ ├── readline │ └── readline.php │ ├── recode │ └── recode.php │ ├── redis │ ├── Redis.php │ └── RedisCluster.php │ ├── regex │ └── ereg.php │ ├── rrd │ └── rrd.php │ ├── session │ ├── SessionHandler.php │ └── session.php │ ├── shmop │ └── shmop.php │ ├── snmp │ └── snmp.php │ ├── soap │ └── soap.php │ ├── sockets │ └── sockets.php │ ├── sodium │ └── sodium.php │ ├── solr │ ├── Documents │ │ ├── SolrDocument.php │ │ ├── SolrDocumentField.php │ │ └── SolrInputDocument.php │ ├── Exceptions │ │ ├── SolrClientException.php │ │ ├── SolrException.php │ │ ├── SolrIllegalArgumentException.php │ │ ├── SolrIllegalOperationException.php │ │ ├── SolrMissingMandatoryParameterException.php │ │ └── SolrServerException.php │ ├── Queries │ │ ├── SolrCollapseFunction.php │ │ ├── SolrDisMaxQuery.php │ │ ├── SolrModifiableParams.php │ │ ├── SolrParams.php │ │ └── SolrQuery.php │ ├── Responses │ │ ├── SolrGenericResponse.php │ │ ├── SolrPingResponse.php │ │ ├── SolrQueryResponse.php │ │ ├── SolrResponse.php │ │ └── SolrUpdateResponse.php │ ├── SolrClient.php │ ├── Utils │ │ ├── SolrObject.php │ │ └── SolrUtils.php │ ├── constants.php │ └── functions.php │ ├── sqlite3 │ └── sqlite3.php │ ├── sqlsrv │ └── sqlsrv.php │ ├── ssh2 │ └── ssh2.php │ ├── standard │ ├── _standard_manual.php │ ├── _types.php │ ├── basic.php │ ├── standard_0.php │ ├── standard_1.php │ ├── standard_2.php │ ├── standard_3.php │ ├── standard_4.php │ ├── standard_5.php │ ├── standard_6.php │ ├── standard_7.php │ ├── standard_8.php │ ├── standard_9.php │ └── standard_defines.php │ ├── suhosin │ └── suhosin.php │ ├── superglobals │ └── _superglobals.php │ ├── svn │ └── svn.php │ ├── sybase │ └── sybase_ct.php │ ├── sync │ └── sync.php │ ├── sysvmsg │ └── sysvmsg.php │ ├── sysvsem │ └── sysvsem.php │ ├── sysvshm │ └── sysvshm.php │ ├── tests │ ├── PHPReflectionParser.php │ ├── StubParser.php │ ├── TestStubs.php │ ├── docker-compose.yml │ └── mutedProblems.json │ ├── tidy │ └── tidy.php │ ├── tokenizer │ └── tokenizer.php │ ├── v8js │ └── v8js.php │ ├── wddx │ └── wddx.php │ ├── win32service │ └── win32service.php │ ├── wincache │ └── wincache.php │ ├── xcache │ └── xcache.php │ ├── xdebug │ └── xdebug.php │ ├── xhprof │ └── xhprof.php │ ├── xml │ └── xml.php │ ├── xmlreader │ └── xmlreader.php │ ├── xmlrpc │ └── xmlrpc.php │ ├── xmlwriter │ └── xmlwriter.php │ ├── xsl │ └── xsl.php │ ├── yaf │ ├── yaf.php │ └── yaf_namespace.php │ ├── yaml │ └── yaml.php │ ├── zend │ ├── zend.php │ ├── zend_d.php │ └── zend_f.php │ ├── zip │ └── zip.php │ ├── zlib │ └── zlib.php │ └── zmq │ └── zmq.php ├── document ├── phpdoc-cn.zip └── phpdoc-en.zip ├── example.png ├── example1.png └── raw ├── php-chunked-xhtml.zip └── phpstorm-stubs-2018.1.2.zip /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | /doc_plugin/out/ 3 | -------------------------------------------------------------------------------- /README.MD: -------------------------------------------------------------------------------- 1 | ### 介绍 2 | 3 | 在代码上快速查看php基本函数的中文文档和使用示例, 默认快捷键ctrl+q. 4 | 5 | // 如果ctrl+q快捷键没有反应,打开File->setting->keymap 搜索quick document,查看你的快捷键是什么,也可以自己设置 6 | 7 | ### 安装 8 | 9 | 在线安装: 在phpstorm的插件中心搜索chinese php document, 点击安装 10 | //该方法有可能会无效,如有问题请点击External Libraries->PHP Runtime->右键->Configure PHP Runtime修改下PHP language level点应用触发更新, 或使用离线安装方法安装 11 | 12 | 13 | 离线安装: 下载项目下的/document/phpdoc-cn.zip文件,解压. 然后点击phpstorm->project->External Libraries->PHP Runtime->右键->Configure PHP Runtime->Advanced Setting->Default Stub Paths->指向解压文件的目录 14 | //使用该方法可以编辑存根, 可以在方法上添加自己的笔记 15 | 16 | ### introduction. 17 | 18 | Quickly view the Chinese documentation and usage examples of php basic functions on the code. Default shortcut key ctrl+q. 19 | 20 | // if the ctrl+q shortcut does not respond, open File- > setting- > keymap and search quick document, to see what your shortcut key is, or you can set it yourself. 21 | 22 | ### installation. 23 | 24 | Online installation: search for Chinese PHP document in the plug-in center of phpstorm and click Install. 25 | //This method may be invalid. If there is a problem, please click external libraries - > PHP runtime - > right click - > configure PHP runtime to modify the PHP language level and click apply to trigger the update, or use the offline installation method to install 26 | 27 | 28 | Offline installation: Download /document/phpdoc-en.zip file, unzip Then click phpstorm -> Project -> external libraries -> PHP runtime -> right click -> configure PHP runtime -> advanced setting -> Default stub paths -> point to the directory of the extracted file 29 | //Using this method, you can edit the stub and add your own notes on the method 30 | 31 | ### 示例/example 32 | 33 | ![img](./example.png) 34 | ![img](./example1.png) 35 | 36 | ### [制作过程/Documentation process](./develop.MD). 37 | -------------------------------------------------------------------------------- /develop.MD: -------------------------------------------------------------------------------- 1 | ###文档制作过程 2 | 3 | 数据来源 4 | 5 | php文档: https://www.php.net/docs.php 6 | phpstorm默认php文档: https://github.com/JetBrains/phpstorm-stubs 7 | 8 | 处理程序 9 | 10 | 99%程序处理 11 | 12 | handler.php 文档处理文件 13 | 修改文档样式 14 | 清楚多余内容 15 | 处理衔接, 方法可直接跳转, 其他衔接为外链(到php.net) 16 | 文件保存到temp目录,供下一步使用 17 | 18 | attacher.php 文档附加文件 19 | 将处理后的内容替换现有的jetbrain英文文档 20 | 21 | 1%手动处理 22 | 将temp目录的下处理过的内容手动附加到jetbrain英文文档上 23 | 魔术变量: standard/basic.php 24 | 25 | 如需制作其他文档语言文档, 可从php.net下载相应语言的文档,步骤同上 26 | 27 | ###Documentation process 28 | 29 | data source 30 | 31 | php doument data: https://www.php.net/docs.php 32 | phpstorm default php document: https://github.com/JetBrains/phpstorm-stubs 33 | 34 | Processing program 35 | 36 | 99% program processing. 37 | Handler.php document processing file. 38 | Modify document styl. 39 | Be aware of the superfluous content. 40 | To deal with cohesion, the method can jump directly, and the other cohesion is outside the chain (to php.net). 41 | Save the file to the temp directory for use in the next step. 42 | 43 | Attacher.php document attach Fil. 44 | Replace the processed content with the existing jetbrain English document. 45 | 46 | 1% manual processing. 47 | Manually attach the processed content under the temp directory to the jetbrain English document. 48 | Magic variable: standard/basic.php 49 | 50 | To create documents in other documentation languages, you can download the documents in the corresponding language from php.net. The steps are the same as above. -------------------------------------------------------------------------------- /doc_handler/attacher.php: -------------------------------------------------------------------------------- 1 | 'test comment', 16 | 'AMQP_NOPARAM' => 'test const', 17 | 'class.AMQPBasicProperties' => 'test class', 18 | ]; 19 | 20 | function my_dir($dir, $parent = '', &$files = []) 21 | { 22 | if (@$handle = opendir($dir)) { //注意这里要加一个@,不然会有warning错误提示:) 23 | while (($file = readdir($handle)) !== false) { 24 | if ($file != ".." && $file != ".") { //排除根目录 25 | if (is_dir($dir . "/" . $file)) { //如果是子文件夹,就进行递归 26 | my_dir($dir . "/" . $file, $parent . '/' . $file, $files); 27 | } else { //不然就将文件的名字存入数组 28 | $files[] = $parent . '/' . $file; 29 | } 30 | } 31 | } 32 | closedir($handle); 33 | return $files; 34 | } 35 | } 36 | 37 | function isComment($line) 38 | { 39 | foreach (['/*', '*', '*/','#'] as $item) { 40 | if (strpos($line, $item) === 0) { 41 | return true; 42 | } 43 | } 44 | return false; 45 | } 46 | 47 | function getComment($token, $oldComment) 48 | { 49 | if (strpos($token, 'constant.') !== 0) //不是常量替换下划线 50 | $token = str_replace('_', '-', $token); 51 | $file = docIn . $token . '.html'; 52 | $return=''; 53 | if (file_exists($file)) { 54 | if ($oldComment) { //保留return行 55 | $olds = explode("\n", $oldComment); 56 | foreach ($olds as $old) { 57 | $old2 = trim($old); 58 | if (strpos($old2, '* @return')===0){ 59 | $return = $old; 60 | break; 61 | } 62 | } 63 | } 64 | $comment = file_get_contents($file); 65 | $comment = '/**' . line . '*' . $comment . line . $return . '*/' . line; 66 | return $comment; 67 | } else { 68 | return $oldComment; 69 | } 70 | } 71 | 72 | function isElement($line, $type) 73 | { 74 | $tokens = explode(' ', $line); 75 | for ($i = 0; $i < count($tokens); $i++) { 76 | if ($tokens[$i] == $type) { 77 | $name = $tokens[$i + 1]; 78 | $name = trim($name); 79 | if (strpos($name, '(')) { 80 | $name = substr($name, 0, strpos($name, '(')); 81 | } 82 | return $name; 83 | } 84 | } 85 | return false; 86 | } 87 | 88 | function isClass($line) 89 | { 90 | return isElement($line, 'class'); 91 | } 92 | 93 | function isFunction($line) 94 | { 95 | return isElement($line, 'function'); 96 | } 97 | 98 | function isConst($line) 99 | { 100 | // define('AMQP_EX_TYPE_HEADERS', 'headers'); 101 | $line = str_replace(' ', '', $line); 102 | $pre = "define('"; 103 | if (strpos($line, $pre) === 0) { 104 | $line = str_replace($pre, '', $line); 105 | $const = explode("'", $line)[0]; 106 | return $const; 107 | } 108 | return false; 109 | } 110 | 111 | function isVar($line){ 112 | $line = str_replace(' ', '', $line); 113 | $pre = "$"; 114 | if (strpos($line, $pre) === 0) { 115 | $line = str_replace($pre, '', $line); 116 | $line = str_replace('_', '', $line); 117 | $var = explode("=", $line)[0]; 118 | return $var; 119 | } 120 | return false; 121 | } 122 | 123 | function handle($name) 124 | { 125 | $file = docOut . $name; 126 | $newContent = ''; 127 | $handle = fopen($file, "r");//以只读方式打开一个文件 128 | $i = 0; 129 | $comment = ''; 130 | $class = ''; 131 | while (!feof($handle)) {//函数检测是否已到达文件末尾 132 | if ($line = fgets($handle)) {// 从文件指针中读取一行 133 | $line1 = str_replace(' ', '', $line); 134 | 135 | //注释 136 | if (isComment($line1)) { 137 | $comment .= $line; 138 | continue; 139 | } 140 | 141 | //类 142 | if ($clsName = isClass($line)) { 143 | $class = $clsName; 144 | $newComment = getComment('class.' . $class, $comment); 145 | $newContent .= $newComment; 146 | $comment = ''; //注释已使用 147 | }else if ($function = isFunction($line)) { //函数方法 148 | if (substr($function,0,20)=='PS_UNRESERVE_PREFIX_'){ 149 | $function=substr($function,20); 150 | } 151 | $blankPre = strpos($line, ' ') === 0; //前面空白是类方法的特征 152 | $function = $class && $blankPre ? $class . '.' . $function : 'function.' . $function; 153 | $newComment = getComment($function, $comment); 154 | $newContent .= $newComment; 155 | $comment = ''; //注释已使用 156 | }else if ($const = isConst($line)) { //常量 157 | $newComment = getComment('constant.' . $const, $comment); 158 | $newContent .= $newComment; 159 | $comment = ''; //注释已使用 160 | }else if($var = isVar($line)){ //预定义变量 161 | $newComment = getComment('reserved.variables.' . $var, $comment); 162 | $newContent .= $newComment; 163 | $comment = ''; //注释已使用 164 | } 165 | 166 | //没有匹配到任何类型内容 167 | if ($comment) { 168 | $newContent .= $comment; 169 | $comment = ''; 170 | } 171 | $newContent .= $line; 172 | }; 173 | } 174 | file_put_contents(docOut . $name, $newContent); 175 | } 176 | 177 | function handleAll() 178 | { 179 | $files = []; 180 | my_dir(docOut, '', $files); 181 | foreach ($files as $file) { 182 | $suffix = substr(strrchr($file, '.'), 1); 183 | if ($suffix == 'php') { 184 | handle($file); 185 | echo $file . line; 186 | // break; //test 187 | } 188 | } 189 | } 190 | 191 | handleAll(); -------------------------------------------------------------------------------- /doc_handler/handler.php: -------------------------------------------------------------------------------- 1 | find('a'); 35 | for ($i = 0; $i < count($links); $i++) { 36 | $a = $links[$i]; 37 | $href = $a->href; 38 | if (strstr($href, 'http://')) { //不处理外链 39 | continue; 40 | } 41 | 42 | $known = 0; 43 | if (strstr($href, 'function.')) { 44 | $known = 1; 45 | } else if (strstr($a->innertext, '::')) { 46 | $known = 1; 47 | } 48 | 49 | if ($known) { //已知类型, 方法,类静态方法.. 50 | $href = '{@link ' . $a->innertext . '}'; 51 | $a->outertext = $href; 52 | } else { //如果未匹配到任何类型, 改成官网外链 53 | $href = str_replace('.html', '.php', $href); //网站外链为php 本地为html 54 | $a->href = site . $href; 55 | } 56 | } 57 | } 58 | 59 | /** 60 | * 修改文本 61 | */ 62 | function modifyStr($html) 63 | { 64 | //防止注释异常终止 65 | $html = str_replace('/*', '//', $html); 66 | $html = str_replace('*/', '', $html); 67 | //重设代码颜色以便在黑色主题下查看 68 | $html = str_replace('#0000BB', '#9876AA', $html); 69 | //清理换行 70 | $html = str_replace("\r", '', $html); 71 | $html = str_replace("\n", '', $html); 72 | return $html; 73 | } 74 | 75 | function modifyAttr($dom,$selector,$value,$attr='style'){ 76 | $subs=$dom->find($selector); 77 | foreach ($subs as $sub){ 78 | $sub->setAttribute($attr,$value); 79 | } 80 | } 81 | 82 | function modifyTag($dom, $selector,$outside, $pre, $after,$one=false){ 83 | $subs=$dom->find($selector); 84 | foreach ($subs as $sub){ 85 | if($outside) 86 | $sub->outertext=$pre.$sub->outertext().$after; 87 | else 88 | $sub->outertext=$pre.$sub->innertext().$after; 89 | if($one) 90 | break; 91 | } 92 | } 93 | 94 | function modifyOutput($dom){ 95 | $subs = $dom->find("pre"); 96 | foreach ($subs as $sub) { 97 | $text = $sub->innertext(); 98 | if (substr($text,0,1)=="\n"){ 99 | $text=substr($text,1); 100 | } 101 | $text = '' . str_replace("\n", "
",$text) . '
'; 102 | $sub->outertext = $text; 103 | } 104 | } 105 | 106 | function handleStyle($dom){ 107 | //方法颜色 108 | modifyAttr($dom,'.methodname','color:#CC7832'); 109 | modifyAttr($dom,'.function strong','color:#CC7832'); 110 | //类型颜色 111 | modifyAttr($dom,'.type','color:#EAB766'); 112 | //参数颜色 113 | modifyAttr($dom,'.parameter','color:#9070A1'); 114 | //方法描述背景 115 | // modifyAttr($dom,'.methodsynopsis','border:1px gray;padding-left:5px;background:#232525'); 116 | //添加分隔符 117 | //modifyAttr($dom,"div[class='refsect1']","BORDER-TOP: gray 1px dashed; OVERFLOW: hidden; HEIGHT: 1px"); 118 | //note 119 | modifyAttr($dom,".note","border:1px gray solid"); 120 | //php代码 121 | modifyAttr($dom,".phpcode","border-color:gray;background:#232525"); 122 | //output 123 | modifyAttr($dom,".screen","color:AFB1B3;background:black;padding-left:5px;"); 124 | 125 | //pre 126 | modifyOutput($dom); 127 | // modifyTag($dom,"pre",false,'',''); 128 | //code 129 | modifyTag($dom,"code",false,'',''); 130 | //参数标签, 9070A1 编辑器紫, EE82EE 鲜艳紫, 00B5FF 鲜艳蓝,4285F4 一般蓝, 19A1FA 3A95FF ok蓝 131 | modifyTag($dom,'.parameter',false,'',''); 132 | //去除换行:参数,示例 133 | modifyTag($dom,".parameters .para",false,'','',true); 134 | modifyTag($dom,".examples .para",false,'','',true); 135 | modifyTag($dom,".seealso .para",false,'','',true); 136 | modifyTag($dom,".changelog .para",false,'','',true); 137 | //添加分隔符,换行标签 138 | modifyTag($dom,"div[class='refsect1']",true,'

',''); 139 | //modifyTag($dom,"div[class='refsect1']",true,'


',''); 140 | return $dom; 141 | } 142 | 143 | function handleConst($file = 'filesystem.consts.html') 144 | { 145 | $content = loadStr($file); 146 | $selector = str_get_html($content); 147 | $name = substr($file, 0, strlen($file) - 5); 148 | 149 | $doms = $selector->find('strong code'); 150 | foreach ($doms as $dom) { 151 | // $name = $dom->find('strong code', 0); 152 | if (!$dom) continue; 153 | $outFile = 'constant.' . $dom->innertext . '.html'; 154 | $parent = $dom->parentNode()->parentNode(); 155 | /** @var simple_html_dom_node $test */ 156 | $next = $parent->nextSibling(); 157 | if (!$next) continue; 158 | $next = $next->children(0); 159 | if (!$next) continue; 160 | modifyUrl($next); 161 | $html = $next->innertext; 162 | if (!$html) continue; 163 | if (trim($html) == '') continue; 164 | $html = modifyStr($html); 165 | if (strpos($outFile, '::')) continue; 166 | echo $outFile . line; 167 | file_put_contents(temp . '\\' . $outFile, $html); 168 | } 169 | } 170 | 171 | function getClass() 172 | { 173 | $clses = []; 174 | if (@$handle = opendir(in)) { 175 | while (($file = readdir($handle)) !== false) { 176 | $pre = 'class.'; 177 | if ((substr($file, 0, strlen($pre)) === $pre)) { 178 | $clsName = substr($file, strlen($pre), strlen($file) - strlen($pre) - 5); 179 | $clses[$clsName] = 1; 180 | } 181 | } 182 | } 183 | return $clses; 184 | } 185 | 186 | /** 187 | * 处理函数 188 | */ 189 | function handle($file = 'function.date.html') 190 | { 191 | $content = loadStr($file); 192 | $selector = str_get_html($content,true,true,DEFAULT_TARGET_CHARSET,false); 193 | $name = substr($file, 0, strlen($file) - 5); 194 | $dom = $selector->find("div[id='$name']", 0); 195 | 196 | // $ref = $selector->find("div[class='up']", 0); //参考衔接 197 | modifyUrl($dom); 198 | // modifyUrl($ref); 199 | // $dom->appendChild($ref); 200 | handleStyle($dom); 201 | 202 | $html = $dom->outertext; 203 | $html = modifyStr($html); 204 | 205 | file_put_contents(temp . '\\' . $file, $html); 206 | echo $file . line; 207 | } 208 | 209 | function handleAll() 210 | { 211 | $clses = getClass(); 212 | $clses['function'] = 1; 213 | $clses['class'] = 1; 214 | $clses['reserved'] = 1; 215 | 216 | if (@$handle = opendir(in)) { 217 | while (($file = readdir($handle)) !== false) { 218 | $tokens = explode('.', $file); 219 | $prefix = $tokens[0]; 220 | if (@$clses[$prefix]) { 221 | handle($file); 222 | } 223 | if ($tokens[count($tokens) - 2] == 'constants') { //收集常量 224 | handleConst($file); 225 | } 226 | } 227 | } 228 | } 229 | 230 | //handle('function.substr.html'); 231 | handleAll(); -------------------------------------------------------------------------------- /doc_handler/test.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /doc_plugin/doc_plugin.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fw6669998/php-doc/b1fc4033c7d43a48a6ba6919cc4c8d8a93ab4438/doc_plugin/doc_plugin.jar -------------------------------------------------------------------------------- /doc_plugin/doc_plugin_en.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fw6669998/php-doc/b1fc4033c7d43a48a6ba6919cc4c8d8a93ab4438/doc_plugin/doc_plugin_en.jar -------------------------------------------------------------------------------- /doc_plugin/out/production/doc_plugin/META-INF/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | pers.fw.doc 3 | Chinese PHP Document 4 | 1.2 5 | https://github.com/fw6669998/php-doc 6 | 7 | 8 | Quickly view the Chinese documentation of the php basic function on the code, the default shortcut key ctrl+q.

10 |

在代码上快速查看php基本函数的中文文档,默认快捷键ctrl+q.

11 |
12 |

screenshots-balloon.png

13 | ]]> 14 |
15 | 16 | 17 | 18 | 19 | 20 | 22 | 25 | com.intellij.modules.platform 26 | com.jetbrains.php 27 | 28 | 29 | 30 | 31 |
-------------------------------------------------------------------------------- /doc_plugin/resources/META-INF/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | pers.fw.doc 3 | Chinese PHP Document 4 | 1.2 5 | https://github.com/fw6669998/php-doc 6 | 7 | 8 | Quickly view the Chinese documentation of the php basic function on the code, the default shortcut key ctrl+q.

10 |

在代码上快速查看php基本函数的中文文档,默认快捷键ctrl+q.

11 |
12 |

screenshots-balloon.png

13 | ]]> 14 |
15 | 16 | 17 | 18 | 19 | 20 | 22 | 25 | com.intellij.modules.platform 26 | com.jetbrains.php 27 | 28 | 29 | 30 | 31 |
-------------------------------------------------------------------------------- /doc_plugin/src/library/.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: required 2 | 3 | services: 4 | - docker 5 | addons: 6 | apt: 7 | packages: 8 | - docker-ce 9 | 10 | language: php 11 | php: 12 | - '7.2' 13 | install: 14 | - composer install 15 | script: 16 | - docker-compose -f tests/docker-compose.yml pull 17 | - docker-compose -f tests/docker-compose.yml build 18 | - docker-compose -f tests/docker-compose.yml run php > ./tests/stub.json 19 | - phpunit tests/TestStubs.php 20 | -------------------------------------------------------------------------------- /doc_plugin/src/library/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contribution process 2 | Thank you, your help is most appreciated, and improves experience for everyone! 3 | Please follow the guidelines to keep it simpler for both sides. Contact us if unsure or in case if you *have* to massively violate these guidelines) 4 | 5 | # Notes on content 6 | Please check our [issue tracker] for issues corresponding to the problem you fixing with your pull requests. Create issue on [issue tracker] describing the problem if there doesn't exist. Please link pull request/commit messages to the issue. 7 | 8 | ## Code Style 9 | * Please avoid any unnecessary changes eg. spacing, line endings, HTML formatting. Remember, these files are NOT for human consumption. We want to preserve meaningful history. 10 | * Please try to match existing style for any particular file - formatting, spacing, naming conventions. 11 | * Please add corresponding @since tags 12 | 13 | ## Tests 14 | * Please make sure that tests pass for your Pull Request. 15 | * If necessary, please include changes to *mutedProblems.json*. 16 | 17 | ## Types of contribution 18 | As of 2017.1 Preview we gladly accept all "non-standard" extensions and IDE get a UI for per-project configuration. 19 | As of 2016.3 there is an [easy way to package your custom stubs/metadata] as a plugin. 20 | 21 | 22 | [issue tracker]:https://youtrack.jetbrains.com/issues/WI?q=%23Unresolved+%23%7BPHP+lib+stubs%7D+ 23 | [easy way to package your custom stubs/metadata]:https://github.com/artspb/phpstorm-library-plugin 24 | -------------------------------------------------------------------------------- /doc_plugin/src/library/Parle/ErrorInfo.php: -------------------------------------------------------------------------------- 1 | ' before the name means push. Use the signature without id for either continuation or to 148 | * start matching, when a continuation or recursion is required. 149 | * If '<' is specified as exit state, it means pop. In that case, the signature containing the id can be used to 150 | * identify the match. Note that even in the case an id is specified, the rule will finish first when all the 151 | * previous pushes popped. 152 | * @return void 153 | * @link http://php.net/manual/en/parle-rlexer.push.php 154 | */ 155 | public function push(string $state, string $regex, int $id, string $newState) : void {} 156 | 157 | /** 158 | * Add a lexer rule 159 | * 160 | * Push a pattern for lexeme recognition. 161 | * A 'start state' and 'exit state' can be specified by using a suitable signature. 162 | * 163 | * @param string $state State name. If '*' is used as start state, then the rule is applied to all lexer states. 164 | * @param string $regex Regular expression used for token matching. 165 | * @param string $newState 166 | * New state name, after the rule was applied. 167 | * If '.' is specified as the exit state, then the lexer state is unchanged when that rule matches. 168 | * An exit state with '>' before the name means push. Use the signature without id for either continuation or to 169 | * start matching, when a continuation or recursion is required. 170 | * If '<' is specified as exit state, it means pop. In that case, the signature containing the id can be used to 171 | * identify the match. Note that even in the case an id is specified, the rule will finish first when all the 172 | * previous pushes popped. 173 | * @return void 174 | * @link http://php.net/manual/en/parle-rlexer.push.php 175 | */ 176 | public function push(string $state, string $regex, string $newState) : void {} 177 | 178 | /** 179 | * Push a new start state 180 | * This lexer type can have more than one state machine. 181 | * This allows you to lex different tokens depending on context, thus allowing simple parsing to take place. 182 | * Once a state pushed, it can be used with a suitable Parle\RLexer::push() signature variant. 183 | * 184 | * @see RLexer::push() 185 | * @link http://php.net/manual/en/parle-rlexer.pushstate.php 186 | * @param string $state Name of the state. 187 | * @return int 188 | */ 189 | public function pushState(string $state) : int {} 190 | 191 | /** 192 | * Reset lexer 193 | * 194 | * Reset lexing optionally supplying the desired offset. 195 | * 196 | * @param int $pos Reset position. 197 | */ 198 | public function reset(int $pos) : void {} 199 | } 200 | -------------------------------------------------------------------------------- /doc_plugin/src/library/Parle/RParser.php: -------------------------------------------------------------------------------- 1 | tests/stub.json` 23 | 3. Run the test `phpunit tests/TestStubs.php` 24 | 25 | ### License 26 | [Apache 2] 27 | 28 | [PHPDOC]:https://github.com/phpDocumentor/fig-standards/blob/master/proposed/phpdoc.md 29 | [Apache 2]:https://www.apache.org/licenses/LICENSE-2.0 30 | [Relevant open issues]:https://youtrack.jetbrains.com/issues/WI?q=%23Unresolved+Subsystem%3A+%7BPHP+lib+stubs%7D+order+by%3A+votes+ 31 | -------------------------------------------------------------------------------- /doc_plugin/src/library/ZendCache/ZendCache.php: -------------------------------------------------------------------------------- 1 | 19 | -------------------------------------------------------------------------------- /doc_plugin/src/library/ZendUtils/ZendUtils.php: -------------------------------------------------------------------------------- 1 | 19 | -------------------------------------------------------------------------------- /doc_plugin/src/library/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jetbrains/phpstorm-stubs", 3 | "description": "PHP runtime & extensions header files for PhpStorm", 4 | "homepage": "https://www.jetbrains.com/phpstorm", 5 | "license": "Apache-2.0", 6 | "keywords": [ 7 | "JetBrains", 8 | "PHPStorm", 9 | "stubs", 10 | "autocomplete", 11 | "type", 12 | "inference", 13 | "code", 14 | "inspection" 15 | ], 16 | "require-dev": { 17 | "nikic/php-parser": "v4.0.1", 18 | "phpdocumentor/reflection-docblock": "^4.3", 19 | "phpunit/phpunit": "7.1.4" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /doc_plugin/src/library/couchbase/toplevel.php: -------------------------------------------------------------------------------- 1 | 42 | -------------------------------------------------------------------------------- /doc_plugin/src/library/meta/.phpstorm.meta.php: -------------------------------------------------------------------------------- 1 | class_name::class|pattern_literal 21 | * where pattern literal can contain @ char to be replaced with argument literal value 22 | * @return mixed overrides map object 23 | */ 24 | function map($map) { 25 | return "map $argNum $map"; 26 | } 27 | 28 | /** 29 | * type of argument #$argNum 30 | * @param mixed $argNum ignored, for now its always 0 31 | * @return mixed 32 | */ 33 | function type($argNum) { 34 | return "type $argNum"; 35 | } 36 | 37 | /** 38 | * element type of argument #$argNum 39 | * @param mixed $argNum 40 | * @return mixed 41 | */ 42 | function elementType($argNum) { 43 | return "elementType $argNum"; 44 | } 45 | 46 | override(\array_shift(0), elementType(0)); 47 | override(\array_reverse(0), elementType(0)); 48 | override(\array_pop(0), elementType(0)); 49 | // override(\array_map(0), type(1)); 50 | override(\array_filter(0), type(0)); 51 | override(\array_reduce(0), elementType(0)); 52 | override(\array_slice(0), type(0)); 53 | 54 | override(\current(0), elementType(0)); 55 | override(\reset(0), elementType(0)); 56 | override(\end(0), elementType(0)); 57 | override(\prev(0), elementType(0)); 58 | override(\next(0), elementType(0)); 59 | 60 | override(\iterator_to_array(0), type(0)); 61 | 62 | 63 | // override( \ServiceLocatorInterface::get(0), 64 | // map( [ 65 | // "A" => \Exception::class, 66 | // \ExampleFactory::EXAMPLE_B => ExampleB::class, 67 | // \EXAMPLE_B => \ExampleB::class, 68 | // '' => '@|\Iterator', 69 | // ])); 70 | 71 | } 72 | -------------------------------------------------------------------------------- /doc_plugin/src/library/pdo_ibm/pdo_ibm.php: -------------------------------------------------------------------------------- 1 | 9 | -------------------------------------------------------------------------------- /doc_plugin/src/library/pdo_mysql/pdo_mysql.php: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /doc_plugin/src/library/pdo_pgsql/pdo_pgsql.php: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /doc_plugin/src/library/pdo_sqlite/pdo_sqlite.php: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /doc_plugin/src/library/recode/recode.php: -------------------------------------------------------------------------------- 1 |

recode_string

(PHP 4, PHP 5, PHP 7)

recode_stringRecode a string according to a recode request



说明

string recode_string ( string $request , string $string )

Recode the string string according to the recode request request.



参数

request

The desired recode request type

string

The string to be recoded



返回值

Returns the recoded string or FALSE, if unable to perform the recode request.



范例

Example #1 Basic recode_string() example

<?php
echo recode_string("us..flat""The following character has a diacritical mark: á");
?>


注释

A simple recode request may be "lat1..iso646-de".



参见

Recode 函数
7 | * @return string the recoded string or FALSE, if unable to*/ 8 | function recode_string ($request, $string) {} 9 | 10 | /** 11 | *

recode_file

(PHP 4, PHP 5, PHP 7)

recode_fileRecode from file to file according to recode request



说明

bool recode_file ( string $request , resource $input , resource $output )

Recode the file referenced by file handle input into the file referenced by file handle output according to the recode request.



参数

request

The desired recode request type

input

A local file handle resource for the input

output

A local file handle resource for the output



返回值

Returns FALSE, if unable to comply, TRUE otherwise.



范例

Example #1 Basic recode_file() example

<?php
$input 
fopen('input.txt''r');
$output fopen('output.txt''w');
recode_file("us..flat"$input$output);
?>


注释

This function does not currently process file handles referencing remote files (URLs). Both file handles must refer to local files.



参见

  • {@link fopen()} - 打开文件或者 URL
Recode 函数
12 | * @return bool FALSE, if unable to comply, TRUE otherwise.*/ 13 | function recode_file ($request, $input, $output) {} 14 | 15 | /** 16 | *

recode

(PHP 4, PHP 5, PHP 7)

recode别名 {@link recode_string()}



说明

此函数是该函数的别名: {@link recode_string()}.

Recode 函数
17 | */ 18 | function recode ($request, $str) {} 19 | 20 | // End of recode v. 21 | ?> 22 | -------------------------------------------------------------------------------- /doc_plugin/src/library/solr/Documents/SolrDocumentField.php: -------------------------------------------------------------------------------- 1 | 6 | * @link https://github.com/pjmazenot/phpsolr-phpdoc 7 | */ 8 | 9 | /** 10 | *

The SolrDocumentField class

(PECL solr >= 0.9.2)

简介

This represents a field in a Solr document. All its properties are read-only.

类摘要

final SolrDocumentField {
// 属性
readonly public string $name ;
readonly public float $boost ;
readonly public array $values ;
// 方法
public __construct ( void )
public void __destruct ( void )
}

属性

name

The name of the field.

boost

The boost value for the field

values

An array of values for this field

Table of Contents

Solr
11 | */ 12 | final class SolrDocumentField { 13 | 14 | /** @var string [readonly] The name of the field. */ 15 | public $name; 16 | 17 | /** @var string [readonly] The boost value for the field */ 18 | public $boost; 19 | 20 | /** @var string [readonly] An array of values for this field */ 21 | public $values; 22 | 23 | /** 24 | * (PECL solr >= 0.9.2)
25 | * SolrDocument constructor. 26 | * @link http://php.net/manual/en/solrdocumentfield.construct.php 27 | */ 28 | public function __construct () {} 29 | 30 | /** 31 | * (PECL solr >= 0.9.2)
32 | * Destructor 33 | * @link http://php.net/manual/en/solrdocumentfield.destruct.php 34 | */ 35 | public function __destruct() {} 36 | 37 | } -------------------------------------------------------------------------------- /doc_plugin/src/library/solr/Exceptions/SolrClientException.php: -------------------------------------------------------------------------------- 1 | 6 | * @link https://github.com/pjmazenot/phpsolr-phpdoc 7 | */ 8 | 9 | /** 10 | *

The SolrClientException class

(PECL solr >= 0.9.2)

简介

An exception thrown when there is an error while making a request to the server from the client.

类摘要

SolrClientException extends SolrException {
// 继承的属性
protected string $message ;
protected int $code ;
protected string $file ;
protected int $line ;
protected integer $sourceline ;
protected string $sourcefile ;
protected string $zif_name ;
// 方法
public array getInternalInfo ( void )
// 继承的方法
final public string {@link Exception::getMessage} ( void )
final public Throwable {@link Exception::getPrevious} ( void )
final public int {@link Exception::getCode} ( void )
final public string {@link Exception::getFile} ( void )
final public int {@link Exception::getLine} ( void )
final public array {@link Exception::getTrace} ( void )
final public string {@link Exception::getTraceAsString} ( void )
public string {@link Exception::__toString} ( void )
final private void {@link Exception::__clone} ( void )
public array {@link SolrException::getInternalInfo} ( void )
}

Table of Contents

Solr
11 | */ 12 | class SolrClientException extends SolrException { 13 | 14 | /** 15 | * (PECL solr >= 0.9.2)
16 | * Returns internal information where the Exception was thrown 17 | * @link http://php.net/manual/en/solrclientexception.getinternalinfo.php 18 | * @return array

19 | * Returns an array containing internal information where the error was thrown. Used only for debugging by extension 20 | * developers. 21 | *

22 | */ 23 | public function getInternalInfo() {} 24 | 25 | } -------------------------------------------------------------------------------- /doc_plugin/src/library/solr/Exceptions/SolrException.php: -------------------------------------------------------------------------------- 1 | 6 | * @link https://github.com/pjmazenot/phpsolr-phpdoc 7 | */ 8 | 9 | /** 10 | *

The SolrException class

(PECL solr >= 0.9.2)

简介

This is the base class for all exception thrown by the Solr extension classes.

类摘要

SolrException extends Exception {
// 属性
protected integer $sourceline ;
protected string $sourcefile ;
protected string $zif_name ;
// 继承的属性
protected string $message ;
protected int $code ;
protected string $file ;
protected int $line ;
// 方法
public array getInternalInfo ( void )
// 继承的方法
final public string {@link Exception::getMessage} ( void )
final public Throwable {@link Exception::getPrevious} ( void )
final public int {@link Exception::getCode} ( void )
final public string {@link Exception::getFile} ( void )
final public int {@link Exception::getLine} ( void )
final public array {@link Exception::getTrace} ( void )
final public string {@link Exception::getTraceAsString} ( void )
public string {@link Exception::__toString} ( void )
final private void {@link Exception::__clone} ( void )
}

属性

sourceline

The line in c-space source file where exception was generated

sourcefile

The c-space source file where exception was generated

zif_name

The c-space function where exception was generated

Table of Contents

Solr
11 | */ 12 | class SolrException extends Exception { 13 | 14 | /** @var int The line in c-space source file where exception was generated */ 15 | protected $sourceline; 16 | 17 | /** @var string The c-space source file where exception was generated */ 18 | protected $sourcefile; 19 | 20 | /** @var string The c-space function where exception was generated */ 21 | protected $zif_name; 22 | 23 | /** 24 | * (PECL solr >= 0.9.2)
25 | * Returns internal information where the Exception was thrown 26 | * @link http://php.net/manual/en/solrexception.getinternalinfo.php 27 | * @return array

28 | * Returns an array containing internal information where the error was thrown. Used only for debugging by extension 29 | * developers. 30 | *

31 | */ 32 | public function getInternalInfo() {} 33 | 34 | } -------------------------------------------------------------------------------- /doc_plugin/src/library/solr/Exceptions/SolrIllegalArgumentException.php: -------------------------------------------------------------------------------- 1 | 6 | * @link https://github.com/pjmazenot/phpsolr-phpdoc 7 | */ 8 | 9 | /** 10 | *

The SolrIllegalArgumentException class

(PECL solr >= 0.9.2)

简介

This object is thrown when an illegal or invalid argument is passed to a method.

类摘要

SolrIllegalArgumentException extends SolrException {
// 继承的属性
protected string $message ;
protected int $code ;
protected string $file ;
protected int $line ;
protected integer $sourceline ;
protected string $sourcefile ;
protected string $zif_name ;
// 方法
public array getInternalInfo ( void )
// 继承的方法
final public string {@link Exception::getMessage} ( void )
final public Throwable {@link Exception::getPrevious} ( void )
final public int {@link Exception::getCode} ( void )
final public string {@link Exception::getFile} ( void )
final public int {@link Exception::getLine} ( void )
final public array {@link Exception::getTrace} ( void )
final public string {@link Exception::getTraceAsString} ( void )
public string {@link Exception::__toString} ( void )
final private void {@link Exception::__clone} ( void )
public array {@link SolrException::getInternalInfo} ( void )
}

Table of Contents

Solr
11 | */ 12 | class SolrIllegalArgumentException extends SolrException { 13 | 14 | /** 15 | * (PECL solr >= 0.9.2)
16 | * Returns internal information where the Exception was thrown 17 | * @link http://php.net/manual/en/solrillegalargumentexception.getinternalinfo.php 18 | * @return array

19 | * Returns an array containing internal information where the error was thrown. Used only for debugging by extension 20 | * developers. 21 | *

22 | */ 23 | public function getInternalInfo() {} 24 | 25 | } -------------------------------------------------------------------------------- /doc_plugin/src/library/solr/Exceptions/SolrIllegalOperationException.php: -------------------------------------------------------------------------------- 1 | 6 | * @link https://github.com/pjmazenot/phpsolr-phpdoc 7 | */ 8 | 9 | /** 10 | *

The SolrIllegalOperationException class

(PECL solr >= 0.9.2)

简介

This object is thrown when an illegal or unsupported operation is performed on an object.

类摘要

SolrIllegalOperationException extends SolrException {
// 继承的属性
protected string $message ;
protected int $code ;
protected string $file ;
protected int $line ;
protected integer $sourceline ;
protected string $sourcefile ;
protected string $zif_name ;
// 方法
public array getInternalInfo ( void )
// 继承的方法
final public string {@link Exception::getMessage} ( void )
final public Throwable {@link Exception::getPrevious} ( void )
final public int {@link Exception::getCode} ( void )
final public string {@link Exception::getFile} ( void )
final public int {@link Exception::getLine} ( void )
final public array {@link Exception::getTrace} ( void )
final public string {@link Exception::getTraceAsString} ( void )
public string {@link Exception::__toString} ( void )
final private void {@link Exception::__clone} ( void )
public array {@link SolrException::getInternalInfo} ( void )
}

Table of Contents

Solr
11 | */ 12 | class SolrIllegalOperationException extends SolrException { 13 | 14 | /** 15 | * (PECL solr >= 0.9.2)
16 | * Returns internal information where the Exception was thrown 17 | * @link http://php.net/manual/en/solrillegaloperationexception.getinternalinfo.php 18 | * @return array

19 | * Returns an array containing internal information where the error was thrown. Used only for debugging by extension 20 | * developers. 21 | *

22 | */ 23 | public function getInternalInfo() {} 24 | 25 | } -------------------------------------------------------------------------------- /doc_plugin/src/library/solr/Exceptions/SolrMissingMandatoryParameterException.php: -------------------------------------------------------------------------------- 1 | 6 | * @link https://github.com/pjmazenot/phpsolr-phpdoc 7 | */ 8 | 9 | /** 10 | *

The SolrMissingMandatoryParameterException class

(No version information available, might only be in Git)

简介

类摘要

SolrMissingMandatoryParameterException extends SolrException {
// 继承的属性
protected string $message ;
protected int $code ;
protected string $file ;
protected int $line ;
protected integer $sourceline ;
protected string $sourcefile ;
protected string $zif_name ;
// 继承的方法
final public string {@link Exception::getMessage} ( void )
final public Throwable {@link Exception::getPrevious} ( void )
final public int {@link Exception::getCode} ( void )
final public string {@link Exception::getFile} ( void )
final public int {@link Exception::getLine} ( void )
final public array {@link Exception::getTrace} ( void )
final public string {@link Exception::getTraceAsString} ( void )
public string {@link Exception::__toString} ( void )
final private void {@link Exception::__clone} ( void )
public array {@link SolrException::getInternalInfo} ( void )
}
Solr
11 | */ 12 | class SolrMissingMandatoryParameterException extends SolrException { 13 | 14 | } -------------------------------------------------------------------------------- /doc_plugin/src/library/solr/Exceptions/SolrServerException.php: -------------------------------------------------------------------------------- 1 | 6 | * @link https://github.com/pjmazenot/phpsolr-phpdoc 7 | */ 8 | 9 | /** 10 | *

The SolrServerException class

(PECL Solr >= 1.1.0, >=2.0.0)

简介

An exception thrown when there is an error produced by the Solr Server itself.

类摘要

SolrServerException extends SolrException {
// 继承的属性
protected string $message ;
protected int $code ;
protected string $file ;
protected int $line ;
protected integer $sourceline ;
protected string $sourcefile ;
protected string $zif_name ;
// 方法
public array getInternalInfo ( void )
// 继承的方法
final public string {@link Exception::getMessage} ( void )
final public Throwable {@link Exception::getPrevious} ( void )
final public int {@link Exception::getCode} ( void )
final public string {@link Exception::getFile} ( void )
final public int {@link Exception::getLine} ( void )
final public array {@link Exception::getTrace} ( void )
final public string {@link Exception::getTraceAsString} ( void )
public string {@link Exception::__toString} ( void )
final private void {@link Exception::__clone} ( void )
public array {@link SolrException::getInternalInfo} ( void )
}

Table of Contents

Solr
11 | */ 12 | class SolrServerException extends SolrException { 13 | 14 | /** 15 | * (PECL solr >= 1.1.0, >=2.0.0)
16 | * Returns internal information where the Exception was thrown 17 | * @link http://php.net/manual/en/solrserverexception.getinternalinfo.php 18 | * @return array

19 | * Returns an array containing internal information where the error was thrown. Used only for debugging by extension 20 | * developers. 21 | *

22 | */ 23 | public function getInternalInfo() {} 24 | 25 | } -------------------------------------------------------------------------------- /doc_plugin/src/library/solr/Queries/SolrModifiableParams.php: -------------------------------------------------------------------------------- 1 | 6 | * @link https://github.com/pjmazenot/phpsolr-phpdoc 7 | */ 8 | 9 | /** 10 | *

The SolrModifiableParams class

(PECL solr >= 0.9.2)

简介

Represents a collection of name-value pairs sent to the Solr server during a request.

类摘要

SolrModifiableParams extends SolrParams implements Serializable {
// 方法
public __construct ( void )
public void __destruct ( void )
// 继承的方法
final public SolrParams {@link SolrParams::add} ( string $name , string $value )
public SolrParams {@link SolrParams::addParam} ( string $name , string $value )
final public mixed {@link SolrParams::get} ( string $param_name )
final public mixed {@link SolrParams::getParam} ([ string $param_name ] )
final public array {@link SolrParams::getParams} ( void )
final public array {@link SolrParams::getPreparedParams} ( void )
final public string {@link SolrParams::serialize} ( void )
final public void {@link SolrParams::set} ( string $name , string $value )
public SolrParams {@link SolrParams::setParam} ( string $name , string $value )
final public string {@link SolrParams::toString} ([ bool $url_encode = FALSE ] )
final public void {@link SolrParams::unserialize} ( string $serialized )
}

Table of Contents

Solr
11 | */ 12 | class SolrModifiableParams extends SolrParams implements Serializable { 13 | 14 | /** 15 | * (PECL solr >= 0.9.2)
16 | * SolrModifiableParams constructor. 17 | * @link http://php.net/manual/en/solrmodifiableparams.construct.php 18 | */ 19 | public function __construct() {} 20 | 21 | /** 22 | * (PECL solr >= 0.9.2)
23 | * Destructor 24 | * @link http://php.net/manual/en/solrmodifiableparams.destruct.php 25 | */ 26 | public function __destruct() {} 27 | 28 | } -------------------------------------------------------------------------------- /doc_plugin/src/library/solr/Responses/SolrPingResponse.php: -------------------------------------------------------------------------------- 1 | 6 | * @link https://github.com/pjmazenot/phpsolr-phpdoc 7 | */ 8 | 9 | /** 10 | *

The SolrPingResponse class

(PECL solr >= 0.9.2)

简介

Represents a response to a ping request to the server

类摘要

final SolrPingResponse extends SolrResponse {
// 常量
const integer PARSE_SOLR_OBJ = 0 ;
const integer PARSE_SOLR_DOC = 1 ;
// 属性
// 方法
public __construct ( void )
public void __destruct ( void )
public string getResponse ( void )
// 继承的方法
public string {@link SolrResponse::getDigestedResponse} ( void )
public int {@link SolrResponse::getHttpStatus} ( void )
public string {@link SolrResponse::getHttpStatusMessage} ( void )
public string {@link SolrResponse::getRawRequest} ( void )
public string {@link SolrResponse::getRawRequestHeaders} ( void )
public string {@link SolrResponse::getRawResponse} ( void )
public string {@link SolrResponse::getRawResponseHeaders} ( void )
public string {@link SolrResponse::getRequestUrl} ( void )
public SolrObject {@link SolrResponse::getResponse} ( void )
public bool {@link SolrResponse::setParseMode} ([ int $parser_mode = 0 ] )
public bool {@link SolrResponse::success} ( void )
}

属性

http_status

The http status of the response.

parser_mode

Whether to parse the solr documents as SolrObject or SolrDocument instances.

success

Was there an error during the request

http_status_message

Detailed message on http status

http_request_url

The request URL

http_raw_request_headers

A string of raw headers sent during the request

http_raw_request

The raw request sent to the server

http_raw_response_headers

Response headers from the Solr server

http_raw_response

The response message from the server

http_digested_response

The response in PHP serialized format.

预定义常量

SolrPingResponse Class Constants

SolrPingResponse::PARSE_SOLR_OBJ

Documents should be parsed as SolrObject instances

SolrPingResponse::PARSE_SOLR_DOC

Documents should be parsed as SolrDocument instances.

Table of Contents

Solr
11 | */ 12 | final class SolrPingResponse extends SolrResponse { 13 | 14 | /** 15 | * (PECL solr >= 0.9.2)
16 | * SolrPingResponse constructor. 17 | * @link http://php.net/manual/en/solrpingresponse.construct.php 18 | */ 19 | public function __construct() {} 20 | 21 | /** 22 | * (PECL solr >= 0.9.2)
23 | * Destructor 24 | * @link http://php.net/manual/en/solrpingresponse.destruct.php 25 | */ 26 | public function __destruct() {} 27 | 28 | /** 29 | * (PECL solr >= 0.9.2)
30 | * Returns the response from the server 31 | * @link http://php.net/manual/en/solrpingresponse.getresponse.php 32 | * @return string

33 | * Returns an empty string. (Returns the response from the server. This should be empty because the request as a 34 | * HEAD request.) 35 | *

36 | */ 37 | public function getResponse() {} 38 | 39 | } -------------------------------------------------------------------------------- /doc_plugin/src/library/solr/Utils/SolrObject.php: -------------------------------------------------------------------------------- 1 | 6 | * @link https://github.com/pjmazenot/phpsolr-phpdoc 7 | */ 8 | 9 | /** 10 | *

The SolrObject class

(PECL solr >= 0.9.2)

简介

This is an object whose properties can also by accessed using the array syntax. All its properties are read-only.

类摘要

final SolrObject implements ArrayAccess {
// 方法
public __construct ( void )
public void __destruct ( void )
public array getPropertyNames ( void )
public bool offsetExists ( string $property_name )
public mixed offsetGet ( string $property_name )
public void offsetSet ( string $property_name , string $property_value )
public void offsetUnset ( string $property_name )
}

Table of Contents

Solr
11 | */ 12 | final class SolrObject implements ArrayAccess { 13 | 14 | /** 15 | * (PECL solr >= 0.9.2)
16 | * SolrObject constructor. 17 | * @link http://php.net/manual/en/solrobject.construct.php 18 | */ 19 | public function __construct () {} 20 | 21 | /** 22 | * (PECL solr >= 0.9.2)
23 | * Destructor 24 | * @link http://php.net/manual/en/solrobject.destruct.php 25 | */ 26 | public function __destruct() {} 27 | 28 | /** 29 | * (PECL solr >= 0.9.2)
30 | * Returns an array of all the names of the properties 31 | * @link http://php.net/manual/en/solrobject.getpropertynames.php 32 | * @return array

33 | * Returns an array. 34 | *

35 | */ 36 | public function getPropertyNames() {} 37 | 38 | /** 39 | * (PECL solr >= 0.9.2)
40 | * Checks if the property exists 41 | * @link http://php.net/manual/en/solrobject.offsetexists.php 42 | * @param string $property_name

43 | * The name of the property. 44 | *

45 | * @return bool

46 | * Returns TRUE on success or FALSE on failure. 47 | *

48 | */ 49 | public function offsetExists($property_name) {} 50 | 51 | /** 52 | * (PECL solr >= 0.9.2)
53 | * Used to retrieve a property 54 | * @link http://php.net/manual/en/solrobject.offsetget.php 55 | * @param string $property_name

56 | * The name of the property. 57 | *

58 | * @return SolrDocumentField

59 | * Returns the property value. 60 | *

61 | */ 62 | public function offsetGet($property_name) {} 63 | 64 | /** 65 | * (PECL solr >= 0.9.2)
66 | * Sets the value for a property 67 | * @link http://php.net/manual/en/solrobject.offsetset.php 68 | * @param string $property_name

69 | * The name of the property. 70 | *

71 | * @param string $property_value

72 | * The new value. 73 | *

74 | */ 75 | public function offsetSet($property_name , $property_value) {} 76 | 77 | /** 78 | * (PECL solr >= 0.9.2)
79 | * Unsets the value for the property 80 | * @link http://php.net/manual/en/solrobject.offsetunset.php 81 | * @param string $property_name

82 | * The name of the property. 83 | *

84 | * @TODO: Check -> doc indicate void function but return is set at true/false 85 | */ 86 | public function offsetUnset($property_name) {} 87 | 88 | } -------------------------------------------------------------------------------- /doc_plugin/src/library/solr/Utils/SolrUtils.php: -------------------------------------------------------------------------------- 1 | 6 | * @link https://github.com/pjmazenot/phpsolr-phpdoc 7 | */ 8 | 9 | /** 10 | *

The SolrUtils class

(PECL solr >= 0.9.2)

简介

Contains utility methods for retrieving the current extension version and preparing query phrases.

Also contains method for escaping query strings and parsing XML responses.

类摘要

abstract SolrUtils {
// 方法
public static SolrObject digestXmlResponse ( string $xmlresponse [, int $parse_mode = 0 ] )
public static string escapeQueryChars ( string $str )
public static string getSolrVersion ( void )
public static string queryPhrase ( string $str )
}

Table of Contents

Solr
11 | */ 12 | abstract class SolrUtils { 13 | 14 | /** 15 | * (PECL solr >= 0.9.2)
16 | * Parses an response XML string into a SolrObject 17 | * @link http://php.net/manual/en/solrutils.digestxmlresponse.php 18 | * @param string $xmlresponse

19 | * The XML response string from the Solr server. 20 | *

21 | * @param int $parse_mode [optional]

22 | * Use SolrResponse::PARSE_SOLR_OBJ or SolrResponse::PARSE_SOLR_DOC 23 | *

24 | * @return SolrObject

25 | * Returns the SolrObject representing the XML response. 26 | *

27 | *

28 | * If the parse_mode parameter is set to SolrResponse::PARSE_SOLR_OBJ Solr documents will be parses as SolrObject instances. 29 | *

30 | *

31 | * If it is set to SolrResponse::PARSE_SOLR_DOC, they will be parsed as SolrDocument instances. 32 | *

33 | * @throws SolrException 34 | */ 35 | public static function digestXmlResponse($xmlresponse, $parse_mode = 0) {} 36 | 37 | /** 38 | * (PECL solr >= 0.9.2)
39 | * Escapes a lucene query string 40 | * @link http://php.net/manual/en/solrutils.escapequerychars.php 41 | * @param string $str

42 | * This is the query string to be escaped. 43 | *

44 | * @return string

45 | * Returns the escaped string or FALSE on failure. 46 | *

47 | */ 48 | public static function escapeQueryChars($str) {} 49 | 50 | /** 51 | * (PECL solr >= 0.9.2)
52 | * Returns the current version of the Solr extension 53 | * @link http://php.net/manual/en/solrutils.getsolrversion.php 54 | * @return string

55 | * The current version of the Apache Solr extension. 56 | *

57 | */ 58 | public static function getSolrVersion() {} 59 | 60 | /** 61 | * (PECL solr >= 0.9.2)
62 | * Prepares a phrase from an unescaped lucene string 63 | * @link http://php.net/manual/en/solrutils.queryphrase.php 64 | * @param $str

65 | * The lucene phrase. 66 | *

67 | * @return string

68 | * Returns the phrase contained in double quotes. 69 | *

70 | */ 71 | public static function queryPhrase($str) {} 72 | 73 | } -------------------------------------------------------------------------------- /doc_plugin/src/library/solr/constants.php: -------------------------------------------------------------------------------- 1 | 6 | * @link https://github.com/pjmazenot/phpsolr-phpdoc 7 | */ 8 | 9 | /* 10 | * Solr Predefined Constants 11 | * The constants below are defined by this extension, and will only be available when the extension has either been 12 | * compiled into PHP or dynamically loaded at runtime. 13 | * @link http://php.net/manual/en/solr.constants.php 14 | */ 15 | 16 | define('SOLR_MAJOR_VERSION', 2); 17 | define('SOLR_MINOR_VERSION', 4); 18 | define('SOLR_PATCH_VERSION', 0); 19 | define('SOLR_EXTENSION_VERSION', '2.4.0'); -------------------------------------------------------------------------------- /doc_plugin/src/library/solr/functions.php: -------------------------------------------------------------------------------- 1 | 6 | * @link https://github.com/pjmazenot/phpsolr-phpdoc 7 | */ 8 | 9 | /** 10 | *

solr_get_version

(PECL solr >= 0.9.1)

solr_get_version返回当前Solr扩展的版本



说明

string solr_get_version ( void )

函数已字符串形式返回扩展的当前版本。



参数

此函数没有参数。


返回值

获取成功则返回版本号,否则返回 FALSE



错误/异常

此函数不抛出异常



范例

Example #1 solr_get_version() example

<?php

$solr_version 
solr_get_version();

print 
$solr_version;

?>

以上例程的输出类似于:

0.9.6


参见

  • {@link SolrUtils::getSolrVersion()} - Returns the current version of the Solr extension
Solr 函数
11 | * @return string

*/ 12 | function solr_get_version() {} -------------------------------------------------------------------------------- /doc_plugin/src/library/suhosin/suhosin.php: -------------------------------------------------------------------------------- 1 | 9 | * Cookie name. 10 | *

11 | * @param string $value

12 | * Cookie value. 13 | *

14 | * @return string the encrypted string or false on failure. 15 | */ 16 | function suhosin_encrypt_cookie ($name, $value) {} 17 | 18 | /** 19 | * Returns an array containing the raw cookie values 20 | * @link http://php.net/manual/en/function.suhosin-get-raw-cookies.php 21 | * @return array an array containing the raw cookie values. 22 | */ 23 | function suhosin_get_raw_cookies () {} 24 | 25 | -------------------------------------------------------------------------------- /doc_plugin/src/library/tests/PHPReflectionParser.php: -------------------------------------------------------------------------------- 1 | $value) { 5 | $constants[] = (new PHPConst())->serialize($name, $value); 6 | } 7 | $data['constants'] = $constants; 8 | 9 | $functions = []; 10 | foreach (get_defined_functions()['internal'] as $name) { 11 | $functions[] = (new PHPFunction())->serialize(new ReflectionFunction($name)); 12 | } 13 | $data['functions'] = $functions; 14 | 15 | $classes = []; 16 | foreach (get_declared_classes() as $class) { 17 | $classes[] = (new PHPClass())->serialize(new ReflectionClass($class)); 18 | } 19 | $data['classes'] = $classes; 20 | 21 | $json = json_encode($data, JSON_NUMERIC_CHECK); 22 | echo $json; 23 | 24 | 25 | class PHPClass 26 | { 27 | public $name; 28 | public $methods = []; 29 | public $constants = []; 30 | public $parentClass; 31 | public $interfaces = []; 32 | 33 | public function serialize(ReflectionClass $reflectionClass): array 34 | { 35 | $this->name = $reflectionClass->name; 36 | $parentClass = $reflectionClass->getParentClass(); 37 | if (null !== $parentClass) { 38 | $this->parentClass = $reflectionClass->getParentClass()->name; 39 | } 40 | $this->interfaces = $reflectionClass->getInterfaceNames(); 41 | foreach ($reflectionClass->getMethods() as $method) { 42 | if ($method->getDeclaringClass()->name !== $this->name) { 43 | continue; 44 | } 45 | $this->methods[$method->name] = (new PHPMethod())->serialize($method); 46 | } 47 | 48 | foreach ($reflectionClass->getReflectionConstants() as $constant){ 49 | if($constant->getDeclaringClass()->name !== $this->name){ 50 | continue; 51 | } 52 | $this->constants[$constant->name] = (new PHPConst())->serialize($constant->name, $constant->getValue()); 53 | } 54 | return (array)$this; 55 | } 56 | 57 | } 58 | 59 | class PHPConst 60 | { 61 | public $name; 62 | public $value; 63 | 64 | public function serialize($name, $value): array 65 | { 66 | $this->name = utf8_encode($name); 67 | $this->value = is_resource($value) ? 'PHPSTORM_RESOURCE' : utf8_encode($value); 68 | return (array)$this; 69 | } 70 | } 71 | 72 | class PHPFunction 73 | { 74 | public $name; 75 | public $is_deprecated; 76 | public $parameters = []; 77 | 78 | public function serialize(ReflectionFunction $reflectionFunction): array 79 | { 80 | 81 | $this->name = $reflectionFunction->name; 82 | $this->is_deprecated = $reflectionFunction->isDeprecated(); 83 | foreach ($reflectionFunction->getParameters() as $parameter) { 84 | $this->parameters[] = (new PHPParameter())->serialize($parameter); 85 | } 86 | return (array)$this; 87 | } 88 | 89 | } 90 | 91 | class PHPMethod 92 | { 93 | public $name; 94 | public $is_static; 95 | public $access; 96 | public $is_final; 97 | public $parameters = []; 98 | 99 | public function serialize(ReflectionMethod $method): array 100 | { 101 | $this->name = $method->name; 102 | $this->is_static = $method->isStatic(); 103 | $this->is_final = $method->isFinal(); 104 | foreach ($method->getParameters() as $parameter) { 105 | $this->parameters[] = (new PHPParameter())->serialize($parameter); 106 | } 107 | 108 | if ($method->isProtected()) { 109 | $access = 'protected'; 110 | } else if ($method->isPrivate()) { 111 | $access = 'private'; 112 | } else { 113 | $access = 'public'; 114 | } 115 | $this->access = $access; 116 | return (array)$this; 117 | } 118 | 119 | } 120 | 121 | class PHPParameter 122 | { 123 | public $name; 124 | public $type = ''; 125 | public $is_vararg; 126 | public $is_passed_by_ref; 127 | 128 | public function serialize(ReflectionParameter $parameter): array 129 | { 130 | $this->name = $parameter->name; 131 | if (!empty($parameter->getType())) { 132 | $this->type = $parameter->getType()->getName(); 133 | } 134 | $this->is_vararg = $parameter->isVariadic(); 135 | $this->is_passed_by_ref = $parameter->isPassedByReference(); 136 | return (array)$this; 137 | } 138 | } 139 | -------------------------------------------------------------------------------- /doc_plugin/src/library/tests/StubParser.php: -------------------------------------------------------------------------------- 1 | stack = []; 27 | } 28 | 29 | public function enterNode(Node $node) 30 | { 31 | if (!empty($this->stack)) { 32 | $node->setAttribute('parent', $this->stack[count($this->stack) - 1]); 33 | } 34 | $this->stack[] = $node; 35 | } 36 | 37 | public function leaveNode(Node $node) 38 | { 39 | array_pop($this->stack); 40 | } 41 | } 42 | 43 | class ASTVisitor extends NodeVisitorAbstract 44 | { 45 | private $docFactory; 46 | private $stubs; 47 | 48 | public function __construct(DocBlockFactory $docFactory, stdClass $stubs) 49 | { 50 | $this->docFactory = $docFactory; 51 | $this->stubs = $stubs; 52 | } 53 | 54 | public function enterNode(Node $node) 55 | { 56 | if ($node instanceof Function_) { 57 | $this->visitFunction($node); 58 | } elseif ($node instanceof Const_) { 59 | $this->visitConstant($node); 60 | } elseif ($node instanceof FuncCall) { 61 | $this->visitDefine($node); 62 | } elseif ($node instanceof ClassMethod) { 63 | $this->visitMethod($node); 64 | } elseif ($node instanceof Class_) { 65 | $this->visitClass($node); 66 | } 67 | } 68 | 69 | public function visitFunction(Function_ $node): void 70 | { 71 | $function = new stdClass(); 72 | $functionName = $this->getFQN($node, $node->name->name); 73 | $function->name = $functionName; 74 | 75 | $function->parameters = $this->parseParams($node); 76 | 77 | if ($node->getDocComment() !== null) { 78 | $phpDoc = $this->docFactory->create($node->getDocComment()->getText()); 79 | if (empty($phpDoc->getTagsByName('deprecated'))) { 80 | $function->is_deprecated = false; 81 | } else { 82 | $function->is_deprecated = true; 83 | } 84 | } 85 | $this->stubs->functions[$functionName] = $function; 86 | } 87 | 88 | private function visitConstant(Const_ $node): void 89 | { 90 | $const = new stdClass(); 91 | $constName = $this->getFQN($node, $node->name->name); 92 | $const->name = $constName; 93 | $const->value = $this->getConstValue($node); 94 | if ($node->getAttribute('parent') instanceof Node\Stmt\ClassConst) { 95 | $className = $node->getAttribute('parent')->getAttribute('parent')->name->name; 96 | $this->stubs->classes[$className]->constants[$constName] = $const; 97 | } else { 98 | $this->stubs->constants[$constName] = $const; 99 | 100 | } 101 | } 102 | 103 | private function visitDefine(FuncCall $node): void 104 | { 105 | if ($node->name->parts[0] === 'define') { 106 | $constName = $this->getFQN($node, $node->args[0]->value->value); 107 | $const = new stdClass(); 108 | if (in_array($constName, ['null', 'true', 'false'])) { 109 | $constName = strtoupper($constName); 110 | } 111 | $const->name = $constName; 112 | $const->value = $this->getConstValue($node->args[1]); 113 | $this->stubs->constants[$constName] = $const; 114 | } 115 | } 116 | 117 | private function getConstValue($node) 118 | { 119 | if (in_array('value', $node->value->getSubNodeNames(), true)) { 120 | return $node->value->value; 121 | } 122 | if (in_array('expr', $node->value->getSubNodeNames(), true)) { 123 | return $node->value->expr->value; 124 | } 125 | if (in_array('name', $node->value->getSubNodeNames(), true)) { 126 | return $node->value->name->parts[0]; 127 | } 128 | return null; 129 | } 130 | 131 | private function visitMethod(ClassMethod $node): void 132 | { 133 | $className = $node->getAttribute('parent')->name->name; 134 | $method = new stdClass(); 135 | $method->name = $node->name->name; 136 | if(strncmp($method->name, 'PS_UNRESERVE_PREFIX_', 20) === 0){ 137 | $method->name = substr($method->name, strlen('PS_UNRESERVE_PREFIX_')); 138 | } 139 | $method->parameters = $this->parseParams($node); 140 | $method->is_final = $node->isFinal(); 141 | $method->is_static = $node->isStatic(); 142 | if ($node->isPrivate()) { 143 | $method->access = 'private'; 144 | } elseif ($node->isProtected()) { 145 | $method->access = 'protected'; 146 | } else { 147 | $method->access = 'public'; 148 | } 149 | 150 | $this->stubs->classes[$className]->methods[$method->name] = $method; 151 | } 152 | 153 | private function visitClass(Class_ $node): void 154 | { 155 | $class = new stdClass(); 156 | $className = $this->getFQN($node, $node->name->name); 157 | $class->name = $className; 158 | if (empty($node->extends)) { 159 | $class->parentClass = null; 160 | } else { 161 | $class->parentClass = $node->extends->parts[0]; 162 | } 163 | $class->interfaces = $node->implements; 164 | $this->stubs->classes[$className] = $class; 165 | $this->stubs->classes[$className]->constants = []; 166 | $this->stubs->classes[$className]->methods = []; 167 | } 168 | 169 | private function parseParams(FunctionLike $node): array 170 | { 171 | $params = $node->getParams(); 172 | $parsedParams = []; 173 | /** @var Node\Param $param */ 174 | foreach ($params as $param) { 175 | $parsedParam = new stdClass(); 176 | $parsedParam->name = $param->var->name; 177 | if ($param->type !== null) { 178 | if (empty($param->type->name)) { 179 | if (!empty($param->type->parts)) { 180 | $parsedParam->type = $param->type->parts[0]; 181 | } 182 | } else { 183 | $parsedParam->type = $param->type->name; 184 | } 185 | 186 | } else { 187 | $parsedParam->type = ''; 188 | } 189 | $parsedParam->is_vararg = $param->variadic; 190 | $parsedParam->is_passed_by_ref = $param->byRef; 191 | $parsedParams[] = $parsedParam; 192 | } 193 | return $parsedParams; 194 | } 195 | 196 | private function getFQN(NodeAbstract $node, string $nodeName): string 197 | { 198 | $namespace = ''; 199 | if ($node->getAttribute('parent') instanceof Namespace_ && !empty($node->getAttribute('parent')->name)) { 200 | $namespace = '\\' . implode('\\', $node->getAttribute('parent')->name->parts) . '\\'; 201 | } 202 | return $namespace . $nodeName; 203 | } 204 | } 205 | 206 | function getPhpStormStubs(): stdClass 207 | { 208 | $parser = (new ParserFactory)->create(ParserFactory::PREFER_PHP7); 209 | $docFactory = \phpDocumentor\Reflection\DocBlockFactory::createInstance(); 210 | $stubs = new stdClass(); 211 | 212 | $stubsIterator = 213 | new RecursiveIteratorIterator( 214 | new RecursiveDirectoryIterator(__DIR__ . '/../', FilesystemIterator::SKIP_DOTS) 215 | ); 216 | /** @var SplFileInfo $file */ 217 | foreach ($stubsIterator as $file) { 218 | if (strpos($file->getRealPath(), 'vendor') || substr(dirname($file->getRealPath(), 1), -5) === 'tests') { 219 | continue; 220 | } 221 | $code = file_get_contents($file->getRealPath()); 222 | 223 | $ast = $parser->parse($code); 224 | $traverser = new NodeTraverser(); 225 | 226 | $traverser->addVisitor(new ParentConnector()); 227 | $traverser->addVisitor(new ASTVisitor($docFactory, $stubs)); 228 | 229 | $traverser->traverse($ast); 230 | } 231 | return $stubs; 232 | } 233 | -------------------------------------------------------------------------------- /doc_plugin/src/library/tests/TestStubs.php: -------------------------------------------------------------------------------- 1 | mutedProblems = json_decode($json); 44 | } 45 | 46 | public function getMutedProblemsForConstant(string $constantName): array 47 | { 48 | foreach ($this->mutedProblems->constants as $constant) { 49 | if ($constant->name === $constantName) { 50 | return $constant->problems; 51 | } 52 | } 53 | return []; 54 | } 55 | 56 | public function getMutedProblemsForFunction(string $functionName): array 57 | { 58 | foreach ($this->mutedProblems->functions as $function) { 59 | if ($function->name === $functionName) { 60 | return $function->problems; 61 | } 62 | } 63 | return []; 64 | } 65 | 66 | public function getMutedProblemsForClass(string $className): array 67 | { 68 | foreach ($this->mutedProblems->classes as $class) { 69 | if ($class->name === $className && !empty($class->problems)) { 70 | return $class->problems; 71 | } 72 | } 73 | return []; 74 | } 75 | 76 | public function getMutedProblemsForMethod(string $className, $methodName): array 77 | { 78 | foreach ($this->mutedProblems->classes as $class) { 79 | if ($class->name === $className && !empty($class->methods)) { 80 | foreach ($class->methods as $method) { 81 | if ($method->name === $methodName) { 82 | return $method->problems; 83 | } 84 | } 85 | } 86 | } 87 | return []; 88 | } 89 | 90 | public function getMutedProblemsForClassConstants($className, $constantName) 91 | { 92 | foreach ($this->mutedProblems->classes as $class) { 93 | if ($class->name === $className && !empty($class->constants)) { 94 | foreach ($class->constants as $constant) { 95 | if ($constant->name === $constantName) { 96 | return $constant->problems; 97 | } 98 | } 99 | } 100 | } 101 | return []; 102 | } 103 | } 104 | 105 | class TestStubs extends TestCase 106 | { 107 | /** @var MutedProblems */ 108 | private static $mutedProblems; 109 | 110 | public static function setUpBeforeClass()/* The :void return type declaration that should be here would cause a BC issue */ 111 | { 112 | self::$mutedProblems = new MutedProblems(); 113 | } 114 | 115 | 116 | public function constantProvider() 117 | { 118 | foreach (ReflectionStubsSingleton::getReflectionStubs()->constants as $constant) { 119 | yield "constant {$constant->name}" => [$constant]; 120 | } 121 | } 122 | 123 | /** 124 | * @dataProvider constantProvider 125 | */ 126 | public function testConstants(stdClass $constant) 127 | { 128 | $constantName = $constant->name; 129 | $constantValue = $constant->value; 130 | $stubConstants = PhpStormStubsSingleton::getPhpStormStubs()->constants; 131 | if (in_array('missing constant', self::$mutedProblems->getMutedProblemsForConstant($constantName), true)) { 132 | $this->markTestSkipped('constant is excluded'); 133 | } 134 | $this->assertArrayHasKey($constantName, $stubConstants, "Missing constant: const $constantName = $constantValue\n"); 135 | } 136 | 137 | 138 | public function functionProvider() 139 | { 140 | foreach (ReflectionStubsSingleton::getReflectionStubs()->functions as $function) { 141 | yield "function {$function->name}" => [$function]; 142 | } 143 | } 144 | 145 | /** 146 | * @dataProvider functionProvider 147 | */ 148 | public function testFunctions(stdClass $function) 149 | { 150 | $functionName = $function->name; 151 | $stubFunctions = PhpStormStubsSingleton::getPhpStormStubs()->functions; 152 | $params = $this->getParameterRepresentation($function); 153 | if (in_array('missing function', self::$mutedProblems->getMutedProblemsForFunction($functionName), true)) { 154 | $this->markTestSkipped('function is excluded'); 155 | } 156 | $this->assertArrayHasKey($functionName, $stubFunctions, "Missing function: function $functionName($params){}"); 157 | $phpstormFunction = $stubFunctions[$functionName]; 158 | if (!in_array('deprecated function', self::$mutedProblems->getMutedProblemsForFunction($functionName), true)) { 159 | $this->assertFalse($function->is_deprecated && $phpstormFunction->is_deprecated !== true, "Function $functionName is not deprecated in stubs"); 160 | } 161 | if (!in_array('parameter mismatch', self::$mutedProblems->getMutedProblemsForFunction($functionName), true)) { 162 | $this->assertSameSize($function->parameters, $phpstormFunction->parameters, 163 | "Parameter number mismatch for function $functionName. Expected: " . $this->getParameterRepresentation($function)); 164 | } 165 | 166 | } 167 | 168 | 169 | public function classProvider() 170 | { 171 | foreach (ReflectionStubsSingleton::getReflectionStubs()->classes as $class) { 172 | //exclude classes from PHPReflectionParser 173 | if (0 !== strncmp($class->name, 'PHP', 3)) { 174 | yield "class {$class->name}" => [$class]; 175 | } 176 | } 177 | } 178 | 179 | /** 180 | * @dataProvider classProvider 181 | */ 182 | public function testClasses(stdClass $class) 183 | { 184 | $className = $class->name; 185 | $stubClasses = PhpStormStubsSingleton::getPhpStormStubs()->classes; 186 | if (in_array('missing class', self::$mutedProblems->getMutedProblemsForClass($className), true)) { 187 | $this->markTestSkipped('class is skipped'); 188 | } 189 | $this->assertArrayHasKey($className, $stubClasses, "Missing class $className: class $className {}"); 190 | $stubClass = $stubClasses[$className]; 191 | if (!in_array('wrong parent', self::$mutedProblems->getMutedProblemsForClass($className), true)) { 192 | $this->assertEquals($class->parentClass, $stubClass->parentClass, "Class $className should extend {$class->parentClass}"); 193 | } 194 | foreach ($class->constants as $constant) { 195 | if (!in_array('missing constant', self::$mutedProblems->getMutedProblemsForClassConstants($className, $constant->name), true)) { 196 | $this->assertArrayHasKey($constant->name, $stubClass->constants, "Missing constant $className::{$constant->name}"); 197 | } 198 | } 199 | // @todo check interfaces 200 | // @todo check traits 201 | foreach ($class->methods as $method) { 202 | $params = $this->getParameterRepresentation($method); 203 | $methodName = $method->name; 204 | if (!in_array('missing method', self::$mutedProblems->getMutedProblemsForMethod($className, $methodName), true)) { 205 | $this->assertArrayHasKey($methodName, $stubClass->methods, "Missing method $className::$methodName($params){}"); 206 | $stubMethod = $stubClass->methods[$methodName]; 207 | if (!in_array('not final', self::$mutedProblems->getMutedProblemsForMethod($className, $methodName), true)) { 208 | $this->assertEquals($method->is_final, $stubMethod->is_final, "Method $className::$methodName final modifier is incorrect"); 209 | } 210 | if (!in_array('not static', self::$mutedProblems->getMutedProblemsForMethod($className, $methodName), true)) { 211 | $this->assertEquals($method->is_static, $stubMethod->is_static, "Method $className::$methodName static modifier is incorrect"); 212 | } 213 | if (!in_array('access modifiers', self::$mutedProblems->getMutedProblemsForMethod($className, $methodName), true)) { 214 | $this->assertEquals($method->access, $stubMethod->access, "Method $className::$methodName access modifier is incorrect"); 215 | } 216 | if (!in_array('parameter mismatch', self::$mutedProblems->getMutedProblemsForMethod($className, $methodName), true)) { 217 | $this->assertSameSize($method->parameters, $stubMethod->parameters, "Parameter number mismatch for method $className::$methodName. Expected: " . $this->getParameterRepresentation($method)); 218 | } 219 | } 220 | } 221 | 222 | } 223 | 224 | 225 | private function getParameterRepresentation(stdClass $function): string 226 | { 227 | $result = ''; 228 | foreach ($function->parameters as $parameter) { 229 | if (!empty($parameter->type)) { 230 | $result .= $parameter->type . ' '; 231 | } 232 | if ($parameter->is_passed_by_ref) { 233 | $result .= '&'; 234 | } 235 | if ($parameter->is_vararg) { 236 | $result .= '...'; 237 | } 238 | $result .= '$' . $parameter->name . ', '; 239 | } 240 | $result = rtrim($result, ', '); 241 | return $result; 242 | } 243 | } -------------------------------------------------------------------------------- /doc_plugin/src/library/tests/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | php: 4 | image: php:latest 5 | volumes: 6 | - .:/opt/project 7 | command: php /opt/project/PHPReflectionParser.php -------------------------------------------------------------------------------- /doc_plugin/src/library/xcache/xcache.php: -------------------------------------------------------------------------------- 1 | 36 | -------------------------------------------------------------------------------- /doc_plugin/src/library/zend/zend_f.php: -------------------------------------------------------------------------------- 1 | bar and $foo->bar() would match Bar too. 47 | * @return void 48 | */ 49 | function java_set_ignore_case($ignore) {} 50 | 51 | /** 52 | * Set encoding for strings received by Java from PHP. Default is UTF-8. 53 | * @param encoding string 54 | * @return array 55 | */ 56 | function java_set_encoding($encoding) {} 57 | 58 | /** 59 | * Control if exceptions are thrown on Java exception. Only for PHP5. 60 | * @param throw bool If true, PHP exception is thrown when Java exception happens. If set to false, use java_last_exception_get() to check for exception. 61 | * @return void 62 | */ 63 | function java_throw_exceptions($throw) {} 64 | 65 | /** 66 | * Reload Jar's that were dynamically loaded 67 | * 68 | * @return array 69 | * @param new_jarpath string 70 | */ 71 | function java_reload($new_jarpath) {} 72 | 73 | /** 74 | * Add to Java's classpath in runtime 75 | * 76 | * @return array 77 | * @param new_classpath string 78 | */ 79 | function java_require($new_classpath) {} 80 | 81 | 82 | /** 83 | * Shown if loader is enabled 84 | * @return bool 85 | */ 86 | function zend_loader_enabled() {} 87 | 88 | /** 89 | * Returns true if the current file is a Zend-encoded file. 90 | * @return bool 91 | */ 92 | function zend_loader_file_encoded() {} 93 | 94 | /** 95 | * Returns license (array with fields) if the current file has a valid license and is encoded, otherwise it returns false. 96 | * @return array 97 | */ 98 | function zend_loader_file_licensed() {} 99 | 100 | /** 101 | * Returns the name of the file currently being executed. 102 | * @return string 103 | */ 104 | function zend_loader_current_file() {} 105 | 106 | /** 107 | * Dynamically loads a license for applications encoded with Zend SafeGuard. The Override controls if it will override old licenses for the same product. 108 | * @param license_file string 109 | * @param override bool[optional] 110 | * @return bool 111 | */ 112 | function zend_loader_install_license($license_file, $override) {} 113 | 114 | /** 115 | * Obfuscate and return the given function name with the internal obfuscation function. 116 | * @param function_name string 117 | * @return string 118 | */ 119 | function zend_obfuscate_function_name($function_name) {} 120 | 121 | /** 122 | * Obfuscate and return the given class name with the internal obfuscation function. 123 | * @param class_name string 124 | * @return string 125 | */ 126 | function zend_obfuscate_class_name($class_name) {} 127 | 128 | /** 129 | * Returns the current obfuscation level support (set by zend_optimizer.obfuscation_level_support) 130 | * @return int 131 | */ 132 | function zend_current_obfuscation_level() {} 133 | 134 | /** 135 | * Start runtime-obfuscation support that allows limited mixing of obfuscated and un-obfuscated code. 136 | * @return void 137 | */ 138 | function zend_runtime_obfuscate() {} 139 | 140 | /** 141 | * Returns array of the host ids. If all_ids is true, then all IDs are returned, otehrwise only IDs considered "primary" are returned. 142 | * @param all_ids bool[optional] 143 | * @return array 144 | */ 145 | function zend_get_id($all_ids = false) {} 146 | 147 | /** 148 | * Returns Optimizer version. Alias: zend_loader_version() 149 | * @return string 150 | */ 151 | function zend_optimizer_version() {} 152 | 153 | // End of Zend Extensions 154 | 155 | ?> 156 | -------------------------------------------------------------------------------- /document/phpdoc-cn.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fw6669998/php-doc/b1fc4033c7d43a48a6ba6919cc4c8d8a93ab4438/document/phpdoc-cn.zip -------------------------------------------------------------------------------- /document/phpdoc-en.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fw6669998/php-doc/b1fc4033c7d43a48a6ba6919cc4c8d8a93ab4438/document/phpdoc-en.zip -------------------------------------------------------------------------------- /example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fw6669998/php-doc/b1fc4033c7d43a48a6ba6919cc4c8d8a93ab4438/example.png -------------------------------------------------------------------------------- /example1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fw6669998/php-doc/b1fc4033c7d43a48a6ba6919cc4c8d8a93ab4438/example1.png -------------------------------------------------------------------------------- /raw/php-chunked-xhtml.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fw6669998/php-doc/b1fc4033c7d43a48a6ba6919cc4c8d8a93ab4438/raw/php-chunked-xhtml.zip -------------------------------------------------------------------------------- /raw/phpstorm-stubs-2018.1.2.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fw6669998/php-doc/b1fc4033c7d43a48a6ba6919cc4c8d8a93ab4438/raw/phpstorm-stubs-2018.1.2.zip --------------------------------------------------------------------------------