• 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

88.89
/src/Standards/Squiz/Sniffs/Scope/MemberVarScopeSniff.php
1
<?php
2
/**
3
 * Verifies that class members have scope modifiers.
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

10
namespace PHP_CodeSniffer\Standards\Squiz\Sniffs\Scope;
11

12
use PHP_CodeSniffer\Files\File;
13
use PHP_CodeSniffer\Sniffs\AbstractVariableSniff;
14

15
class MemberVarScopeSniff extends AbstractVariableSniff
16
{
17

18

19
    /**
20
     * Processes the function tokens within the class.
21
     *
22
     * @param \PHP_CodeSniffer\Files\File $phpcsFile The file where this token was found.
23
     * @param int                         $stackPtr  The position where the token was found.
24
     *
25
     * @return void
26
     */
27
    protected function processMemberVar(File $phpcsFile, $stackPtr)
3✔
28
    {
29
        $tokens     = $phpcsFile->getTokens();
3✔
30
        $properties = $phpcsFile->getMemberProperties($stackPtr);
3✔
31

32
        if ($properties === [] || $properties['scope_specified'] !== false) {
3✔
33
            return;
3✔
34
        }
35

36
        if ($properties['set_scope'] === false) {
3✔
37
            $error = 'Scope modifier not specified for member variable "%s"';
3✔
38
            $data  = [$tokens[$stackPtr]['content']];
3✔
39
            $phpcsFile->addError($error, $stackPtr, 'Missing', $data);
3✔
40
        } else {
1✔
41
            $error = 'Read scope modifier not specified for member variable "%s"';
3✔
42
            $data  = [$tokens[$stackPtr]['content']];
3✔
43
            $phpcsFile->addError($error, $stackPtr, 'AsymReadMissing', $data);
3✔
44
        }
45

46
    }//end processMemberVar()
2✔
47

48

49
    /**
50
     * Processes normal variables.
51
     *
52
     * @param \PHP_CodeSniffer\Files\File $phpcsFile The file where this token was found.
53
     * @param int                         $stackPtr  The position where the token was found.
54
     *
55
     * @return void
56
     */
57
    protected function processVariable(File $phpcsFile, $stackPtr)
3✔
58
    {
59
        /*
60
            We don't care about normal variables.
61
        */
62

63
    }//end processVariable()
3✔
64

65

66
    /**
67
     * Processes variables in double quoted strings.
68
     *
69
     * @param \PHP_CodeSniffer\Files\File $phpcsFile The file where this token was found.
70
     * @param int                         $stackPtr  The position where the token was found.
71
     *
72
     * @return void
73
     */
74
    protected function processVariableInString(File $phpcsFile, $stackPtr)
×
75
    {
76
        /*
77
            We don't care about normal variables.
78
        */
79

80
    }//end processVariableInString()
×
81

82

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