Skip to content

Commit 951dbff

Browse files
authored
Merge pull request #179 from dunglas/fix-entity-regenerator-test
Fix the EntityRegenerator on Mac
2 parents 5110979 + 463c53a commit 951dbff

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

.php_cs.dist

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,18 @@
33
if (!file_exists(__DIR__.'/src')) {
44
exit(0);
55
}
6+
7+
$finder = PhpCsFixer\Finder::create()
8+
->in(__DIR__.'/src')
9+
// the PHP template files are a bit special
10+
->notName('*.tpl.php')
11+
;
12+
13+
if (\PHP_VERSION_ID < 70100) {
14+
// EntityRegenerator works only with PHP 7.1+
15+
$finder->notName('EntityRegenerator.php');
16+
}
17+
618
return PhpCsFixer\Config::create()
719
->setRules(array(
820
'@Symfony' => true,
@@ -22,10 +34,5 @@ EOF
2234
]
2335
))
2436
->setRiskyAllowed(true)
25-
->setFinder(
26-
PhpCsFixer\Finder::create()
27-
->in(__DIR__.'/src')
28-
// the PHP template files are a bit special
29-
->notName('*.tpl.php')
30-
)
37+
->setFinder($finder)
3138
;

src/Doctrine/EntityRegenerator.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Bundle\MakerBundle\Doctrine;
1313

14+
use Doctrine\Common\Persistence\Mapping\MappingException as CommonMappingException;
1415
use Doctrine\ORM\Mapping\ClassMetadata;
1516
use Doctrine\ORM\Mapping\MappingException;
1617
use Symfony\Bundle\MakerBundle\Exception\RuntimeCommandException;
@@ -43,7 +44,7 @@ public function regenerateEntities(string $classOrNamespace)
4344
{
4445
try {
4546
$metadata = $this->doctrineHelper->getMetadata($classOrNamespace);
46-
} catch (MappingException $mappingException) {
47+
} catch (MappingException | CommonMappingException $mappingException) {
4748
$metadata = $this->doctrineHelper->getMetadata($classOrNamespace, true);
4849
}
4950

0 commit comments

Comments
 (0)