33 | | Added [https://github.com/squizlabs/PHP_CodeSniffer/blob/b10c327dcf4f30151101858fa79053b6ecc99fbb/src/Standards/Squiz/Sniffs/Scope/MethodScopeSniff.php#L70 at this location]. |
34 | | |
35 | | {{{#!php |
36 | | <?php |
37 | | $phpcsFile->addFixableError($error, $stackPtr, 'ScopeMissing'); |
38 | | $methodName = $phpcsFile->getDeclarationName($stackPtr); |
39 | | |
40 | | if ('__' !== substr($methodName, 0, 2) && '_' === $methodName[0]) { |
41 | | $phpcsFile->fixer->addContentBefore($stackPtr, 'private '); |
42 | | } else { |
43 | | // In general, these should still have a review to determine |
44 | | // if they should actually have a 'private' scope. |
45 | | // For now, all PHPUnit tests pass. |
46 | | $phpcsFile->fixer->addContentBefore($stackPtr, 'public '); |
47 | | } |
48 | | }}} |
| 33 | See [https://github.com/costdev/PHP_CodeSniffer/commit/4902bc121efb6fde893aa48862c6df1079317e45 here]. |
52 | | Added [https://github.com/squizlabs/PHP_CodeSniffer/blob/b10c327dcf4f30151101858fa79053b6ecc99fbb/src/Standards/PSR2/Sniffs/Classes/PropertyDeclarationSniff.php#L117 at this location]. |
53 | | |
54 | | {{{#!php |
55 | | <?php |
56 | | $phpcsFile->addFixableError($error, $stackPtr, 'ScopeMissing'); |
57 | | $propertyName = $tokens[$stackPtr]['content']; |
58 | | |
59 | | if ('_' === $propertyName[1]) { |
60 | | $phpcsFile->fixer->addContentBefore($stackPtr, 'private '); |
61 | | } else { |
62 | | // In general, these should still have a review to determine |
63 | | // if they should actually have a 'private' scope. |
64 | | // For now, all PHPUnit tests pass. |
65 | | $phpcsFile->fixer->addContentBefore($stackPtr, 'public '); |
66 | | } |
67 | | }}} |
| 37 | See [https://github.com/costdev/PHP_CodeSniffer/commit/18f5f2701932cb2f5219601a2e2210b5ef48f9b7 here]. |