From 981fee84b9dc80d2796a583d7530aadc3e970390 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Anne?= Date: Thu, 17 Jul 2025 11:34:47 +0200 Subject: [PATCH] Add a configuration example --- README.md | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5abe2d8..ae759ad 100644 --- a/README.md +++ b/README.md @@ -16,13 +16,44 @@ See https://phpstan.org/user-guide/extension-library#installing-extensions for m ## Configuration -The GLPI version should be detected automatically, but you can specify it in your PHPStan configuration: -```yaml +The PHPStan configuration depends on your GLPI version. +If your plugin is located in either the `plugins` or `marketplace` directory of GLPI, +you can use the following configuration file example: + +```neon +parameters: + level: 0 + paths: + - ajax + - front + - inc # or `src` if your PHP class files are in the `src` directory + - hook.php + - setup.php + scanDirectories: + - ../../inc + - ../../src + + # for GLPI 11.x the following configuration entries must be used + bootstrapFiles: + - ../../stubs/glpi_constants.php + - ../../vendor/autoload.php + + # for GLPI 10.x the following configuration entries must be used + bootstrapFiles: + - ../../inc/based_config.php + stubFiles: + - ../../stubs/glpi_constants.php +``` + +The GLPI version should be detected automatically, but you can specify it in the `parameters` section of your PHPStan configuration: +```neon parameters: glpi: glpiVersion: "11.0" ``` +See https://phpstan.org/config-reference fore more information about the PHPStan configuration options. + ## Rules ### `ForbidDynamicInstantiationRule`