/application/docs/__discovery/docblock-templates.md

https://gitlab.com/digitalpoetry/exceptionally-timed · Markdown · 424 lines · 373 code · 51 blank · 0 comment · 0 complexity · 9180e0b2b8f368103499cc634a40a448 MD5 · raw file

  1. DocBlock Templates
  2. ====================
  3. TODO:
  4. - [ ] Review @version tags
  5. - [ ] Add annotations to DocBlock Templates
  6. ****************************************
  7. #### Markers
  8. Mark code for improvements:
  9. ```php
  10. // TODO: [description]
  11. ```
  12. Mark code for bugs:
  13. ```php
  14. // FIXME: [description]
  15. ```
  16. ****************************************
  17. #### Single Line Comments
  18. Not a DocBlock:
  19. ```php
  20. // Allow plugins to filter an array.
  21. ```
  22. DocBlock:
  23. ```php
  24. /** Allow plugins to filter an array. */
  25. ```
  26. ****************************************
  27. #### Multi-line Comments
  28. Not a DocBlock:
  29. ```php
  30. /*
  31. * This is a comment that is long enough to warrant being stretched over
  32. * the span of multiple lines. You'll notice this follows basically
  33. * the same format as the PHPDoc wrapping and comment block style.
  34. */
  35. ```
  36. DocBlock:
  37. ```php
  38. /**
  39. * This is a comment that is long enough to warrant being stretched over
  40. * the span of multiple lines. You'll notice this follows basically
  41. * the same format as the PHPDoc wrapping and comment block style.
  42. */
  43. ```
  44. ****************************************
  45. #### File
  46. Standard Usage:
  47. ```php
  48. /**
  49. * Code All The Things!
  50. *
  51. * Project jumpstarter based on the Sprint & CodeIgniter frameworks.
  52. *
  53. * @package CATT
  54. * @author Jesse LaReaux <jlareaux@gmail.com>
  55. * @copyright Copyright (c) 2016, DigitalPoetry (http://digitalpoetry.studio/).
  56. * @license http://opensource.org/licenses/MIT MIT License
  57. * @link http://codeallthethings.xyz Code All The Things!
  58. * @version 0.1.0 Shiny Things
  59. * @filesource
  60. */
  61. ```
  62. Complete Usage:
  63. ```php
  64. /**
  65. * Summary (no period for file headers)
  66. *
  67. * Description.
  68. *
  69. * @package CATT
  70. * @author Jesse LaReaux <jlareaux@gmail.com>
  71. * @copyright Copyright (c) 2016, DigitalPoetry (http://digitalpoetry.studio/).
  72. * @license http://opensource.org/licenses/MIT MIT License
  73. * @version 0.1.0 Shiny Things
  74. * @since 0.0.0 Basic Things.
  75. * @link http://codeallthethings.xyz Code-All-The-Things
  76. * @filesource
  77. *
  78. * @todo Description.
  79. */
  80. ```
  81. ****************************************
  82. #### Require(_once), Include(_once)
  83. Standard Usage:
  84. ```php
  85. /**
  86. * Summary.
  87. *
  88. * @since 0.0.0 Shiny Things
  89. * @see [URI | FQSEN] [<description>]
  90. * @link http://codeallthethings.xyz Code All The Things.
  91. */
  92. ```
  93. Complete Usage:
  94. ```php
  95. /**
  96. * Summary.
  97. *
  98. * @since 0.0.0 Shiny Things
  99. * @see [URI | FQSEN] [<description>]
  100. * @link http://codeallthethings.xyz Code All The Things.
  101. * @todo Description.
  102. */
  103. ```
  104. ****************************************
  105. #### Class
  106. Standard Usage:
  107. ```php
  108. /**
  109. * Summary.
  110. *
  111. * Description, {@inheritdoc}.
  112. *
  113. * @inheritdoc
  114. * @since 0.0.0 Basic Things.
  115. */
  116. ```
  117. Complete Usage:
  118. ```php
  119. /**
  120. * Summary.
  121. *
  122. * Description, {@inheritdoc}.
  123. *
  124. * @inheritdoc
  125. * @author Jesse LaReaux <jlareaux@gmail.com>
  126. * @copyright Copyright (c) 2016, DigitalPoetry (http://digitalpoetry.studio/).
  127. * @license http://opensource.org/licenses/MIT MIT License
  128. *
  129. * @package CATT
  130. * @version 0.1.0 Shiny Things
  131. * @since 0.0.0 Basic Things
  132. * @deprecated x.x.x Use new_function_name().
  133. * @see new_function_name().`
  134. *
  135. * @uses fqsen <description>
  136. * @see url|fqsen <description>
  137. * @example location <start> <length> <description>
  138. * @link http://codeallthethings.xyz Code All The Things.
  139. * @source <start> <length> <description>
  140. * @todo Description.
  141. */
  142. ```
  143. ****************************************
  144. #### Function
  145. Standard Usage:
  146. ```php
  147. /**
  148. * Summary.
  149. *
  150. * Description.
  151. *
  152. * @version 0.1.0 Shiny Things
  153. * @since 0.0.0 Basic Things
  154. *
  155. * @global type $var <description>
  156. * @uses fqsen <description>
  157. * @see url|fqsen <description>
  158. * @link http://codeallthethings.xyz Code All The Things.
  159. *
  160. * @param type $var Description.
  161. * @return type Description.
  162. * @throws type Description.
  163. */
  164. ```
  165. Complete Usage:
  166. ```php
  167. /**
  168. * Summary.
  169. *
  170. * Description.
  171. *
  172. * @version <vector> <description>
  173. * @since 0.0.0 Basic Things
  174. * @deprecated x.x.x Use new_function_name().
  175. * @see new_function_name().
  176. *
  177. * @global type $var <description>
  178. * @uses fqsen <description>
  179. * @see url|fqsen <description>
  180. * @example location <start> <length> <description>
  181. * @link http://codeallthethings.xyz Code All The Things.
  182. * @source <start> <length>
  183. * @todo Description.
  184. *
  185. * @param type $var Description.
  186. * @return type Description.
  187. * @throws type Description.
  188. */
  189. ```
  190. ****************************************
  191. #### Method
  192. Standard Usage:
  193. ```php
  194. /**
  195. * Summary.
  196. *
  197. * Description, {@inheritdoc}.
  198. *
  199. * @inheritdoc
  200. * @api
  201. * @since 0.0.0 Basic Things
  202. *
  203. * @global type $var <description>
  204. * @uses fqsen <description>
  205. * @see url|fqsen <description>
  206. * @link http://codeallthethings.xyz Code All The Things.
  207. *
  208. * @param type $var Description.
  209. * @return type Description.
  210. * @throws type Description.
  211. */
  212. ```
  213. Complete Usage:
  214. ```php
  215. /**
  216. * Summary.
  217. *
  218. * Description, {@inheritdoc}.
  219. *
  220. * @inheritdoc
  221. * @api
  222. * @since 0.0.0 Basic Things
  223. * @deprecated x.x.x Use new_method_name().
  224. * @see new_method_name().
  225. *
  226. * @global type $var <description>
  227. * @uses fqsen <description>
  228. * @see url|fqsen <description>
  229. * @example location <start> <length> <description>
  230. * @link http://codeallthethings.xyz Code All The Things.
  231. * @source <start> <length>
  232. * @todo Description.
  233. *
  234. * @param type $var Description.
  235. * @return type Description.
  236. * @throws type Description.
  237. */
  238. ```
  239. ****************************************
  240. #### Property
  241. Standard Usage:
  242. ```php
  243. /**
  244. * Summary, {@inheritdoc}.
  245. *
  246. * @inheritdoc
  247. * @version 0.1.0 Shiny Things
  248. * @since 0.0.0 Basic Things
  249. * @var type $var Description.
  250. */
  251. ```
  252. Complete Usage:
  253. ```php
  254. /**
  255. * Summary, {@inheritdoc}.
  256. *
  257. * @inheritdoc
  258. * @version 0.1.0 Shiny Things
  259. * @since 0.0.0 Basic Things
  260. * @deprecated x.x.x Use new_property_name().
  261. * @see new_property_name().
  262. *
  263. * @see url|fqsen <description>
  264. * @example location <start> <length> <description>
  265. * @link http://codeallthethings.xyz Code All The Things.
  266. * @source <start> <length> <description>
  267. * @todo Description.
  268. *
  269. * @var type $var Description.
  270. */
  271. ```
  272. ****************************************
  273. #### [class] Constant:
  274. Standard Usage:
  275. ```php
  276. /**
  277. * Summary.
  278. *
  279. * @version 0.1.0 Shiny Things
  280. * @since 0.0.0 Basic Things
  281. * @var type $var Description.
  282. */
  283. ```
  284. Complete Usage:
  285. ```php
  286. /**
  287. * Summary.
  288. *
  289. * @inheritdoc
  290. * @version 0.1.0 Shiny Things
  291. * @since 0.0.0 Basic Things
  292. * @deprecated x.x.x Use new_class_name().
  293. * @see new_property_name().
  294. *
  295. * @see url|fqsen <description>
  296. * @example location <start> <length> <description>
  297. * @link http://codeallthethings.xyz Code All The Things.
  298. * @source <start> <length> <description>
  299. * @todo Description.
  300. *
  301. * @var type $var Description.
  302. */
  303. ```
  304. ****************************************
  305. #### Global Variable
  306. Standard Usage:
  307. ```php
  308. /**
  309. * Summary.
  310. *
  311. * @version 0.1.0 Shiny Things
  312. * @since 0.0.0 Basic Things
  313. * @global type Description.
  314. */
  315. ```
  316. Complete Usage:
  317. ```php
  318. /**
  319. * Summary.
  320. *
  321. * @version 0.1.0 Shiny Things
  322. * @since 0.0.0 Basic Things
  323. * @deprecated x.x.x Use new_global_name().
  324. * @see new_property_name().
  325. *
  326. * @global type Description.
  327. * @see url|fqsen <description>
  328. * @example location <start> <length> <description>
  329. * @link http://codeallthethings.xyz Code All The Things.
  330. * @source <start> <length> <description>
  331. * @todo Description.
  332. */
  333. ```
  334. ****************************************
  335. #### Param, Type, Property, Etc
  336. ```php
  337. /**
  338. * @param string $var Optional. The _ string. Default is _.
  339. * @param integer $var Optional. The number of _. Default is _.
  340. * @param float $var Optional. The value of _. Default is _.
  341. * @param number $var Optional. The _ number. Default is _.
  342. * @param boolean $var Optional. _ if set to true, _ if false. Default is _.
  343. * @param array $var Optional. An array of _. Default is _.
  344. * @param object $var Optional. The _ object. Default is _.
  345. * @param static $var Optional. The _ instance. Default is _.
  346. * @param mixed $var Optional. The value of _. Default is _.
  347. * @param null $var Optional. An empty value. Default is _.
  348. * @param resource $var Optional. The _ file handler. Default is _.
  349. * @param callable $var Optional. The _ handler. Default is _.
  350. * @param (type|type) $var Optional. Description. Default is _.
  351. * @param string[] $var Optional. An array of _ strings. Default is _.
  352. * @param array[] $var Optional. An array of _ arrays. Default is _.
  353. * @param object[] $var Optional. An array of _ objects. Default is _.
  354. * @param mixed[] $var Optional. An array of _ values. Default is _.
  355. * @param array $args {
  356. * Optional. An array of _. Default is _
  357. *
  358. * @type type $key Optional. Accepts 'value', 'value'. (align with
  359. * description if wraps to a new line) Default is _.
  360. * @type string $key Optional. The _ string. Default is _.
  361. * @type integer $key Optional. he number of _. Default is _.
  362. * @type object $key Optional. The _ object. Default is _.
  363. * @type boolean $key Optional. _ if set to true, _ if false. Default is _.
  364. * }
  365. */
  366. ```
  367. ****************************************
  368. References:
  369. - [phpDoc Documentation](https://www.phpdoc.org/docs/latest/index.html)
  370. - [PSR-5: PHPDoc Standard](https://github.com/phpDocumentor/fig-standards/tree/master/proposed)
  371. - [PSR-?: PHPDoc Standard Revision](https://github.com/mvriel/phpDocumentor2/blob/b803b549189926ae6880cabd699675f22d8aade1/docs/PSR.md)
  372. - [PhpDoc2Cheatsheet](http://phpdoc2cheatsheet.com/)
  373. - [WordPress PHP Documentation Standards](https://make.wordpress.org/core/handbook/best-practices/inline-documentation-standards/php/#resources)