ObjectShape.php 726 B

123456789101112131415161718192021
  1. <?php
  2. namespace JetBrains\PhpStorm;
  3. use Attribute;
  4. /**
  5. * The attribute specifies possible object field names and their types.
  6. *
  7. * If applied, an IDE will suggest the specified field names and infer the specified types.
  8. *
  9. * Example:
  10. * <pre>#[ObjectShape(["age" => "int", "name" => "string"])]</pre>
  11. *
  12. * This usage applied on an element effectively means that the object has 2 fields, the names are <code>"age"</code> and <code>"name"</code>, and the corresponding types are <code>"int"</code> and <code>"string"</code>.
  13. */
  14. #[Attribute(Attribute::TARGET_FUNCTION|Attribute::TARGET_METHOD|Attribute::TARGET_PARAMETER|Attribute::TARGET_PROPERTY)]
  15. class ObjectShape
  16. {
  17. public function __construct(array $shape) {}
  18. }