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

PHPCompatibility / PHPCompatibility / 19804455605

30 Nov 2025 08:31PM UTC coverage: 98.306% (-0.04%) from 98.346%
19804455605

push

github

web-flow
Merge pull request #2014 from PHPCompatibility/php-8.5/new-removedterminatingcasewithsemicolon-sniff

PHP 8.5 | ✨ New `PHPCompatibility.ControlStructures.RemovedTerminatingCaseWithSemicolon` sniff (RFC)

30 of 34 new or added lines in 1 file covered. (88.24%)

21 existing lines in 15 files now uncovered.

8355 of 8499 relevant lines covered (98.31%)

20.51 hits per line

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

93.33
/PHPCompatibility/Sniffs/ParameterValues/RemovedGetDefinedFunctionsExcludeDisabledFalseSniff.php
1
<?php
2
/**
3
 * PHPCompatibility, an external standard for PHP_CodeSniffer.
4
 *
5
 * @package   PHPCompatibility
6
 * @copyright 2012-2020 PHPCompatibility Contributors
7
 * @license   https://opensource.org/licenses/LGPL-3.0 LGPL3
8
 * @link      https://github.com/PHPCompatibility/PHPCompatibility
9
 */
10

11
namespace PHPCompatibility\Sniffs\ParameterValues;
12

13
use PHPCompatibility\AbstractFunctionCallParameterSniff;
14
use PHPCompatibility\Helpers\ScannedCode;
15
use PHP_CodeSniffer\Files\File;
16
use PHPCSUtils\Utils\PassedParameters;
17

18
/**
19
 * Detect: Passing `false` to `get_defined_functions()` is deprecated as of PHP 8.0.
20
 *
21
 * > Calling `get_defined_functions()` with `$exclude_disabled` explicitly set to `false`
22
 * > is deprecated. `get_defined_functions()` will never include disabled functions.
23
 *
24
 * Note: as of PHP 8.5, the parameter is completely deprecated.
25
 * This is handled via the PHPCompatibility.FunctionUse.RemovedFunctionParameters sniff.
26
 *
27
 * PHP version 8.0
28
 *
29
 * @link https://github.com/php/php-src/blob/69888c3ff1f2301ead8e37b23ff8481d475e29d2/UPGRADING#L514-L516
30
 *
31
 * @since 10.0.0
32
 */
33
final class RemovedGetDefinedFunctionsExcludeDisabledFalseSniff extends AbstractFunctionCallParameterSniff
34
{
35

36
    /**
37
     * Functions to check for.
38
     *
39
     * @since 10.0.0
40
     *
41
     * @var array<string, true>
42
     */
43
    protected $targetFunctions = [
44
        'get_defined_functions' => true,
45
    ];
46

47
    /**
48
     * Do a version check to determine if this sniff needs to run at all.
49
     *
50
     * @since 10.0.0
51
     *
52
     * @return bool
53
     */
54
    protected function bowOutEarly()
8✔
55
    {
56
        return (ScannedCode::shouldRunOnOrAbove('8.0') === false);
8✔
57
    }
58

59
    /**
60
     * Process the parameters of a matched function.
61
     *
62
     * @since 10.0.0
63
     *
64
     * @param \PHP_CodeSniffer\Files\File $phpcsFile    The file being scanned.
65
     * @param int                         $stackPtr     The position of the current token in the stack.
66
     * @param string                      $functionName The token content (function name) which was matched.
67
     * @param array                       $parameters   Array with information about the parameters.
68
     *
69
     * @return void
70
     */
71
    public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters)
4✔
72
    {
73
        $targetParam = PassedParameters::getParameterFromStack($parameters, 1, 'exclude_disabled');
4✔
74
        if ($targetParam === false) {
4✔
UNCOV
75
            return;
×
76
        }
77

78
        $cleanValueLc = \strtolower($targetParam['clean']);
4✔
79
        if ($cleanValueLc !== 'false' && $cleanValueLc !== '\false') {
4✔
80
            return;
4✔
81
        }
82

83
        $phpcsFile->addWarning(
4✔
84
            'Explicitly passing "false" as the value for $exclude_disabled to get_defined_functions() is deprecated since PHP 8.0.',
4✔
85
            $targetParam['start'],
4✔
86
            'Deprecated'
4✔
87
        );
2✔
88
    }
2✔
89
}
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