尝试将phpDocumentor添加到PhpStorm几个小时,我使用了一些指令:
http://kevinquillen.com/ide/2015/02/01/setting-up-phpdocumentor-in-phpstorm-8
现在看起来像 this
但是当我运行phpdoc时,我得到了这个:
C:\xampp\php\php.exe phpdoc -d c:\dokumentacja_php\folder_zrodlowy -t c:\dokumentacja_php\folder_docelowy
Collecting files .. OK
Initializing parser .. OK
Parsing files
Parsing C:\dokumentacja_php\folder_zrodlowy\Test.php
Storing cache in "C:\dokumentacja_php\folder_docelowy" .. OK
Load cache .. 0.010s
Preparing template "clean" .. 0.019s
Preparing 17 transformations .. 0.000s
Build "elements" index .. 0.000s
Replace textual FQCNs with object aliases .. 0.000s
Resolve @link and @see tags in descriptions .. 0.000s
Enriches inline example tags with their sources .. 0.000s
Build "packages" index .. 0.002s
Build "namespaces" index and add namespaces to "elements" .. 0.000s
Collect all markers embedded in tags .. 0.000s
Transform analyzed project into artifacts ..
Applying 17 transformations
Initialize writer "phpDocumentor\Plugin\Core\Transformer\Writer\FileIo"
Initialize writer "phpDocumentor\Plugin\Twig\Writer\Twig"
Initialize writer "phpDocumentor\Plugin\Graphs\Writer\Graph"
Execute transformation using writer "FileIo"
Execute transformation using writer "FileIo"
Execute transformation using writer "FileIo"
Execute transformation using writer "FileIo"
Execute transformation using writer "FileIo"
Execute transformation using writer "twig"
Execute transformation using writer "twig"
Execute transformation using writer "twig"
[2016-01-17 02:59:54] phpDocumentor.ALERT: Fatal Error (E_ERROR): Uncaught TypeError: Argument 1 passed to Monolog\ErrorHandler::handleException() must be an instance of Exception, instance of Error given in C:\xampp\php\pear\phpDocumentor-2.8.5\phpDocumentor-2.8.5\vendor\monolog\monolog\src\Monolog\ErrorHandler.php:122 Stack trace: #0 [internal function]: Monolog\ErrorHandler->handleException(Object(Error)) #1 {main} thrown {"code":1,"message":"Uncaught TypeError: Argument 1 passed to Monolog\\ErrorHandler::handleException() must be an instance of Exception, instance of Error given in C:\\xampp\\php\\pear\\phpDocumentor-2.8.5\\phpDocumentor-2.8.5\\vendor\\monolog\\monolog\\src\\Monolog\\ErrorHandler.php:122\nStack trace:\n#0 [internal function]: Monolog\\ErrorHandler->handleException(Object(Error))\n#1 {main}\n thrown","file":"C:\\xampp\\php\\pear\\phpDocumentor-2.8.5\\phpDocumentor-2.8.5\\vendor\\monolog\\monolog\\src\\Monolog\\ErrorHandler.php","line":122} []
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
<meta charset="utf-8"/>
<title>API Documentation</title>
<meta name="author" content=""/>
<meta name="description" content=""/>
<link href="../css/bootstrap-combined.no-icons.min.css" rel="stylesheet">
<link href="../css/font-awesome.min.css" rel="stylesheet">
<link href="../css/prism.css" rel="stylesheet" media="all"/>
<link href="../css/template.css" rel="stylesheet" media="all"/>
<!--[if lt IE 9]>
<script src="../js/html5.js"></script>
<![endif]-->
<script src="../js/jquery-1.11.0.min.js"></script>
<script src="../js/ui/1.10.4/jquery-ui.min.js"></script>
<script src="../js/bootstrap.min.js"></script>
<script src="../js/jquery.smooth-scroll.js"></script>
<script src="../js/prism.min.js"></script>
<!-- TODO: Add http://jscrollpane.kelvinluck.com/ to style the scrollbars for browsers not using webkit-->
<script type="text/javascript">
function loadExternalCodeSnippets() {
Array.prototype.slice.call(document.querySelectorAll('pre[data-src]')).forEach(function (pre) {
var src = pre.getAttribute('data-src');
var extension = (src.match(/\.(\w+)$/) || [, ''])[1];
var language = 'php';
var code = document.createElement('code');
code.className = 'language-' + language;
pre.textContent = '';
code.textContent = 'Loading…';
pre.appendChild(code);
var xhr = new XMLHttpRequest();
xhr.open('GET', src, true);
xhr.onreadystatechange = function () {
if (xhr.readyState == 4) {
if (xhr.status < 400 && xhr.responseText) {
code.textContent = xhr.responseText;
Prism.highlightElement(code);
}
else if (xhr.status >= 400) {
code.textContent = '✖ Error ' + xhr.status + ' while fetching file: ' + xhr.statusText;
}
else {
code.textContent = '✖ Error: File does not exist or is empty';
}
}
};
xhr.send(null);
});
}
$(document).ready(function(){
loadExternalCodeSnippets();
});
$('#source-view').on('shown', function () {
loadExternalCodeSnippets();
})
</script>
<link rel="shortcut icon" href="../images/favicon.ico"/>
<link rel="apple-touch-icon" href="../images/apple-touch-icon.png"/>
<link rel="apple-touch-icon" sizes="72x72" href="../images/apple-touch-icon-72x72.png"/>
<link rel="apple-touch-icon" sizes="114x114" href="../images/apple-touch-icon-114x114.png"/>
</head>
<body>
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<i class="icon-ellipsis-vertical"></i>
</a>
<a class="brand" href="../index.html">API Documentation</a>
<div class="nav-collapse">
<ul class="nav pull-right">
<li class="dropdown" id="charts-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
Charts <b class="caret"></b>
</a>
<ul class="dropdown-menu">
<li>
<a href="../graphs/class.html">
<i class="icon-list-alt"></i> Class hierarchy diagram
</a>
</li>
</ul>
</li>
<li class="dropdown" id="reports-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
Reports <b class="caret"></b>
</a>
<ul class="dropdown-menu">
<li>
<a href="../reports/errors.html">
<i class="icon-list-alt"></i> Errors <span class="label label-info pull-right">5</span>
</a>
</li>
<li>
<a href="../reports/markers.html">
<i class="icon-list-alt"></i> Markers <span class="label label-info pull-right">0</span>
</a>
</li>
<li>
<a href="../reports/deprecated.html">
<i class="icon-list-alt"></i> Deprecated <span class="label label-info pull-right">0</span>
</a>
</li>
</ul>
</li>
</ul>
</div>
</div>
</div>
<!--<div class="go_to_top">-->
<!--<a href="#___" style="color: inherit">Back to top  <i class="icon-upload icon-white"></i></a>-->
<!--</div>-->
</div>
<div id="___" class="container-fluid">
<section class="row-fluid">
<div class="span2 sidebar">
<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-734108015"></a>
<a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a>
</div>
<div id="namespace-734108015" class="accordion-body collapse in">
<div class="accordion-inner">
<ul>
<li class="class"><a href="../classes/Test.html">Test</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
</section>
<section class="row-fluid">
<div class="span10 offset2">
<div class="row-fluid">
<div class="span8 content class">
<nav>
<a href="../namespaces/default.html">\</a> <i class="icon-level-up"></i>
</nav>
<a href="#source-view" role="button" class="pull-right btn" data-toggle="modal"><i class="icon-code"></i></a>
<h1><small>\</small>Test</h1>
<p><em>Created by PhpStorm.</em></p>
Notice: Array to string conversion in C:\xampp\php\pear\phpDocumentor-2.8.5\phpDocumentor-2.8.5\vendor\erusev\parsedown\Parsedown.php on line 1405
Notice: Undefined property: Parsedown::$Array in C:\xampp\php\pear\phpDocumentor-2.8.5\phpDocumentor-2.8.5\vendor\erusev\parsedown\Parsedown.php on line 1405
Fatal error: Uncaught TypeError: Argument 1 passed to Monolog\ErrorHandler::handleException() must be an instance of Exception, instance of Error given in C:\xampp\php\pear\phpDocumentor-2.8.5\phpDocumentor-2.8.5\vendor\monolog\monolog\src\Monolog\ErrorHandler.php:122
Stack trace:
#0 [internal function]: Monolog\ErrorHandler->handleException(Object(Error))
#1 {main}
thrown in C:\xampp\php\pear\phpDocumentor-2.8.5\phpDocumentor-2.8.5\vendor\monolog\monolog\src\Monolog\ErrorHandler.php on line 122
PHP Notice: Array to string conversion in C:\xampp\php\pear\phpDocumentor-2.8.5\phpDocumentor-2.8.5\vendor\erusev\parsedown\Parsedown.php on line 1405
PHP Notice: Undefined property: Parsedown::$Array in C:\xampp\php\pear\phpDocumentor-2.8.5\phpDocumentor-2.8.5\vendor\erusev\parsedown\Parsedown.php on line 1405
PHP Fatal error: Uncaught TypeError: Argument 1 passed to Monolog\ErrorHandler::handleException() must be an instance of Exception, instance of Error given in C:\xampp\php\pear\phpDocumentor-2.8.5\phpDocumentor-2.8.5\vendor\monolog\monolog\src\Monolog\ErrorHandler.php:122
Stack trace:
#0 [internal function]: Monolog\ErrorHandler->handleException(Object(Error))
#1 {main}
thrown in C:\xampp\php\pear\phpDocumentor-2.8.5\phpDocumentor-2.8.5\vendor\monolog\monolog\src\Monolog\ErrorHandler.php on line 122
Process finished with exit code 255
不幸的是,我不知道我做错了什么。有没有人有类似的问题?
答案 0 :(得分:6)
马尔钦, 首先,将PHP版本更改为PHP5。 PHPDocumentator尚不支持PHP7。
其次,最好在参数字段中使用它:
phpDocumentor.phar -d $ProjectFileDir$ -t $ProjectFileDir$\Docs
$ ProjectFileDir $ - 是项目根目录的绝对路径,由PHPStrom宏自动生成。
此致 彼得