• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

PHPCSStandards / PHP_CodeSniffer / 17483947696

05 Sep 2025 04:45AM UTC coverage: 78.507% (-0.7%) from 79.184%
17483947696

push

github

web-flow
Merge pull request #1213 from PHPCSStandards/feature/remove-filelist-tests

:fire: Hot Fix: remove FileList tests

25309 of 32238 relevant lines covered (78.51%)

73.81 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

66.67
/src/Standards/MySource/Sniffs/Debug/DebugCodeSniff.php
1
<?php
2
/**
3
 * Warns about the use of debug code.
4
 *
5
 * @author    Greg Sherwood <gsherwood@squiz.net>
6
 * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
7
 * @license   https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
8
 *
9
 * @deprecated 3.9.0
10
 */
11

12
namespace PHP_CodeSniffer\Standards\MySource\Sniffs\Debug;
13

14
use PHP_CodeSniffer\Sniffs\DeprecatedSniff;
15
use PHP_CodeSniffer\Sniffs\Sniff;
16
use PHP_CodeSniffer\Files\File;
17

18
class DebugCodeSniff implements Sniff, DeprecatedSniff
19
{
20

21

22
    /**
23
     * Returns an array of tokens this test wants to listen for.
24
     *
25
     * @return array<int|string>
26
     */
27
    public function register()
3✔
28
    {
29
        return [T_DOUBLE_COLON];
3✔
30

31
    }//end register()
32

33

34
    /**
35
     * Processes this sniff, when one of its tokens is encountered.
36
     *
37
     * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
38
     * @param int                         $stackPtr  The position of the current token in
39
     *                                               the stack passed in $tokens.
40
     *
41
     * @return void
42
     */
43
    public function process(File $phpcsFile, $stackPtr)
3✔
44
    {
45
        $tokens = $phpcsFile->getTokens();
3✔
46

47
        $className = $phpcsFile->findPrevious(T_WHITESPACE, ($stackPtr - 1), null, true);
3✔
48
        if (strtolower($tokens[$className]['content']) === 'debug') {
3✔
49
            $method = $phpcsFile->findNext(T_WHITESPACE, ($stackPtr + 1), null, true);
3✔
50
            $error  = 'Call to debug function Debug::%s() must be removed';
3✔
51
            $data   = [$tokens[$method]['content']];
3✔
52
            $phpcsFile->addError($error, $stackPtr, 'Found', $data);
3✔
53
        }
1✔
54

55
    }//end process()
2✔
56

57

58
    /**
59
     * Provide the version number in which the sniff was deprecated.
60
     *
61
     * @return string
62
     */
63
    public function getDeprecationVersion()
×
64
    {
65
        return 'v3.9.0';
×
66

67
    }//end getDeprecationVersion()
68

69

70
    /**
71
     * Provide the version number in which the sniff will be removed.
72
     *
73
     * @return string
74
     */
75
    public function getRemovalVersion()
×
76
    {
77
        return 'v4.0.0';
×
78

79
    }//end getRemovalVersion()
80

81

82
    /**
83
     * Provide a custom message to display with the deprecation.
84
     *
85
     * @return string
86
     */
87
    public function getDeprecationMessage()
×
88
    {
89
        return 'The MySource standard will be removed completely in v4.0.0.';
×
90

91
    }//end getDeprecationMessage()
92

93

94
}//end class
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc