Skip to content

Commit 8d57d3d

Browse files
committed
Add deprecation to getArguments
1 parent 81553b5 commit 8d57d3d

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

src/DocBlock/Tags/Method.php

+15-9
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,6 @@ final class Method extends BaseTag implements Factory\StaticMethod
4949
/** @var string */
5050
private $methodName;
5151

52-
/**
53-
* @phpstan-var array<int, array{name: string, type: Type}>
54-
* @var array<int, array<string, Type|string>>
55-
*/
56-
private $arguments;
57-
5852
/** @var bool */
5953
private $isStatic;
6054

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

9185
$this->methodName = $methodName;
92-
$this->arguments = $arguments;
9386
$this->returnType = $returnType;
9487
$this->isStatic = $static;
9588
$this->description = $description;
@@ -103,7 +96,11 @@ public static function create(
10396
?DescriptionFactory $descriptionFactory = null,
10497
?TypeContext $context = null
10598
): ?self {
106-
trigger_error('Create using static factory is deprecated, this method should not be called directly by library consumers', E_USER_DEPRECATED);
99+
trigger_error(
100+
'Create using static factory is deprecated, this method should not be called directly
101+
by library consumers',
102+
E_USER_DEPRECATED
103+
);
107104
Assert::stringNotEmpty($body);
108105
Assert::notNull($typeResolver);
109106
Assert::notNull($descriptionFactory);
@@ -217,12 +214,21 @@ public function getMethodName(): string
217214
}
218215

219216
/**
217+
* @deprecated Method deprecated, use {@see self::getParameters()}
218+
*
220219
* @return array<int, array<string, Type|string>>
221220
* @phpstan-return array<int, array{name: string, type: Type}>
222221
*/
223222
public function getArguments(): array
224223
{
225-
return $this->arguments;
224+
trigger_error('Method deprecated, use ::getParameters()', E_USER_DEPRECATED);
225+
226+
return array_map(
227+
static function (MethodParameter $methodParameter) {
228+
return ['name' => $methodParameter->getName(), 'type' => $methodParameter->getType()];
229+
},
230+
$this->parameters
231+
);
226232
}
227233

228234
/** @return MethodParameter[] */

0 commit comments

Comments
 (0)