Actions

User

User:Gold/PHP 8 Scratchpad/phan sample output

From Mahara Wiki

< User:Gold‎ | PHP 8 Scratchpad

phan is looking comprehensive. Dropping this sample output of a minimum severity check. The output is... long. It has been trimmed.

The output is looking useful for programatically extracting metrics. With a little work we may be able to identify area of the codebase that need attention based on directory.

This is from running vendor/bin/phan --allow-polyfill-parser --analyze-twice --dead-code-detection -m json.

[
    {
        "type": "issue",
        "type_id": 11013,
        "check_name": "PhanUndeclaredMethod",
        "description": "UndefError PhanUndeclaredMethod Call to undeclared method \u001b[93m\\Auth::is_username_valid\u001b[0m",
        "severity": 10,
        "location": {
            "path": "htdocs/account/index.php",
            "lines": {
                "begin": 204,
                "end": 204
            }
        }
    },
    {
        "type": "issue",
        "type_id": 11013,
        "check_name": "PhanUndeclaredMethod",
        "description": "UndefError PhanUndeclaredMethod Call to undeclared method \u001b[93m\\Auth::change_password\u001b[0m",
        "severity": 10,
        "location": {
            "path": "htdocs/account/index.php",
            "lines": {
                "begin": 232,
                "end": 232
            }
        }
    },
    {
        "type": "issue",
        "type_id": 11009,
        "check_name": "PhanUndeclaredClassMethod",
        "description": "UndefError PhanUndeclaredClassMethod Call to method \u001b[93m__construct\u001b[0m from undeclared class \u001b[32m\\SimpleSAML\\Auth\\Simple\u001b[0m",
        "severity": 10,
        "location": {
            "path": "htdocs/account/migrateinstitution.php",
            "lines": {
                "begin": 122,
                "end": 122
            }
        }
    },
    {
        "type": "issue",
        "type_id": 11009,
        "check_name": "PhanUndeclaredClassMethod",
        "description": "UndefError PhanUndeclaredClassMethod Call to method \u001b[93mlogout\u001b[0m from undeclared class \u001b[32m\\SimpleSAML\\Auth\\Simple\u001b[0m",
        "severity": 10,
        "location": {
            "path": "htdocs/account/migrateinstitution.php",
            "lines": {
                "begin": 123,
                "end": 123
            }
        }
    },
    {
        "type": "issue",
        "type_id": 11013,
        "check_name": "PhanUndeclaredMethod",
        "description": "UndefError PhanUndeclaredMethod Call to undeclared method \u001b[93m\\Auth::change_password\u001b[0m",
        "severity": 10,
        "location": {
            "path": "htdocs/admin/cli/install.php",
            "lines": {
                "begin": 91,
                "end": 91
            }
        }
    },
    {
        "type": "issue",
        "type_id": 10038,
        "check_name": "PhanTypeExpectedObjectPropAccess",
        "description": "TypeError PhanTypeExpectedObjectPropAccess Expected an object instance when accessing an instance property, but saw an expression \u001b[95m$msg->error\u001b[0m with type \u001b[37mfalse|string\u001b[0m",
        "severity": 10,
        "location": {
            "path": "htdocs/admin/extensions/pluginconfig.php",
            "lines": {
                "begin": 135,
                "end": 135
            }
        }
    },
    {
        "type": "issue",
        "type_id": 10038,
        "check_name": "PhanTypeExpectedObjectPropAccess",
        "description": "TypeError PhanTypeExpectedObjectPropAccess Expected an object instance when accessing an instance property, but saw an expression \u001b[95m$msg->error\u001b[0m with type \u001b[37mstring\u001b[0m",
        "severity": 10,
        "location": {
            "path": "htdocs/admin/extensions/pluginconfig.php",
            "lines": {
                "begin": 135,
                "end": 135
            }
        }
    }
]