一般来说,PHPDOC属性是不言自明的,但我很难理解这些:
@category - 这究竟是什么?
@package - 有人可以提供一些关于这个属性用法的例子吗?
我们目前正处于一个新项目的开始阶段,并且希望(从一开始)尽可能多地评论从一开始就帮助未来的发展.
我试图找出在Eclipse中使用phpDoc的最佳实践,但结果非常简洁.
您能否分享使用phpDoc在Eclipse中评论内容的最佳实践和技巧?
我使用NetBeans作为我的php ide,我在docblock中看到了@version标签,如下所示:
@version $Id someinfo and timestamp
Run Code Online (Sandbox Code Playgroud)
NetBeans是否有办法在每次提交时自动更新?或者我完全忽略了这个标签的观点?
我认为这个问题的标题很清楚.我需要解释@property-read和@property-write.这是关于phpDoc http://manual.phpdoc.org/HTMLframesConverter/default/的链接,但在那里我找不到关于它的解释.只有解释@property
有什么理由让我的 IDE(实际上是 PHPStorm)理解:
$student->setName('Marco');
Run Code Online (Sandbox Code Playgroud)
是否会返回 , 的实例Student而不setName()在子类中重新定义(仅用于添加 PHPDoc 注释)?
class Person
{
private $name;
/**
* @param string $name
* @return Person
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
}
class Student extends Person { }
Run Code Online (Sandbox Code Playgroud) 在http://www.phpdoc.org/的主页上,在http://manual.phpdoc.org/HTMLSmartyConverter/HandS/phpDocumentor/tutorial_phpDocumentor.quickstart.pkg.html和https://github.com上/ phpDocumentor/phpDocumentor2,安装phpDocumentor的说明是:
pear channel-discover pear.phpdoc.org
pear install phpdoc/phpDocumentor
Run Code Online (Sandbox Code Playgroud)
当我这样做时,我发现它已被弃用:
[root@desktop ~]# pear channel-discover pear.phpdoc.org
Adding Channel "pear.phpdoc.org" succeeded
Discovery of channel "pear.phpdoc.org" succeeded
[root@desktop ~]# pear install PhpDocumentor
WARNING: "pear/PhpDocumentor" is deprecated in favor of "phpdoc/phpdocumentor"
Did not download optional dependencies: pear/XML_Beautifier, use --alldeps to download automatically
pear/PhpDocumentor can optionally use package "pear/XML_Beautifier" (version >= 1.1)
downloading PhpDocumentor-1.4.4.tgz ...
Starting to download PhpDocumentor-1.4.4.tgz (1,534,088 bytes)
..............................................................................................................................................................................................................................................................................................................done: 1,534,088 bytes
install ok: channel://pear.php.net/PhpDocumentor-1.4.4
[root@desktop ~]# pear …Run Code Online (Sandbox Code Playgroud) 最近,我在使用 PhpStorm 实现 PHP 应用程序时遇到了一个有趣的情况。下面的代码片段说明了这个问题。
interface I{
function foo();
}
trait T{
/**
* @return string
*/
public function getTraitMsg()
{
return "I am a trait";
}
}
class A implements I{
use T;
function foo(){}
}
class C implements I{
use T;
function foo(){}
}
class B {
/**
* @param I $input <===Is there anyway to specify that $input use T?
*/
public function doSomethingCool($input){ //An instance of "A" or "C"
$msg = $input -> getTraitMsg(); //Phpstorm freaks …Run Code Online (Sandbox Code Playgroud) 我想用 phpdoc 解析两个或多个文件夹。解析一个文件夹效果很好。
\n在文档中,我可以看到:
\n\n\n-d|\xe2\x80\x93目录[=\xe2\x80\x9d...\xe2\x80\x9d]
\n提供要解析的以逗号分隔的源文件夹列表。
\n
但我无法使用这些变体让它工作:
\n\n\nphpdoc.bat -d[应用程序\\控制器\\mnm,应用程序\\库] -t phpdoc
\nphpdoc.bat -d [应用程序\\控制器\\mnm,应用程序\\库] -t phpdoc
\nphpdoc.bat -目录[应用程序\\控制器\\mnm,应用程序\\库] -t phpdoc
\nphpdoc.bat -directory["application\\controllers\\mnm","application\\libraries"] -t phpdoc
\nphpdoc.bat -directory[="application\\controllers\\mnm","application\\libraries"] -t phpdoc
\nphpdoc.bat -directory [="application\\controllers\\mnm","application\\libraries"] -t phpdoc
\nphpdoc.bat -d [="application\\controllers\\mnm","application\\libraries"] -t phpdoc
\n
我收到的错误消息是
\n\n\n[异常] \n未找到可解析文件,您是否使用 -f 或 -d 参数指定了任何文件?
\n
正确的语法是什么?
\n如何一步步设置和使用phpDocumentor?
我正在尝试使用 composer 有很多安装请求。任何人都可以给我关于 phpDocumentor 设置和在 php.ini 中使用的想法。
试过 $ composer require "phpdocumentor/phpdocumentor:2.*"
低于错误
Your requirements could not be resolved to an installable set of packages.
Problem 1
- phpdocumentor/phpdocumentor v2.8.0 requires herrera-io/phar-update 1.0.3 -> satisfiable by herrera-io/phar-update[1.0.3].
- phpdocumentor/phpdocumentor v2.8.1 requires herrera-io/phar-update 1.0.3 -> satisfiable by herrera-io/phar-update[1.0.3].
- phpdocumentor/phpdocumentor v2.8.2 requires herrera-io/phar-update 1.0.3 -> satisfiable by herrera-io/phar-update[1.0.3].
- phpdocumentor/phpdocumentor v2.8.3 requires herrera-io/phar-update 1.0.3 -> satisfiable by herrera-io/phar-update[1.0.3].
- phpdocumentor/phpdocumentor v2.8.4 requires herrera-io/phar-update 1.0.3 -> satisfiable by herrera-io/phar-update[1.0.3].
- phpdocumentor/phpdocumentor …Run Code Online (Sandbox Code Playgroud) 我使用几个辅助函数来停止程序流并返回数据。例如,虽然大多数页面都是 HTML,但我偶尔会返回 JSON 并调用
/**
* @param array|bool $response
*
* @die
*/
function jsonResponseDie($response)
{
header('Content-Type: application/json');
echo json_encode($response);
die();
}
Run Code Online (Sandbox Code Playgroud)
但是,调用函数不会检测到是否存在 die 语句,并允许在其后出现代码而不发出警告。
function recievePush()
{
// Process a push request and respond with a json array.
jsonResponseDie(array('status' => TRUE));
echo 'This will never execute but PhpStorm doesn\'t know that';
}
Run Code Online (Sandbox Code Playgroud)
我怎样才能让 PhpStorm 检测到这个函数会死掉?
我确实尝试了一些项目“@return die”或“@die”,但这些似乎没有被识别。我还在这里查看了一些文档,但没有发现任何有用的内容。