1 | <?php |
||
4 | trait WhiteSpaceTrait |
||
5 | { |
||
6 | /** |
||
7 | * @Exclude |
||
8 | * @var string specifies how whitespace (line feeds, tabs, spaces, and carriage returns) is handled |
||
9 | */ |
||
10 | private $whiteSpace = 'preserve'; |
||
11 | |||
12 | /** |
||
13 | * Changes the input value in accordance with the defined white space handler. |
||
14 | * @param string $val |
||
15 | * @return string |
||
|
|||
16 | */ |
||
17 | protected function fixWhitespace($val) |
||
18 | { |
||
19 | switch ($this->whiteSpace) { |
||
20 | case 'preserve': |
||
21 | return $val; |
||
22 | case 'replace': |
||
23 | $val = str_replace("\r\n", "\n", $val); |
||
24 | return preg_replace('/\s/', ' ', $val); |
||
25 | case 'collapse': |
||
26 | return trim(preg_replace('/\s+/', ' ', $val)); |
||
27 | } |
||
28 | } |
||
29 | |||
30 | /** |
||
31 | * @param string $value |
||
32 | */ |
||
33 | protected function setWhiteSpaceFacet($value) |
||
40 | } |
||
41 |
This check compares the return type specified in the
@return
annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.