ArrayOf.php
2 months ago
ConnectionOf.php
2 months ago
Deprecated.php
2 months ago
Description.php
2 months ago
Experimental.php
4 weeks ago
HiddenFromMetadataQuery.php
4 weeks ago
Ignore.php
2 months ago
Internal.php
4 weeks ago
Metadata.php
4 weeks ago
Name.php
2 months ago
Parameter.php
2 months ago
ParameterDescription.php
2 months ago
PublicAccess.php
4 weeks ago
RequiredCapability.php
4 weeks ago
ReturnType.php
2 months ago
ScalarType.php
2 months ago
Unroll.php
2 months ago
ParameterDescription.php
34 lines
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Automattic\WooCommerce\Api\Attributes; |
| 6 | |
| 7 | use Attribute; |
| 8 | |
| 9 | /** |
| 10 | * Adds a description to a query/mutation argument without overriding its type. |
| 11 | * |
| 12 | * Sets the description for a query/mutation argument. Can be used both for |
| 13 | * arguments inferred from the `execute()` method signature and for arguments |
| 14 | * declared via #[Parameter]. However, a parameter must not have a description |
| 15 | * in both #[Parameter] and #[ParameterDescription] — that is a build error. |
| 16 | * This attribute is repeatable: apply it once per argument that needs a |
| 17 | * description. |
| 18 | */ |
| 19 | #[Attribute( Attribute::TARGET_ALL | Attribute::IS_REPEATABLE )] |
| 20 | final class ParameterDescription { |
| 21 | /** |
| 22 | * Constructor. |
| 23 | * |
| 24 | * @param string $name The argument name (must match the `execute()` |
| 25 | * parameter name). |
| 26 | * @param string $description Human-readable description for the schema. |
| 27 | */ |
| 28 | public function __construct( |
| 29 | public readonly string $name, |
| 30 | public readonly string $description, |
| 31 | ) { |
| 32 | } |
| 33 | } |
| 34 |