PHP code example of richcongress / static-analysis

1. Go to this page and download the library: Download richcongress/static-analysis library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

richcongress / static-analysis example snippets


{
    "autoload": {
        "exclude-from-classmap": ["phpinsights.php"]
    }
}
bash
cp ./vendor/richcongress/static-analysis/configs/phpstan.neon ./
cp ./vendor/richcongress/static-analysis/configs/phpinsights.php ./
cp ./vendor/richcongress/static-analysis/configs/php-cs-fixer.dist.php ./.php-cs-fixer.dist.php

{
    "scripts": {
        "post-install-cmd": [
            "[ $COMPOSER_DEV_MODE -eq 0 ] || cghooks add --ignore-lock"
        ],
        "post-update-cmd": [
            "[ $COMPOSER_DEV_MODE -eq 0 ] || cghooks update"
        ]
    },

    "extra": {
        "hooks": {
            "pre-commit": [
                "docker-compose exec -T application ./vendor/friendsofphp/php-cs-fixer/php-cs-fixer fix -n"
            ],
            "pre-push": [
                "docker-compose exec -T application ./vendor/friendsofphp/php-cs-fixer/php-cs-fixer fix --dry-run -n",
                "docker-compose exec -T application ./vendor/richcongress/static-analysis/bin/static_analysis"
            ]
        }
    }
}