| 1 | <?php |
||
| 10 | class CheckLNumberKind implements AnalyzerPassInterface |
||
| 11 | { |
||
| 12 | use DefaultMetadataPassTrait; |
||
| 13 | |||
| 14 | const DESCRIPTION = 'Using octal, hexadecimal or binary integers are discouraged.'; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * @param Scalar\LNumber $lNum |
||
| 18 | * @param Context $context |
||
| 19 | * @return bool |
||
| 20 | */ |
||
| 21 | 491 | public function pass(Scalar\LNumber $lNum, Context $context) |
|
| 22 | { |
||
| 23 | 491 | if ($lNum->getAttribute('kind') != Scalar\LNumber::KIND_DEC) { |
|
| 24 | 487 | $context->notice( |
|
| 25 | 487 | 'l_number_kind', |
|
| 26 | 487 | 'Avoid using octal, hexadecimal or binary', |
|
| 27 | $lNum |
||
| 28 | 487 | ); |
|
| 29 | 487 | return true; |
|
| 30 | } |
||
| 31 | |||
| 32 | 5 | return false; |
|
| 33 | } |
||
| 34 | |||
| 35 | /** |
||
| 36 | * @return array |
||
| 37 | */ |
||
| 38 | 1 | public function getRegister() |
|
| 44 | } |
||
| 45 |