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

PHPCSStandards / PHP_CodeSniffer / 18114150721

30 Sep 2025 12:00AM UTC coverage: 78.601% (-0.6%) from 79.178%
18114150721

push

github

web-flow
Merge pull request #1284 from PHPCSStandards/dependabot/github_actions/3.x/action-runners-f175f89d6c

GH Actions: Bump actions/cache from 4.2.4 to 4.3.0 in the action-runners group

25341 of 32240 relevant lines covered (78.6%)

74.7 hits per line

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

62.5
/src/Standards/Squiz/Sniffs/CSS/EmptyClassDefinitionSniff.php
1
<?php
2
/**
3
 * Ensure that class definitions are not empty.
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/HEAD/licence.txt BSD Licence
8
 *
9
 * @deprecated 3.9.0
10
 */
11

12
namespace PHP_CodeSniffer\Standards\Squiz\Sniffs\CSS;
13

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

19
class EmptyClassDefinitionSniff implements Sniff, DeprecatedSniff
20
{
21

22
    /**
23
     * A list of tokenizers this sniff supports.
24
     *
25
     * @var array
26
     */
27
    public $supportedTokenizers = ['CSS'];
28

29

30
    /**
31
     * Returns the token types that this sniff is interested in.
32
     *
33
     * @return array<int|string>
34
     */
35
    public function register()
3✔
36
    {
37
        return [T_OPEN_CURLY_BRACKET];
3✔
38

39
    }//end register()
40

41

42
    /**
43
     * Processes the tokens that this sniff is interested in.
44
     *
45
     * @param \PHP_CodeSniffer\Files\File $phpcsFile The file where the token was found.
46
     * @param int                         $stackPtr  The position in the stack where
47
     *                                               the token was found.
48
     *
49
     * @return void
50
     */
51
    public function process(File $phpcsFile, $stackPtr)
3✔
52
    {
53
        $tokens = $phpcsFile->getTokens();
3✔
54
        $next   = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true);
3✔
55

56
        if ($next === false || $tokens[$next]['code'] === T_CLOSE_CURLY_BRACKET) {
3✔
57
            $error = 'Class definition is empty';
3✔
58
            $phpcsFile->addError($error, $stackPtr, 'Found');
3✔
59
        }
1✔
60

61
    }//end process()
2✔
62

63

64
    /**
65
     * Provide the version number in which the sniff was deprecated.
66
     *
67
     * @return string
68
     */
69
    public function getDeprecationVersion()
×
70
    {
71
        return 'v3.9.0';
×
72

73
    }//end getDeprecationVersion()
74

75

76
    /**
77
     * Provide the version number in which the sniff will be removed.
78
     *
79
     * @return string
80
     */
81
    public function getRemovalVersion()
×
82
    {
83
        return 'v4.0.0';
×
84

85
    }//end getRemovalVersion()
86

87

88
    /**
89
     * Provide a custom message to display with the deprecation.
90
     *
91
     * @return string
92
     */
93
    public function getDeprecationMessage()
×
94
    {
95
        return 'Support for scanning CSS files will be removed completely in v4.0.0.';
×
96

97
    }//end getDeprecationMessage()
98

99

100
}//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

© 2026 Coveralls, Inc