From 447be7929deb2dc2da8da725024540bf8faf39c7 Mon Sep 17 00:00:00 2001 From: Karoly Gossler Date: Tue, 27 Feb 2024 16:11:46 +0100 Subject: [PATCH 1/4] Add phpstan config with baseline Co-authored-by: Alexander M. Turek --- phpstan-baseline.neon | 41 +++++++++++++++++++++++++++++++++++++++++ phpstan.neon | 8 ++++++++ 2 files changed, 49 insertions(+) create mode 100644 phpstan-baseline.neon create mode 100644 phpstan.neon diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon new file mode 100644 index 000000000..a5979d112 --- /dev/null +++ b/phpstan-baseline.neon @@ -0,0 +1,41 @@ +parameters: + ignoreErrors: + - + message: "#^Property DoctrineExtensions\\\\Query\\\\Mysql\\\\Collate\\:\\:\\$collation \\(null\\) does not accept string\\.$#" + count: 1 + path: src/Query/Mysql/Collate.php + + - + message: "#^Property DoctrineExtensions\\\\Query\\\\Mysql\\\\Collate\\:\\:\\$stringPrimary \\(null\\) does not accept Doctrine\\\\ORM\\\\Query\\\\AST\\\\Node\\.$#" + count: 1 + path: src/Query/Mysql/Collate.php + + - + message: "#^Property DoctrineExtensions\\\\Query\\\\Mysql\\\\Lag\\:\\:\\$aggregateExpression \\(Doctrine\\\\ORM\\\\Query\\\\AST\\\\AggregateExpression\\) does not accept Doctrine\\\\ORM\\\\Query\\\\AST\\\\Node\\|string\\.$#" + count: 1 + path: src/Query/Mysql/Lag.php + + - + message: "#^Property DoctrineExtensions\\\\Query\\\\Mysql\\\\Lag\\:\\:\\$offset \\(Doctrine\\\\ORM\\\\Query\\\\AST\\\\ArithmeticExpression\\) does not accept Doctrine\\\\ORM\\\\Query\\\\AST\\\\Node\\|string\\.$#" + count: 1 + path: src/Query/Mysql/Lag.php + + - + message: "#^Property DoctrineExtensions\\\\Query\\\\Mysql\\\\Lead\\:\\:\\$aggregateExpression \\(Doctrine\\\\ORM\\\\Query\\\\AST\\\\AggregateExpression\\) does not accept Doctrine\\\\ORM\\\\Query\\\\AST\\\\Node\\|string\\.$#" + count: 1 + path: src/Query/Mysql/Lead.php + + - + message: "#^Property DoctrineExtensions\\\\Query\\\\Mysql\\\\Lead\\:\\:\\$offset \\(Doctrine\\\\ORM\\\\Query\\\\AST\\\\ArithmeticExpression\\) does not accept Doctrine\\\\ORM\\\\Query\\\\AST\\\\Node\\|string\\.$#" + count: 1 + path: src/Query/Mysql/Lead.php + + - + message: "#^Property DoctrineExtensions\\\\Query\\\\Sqlite\\\\Week\\:\\:\\$mode \\(int\\) does not accept Doctrine\\\\ORM\\\\Query\\\\AST\\\\Literal\\.$#" + count: 1 + path: src/Query/Sqlite/Week.php + + - + message: "#^Method DoctrineExtensions\\\\Types\\\\ZendDateType\\:\\:convertToPHPValue\\(\\) should return Zend_Date but returns null\\.$#" + count: 1 + path: src/Types/ZendDateType.php diff --git a/phpstan.neon b/phpstan.neon new file mode 100644 index 000000000..3051cd9cf --- /dev/null +++ b/phpstan.neon @@ -0,0 +1,8 @@ +parameters: + level: 3 + paths: + - src + phpVersion: 80300 + +includes: + - phpstan-baseline.neon From 1effd18c5651f5493be725918f3b8ce02e138088 Mon Sep 17 00:00:00 2001 From: Karoly Gossler Date: Tue, 27 Feb 2024 17:17:52 +0100 Subject: [PATCH 2/4] Add psalm config with baseline --- psalm-baseline.xml | 13 +++++++++++++ psalm.xml | 16 ++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 psalm-baseline.xml create mode 100644 psalm.xml diff --git a/psalm-baseline.xml b/psalm-baseline.xml new file mode 100644 index 000000000..d69d1b705 --- /dev/null +++ b/psalm-baseline.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/psalm.xml b/psalm.xml new file mode 100644 index 000000000..a49111abe --- /dev/null +++ b/psalm.xml @@ -0,0 +1,16 @@ + + + + + + From 01ceaaa801763c64a067b341bd88696738207a76 Mon Sep 17 00:00:00 2001 From: Karoly Gossler Date: Tue, 27 Feb 2024 16:42:38 +0100 Subject: [PATCH 3/4] Add psalm, phpstan dev requirement --- composer.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/composer.json b/composer.json index 751e54899..05c6443ba 100644 --- a/composer.json +++ b/composer.json @@ -16,10 +16,12 @@ "doctrine/annotations": "^1.14 || ^2", "doctrine/coding-standard": "^9.0.2 || ^12.0", "nesbot/carbon": "^2.72 || ^3", + "phpstan/phpstan": "^1.10", "phpunit/phpunit": "^8.5 || ^9.6", "squizlabs/php_codesniffer": "^3.8", "symfony/cache": "^5.4 || ^6.4 || ^7.0", "symfony/yaml": "^5.4 || ^6.4 || ^7.0", + "vimeo/psalm": "^3.18 || ^5.22", "zf1/zend-date": "^1.12", "zf1/zend-registry": "^1.12" }, From 22e0de6ccd3db8859e27f49ff6493e048a782cf3 Mon Sep 17 00:00:00 2001 From: Karoly Gossler Date: Tue, 27 Feb 2024 16:29:13 +0100 Subject: [PATCH 4/4] Add workflow config --- .github/workflows/static-analysis.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/static-analysis.yml diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml new file mode 100644 index 000000000..7a8e65739 --- /dev/null +++ b/.github/workflows/static-analysis.yml @@ -0,0 +1,25 @@ +name: "Static Analysis" + +on: + pull_request: + branches: + - "master" + paths: + - .github/workflows/static-analysis.yml + - composer.* + - src/** + - phpstan* + - psalm* + push: + branches: + - "master" + paths: + - .github/workflows/static-analysis.yml + - composer.* + - src/** + - phpstan* + - psalm* + +jobs: + static-analysis: + uses: "doctrine/.github/.github/workflows/static-analysis.yml@4.0.0"