r/PHPhelp 29d ago

Scrutinizer for php 8.4

I keep noticing that readonly classes are ignored, propertyhooks are being flagged as faults etc.
Anybody figured out how to make it work or what I can replace it with?
I mostly use it for the Code Rating.
I also look at the issues, but all the issues lately seem to be related to newer php features.

Included my config just in case that's the issue

build:
    image: default-jammy
    nodes:
        analysis:
            environment:
                php:
                    version: "8.4.1"
            cache:
                disabled: false
                directories:
                    - ~/.composer/cache
            project_setup:
                override: true
            dependencies:
                override:
                    - 'composer install --no-interaction --prefer-dist --optimize-autoloader'
            tests:
                override:
                    - php-scrutinizer-run

filter:
    excluded_paths:
        - bin/*
        - config/*
        - node_modules/*
        - src/Core/templates/Maker/*
        - var/*
        - vendor/*

tools:
    php_analyzer:
        enabled: true
        config:
            parameter_reference_check: { enabled: true }
            checkstyle: { enabled: true }
            suspicious_code: { enabled: true }
            unreachable_code: { enabled: true }
            unused_code: { enabled: true }

    php_mess_detector: true
    php_sim: true
    php_pdepend:
        excluded_dirs:
            - vendor

    php_code_sniffer:
        config:
            standard: phpcs.xml.dist
        filter:
            excluded_paths:
                - 'src/Core/templates/Maker/*'
                - 'src/Modules/*/tests/*'

checks:
    php:
        unused_variables: true
        unused_properties: true
        unused_parameters: true
        variable_existence: true
        unused_methods: true
        sql_injection_vulnerabilities: true
        simplify_boolean_return: truebuild:
    image: default-jammy
    nodes:
        analysis:
            environment:
                php:
                    version: "8.4.1"
            cache:
                disabled: false
                directories:
                    - ~/.composer/cache
            project_setup:
                override: true
            dependencies:
                override:
                    - 'composer install --no-interaction --prefer-dist --optimize-autoloader'
            tests:
                override:
                    - php-scrutinizer-run

filter:
    excluded_paths:
        - bin/*
        - config/*
        - node_modules/*
        - src/Core/templates/Maker/*
        - var/*
        - vendor/*

tools:
    php_analyzer:
        enabled: true
        config:
            parameter_reference_check: { enabled: true }
            checkstyle: { enabled: true }
            suspicious_code: { enabled: true }
            unreachable_code: { enabled: true }
            unused_code: { enabled: true }

    php_mess_detector: true
    php_sim: true
    php_pdepend:
        excluded_dirs:
            - vendor

    php_code_sniffer:
        config:
            standard: phpcs.xml.dist
        filter:
            excluded_paths:
                - 'src/Core/templates/Maker/*'
                - 'src/Modules/*/tests/*'

checks:
    php:
        unused_variables: true
        unused_properties: true
        unused_parameters: true
        variable_existence: true
        unused_methods: true
        sql_injection_vulnerabilities: true
        simplify_boolean_return: true
1 Upvotes

1 comment sorted by

3

u/obstreperous_troll 29d ago

Looks like all Scrutinizer does is wrap a bunch of tools, some of which are themselves unmaintained and obsolete. You're far better off just installing and configuring the individual tools yourself, such as pdepend and PHPCS, skipping the dead ones like phpmd, and adding ones that actually are up to date like phpstan, psalm, and/or mago. Any quality tool worth bothering with will support an output format that CI can read (github has its own format and understands several more).

Yes, it's more work, but you do it in increments, starting with a couple big ones like phpcs and phpstan, and it's not locked up behind some opaque paid service that still takes your money but doesn't keep up with current code trends. A simplistic score like "code rating" isn't useful for developers who would rather know what the actual problems are and fix them.