PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.
You can fix this by adding a namespace to your class:
namespaceYourVendor;classYourClass{}
When choosing a vendor namespace, try to pick something that is not too generic
to avoid conflicts with other libraries.
Loading history...
21
{
22
/**
23
* Keep track of whether the warning has been thrown yet.
24
*
25
* This warning should only be thrown once per run.
26
*
27
* @var bool
28
*/
29
protected $thrown = false;
30
31
/**
32
* Returns an array of tokens this test wants to listen for.
33
*
34
* @return array
35
*/
36
public function register()
37
{
38
return array(
39
T_OPEN_TAG,
40
);
41
}
42
43
/**
44
* Processes this test, when one of its tokens is encountered.
45
*
46
* @param PHP_CodeSniffer_File $phpcsFile The file being scanned.
47
* @param int $stackPtr The position of the current token in the
48
* stack passed in $tokens.
49
*
50
* @return void
51
*/
52
public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
53
{
54
// Don't do anything if the warning has already been thrown once.
55
if ($this->thrown === true) {
56
return ($phpcsFile->numTokens + 1);
57
}
58
59
$phpcsFile->addWarning(
60
"IMPORTANT NOTICE:\nPlease be advised that the upcoming 7.1.6 version of the PHPCompatibility standard will contain a breaking change.\n\nPlease read the changelog carefully when you upgrade and follow the instructions contained therein to retain uninterupted service.\n\nThank you for using PHPCompatibility!",
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.