Skip to content

Commit 35efff1

Browse files
committed
upgrade to phpstan v2
1 parent 6e771b1 commit 35efff1

File tree

4 files changed

+18
-12
lines changed

4 files changed

+18
-12
lines changed

composer.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,12 @@
6363
"doctrine/coding-standard": "^12.0",
6464
"roave/security-advisories": "dev-latest",
6565
"squizlabs/php_codesniffer": "^3.11",
66-
"phpstan/phpstan": "^1.12",
67-
"phpstan/phpstan-deprecation-rules": "^1.2",
68-
"phpstan/phpstan-phpunit": "^1.4",
69-
"phpstan/phpstan-strict-rules": "^1.6",
70-
"phpstan/phpstan-symfony": "^1.4",
71-
"phpstan/phpstan-doctrine": "^1.5",
66+
"phpstan/phpstan": "^2.1",
67+
"phpstan/phpstan-deprecation-rules": "^2.0",
68+
"phpstan/phpstan-phpunit": "^2.0",
69+
"phpstan/phpstan-strict-rules": "^2.0",
70+
"phpstan/phpstan-symfony": "^2.0",
71+
"phpstan/phpstan-doctrine": "^2.0",
7272
"phpunit/phpunit": "^11.5",
7373
"symfony/var-dumper": "^7.2",
7474
"symfony/clock": "^7.2"

src/DependencyInjection/Compiler/CronJobCompilerPass.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
use Symfony\Component\DependencyInjection\ContainerBuilder;
1111
use Symfony\Component\DependencyInjection\Reference;
1212

13+
use function is_array;
14+
1315
final class CronJobCompilerPass implements CompilerPassInterface
1416
{
1517
public const CRON_JOB_TAG_ID = 'shapecode_cron.cron_job';
@@ -22,6 +24,10 @@ public function process(ContainerBuilder $container): void
2224

2325
foreach ($tagged as $id => $configs) {
2426
foreach ($configs as $config) {
27+
if (! is_array($config)) {
28+
throw new RuntimeException('config must be an array', 1740941125172);
29+
}
30+
2531
if (! isset($config['expression'])) {
2632
throw new RuntimeException('missing expression config', 1653426737628);
2733
}

tests/Command/CronRunCommandTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public function testRun(): void
7373

7474
$this->command->run($this->input, $this->output);
7575

76-
self::assertEquals('shapecode:cron:run', $this->command->getName());
76+
self::assertSame('shapecode:cron:run', $this->command->getName());
7777
}
7878

7979
public function testRunWithTimeout(): void
@@ -95,6 +95,6 @@ public function testRunWithTimeout(): void
9595

9696
$this->command->run($this->input, $this->output);
9797

98-
self::assertEquals('shapecode:cron:run', $this->command->getName());
98+
self::assertSame('shapecode:cron:run', $this->command->getName());
9999
}
100100
}

tests/CronJob/CronJobManagerTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@ static function (LoadJobsEvent $event) use ($expression, $command): LoadJobsEven
4040
$jobs = $cronJobManager->getJobs();
4141

4242
self::assertCount(1, $jobs);
43-
self::assertEquals($commandName, $jobs->first()->command);
44-
self::assertEquals($expression, $jobs->first()->expression);
43+
self::assertSame($commandName, $jobs->first()->command);
44+
self::assertSame($expression, $jobs->first()->expression);
4545

4646
// Run second time to assert the same result.
4747
$jobs = $cronJobManager->getJobs();
4848

4949
self::assertCount(1, $jobs);
50-
self::assertEquals($commandName, $jobs->first()->command);
51-
self::assertEquals($expression, $jobs->first()->expression);
50+
self::assertSame($commandName, $jobs->first()->command);
51+
self::assertSame($expression, $jobs->first()->expression);
5252
}
5353
}

0 commit comments

Comments
 (0)