wikimedia/mediawiki-core

View on GitHub
includes/debug/DeprecationHelper.php

Summary

Maintainability
A
3 hrs
Test Coverage

Function __set has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function __set( $name, $value ) {
        if ( isset( self::$deprecatedPublicProperties[$name] ) ) {
            [ $version, $class, $component, , $setter ] = self::$deprecatedPublicProperties[$name];
            $qualifiedName = $class . '::$' . $name;
            wfDeprecated( $qualifiedName, $version, $component, 2 );
Severity: Minor
Found in includes/debug/DeprecationHelper.php - About 55 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method deprecatePublicPropertyFallback has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

        string $property,
        string $version,
        $getter,
        $setter = null,
        $class = null,
Severity: Minor
Found in includes/debug/DeprecationHelper.php - About 45 mins to fix

    Function __isset has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        public function __isset( $name ) {
            // Overriding magic __isset is required not only for isset() and empty(),
            // but to correctly support null coalescing for dynamic properties,
            // e.g. $foo->bar ?? 'default'
            if ( isset( self::$deprecatedPublicProperties[$name] ) ) {
    Severity: Minor
    Found in includes/debug/DeprecationHelper.php - About 35 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function deprecationHelperGetPropertyOwner has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        private function deprecationHelperGetPropertyOwner( $property ) {
            // Returning false is a non-error path and should avoid slow checks like reflection.
            // Use array cast hack instead.
            $obfuscatedProps = array_keys( (array)$this );
            $obfuscatedPropTail = "\0$property";
    Severity: Minor
    Found in includes/debug/DeprecationHelper.php - About 25 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function __get has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function __get( $name ) {
            if ( isset( self::$deprecatedPublicProperties[$name] ) ) {
                [ $version, $class, $component, $getter ] = self::$deprecatedPublicProperties[$name];
                $qualifiedName = $class . '::$' . $name;
                wfDeprecated( $qualifiedName, $version, $component, 2 );
    Severity: Minor
    Found in includes/debug/DeprecationHelper.php - About 25 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    There are no issues that match your filters.

    Category
    Status