mirror of
https://github.com/doctrine/DoctrineFixturesBundle.git
synced 2026-03-23 22:32:17 +01:00
Add missing type declarations and phpdoc
This implies bumping psr/log to v2, which adds type declarations to its interface.
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
UPGRADE to 4.0
|
||||
==============
|
||||
|
||||
## Type declarations
|
||||
|
||||
Type declarations have been added everywhere. Types extending or implementing
|
||||
types from this bundle need to be updated to match the new signatures.
|
||||
|
||||
## Final classes
|
||||
|
||||
Some classes have been marked as `final` because they are not supposed to be
|
||||
@@ -39,7 +44,7 @@ services:
|
||||
and so no longer have a ``$this->container`` property. You *can* manually
|
||||
implement this interface. Or, a better idea is to update your fixtures
|
||||
to use dependency injection:
|
||||
|
||||
|
||||
```diff
|
||||
class MyFixture extends Fixture
|
||||
{
|
||||
@@ -61,7 +66,7 @@ class MyFixture extends Fixture
|
||||
* The base ``Fixture`` class no longer implements ``DependentFixtureInterface``.
|
||||
If you want to have a ``getDependencies()`` method, be sure to implement
|
||||
this interface explicitly:
|
||||
|
||||
|
||||
```diff
|
||||
+ use Doctrine\Common\DataFixtures\DependentFixtureInterface;
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
"doctrine/doctrine-bundle": "^2.2",
|
||||
"doctrine/orm": "^2.14.0 || ^3.0",
|
||||
"doctrine/persistence": "^2.4 || ^3.0",
|
||||
"psr/log": "^1 || ^2 || ^3",
|
||||
"psr/log": "^2 || ^3",
|
||||
"symfony/config": "^5.4 || ^6.0 || ^7.0",
|
||||
"symfony/console": "^5.4 || ^6.0 || ^7.0",
|
||||
"symfony/dependency-injection": "^5.4 || ^6.0 || ^7.0",
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
parameters:
|
||||
ignoreErrors:
|
||||
-
|
||||
message: '#^Method Psr\\Log\\AbstractLogger@anonymous/src/Command/LoadDataFixturesDoctrineCommand\.php\:120\:\:log\(\) has parameter \$message with no type specified\.$#'
|
||||
identifier: missingType.parameter
|
||||
count: 1
|
||||
path: src/Command/LoadDataFixturesDoctrineCommand.php
|
||||
|
||||
-
|
||||
message: '#^Method Doctrine\\Bundle\\FixturesBundle\\Loader\\SymfonyFixturesLoader\:\:createFixture\(\) has parameter \$class with no type specified\.$#'
|
||||
identifier: missingType.parameter
|
||||
count: 1
|
||||
path: src/Loader/SymfonyFixturesLoader.php
|
||||
|
||||
-
|
||||
message: '#^Constructor of class Doctrine\\Bundle\\FixturesBundle\\Tests\\Fixtures\\FooBundle\\DataFixtures\\RequiredConstructorArgsFixtures has an unused parameter \$fooRequiredArg\.$#'
|
||||
identifier: constructor.unusedParameter
|
||||
count: 1
|
||||
path: tests/Fixtures/FooBundle/DataFixtures/RequiredConstructorArgsFixtures.php
|
||||
|
||||
-
|
||||
message: '#^Method Doctrine\\Bundle\\FixturesBundle\\Tests\\IntegrationTestKernel\:\:registerBundles\(\) return type has no value type specified in iterable type array\.$#'
|
||||
identifier: missingType.iterableValue
|
||||
count: 1
|
||||
path: tests/IntegrationTestKernel.php
|
||||
@@ -4,9 +4,3 @@ parameters:
|
||||
paths:
|
||||
- src
|
||||
- tests
|
||||
excludePaths:
|
||||
# Contains an issue that cannot be ignored
|
||||
- tests/IntegrationTest.php
|
||||
|
||||
includes:
|
||||
- phpstan-baseline.neon
|
||||
|
||||
@@ -13,6 +13,7 @@ use Doctrine\Common\DataFixtures\Executor\ORMExecutor;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Psr\Log\AbstractLogger;
|
||||
use Stringable;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
@@ -123,7 +124,7 @@ final class LoadDataFixturesDoctrineCommand extends DoctrineCommand
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public function log($level, $message, array $context = []): void
|
||||
public function log(mixed $level, string|Stringable $message, array $context = []): void
|
||||
{
|
||||
$this->ui->text(sprintf(' <comment>></comment> <info>%s</info>', $message));
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ final class SymfonyFixturesLoader extends Loader
|
||||
* Overridden to not allow new fixture classes to be instantiated.
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function createFixture($class): FixtureInterface
|
||||
protected function createFixture(string $class): FixtureInterface
|
||||
{
|
||||
/*
|
||||
* We don't actually need to create the fixture. We just
|
||||
|
||||
@@ -9,7 +9,7 @@ use Doctrine\Persistence\ObjectManager;
|
||||
|
||||
class RequiredConstructorArgsFixtures implements ORMFixtureInterface
|
||||
{
|
||||
public function __construct(string $fooRequiredArg)
|
||||
public function __construct(public string $fooRequiredArg)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ use Doctrine\Persistence\ManagerRegistry;
|
||||
use Symfony\Component\Config\Loader\LoaderInterface;
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\HttpKernel\Bundle\BundleInterface;
|
||||
use Symfony\Component\HttpKernel\Kernel;
|
||||
|
||||
use function rand;
|
||||
@@ -35,6 +36,8 @@ class IntegrationTestKernel extends Kernel
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @return array<mixed, BundleInterface>
|
||||
*/
|
||||
public function registerBundles(): array
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user