Make unit tests working

This commit is contained in:
Eric Espie
2025-10-02 09:48:22 +02:00
parent 0ea0da525e
commit 39fd879ca9
83 changed files with 1924 additions and 262 deletions

View File

@@ -60,7 +60,7 @@ class PhpDocExtractor implements PropertyDescriptionExtractorInterface, Property
public function __construct(?DocBlockFactoryInterface $docBlockFactory = null, ?array $mutatorPrefixes = null, ?array $accessorPrefixes = null, ?array $arrayMutatorPrefixes = null)
{
if (!class_exists(DocBlockFactory::class)) {
throw new \LogicException(sprintf('Unable to use the "%s" class as the "phpdocumentor/reflection-docblock" package is not installed. Try running composer require "phpdocumentor/reflection-docblock".', __CLASS__));
throw new \LogicException(\sprintf('Unable to use the "%s" class as the "phpdocumentor/reflection-docblock" package is not installed. Try running composer require "phpdocumentor/reflection-docblock".', __CLASS__));
}
$this->docBlockFactory = $docBlockFactory ?: DocBlockFactory::createInstance();
@@ -73,7 +73,7 @@ class PhpDocExtractor implements PropertyDescriptionExtractorInterface, Property
public function getShortDescription(string $class, string $property, array $context = []): ?string
{
/** @var $docBlock DocBlock */
/** @var DocBlock $docBlock */
[$docBlock] = $this->getDocBlock($class, $property);
if (!$docBlock) {
return null;
@@ -100,7 +100,7 @@ class PhpDocExtractor implements PropertyDescriptionExtractorInterface, Property
public function getLongDescription(string $class, string $property, array $context = []): ?string
{
/** @var $docBlock DocBlock */
/** @var DocBlock $docBlock */
[$docBlock] = $this->getDocBlock($class, $property);
if (!$docBlock) {
return null;
@@ -113,7 +113,7 @@ class PhpDocExtractor implements PropertyDescriptionExtractorInterface, Property
public function getTypes(string $class, string $property, array $context = []): ?array
{
/** @var $docBlock DocBlock */
/** @var DocBlock $docBlock */
[$docBlock, $source, $prefix] = $this->getDocBlock($class, $property);
if (!$docBlock) {
return null;
@@ -221,7 +221,7 @@ class PhpDocExtractor implements PropertyDescriptionExtractorInterface, Property
*/
private function getDocBlock(string $class, string $property): array
{
$propertyHash = sprintf('%s::%s', $class, $property);
$propertyHash = \sprintf('%s::%s', $class, $property);
if (isset($this->docBlocks[$propertyHash])) {
return $this->docBlocks[$propertyHash];