Commit bc262d96 authored by Antony Le Courtes's avatar Antony Le Courtes
Browse files

phpstan to test code

parent 3696b6f9
Loading
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -67,7 +67,8 @@
        "phan/phan"                         : "^5.3",
        "phpmd/phpmd"                       : "*",
        "phpunit/phpunit"                   : "^9",
        "friendsofphp/php-cs-fixer": "^3.74"
        "friendsofphp/php-cs-fixer": "^3.74",
        "phpstan/phpstan": "^2.1"
    },
    "prefer-stable"    : true,
    "config"           : {
+59 −1
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@
        "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
        "This file is @generated automatically"
    ],
    "content-hash": "236cdc9ec2e54862dfe78f687bfdcf59",
    "content-hash": "3ea259a637838d5775140a278405bce6",
    "packages": [
        {
            "name": "apereo/phpcas",
@@ -9391,6 +9391,64 @@
            },
            "time": "2025-02-19T13:28:12+00:00"
        },
        {
            "name": "phpstan/phpstan",
            "version": "2.1.12",
            "source": {
                "type": "git",
                "url": "https://github.com/phpstan/phpstan.git",
                "reference": "96dde49e967c0c22812bcfa7bda4ff82c09f3b0c"
            },
            "dist": {
                "type": "zip",
                "url": "https://api.github.com/repos/phpstan/phpstan/zipball/96dde49e967c0c22812bcfa7bda4ff82c09f3b0c",
                "reference": "96dde49e967c0c22812bcfa7bda4ff82c09f3b0c",
                "shasum": ""
            },
            "require": {
                "php": "^7.4|^8.0"
            },
            "conflict": {
                "phpstan/phpstan-shim": "*"
            },
            "bin": [
                "phpstan",
                "phpstan.phar"
            ],
            "type": "library",
            "autoload": {
                "files": [
                    "bootstrap.php"
                ]
            },
            "notification-url": "https://packagist.org/downloads/",
            "license": [
                "MIT"
            ],
            "description": "PHPStan - PHP Static Analysis Tool",
            "keywords": [
                "dev",
                "static analysis"
            ],
            "support": {
                "docs": "https://phpstan.org/user-guide/getting-started",
                "forum": "https://github.com/phpstan/phpstan/discussions",
                "issues": "https://github.com/phpstan/phpstan/issues",
                "security": "https://github.com/phpstan/phpstan/security/policy",
                "source": "https://github.com/phpstan/phpstan-src"
            },
            "funding": [
                {
                    "url": "https://github.com/ondrejmirtes",
                    "type": "github"
                },
                {
                    "url": "https://github.com/phpstan",
                    "type": "github"
                }
            ],
            "time": "2025-04-16T13:19:18+00:00"
        },
        {
            "name": "phpunit/php-code-coverage",
            "version": "9.2.32",
+6 −4
Original line number Diff line number Diff line
@@ -9,7 +9,7 @@ class RIBValidator extends Iban
    /**
     * Sets validator options
     *
     * @param array|Traversable $options OPTIONAL
     * @param array|\Traversable $options OPTIONAL
     */
    public function __construct($options = [])
    {
@@ -26,10 +26,12 @@ class RIBValidator extends Iban

    public function isValid($value, $context = null)
    {
        $horsSepa = isset($context['ribHorsSepa']) ? (bool)$context['ribHorsSepa'] : false;
        $horsSepa = isset($context['ribHorsSepa']) && (bool)$context['ribHorsSepa'];

        if ($horsSepa) return true; // pas de contrôle si hors SEPA!!
        if ($horsSepa) {
            return true;
        }

        return parent::isValid($value, $context);
        return parent::isValid($value);
    }
}

phpstan.neon

0 → 100644
+10 −0
Original line number Diff line number Diff line
parameters:
    level: 5 # Niveau d’analyse (0 à 9, plus c’est haut, plus c’est strict)
    paths:
        - module/Dossier
        - tests
    excludePaths:
        analyse:
            - module/*/src/View/**
    ignoreErrors:
        - '#Call to static method container\(\)#'
 No newline at end of file