-
Notifications
You must be signed in to change notification settings - Fork 795
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[phpstorm-stubs] WI-72923 add ObjectShape attribute
- Loading branch information
Showing
1 changed file
with
21 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
namespace JetBrains\PhpStorm; | ||
|
||
use Attribute; | ||
|
||
/** | ||
* The attribute specifies possible object field names and their types. | ||
* | ||
* If applied, an IDE will suggest the specified field names and infer the specified types. | ||
* | ||
* Example: | ||
* <pre>#[ObjectShape(["age" => "int", "name" => "string"])]</pre> | ||
* | ||
* 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>. | ||
*/ | ||
#[Attribute(Attribute::TARGET_FUNCTION|Attribute::TARGET_METHOD|Attribute::TARGET_PARAMETER|Attribute::TARGET_PROPERTY)] | ||
class ObjectShape | ||
{ | ||
public function __construct(array $shape) {} | ||
} |