Skip to content

Commit d36abe5

Browse files
fix: use PHPStan version >=2 for Pimcore projects
Error: On a fresh install PHPStan failed with: Service 'symfony.serviceMapFactory':Service 'symfony.serviceMapFactory': Class or interface 'PHPStan\Symfony\ServiceMapFactory' not found. Caused by: Most Pimcore projects still having PHPStan 1.x installed (Pimcore Skeleton or Youwe Accelerator) but that one refused to load "phpstan/phpstan-symfony" Resolved with: Bumping to version >=2 (for Pimcore only) and making PHPStan 2 related adjustments in phpstan.neon
1 parent 75981a0 commit d36abe5

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/Installer/PackagesInstaller.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ class PackagesInstaller implements InstallerInterface
5656
]
5757
],
5858
'pimcore' => [
59+
'phpstan/phpstan' => [
60+
'version' => '>=2.0',
61+
'updateDependencies' => true,
62+
],
5963
'phpstan/phpstan-symfony' => [
6064
'version' => '@stable',
6165
'updateDependencies' => true,

templates/files/pimcore/phpstan.neon

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ includes:
99
parameters:
1010
paths:
1111
- src
12-
- var/classes/DataObject # Include DataObject generated classes, otherwise PHPStan will complain about class not found
1312

1413
# Uncomment when your project has unit tests:
1514
# - tests
@@ -23,3 +22,9 @@ parameters:
2322
# Point PHPStan to internal constants that are bootstrapped
2423
bootstrapFiles:
2524
- ./vendor/youwe/testing-suite/config/pimcore/phpstan-bootstrap.php
25+
26+
ignoreErrors:
27+
# PHPStan won't correctly recognize "@var Pimcore\Model\DataObject\ClassName $this", something we often use in
28+
# abstract models. The "varTag.nativeType" rule has been added recently to PHPStan and apparently is not stable
29+
# enough yet. Disable this check completely.
30+
- { identifier: varTag.nativeType }

0 commit comments

Comments
 (0)