|
@@ 396-401 (lines=6) @@
|
| 393 |
|
) { |
| 394 |
|
$error = 'Single-quoted strings should be used unless it contains variables, special chars like \n or single quotes.'; |
| 395 |
|
$phpcsFile->addError($error, $stackPtr); |
| 396 |
|
} else if (false !== $smpl_qt_at && false !== $dbl_qt_at |
| 397 |
|
&& false === $has_variable && false === $has_specific_sequence |
| 398 |
|
) { |
| 399 |
|
$warning = 'It is encouraged to use a single-quoted string, since it doesn\'t contain any variable nor special char though it mixes single and double quotes.'; |
| 400 |
|
$phpcsFile->addWarning($warning, $stackPtr); |
| 401 |
|
} |
| 402 |
|
}//end processDoubleQuotedString() |
| 403 |
|
|
| 404 |
|
|
|
@@ 426-429 (lines=4) @@
|
| 423 |
|
$has_variable = parent::processSingleQuotedString($phpcsFile, $stackPtr, "'".$qtString."'"); |
| 424 |
|
$dbl_qt_at = strpos($qtString, '"'); |
| 425 |
|
$smpl_qt_at = strpos($qtString, "'"); |
| 426 |
|
if (false === $has_variable && false !== $smpl_qt_at && false === $dbl_qt_at) { |
| 427 |
|
$warning = 'You may also use double-quoted strings if the string contains single quotes, so you do not have to use escape characters.'; |
| 428 |
|
$phpcsFile->addWarning($warning, $stackPtr); |
| 429 |
|
} |
| 430 |
|
}//end processSingleQuotedString() |
| 431 |
|
|
| 432 |
|
/** |