Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bug #27837 [PropertyInfo] Fix dock block lookup fallback loop (DerMan…
…oMann) This PR was submitted for the 4.1 branch but it was squashed and merged into the 3.4 branch instead (closes #27837). Discussion ---------- [PropertyInfo] Fix dock block lookup fallback loop | Q | A | ------------- | --- | Branch? | 4.1 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | `getDocBlock()` in `PhpDocExtractor` implements a fallback loop when trying to lookup a dock block for a property (property, accessor method, mutator method). This relies on the individual lookups to return `null`. Unfortunately, phpDocumentor will throw an `InvalidArgumentException` exception in case there is no dock block. Currently the try/catch is wrapping the whole loop which means if the first lookup fails the loop is ended instead of moving on to the next one. This PR moves the try/catch to each individual call of `$this->docBlockFactory->create()`. Commits ------- b1a6120 [PropertyInfo] Fix dock block lookup fallback loop
- Loading branch information
Showing
3 changed files
with
109 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
src/Symfony/Component/PropertyInfo/Tests/Fixtures/DockBlockFallback.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?php | ||
|
||
namespace Symfony\Component\PropertyInfo\Tests\Fixtures; | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\PropertyInfo\Tests\Fixtures; | ||
|
||
/** | ||
* PhpDocExtractor should fallback from property -> accessor -> mutator when looking up dockblocks. | ||
* | ||
* @author Martin Rademacher <mano@radebatz.net> | ||
*/ | ||
class DockBlockFallback | ||
{ | ||
/** @var string $pub */ | ||
public $pub = 'pub'; | ||
|
||
protected $protAcc; | ||
protected $protMut; | ||
|
||
public function getPub() | ||
{ | ||
return $this->pub; | ||
} | ||
|
||
public function setPub($pub) | ||
{ | ||
$this->pub = $pub; | ||
} | ||
|
||
/** | ||
* @return int | ||
*/ | ||
public function getProtAcc() | ||
{ | ||
return $this->protAcc; | ||
} | ||
|
||
public function setProt($protAcc) | ||
{ | ||
$this->protAcc = $protAcc; | ||
} | ||
|
||
public function getProtMut() | ||
{ | ||
return $this->protMut; | ||
} | ||
|
||
/** | ||
* @param bool $protMut | ||
*/ | ||
public function setProtMut($protMut) | ||
{ | ||
$this->protMut = $protMut; | ||
} | ||
} |