PHP autodoc(继承)自动文档标签

发布于 2024-10-07 18:47:45 字数 151 浏览 0 评论 0原文

我正在使用 phpautodocumentor,我正在编写一个类,它扩展了一个位于完全不同的文件夹中的类,我如何在注释中写下我正在扩展该特定类。因为Visual Studio或Aptana中的intellisense无法识别。代码工作正常。问题在于文档。它并没有说我正在扩展文档中的某某类

I am using phpautodocumentor, I am writing a class which extends a class which is in completely different folder, How can I write in comments that I am extending that particular class. Because intellisense in visual studio or Aptana doesn't recognize. The code works fine.The problem is documenting. It doesn't say I am extending so and so class in documentation

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

旧话新听 2024-10-14 18:47:45

没有用于扩展的标签,您的 IDE 应该从代码中实现它,好的 IDE(例如 PDT、Zend Studio 或 PhpStorm)可以做到。但是,有一个 @see 标签可以引用文档中的其他内容。

 /** 
  * this class extends main_class.
  * @see main_class, TEST_CONST
  */
  subclass extends main_class {
  }

There's no tag for extending, your IDE should realize it from the code, good ones - like PDT, Zend Studio or PhpStorm - do. However, there's a @see tag to refer to other content in the docs.

 /** 
  * this class extends main_class.
  * @see main_class, TEST_CONST
  */
  subclass extends main_class {
  }
染火枫林 2024-10-14 18:47:45

(从 phpDocumentor、一般文档块和 IDE 弹出帮助的角度来看...)

理想情况下,IDE 应该从代码中识别出当前类是另一个类的子类,并向您显示来自子类的父文档块的信息类的弹出帮助。但是,如果您在子类本身上放置一个文档块并在那里写入与父文档块中的部分重复的信息(简短描述、长描述、@param、@return),则子文档块信息有时会“覆盖”父信息,有效地防止弹出窗口显示任何家长信息。

如果我在子类或继承的项目上创建文档块,我将坚持只在其中使用除 @param 和 @return 之外的标签,以便子文档块信息增强父信息而不是替换它。不过,一般来说,我不会在继承的方法上放置文档块,因为我不需要它来显示父级文档块中已给出的内容之外的任何内容。


(从我不知道的“phpautodocumentor”和Aptana的角度来看,我不使用它,但据推测它是Eclipse的衍生品......)

我假设您主要指的是IDE的弹出窗口当您突出显示子班级时,帮助您显示父班级信息。

相反,如果您指的是与 IDE 文件编辑分开生成实际类文档的东西,那么除了代码本身之外,通常不需要任何东西。 phpDocumentor 当然可以仅从代码中识别类继承,并且会在大多数输出​​转换器中的自己的部分中显示继承的内容。如果“phpautodocumentor”是其他东西,那么我无法说出它的功能是什么。

(from the perspective of phpDocumentor, docblocks in general, and IDE popup help...)

Ideally, the IDE should recognize from the code that the current class is a child of another class, and show you info from the parent docblock on the child class's popup help. However, if you put a docblock on the child class itself and write info there that duplicates sections from the parent docblock (short description, long description, @param, @return), then the child docblock info will sometimes "override" the parent info, effectively preventing the popup from showing any parent info at all.

If I make a docblock on a child class or inherited items, I'll stick with only using tags in them other than @param and @return, so that the child docblock info augments the parent info rather than replace it. Generally, though, I won't put a docblock on inherited methods since I don't need it to show anything beyond what's already given in the parent's docblock.


(from the perspective of "phpautodocumentor", which I don't know of, and Aptana, which I don't use but is presumed to be an Eclipse derivative...)

I have assumed that you are mainly referring to the IDE's popup help showing you parent class info when you highlight the child class.

Instead, if you are referring to something that is generating actual class documentation separately from IDE file editing, then nothing should generally be required other than the code itself. phpDocumentor certainly recognizes class inheritance from the code alone, and will show inherited things in their own section in most of the output converters. If "phpautodocumentor" is something else, then I can't speak to what its capabilities are.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文