1 | <?php |
||
33 | class NewHeredocInitializeSniff extends NewConstantScalarExpressionsSniff |
||
34 | { |
||
35 | |||
36 | /** |
||
37 | * Error message. |
||
38 | * |
||
39 | * @var string |
||
40 | */ |
||
41 | const ERROR_PHRASE = 'Initializing %s using the Heredoc syntax was not supported in PHP 5.2 or earlier'; |
||
42 | |||
43 | /** |
||
44 | * Partial error phrases to be used in combination with the error message constant. |
||
45 | * |
||
46 | * @var array |
||
47 | */ |
||
48 | protected $errorPhrases = array( |
||
49 | 'const' => 'constants', |
||
50 | 'property' => 'class properties', |
||
51 | 'staticvar' => 'static variables', |
||
52 | 'default' => 'default parameter values', |
||
53 | ); |
||
54 | |||
55 | |||
56 | /** |
||
57 | * Do a version check to determine if this sniff needs to run at all. |
||
58 | * |
||
59 | * @return bool |
||
60 | */ |
||
61 | protected function bowOutEarly() |
||
65 | |||
66 | |||
67 | /** |
||
68 | * Is a value declared and does the declared value not contain an heredoc ? |
||
69 | * |
||
70 | * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. |
||
71 | * @param int $stackPtr The position of the current token in the |
||
72 | * stack passed in $tokens. |
||
73 | * @param int $end The end of the value definition. |
||
74 | * |
||
75 | * @return bool True if no heredoc (or assignment) is found, false otherwise. |
||
76 | */ |
||
77 | protected function isValidAssignment(\PHP_CodeSniffer_File $phpcsFile, $stackPtr, $end) |
||
88 | } |
||
89 |