| 1 | <?php |
||
| 5 | class DocstringRepresentation extends Representation |
||
| 6 | { |
||
| 7 | public $file = null; |
||
| 8 | public $line = null; |
||
| 9 | public $class = null; |
||
| 10 | public $hints = array('docstring'); |
||
| 11 | |||
| 12 | public function __construct($docstring, $file, $line, $class = null) |
||
| 21 | |||
| 22 | /** |
||
| 23 | * Returns the representation's docstring without surrounding comments. |
||
| 24 | * |
||
| 25 | * Note that this will not work flawlessly. |
||
| 26 | * |
||
| 27 | * On comments with whitespace after the stars the lines will begin with |
||
| 28 | * whitespace, since we can't accurately guess how much of an indentation |
||
| 29 | * is required. |
||
| 30 | * |
||
| 31 | * And on lines without stars on the left this may eat bullet points. |
||
| 32 | * |
||
| 33 | * Long story short: If you want the docstring read the contents. If you |
||
| 34 | * absolutely must have it without comments (ie renderValueShort) this will |
||
| 35 | * probably do. |
||
| 36 | * |
||
| 37 | * @return string|null Docstring with comments stripped |
||
| 38 | */ |
||
| 39 | public function getDocstringWithoutComments() |
||
| 50 | } |
||
| 51 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)or! empty(...)instead.