Skip to content

Commit

Permalink
Add native return types everywhere (#409)
Browse files Browse the repository at this point in the history
  • Loading branch information
derrabus authored Nov 11, 2023
1 parent b552b4c commit 22c1462
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 61 deletions.
35 changes: 0 additions & 35 deletions Command/CommandCompatibility.php

This file was deleted.

7 changes: 2 additions & 5 deletions Command/LoadDataFixturesDoctrineCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
*/
class LoadDataFixturesDoctrineCommand extends DoctrineCommand
{
use CommandCompatibility;

private SymfonyFixturesLoader $fixturesLoader;

/** @var PurgerFactory[] */
Expand All @@ -55,8 +53,7 @@ public function __construct(SymfonyFixturesLoader $fixturesLoader, ?ManagerRegis
$this->purgerFactories = $purgerFactories;
}

/** @return void */
protected function configure()
protected function configure(): void
{
$this
->setName('doctrine:fixtures:load')
Expand Down Expand Up @@ -92,7 +89,7 @@ protected function configure()
);
}

private function doExecute(InputInterface $input, OutputInterface $output): int
protected function execute(InputInterface $input, OutputInterface $output): int
{
$ui = new SymfonyStyle($input, $output);

Expand Down
4 changes: 1 addition & 3 deletions DependencyInjection/DoctrineFixturesExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@ class DoctrineFixturesExtension extends Extension
{
/**
* {@inheritDoc}
*
* @return void
*/
public function load(array $configs, ContainerBuilder $container)
public function load(array $configs, ContainerBuilder $container): void
{
$loader = new XmlFileLoader($container, new FileLocator(dirname(__DIR__) . '/Resources/config'));

Expand Down
3 changes: 1 addition & 2 deletions DoctrineFixturesBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@

class DoctrineFixturesBundle extends Bundle
{
/** @return void */
public function build(ContainerBuilder $container)
public function build(ContainerBuilder $container): void
{
$container->addCompilerPass(new FixturesCompilerPass());
$container->addCompilerPass(new PurgerFactoryCompilerPass());
Expand Down
3 changes: 1 addition & 2 deletions Purger/ORMPurgerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace Doctrine\Bundle\FixturesBundle\Purger;

use Doctrine\Common\DataFixtures\Purger\ORMPurger;
use Doctrine\Common\DataFixtures\Purger\PurgerInterface;
use Doctrine\ORM\EntityManagerInterface;

final class ORMPurgerFactory implements PurgerFactory
Expand All @@ -18,7 +17,7 @@ public function createForEntityManager(
EntityManagerInterface $em,
array $excluded = [],
bool $purgeWithTruncate = false
): PurgerInterface {
): ORMPurger {
$purger = new ORMPurger($em, $excluded);
$purger->setPurgeMode($purgeWithTruncate ? ORMPurger::PURGE_MODE_TRUNCATE : ORMPurger::PURGE_MODE_DELETE);

Expand Down
3 changes: 1 addition & 2 deletions Tests/IntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,5 @@ public function testRunCommandWithPurgeMode(): void

interface ForwardCompatibleEntityManager extends EntityManagerInterface
{
/** @return mixed */
public function wrapInTransaction(callable $func);
public function wrapInTransaction(callable $func): mixed;
}
5 changes: 1 addition & 4 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@
<file>.</file>
<exclude-pattern>/vendor</exclude-pattern>

<rule ref="Doctrine">
<exclude name="SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint"/>
<exclude name="SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingNativeTypeHint"/>
</rule>
<rule ref="Doctrine" />


<rule ref="SlevomatCodingStandard.Classes.SuperfluousInterfaceNaming.SuperfluousSuffix">
Expand Down
8 changes: 0 additions & 8 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,4 @@
<directory name="vendor" />
</ignoreFiles>
</projectFiles>

<issueHandlers>
<DuplicateClass>
<errorLevel type="suppress">
<file name="Command/CommandCompatibility.php"/>
</errorLevel>
</DuplicateClass>
</issueHandlers>
</psalm>

0 comments on commit 22c1462

Please sign in to comment.