1 | <?php |
||
35 | class AbstractClosingCommentSniff implements Sniff |
||
36 | { |
||
37 | /** |
||
38 | * As an abstract class, this sniff is not associated to any token. |
||
39 | */ |
||
40 | public function register() |
||
44 | |||
45 | /** |
||
46 | * As an abstract class, this sniff is not dedicated to process a token. |
||
47 | */ |
||
48 | public function process(File $phpcsFile, $stackPtr) |
||
53 | |||
54 | /** |
||
55 | * Returns the comment without its delimiter(s) as well as leading |
||
56 | * and traling whitespaces. |
||
57 | * |
||
58 | * It removes the first #, the two first / (i.e. //) or the first /* |
||
59 | * and last \*\/. If a comment starts with /**, then the last * will remain |
||
60 | * as well as whitespaces between this star and the comment content. |
||
61 | * |
||
62 | * @param string $comment Comment containing either comment delimiter(s) and |
||
63 | * trailing or leading whitspaces to clean. |
||
64 | * |
||
65 | * @return string Comment without comment delimiter(s) and whitespaces. |
||
66 | */ |
||
67 | protected static function _getCommentContent ($comment) |
||
79 | |||
80 | |||
81 | /** |
||
82 | * Binary safe string comparison between $needle and |
||
83 | * the beginning of $haystack. Returns true if $haystack starts with |
||
84 | * $needle, false otherwise. |
||
85 | * |
||
86 | * @param string $haystack The string to search in. |
||
87 | * @param string $needle The string to search for. |
||
88 | * |
||
89 | * @return bool true if $haystack starts with $needle, false otherwise. |
||
90 | */ |
||
91 | protected static function _stringStartsWith ($haystack, $needle) |
||
102 | }//end class |
||
103 | |||
105 |
Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.
A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.