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
ArrayOf.php
32 lines
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Automattic\WooCommerce\Api\Attributes; |
| 6 | |
| 7 | use Attribute; |
| 8 | |
| 9 | /** |
| 10 | * Declares the element type for an array-typed property or return value. |
| 11 | * |
| 12 | * PHP arrays are untyped, so the builder cannot infer the element type via |
| 13 | * reflection. Apply this attribute to tell the builder what GraphQL list type |
| 14 | * to generate (e.g. `[Int!]`, `[String!]`). |
| 15 | * |
| 16 | * Example: `#[ArrayOf('int')]` on a `array $product_ids` property produces |
| 17 | * the GraphQL type `[Int!]!`. |
| 18 | */ |
| 19 | #[Attribute] |
| 20 | final class ArrayOf { |
| 21 | /** |
| 22 | * Constructor. |
| 23 | * |
| 24 | * @param string $type A scalar name ('int', 'string', 'float', 'bool') or |
| 25 | * a fully-qualified class name for output/enum types. |
| 26 | */ |
| 27 | public function __construct( |
| 28 | public readonly string $type, |
| 29 | ) { |
| 30 | } |
| 31 | } |
| 32 |