Skip to content
Permalink
Browse files

bug #30294 [FrameworkBundle] Fix Descriptor throwing on non existent …

…parent (GuilhemN)

This PR was merged into the 4.2 branch.

Discussion
----------

[FrameworkBundle] Fix Descriptor throwing on non existent parent

| Q             | A
| ------------- | ---
| Branch?       | 4.2
| Bug fix?      | yes
| New feature?  | no <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | nelmio/NelmioApiDocBundle#1470  <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        |

The Descriptor throws an exception when it encounters a class having a non existent parent, see nelmio/NelmioApiDocBundle#1470 for the record.

<!--
Write a short README entry for your feature/bugfix here (replace this comment block.)
This will help people understand your PR and can be used as a start of the Doc PR.
Additionally:
 - Bug fixes must be submitted against the lowest branch where they apply
   (lowest branches are regularly merged to upper ones so they get the fixes too).
 - Features and deprecations must be submitted against the master branch.
-->

Commits
-------

6b354cc Fix Descriptor throwing on non existent parent
  • Loading branch information...
nicolas-grekas committed Feb 20, 2019
2 parents 822867d + 6b354cc commit 424773da1f650a003de49518ba9753cb3adaff4d
Showing with 6 additions and 0 deletions.
  1. +6 −0 src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php
@@ -11,6 +11,7 @@
namespace Symfony\Bundle\FrameworkBundle\Console\Descriptor;
use Symfony\Component\Config\Resource\ClassExistenceResource;
use Symfony\Component\Console\Descriptor\DescriptorInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\DependencyInjection\Alias;
@@ -292,6 +293,11 @@ public static function getClassDescription(string $class, string &$resolvedClass
{
$resolvedClass = $class;
try {
$resource = new ClassExistenceResource($class, false);
// isFresh() will explode ONLY if a parent class/trait does not exist
$resource->isFresh(0);
$r = new \ReflectionClass($class);
$resolvedClass = $r->name;

0 comments on commit 424773d

Please sign in to comment.
You can’t perform that action at this time.