Skip to content

Commit 5b8dd5e

Browse files
committed
Add missing type declarations and phpdoc
This implies bumping psr/log to v2, which adds type declarations to its interface.
1 parent 347d92d commit 5b8dd5e

File tree

8 files changed

+15
-36
lines changed

8 files changed

+15
-36
lines changed

UPGRADE.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
UPGRADE to 4.0
22
==============
33

4+
## Type declarations
5+
6+
Type declarations have been added everywhere. Types extending or implementing
7+
types from this bundle need to be updated to match the new signatures.
8+
49
## Mandatory ManagerRegistry argument
510

611
It is now mandatory to pass a `ManagerRegistry` instance to the constructor of
@@ -34,7 +39,7 @@ services:
3439
and so no longer have a ``$this->container`` property. You *can* manually
3540
implement this interface. Or, a better idea is to update your fixtures
3641
to use dependency injection:
37-
42+
3843
```diff
3944
class MyFixture extends Fixture
4045
{
@@ -56,7 +61,7 @@ class MyFixture extends Fixture
5661
* The base ``Fixture`` class no longer implements ``DependentFixtureInterface``.
5762
If you want to have a ``getDependencies()`` method, be sure to implement
5863
this interface explicitly:
59-
64+
6065
```diff
6166
+ use Doctrine\Common\DataFixtures\DependentFixtureInterface;
6267

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"doctrine/doctrine-bundle": "^2.2",
2929
"doctrine/orm": "^2.14.0 || ^3.0",
3030
"doctrine/persistence": "^2.4 || ^3.0",
31-
"psr/log": "^1 || ^2 || ^3",
31+
"psr/log": "^2 || ^3",
3232
"symfony/config": "^5.4 || ^6.0 || ^7.0",
3333
"symfony/console": "^5.4 || ^6.0 || ^7.0",
3434
"symfony/dependency-injection": "^5.4 || ^6.0 || ^7.0",

phpstan-baseline.neon

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

phpstan.neon.dist

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,3 @@ parameters:
44
paths:
55
- src
66
- tests
7-
excludePaths:
8-
# Contains an issue that cannot be ignored
9-
- tests/IntegrationTest.php
10-
11-
includes:
12-
- phpstan-baseline.neon

src/Command/LoadDataFixturesDoctrineCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use Doctrine\ORM\EntityManagerInterface;
1414
use Doctrine\Persistence\ManagerRegistry;
1515
use Psr\Log\AbstractLogger;
16+
use Stringable;
1617
use Symfony\Component\Console\Input\InputInterface;
1718
use Symfony\Component\Console\Input\InputOption;
1819
use Symfony\Component\Console\Output\OutputInterface;
@@ -123,7 +124,7 @@ public function __construct(private SymfonyStyle $ui)
123124
}
124125

125126
/** {@inheritDoc} */
126-
public function log($level, $message, array $context = []): void
127+
public function log(mixed $level, string|Stringable $message, array $context = []): void
127128
{
128129
$this->ui->text(sprintf(' <comment>></comment> <info>%s</info>', $message));
129130
}

src/Loader/SymfonyFixturesLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public function addFixture(FixtureInterface $fixture): void
6666
* Overridden to not allow new fixture classes to be instantiated.
6767
* {@inheritDoc}
6868
*/
69-
protected function createFixture($class): FixtureInterface
69+
protected function createFixture(string $class): FixtureInterface
7070
{
7171
/*
7272
* We don't actually need to create the fixture. We just

tests/Fixtures/FooBundle/DataFixtures/RequiredConstructorArgsFixtures.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
class RequiredConstructorArgsFixtures implements ORMFixtureInterface
1111
{
12+
/** @phpstan-ignore constructor.unusedParameter */
1213
public function __construct(string $fooRequiredArg)
1314
{
1415
}

tests/IntegrationTestKernel.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Symfony\Component\Config\Loader\LoaderInterface;
1212
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
1313
use Symfony\Component\DependencyInjection\ContainerBuilder;
14+
use Symfony\Component\HttpKernel\Bundle\BundleInterface;
1415
use Symfony\Component\HttpKernel\Kernel;
1516

1617
use function rand;
@@ -35,6 +36,8 @@ protected function getContainerClass(): string
3536

3637
/**
3738
* {@inheritDoc}
39+
*
40+
* @return array<mixed, BundleInterface>
3841
*/
3942
public function registerBundles(): array
4043
{

0 commit comments

Comments
 (0)