Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
},
"require-dev": {
"symfony/phpunit-bridge": "^5.4 || ^6.4 || ^7.0 || ^8.0",
"symfony/form": "^5.4 || ^6.4 || ^7.0 || ^8.0",
"symfony/translation": "^5.4 || ^6.4 || ^7.0 || ^8.0",
"symfony/validator": "^5.4 || ^6.4 || ^7.0 || ^8.0",
"symfony/twig-bridge": "^5.4 || ^6.4 || ^7.0 || ^8.0",
Expand Down
16 changes: 2 additions & 14 deletions src/Visitor/Php/Symfony/FormTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ protected function loadParentInterfaces(string $parentFqcn): array
$loading[$parentFqcn] = true;

try {
$filePath = $this->findClassFile($parentFqcn);
$reflector = new \ReflectionClass($parentFqcn);
$filePath = $reflector->getFileName();

if (!$filePath || !file_exists($filePath)) {
unset($loading[$parentFqcn]);
Expand Down Expand Up @@ -111,17 +112,4 @@ protected function loadParentInterfaces(string $parentFqcn): array

return $interfaces;
}

private function findClassFile(string $fqcn): ?string
{
$autoloadFile = __DIR__.'/../../../../vendor/autoload.php';

if (!file_exists($autoloadFile)) {
return null;
}

$loader = require $autoloadFile;

return $loader->findFile($fqcn) ?: null;
}
}
5 changes: 4 additions & 1 deletion tests/Resources/Php/Symfony/ParentType.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

namespace Translation\Extractor\Tests\Resources\Php\Symfony;

class ParentType implements FormTypeInterface
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;

class ParentType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
Expand Down
Loading