Skip to content

Commit

Permalink
Add deprecation to getArguments
Browse files Browse the repository at this point in the history
  • Loading branch information
jaapio committed Oct 28, 2022
1 parent 81553b5 commit 8d57d3d
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions src/DocBlock/Tags/Method.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,6 @@ final class Method extends BaseTag implements Factory\StaticMethod
/** @var string */
private $methodName;

/**
* @phpstan-var array<int, array{name: string, type: Type}>
* @var array<int, array<string, Type|string>>
*/
private $arguments;

/** @var bool */
private $isStatic;

Expand Down Expand Up @@ -89,7 +83,6 @@ public function __construct(
$arguments = $this->filterArguments($arguments);

$this->methodName = $methodName;
$this->arguments = $arguments;
$this->returnType = $returnType;
$this->isStatic = $static;
$this->description = $description;
Expand All @@ -103,7 +96,11 @@ public static function create(
?DescriptionFactory $descriptionFactory = null,
?TypeContext $context = null
): ?self {
trigger_error('Create using static factory is deprecated, this method should not be called directly by library consumers', E_USER_DEPRECATED);
trigger_error(
'Create using static factory is deprecated, this method should not be called directly
by library consumers',
E_USER_DEPRECATED
);
Assert::stringNotEmpty($body);
Assert::notNull($typeResolver);
Assert::notNull($descriptionFactory);
Expand Down Expand Up @@ -217,12 +214,21 @@ public function getMethodName(): string
}

/**
* @deprecated Method deprecated, use {@see self::getParameters()}
*
* @return array<int, array<string, Type|string>>
* @phpstan-return array<int, array{name: string, type: Type}>
*/
public function getArguments(): array
{
return $this->arguments;
trigger_error('Method deprecated, use ::getParameters()', E_USER_DEPRECATED);

return array_map(
static function (MethodParameter $methodParameter) {
return ['name' => $methodParameter->getName(), 'type' => $methodParameter->getType()];
},
$this->parameters
);
}

/** @return MethodParameter[] */
Expand Down

0 comments on commit 8d57d3d

Please sign in to comment.