102 lines
1.6 KiB
Plaintext
102 lines
1.6 KiB
Plaintext
include::../description.adoc[]
|
|
|
|
== Noncompliant Code Example
|
|
|
|
[source,php]
|
|
----
|
|
<?php // Noncompliant; file comment missing
|
|
class MyClass // Noncompliant; undocumented
|
|
{
|
|
|
|
$prop; // Noncompliant
|
|
|
|
/**
|
|
* Variable comment.
|
|
*/
|
|
$prop2; // Noncompliant; variable comment present, but @var tag missing
|
|
|
|
protected $name, $description; // Noncompliant
|
|
|
|
function doSomething($param) // Noncompliant
|
|
{
|
|
// ...
|
|
if ($vogons) {
|
|
throw new Exception('Help!.');
|
|
}
|
|
|
|
return 42;
|
|
}
|
|
}
|
|
----
|
|
|
|
== Compliant Solution
|
|
|
|
[source,php]
|
|
----
|
|
<?php
|
|
/**
|
|
* This is a file comment. There is vertical whitespace
|
|
* between it and the next element.
|
|
*/
|
|
|
|
/**
|
|
* MyClass does something interesting...
|
|
*/
|
|
class MyClass
|
|
{
|
|
/**
|
|
* Holds the vault combination
|
|
* @var string
|
|
*/
|
|
$prop;
|
|
|
|
/**
|
|
* Variable comment.
|
|
* @var number
|
|
*/
|
|
$prop2;
|
|
|
|
/**
|
|
* @var string $name
|
|
* @var string $description
|
|
*/
|
|
protected $name, $description;
|
|
|
|
/**
|
|
* Calculates the answer to a question
|
|
*
|
|
* @param string The question
|
|
*
|
|
* @throws exception If Vogons encountered
|
|
*
|
|
* @return integer Returns the answer to life, the universe and everything
|
|
*/
|
|
function doSomething($param) // Noncompliant
|
|
{
|
|
// ...
|
|
if ($vogons) {
|
|
throw new Exception('Help!.');
|
|
}
|
|
|
|
return 42;
|
|
}
|
|
}
|
|
----
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
include::message.adoc[]
|
|
|
|
include::parameters.adoc[]
|
|
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
include::../comments-and-links.adoc[]
|
|
endif::env-github,rspecator-view[]
|