Skip to content

Commit

Permalink
Add missing type declarations and phpdoc
Browse files Browse the repository at this point in the history
  • Loading branch information
greg0ire committed Nov 30, 2024
1 parent 347d92d commit fe0a2a2
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 35 deletions.
9 changes: 7 additions & 2 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -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.

## Mandatory ManagerRegistry argument

It is now mandatory to pass a `ManagerRegistry` instance to the constructor of
Expand Down Expand Up @@ -34,7 +39,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
{
Expand All @@ -56,7 +61,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;

Expand Down
25 changes: 0 additions & 25 deletions phpstan-baseline.neon

This file was deleted.

6 changes: 0 additions & 6 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,3 @@ parameters:
paths:
- src
- tests
excludePaths:
# Contains an issue that cannot be ignored
- tests/IntegrationTest.php

includes:
- phpstan-baseline.neon
3 changes: 2 additions & 1 deletion src/Command/LoadDataFixturesDoctrineCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
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;
Expand Down Expand Up @@ -123,7 +124,7 @@ public function __construct(private SymfonyStyle $ui)
}

/** {@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));
}
Expand Down
2 changes: 1 addition & 1 deletion src/Loader/SymfonyFixturesLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function addFixture(FixtureInterface $fixture): void
* 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

class RequiredConstructorArgsFixtures implements ORMFixtureInterface
{
/** @phpstan-ignore constructor.unusedParameter */
public function __construct(string $fooRequiredArg)
{
}
Expand Down
3 changes: 3 additions & 0 deletions tests/IntegrationTestKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
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;
Expand All @@ -35,6 +36,8 @@ protected function getContainerClass(): string

/**
* {@inheritDoc}
*
* @return array<mixed, BundleInterface>
*/
public function registerBundles(): array
{
Expand Down

0 comments on commit fe0a2a2

Please sign in to comment.