├── .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 | 
34 | 
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,'
在代码上快速查看php基本函数的中文文档,默认快捷键ctrl+q.
11 | 12 |在代码上快速查看php基本函数的中文文档,默认快捷键ctrl+q.
11 | 12 |(PHP 4, PHP 5, PHP 7)
recode_string — Recode a string according to a recode request
Recode the string string according to the recode request request.
The desired recode request type
The string to be recoded
Returns the recoded string or FALSE, if unable to perform the recode request.
Example #1 Basic recode_string() example
A simple recode request may be "lat1..iso646-de".
(PHP 4, PHP 5, PHP 7)
recode_file — Recode from file to file according to recode request
Recode the file referenced by file handle input into the file referenced by file handle output according to the recode request.
Returns FALSE, if unable to comply, TRUE otherwise.
Example #1 Basic recode_file() example
This function does not currently process file handles referencing remote files (URLs). Both file handles must refer to local files.
(PHP 4, PHP 5, PHP 7)
recode — 别名 {@link recode_string()}
此函数是该函数的别名: {@link recode_string()}.
(PECL solr >= 0.9.2)
This represents a field in a Solr document. All its properties are read-only.
The name of the field.
The boost value for the field
An array of values for this field
(PECL solr >= 0.9.2)
An exception thrown when there is an error while making a request to the server from the client.
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 | *(PECL solr >= 0.9.2)
This is the base class for all exception thrown by the Solr extension classes.
The line in c-space source file where exception was generated
The c-space source file where exception was generated
The c-space function where exception was generated
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 | *(PECL solr >= 0.9.2)
This object is thrown when an illegal or invalid argument is passed to a method.
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 | *(PECL solr >= 0.9.2)
This object is thrown when an illegal or unsupported operation is performed on an object.
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 | *(No version information available, might only be in Git)
(PECL Solr >= 1.1.0, >=2.0.0)
An exception thrown when there is an error produced by the Solr Server itself.
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 | *(PECL solr >= 0.9.2)
Represents a collection of name-value pairs sent to the Solr server during a request.
(PECL solr >= 0.9.2)
Represents a response to a ping request to the server
The http status of the response.
Whether to parse the solr documents as SolrObject or SolrDocument instances.
Was there an error during the request
Detailed message on http status
The request URL
A string of raw headers sent during the request
The raw request sent to the server
Response headers from the Solr server
The response message from the server
The response in PHP serialized format.
Documents should be parsed as SolrObject instances
Documents should be parsed as SolrDocument instances.
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 | *(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.
33 | * Returns an array. 34 | *
35 | */ 36 | public function getPropertyNames() {} 37 | 38 | /** 39 | * (PECL solr >= 0.9.2)43 | * The name of the property. 44 | *
45 | * @return bool46 | * Returns TRUE on success or FALSE on failure. 47 | *
48 | */ 49 | public function offsetExists($property_name) {} 50 | 51 | /** 52 | * (PECL solr >= 0.9.2)56 | * The name of the property. 57 | *
58 | * @return SolrDocumentField59 | * Returns the property value. 60 | *
61 | */ 62 | public function offsetGet($property_name) {} 63 | 64 | /** 65 | * (PECL solr >= 0.9.2)69 | * The name of the property. 70 | *
71 | * @param string $property_value72 | * The new value. 73 | *
74 | */ 75 | public function offsetSet($property_name , $property_value) {} 76 | 77 | /** 78 | * (PECL solr >= 0.9.2)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 | *(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.
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 SolrObject25 | * 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)42 | * This is the query string to be escaped. 43 | *
44 | * @return string45 | * Returns the escaped string or FALSE on failure. 46 | *
47 | */ 48 | public static function escapeQueryChars($str) {} 49 | 50 | /** 51 | * (PECL solr >= 0.9.2)55 | * The current version of the Apache Solr extension. 56 | *
57 | */ 58 | public static function getSolrVersion() {} 59 | 60 | /** 61 | * (PECL solr >= 0.9.2)65 | * The lucene phrase. 66 | *
67 | * @return string68 | * 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 | *(PECL solr >= 0.9.1)
solr_get_version — 返回当前Solr扩展的版本
函数已字符串形式返回扩展的当前版本。
获取成功则返回版本号,否则返回 FALSE 。
此函数不抛出异常
Example #1 solr_get_version() example
以上例程的输出类似于:
*/ 12 | function solr_get_version() {} -------------------------------------------------------------------------------- /doc_plugin/src/library/suhosin/suhosin.php: -------------------------------------------------------------------------------- 1 | 9 | * Cookie name. 10 | *
11 | * @param string $value12 | * 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 --------------------------------------------------------------------------------