Skip to content

Commit dbf3c69

Browse files
committed
typed properties and remove phpcompat from DoctrineHelper
1 parent cabeea3 commit dbf3c69

File tree

4 files changed

+6
-19
lines changed

4 files changed

+6
-19
lines changed

src/DependencyInjection/CompilerPass/SetDoctrineAnnotatedPrefixesPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function process(ContainerBuilder $container): void
6363
}
6464

6565
if (null !== $annotatedPrefixes) {
66-
$container->getDefinition('maker.doctrine_helper')->setArgument(4, $annotatedPrefixes);
66+
$container->getDefinition('maker.doctrine_helper')->setArgument(3, $annotatedPrefixes);
6767
}
6868
}
6969
}

src/Doctrine/DoctrineHelper.php

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
use Doctrine\Persistence\Mapping\Driver\MappingDriverChain;
2626
use Doctrine\Persistence\Mapping\MappingException as PersistenceMappingException;
2727
use Symfony\Bundle\MakerBundle\Util\ClassNameDetails;
28-
use Symfony\Bundle\MakerBundle\Util\PhpCompatUtil;
2928

3029
/**
3130
* @author Fabien Potencier <[email protected]>
@@ -36,24 +35,13 @@
3635
*/
3736
final class DoctrineHelper
3837
{
39-
/**
40-
* @var string
41-
*/
42-
private $entityNamespace;
43-
private $phpCompatUtil;
44-
private $registry;
45-
46-
/**
47-
* @var array|null
48-
*/
49-
private $mappingDriversByPrefix;
50-
51-
private $attributeMappingSupport;
38+
private ?ManagerRegistry $registry;
39+
private ?array $mappingDriversByPrefix;
40+
private bool $attributeMappingSupport;
5241

53-
public function __construct(string $entityNamespace, PhpCompatUtil $phpCompatUtil, ManagerRegistry $registry = null, bool $attributeMappingSupport = false, array $annotatedPrefixes = null)
42+
public function __construct(private string $entityNamespace, ManagerRegistry $registry = null, bool $attributeMappingSupport = false, array $annotatedPrefixes = null)
5443
{
5544
$this->entityNamespace = trim($entityNamespace, '\\');
56-
$this->phpCompatUtil = $phpCompatUtil;
5745
$this->registry = $registry;
5846
$this->attributeMappingSupport = $attributeMappingSupport;
5947
$this->mappingDriversByPrefix = $annotatedPrefixes;

src/Resources/config/services.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737

3838
<service id="maker.doctrine_helper" class="Symfony\Bundle\MakerBundle\Doctrine\DoctrineHelper">
3939
<argument /> <!-- entity namespace -->
40-
<argument type="service" id="maker.php_compat_util" />
4140
<argument type="service" id="doctrine" on-invalid="ignore" />
4241
<argument key="$attributeMappingSupport">%maker.compatible_check.doctrine.supports_attributes%</argument>
4342
</service>

tests/Doctrine/EntityRegeneratorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ private function doTestRegeneration(string $sourceDir, Kernel $kernel, string $n
101101
});
102102

103103
$fileManager = new FileManager($fs, $autoloaderUtil, new MakerFileLinkFormatter(null), $tmpDir);
104-
$doctrineHelper = new DoctrineHelper('App\\Entity', new PhpCompatUtil($fileManager), $container->get('doctrine'));
104+
$doctrineHelper = new DoctrineHelper('App\\Entity', $container->get('doctrine'));
105105
$phpCompatUtil = new PhpCompatUtil($fileManager);
106106
$generator = new Generator($fileManager, 'App\\', $phpCompatUtil);
107107
$entityClassGenerator = new EntityClassGenerator($generator, $doctrineHelper);

0 commit comments

Comments
 (0)