Skip to content

Commit 70326ba

Browse files
authored
Merge pull request #868 from greg0ire/drop-psalm
Drop Psalm in favor of PHPStan
2 parents 33a9d71 + 7cadc10 commit 70326ba

15 files changed

+853
-109
lines changed

.github/workflows/static-analysis.yml

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,15 @@ on:
44
pull_request:
55
branches:
66
- "*.x"
7+
paths:
8+
- .github/workflows/static-analysis.yml
9+
- composer.*
10+
- config/**
11+
- src/**
12+
- phpstan*
13+
- tests/StaticAnalysis/**
714
push:
815

916
jobs:
10-
static-analysis-psalm:
11-
name: "Static Analysis with Psalm"
12-
runs-on: "ubuntu-20.04"
13-
14-
strategy:
15-
matrix:
16-
php-version:
17-
- "8.2"
18-
19-
steps:
20-
- name: "Checkout code"
21-
uses: "actions/checkout@v4"
22-
23-
- name: "Install PHP"
24-
uses: "shivammathur/setup-php@v2"
25-
with:
26-
coverage: "none"
27-
php-version: "${{ matrix.php-version }}"
28-
29-
- name: "Set minimum-stability to stable in Composer"
30-
run: "composer config minimum-stability stable"
31-
32-
- name: "Install dependencies with Composer"
33-
uses: "ramsey/composer-install@v3"
34-
35-
- name: "Run a static analysis with vimeo/psalm"
36-
run: "vendor/bin/psalm --show-info=false --stats --output-format=github --threads=$(nproc) --php-version=${{ matrix.php-version }}"
17+
static-analysis:
18+
uses: "doctrine/.github/.github/workflows/[email protected]"

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,18 @@
3939
"symfony/options-resolver": "^6.4 || ^7.0"
4040
},
4141
"require-dev": {
42+
"composer/semver": "^3.4",
4243
"doctrine/coding-standard": "^11.0",
4344
"doctrine/data-fixtures": "^1.7",
45+
"phpstan/phpstan": "^2.0",
4446
"phpunit/phpunit": "^9.5.5",
45-
"psalm/plugin-symfony": "^5.0",
4647
"symfony/browser-kit": "^6.4 || ^7.0",
4748
"symfony/form": "^6.4 || ^7.0",
4849
"symfony/phpunit-bridge": "^6.4.1 || ^7.0.1",
4950
"symfony/security-bundle": "^6.4 || ^7.0",
5051
"symfony/stopwatch": "^6.4 || ^7.0",
5152
"symfony/validator": "^6.4 || ^7.0",
52-
"symfony/yaml": "^6.4 || ^7.0",
53-
"vimeo/psalm": "^5.25"
53+
"symfony/yaml": "^6.4 || ^7.0"
5454
},
5555
"conflict": {
5656
"doctrine/data-fixtures": "<1.3"

phpstan-baseline.neon

Lines changed: 805 additions & 0 deletions
Large diffs are not rendered by default.

phpstan.neon.dist

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
includes:
2+
- phpstan-baseline.neon
3+
4+
parameters:
5+
phpVersion: 80400
6+
level: 7
7+
paths:
8+
- config
9+
- src
10+
- tests

psalm-baseline.xml

Lines changed: 0 additions & 34 deletions
This file was deleted.

psalm.xml

Lines changed: 0 additions & 23 deletions
This file was deleted.

src/CacheWarmer/HydratorCacheWarmer.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@
2626
* since this information is necessary to build the hydrators in the first place.
2727
*
2828
* @internal
29-
*
30-
* @psalm-suppress ContainerDependency
3129
*/
3230
class HydratorCacheWarmer implements CacheWarmerInterface
3331
{

src/CacheWarmer/PersistentCollectionCacheWarmer.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
* since this information is necessary to build the persistent collections in the first place.
2828
*
2929
* @internal
30-
*
31-
* @psalm-suppress ContainerDependency
3230
*/
3331
class PersistentCollectionCacheWarmer implements CacheWarmerInterface
3432
{

src/CacheWarmer/ProxyCacheWarmer.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@
2828
* since this information is necessary to build the proxies in the first place.
2929
*
3030
* @internal
31-
*
32-
* @psalm-suppress ContainerDependency
3331
*/
3432
class ProxyCacheWarmer implements CacheWarmerInterface
3533
{

src/Command/LoadDataFixturesDoctrineODMCommand.php

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Doctrine\Bundle\MongoDBBundle\ManagerRegistry;
99
use Doctrine\Common\DataFixtures\Executor\MongoDBExecutor;
1010
use Doctrine\Common\DataFixtures\Purger\MongoDBPurger;
11+
use Psr\Log\AbstractLogger;
1112
use Symfony\Component\Console\Input\InputInterface;
1213
use Symfony\Component\Console\Input\InputOption;
1314
use Symfony\Component\Console\Output\OutputInterface;
@@ -83,8 +84,23 @@ protected function execute(InputInterface $input, OutputInterface $output): int
8384

8485
$purger = new MongoDBPurger($dm);
8586
$executor = new MongoDBExecutor($dm, $purger);
86-
$executor->setLogger(static function ($message) use ($output): void {
87-
$output->writeln(sprintf(' <comment>></comment> <info>%s</info>', $message));
87+
88+
$executor->setLogger(new class ($output) extends AbstractLogger {
89+
public function __construct(private OutputInterface $output)
90+
{
91+
}
92+
93+
/** {@inheritDoc} */
94+
public function log($level, $message, array $context = []): void
95+
{
96+
$this->output->writeln(sprintf(' <comment>></comment> <info>%s</info>', $message));
97+
}
98+
99+
/** @deprecated to be removed when dropping support for doctrine/data-fixtures <1.8 */
100+
public function __invoke(string $message): void
101+
{
102+
$this->log(0, $message);
103+
}
88104
});
89105
$executor->execute($fixtures, $input->getOption('append'));
90106

0 commit comments

Comments
 (0)