1 | <?php |
||
16 | trait SuppressingTrait |
||
17 | { |
||
18 | /** |
||
19 | * The used suppresshelper. |
||
20 | * |
||
21 | * @var SuppressHelper |
||
22 | */ |
||
23 | private $suppressHelper = null; |
||
24 | |||
25 | /** |
||
26 | * Type-safe getter for the file. |
||
27 | * |
||
28 | * @return File |
||
29 | */ |
||
30 | abstract protected function getFile(): File; |
||
31 | |||
32 | /** |
||
33 | * Get the sniff name. |
||
34 | * |
||
35 | * @param string|null $sniffName If there is an optional sniff name. |
||
36 | * |
||
37 | * @return string Returns the special sniff name in the code sniffer context. |
||
38 | */ |
||
39 | private function getSniffName(?string $sniffName = null): string |
||
53 | |||
54 | /** |
||
55 | * Type-safe getter for the stack position. |
||
56 | * |
||
57 | * @return int |
||
58 | */ |
||
59 | abstract protected function getStackPos(): int; |
||
60 | |||
61 | /** |
||
62 | * Returns the used suppress helper. |
||
63 | * |
||
64 | * @return SuppressHelper The suppress helper. |
||
65 | */ |
||
66 | private function getSuppressHelper(): SuppressHelper |
||
74 | |||
75 | /** |
||
76 | * Returns true if this sniff or a rule of this sniff is suppressed with the slevomat suppress annotation. |
||
77 | * |
||
78 | * @param null|string $rule The optional rule. |
||
79 | * |
||
80 | * @return bool Returns true if the sniff is suppressed. |
||
81 | */ |
||
82 | protected function isSniffSuppressed(?string $rule = null): bool |
||
90 | } |
||
91 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
string
values, the empty string''
is a special case, in particular the following results might be unexpected: