Last active
December 12, 2022 15:35
-
-
Save azjezz/60797bb5538e5e1f16d0473407d80eec to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<?php | |
declare(strict_types=1); | |
namespace App; | |
enum ArticleStatus { | |
case Published; | |
case Draft; | |
case Archived; | |
case Deleted; | |
case Scheduled; | |
} | |
#[Entity('article_authors')] | |
final class ArticleAuthor { | |
public function __construct( | |
public readonly string $name, | |
public readonly string $email, | |
) {} | |
} | |
#[Entity('articles')] | |
final class Article { | |
public function __construct( | |
public readonly string $uuid, | |
public readonly string $title, | |
public readonly string $content, | |
public readonly ArticleAuthor $author, | |
public readonly ArticleStatus $status, | |
) {} | |
} |
This file contains hidden or 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
[ | |
{ | |
"type": "declare", | |
"value": { | |
"span": [ | |
3, | |
1 | |
], | |
"entries": { | |
"start": [ | |
3, | |
8 | |
], | |
"end": [ | |
3, | |
23 | |
], | |
"entries": [ | |
{ | |
"key": { | |
"span": [ | |
3, | |
9 | |
], | |
"value": "strict_types" | |
}, | |
"span": [ | |
3, | |
21 | |
], | |
"value": { | |
"type": "literal_integer", | |
"value": { | |
"span": [ | |
3, | |
22 | |
], | |
"value": "1" | |
} | |
} | |
} | |
] | |
}, | |
"body": { | |
"noop": { | |
"span": [ | |
3, | |
24 | |
] | |
} | |
} | |
} | |
}, | |
{ | |
"type": "namespace", | |
"value": { | |
"type": "unbraced", | |
"value": { | |
"start": [ | |
5, | |
1 | |
], | |
"end": [ | |
5, | |
14 | |
], | |
"name": { | |
"span": [ | |
5, | |
11 | |
], | |
"value": "App" | |
}, | |
"statements": [ | |
{ | |
"type": "unit_enum", | |
"value": { | |
"span": [ | |
7, | |
1 | |
], | |
"name": { | |
"span": [ | |
7, | |
6 | |
], | |
"value": "ArticleStatus" | |
}, | |
"attributes": [], | |
"implements": [], | |
"body": { | |
"start": [ | |
7, | |
20 | |
], | |
"end": [ | |
13, | |
1 | |
], | |
"members": [ | |
{ | |
"type": "case", | |
"value": { | |
"start": [ | |
8, | |
5 | |
], | |
"end": [ | |
8, | |
19 | |
], | |
"attributes": [], | |
"name": { | |
"span": [ | |
8, | |
10 | |
], | |
"value": "Published" | |
} | |
} | |
}, | |
{ | |
"type": "case", | |
"value": { | |
"start": [ | |
9, | |
5 | |
], | |
"end": [ | |
9, | |
15 | |
], | |
"attributes": [], | |
"name": { | |
"span": [ | |
9, | |
10 | |
], | |
"value": "Draft" | |
} | |
} | |
}, | |
{ | |
"type": "case", | |
"value": { | |
"start": [ | |
10, | |
5 | |
], | |
"end": [ | |
10, | |
18 | |
], | |
"attributes": [], | |
"name": { | |
"span": [ | |
10, | |
10 | |
], | |
"value": "Archived" | |
} | |
} | |
}, | |
{ | |
"type": "case", | |
"value": { | |
"start": [ | |
11, | |
5 | |
], | |
"end": [ | |
11, | |
17 | |
], | |
"attributes": [], | |
"name": { | |
"span": [ | |
11, | |
10 | |
], | |
"value": "Deleted" | |
} | |
} | |
}, | |
{ | |
"type": "case", | |
"value": { | |
"start": [ | |
12, | |
5 | |
], | |
"end": [ | |
12, | |
19 | |
], | |
"attributes": [], | |
"name": { | |
"span": [ | |
12, | |
10 | |
], | |
"value": "Scheduled" | |
} | |
} | |
} | |
] | |
} | |
} | |
}, | |
{ | |
"type": "class", | |
"value": { | |
"span": [ | |
16, | |
7 | |
], | |
"name": { | |
"span": [ | |
16, | |
13 | |
], | |
"value": "ArticleAuthor" | |
}, | |
"modifiers": [ | |
{ | |
"type": "final", | |
"value": { | |
"start": [ | |
16, | |
1 | |
], | |
"end": [ | |
16, | |
7 | |
] | |
} | |
} | |
], | |
"extends": null, | |
"implements": null, | |
"attributes": [ | |
{ | |
"start": [ | |
15, | |
1 | |
], | |
"end": [ | |
15, | |
28 | |
], | |
"members": [ | |
{ | |
"start": [ | |
15, | |
3 | |
], | |
"end": [ | |
15, | |
28 | |
], | |
"expression": { | |
"type": "call", | |
"value": { | |
"target": { | |
"type": "identifier", | |
"value": { | |
"type": "simple_identifier", | |
"value": { | |
"span": [ | |
15, | |
3 | |
], | |
"value": "Entity" | |
} | |
} | |
}, | |
"args": [ | |
{ | |
"name": null, | |
"value": { | |
"type": "literal_string", | |
"value": { | |
"span": [ | |
15, | |
10 | |
], | |
"value": "article_authors" | |
} | |
}, | |
"unpack": false | |
} | |
] | |
} | |
} | |
} | |
] | |
} | |
], | |
"body": { | |
"start": [ | |
16, | |
27 | |
], | |
"end": [ | |
21, | |
1 | |
], | |
"members": [ | |
{ | |
"type": "method", | |
"value": { | |
"start": [ | |
17, | |
12 | |
], | |
"end": [ | |
20, | |
8 | |
], | |
"name": { | |
"span": [ | |
17, | |
21 | |
], | |
"value": "__construct" | |
}, | |
"attributes": [], | |
"parameters": { | |
"start": [ | |
17, | |
32 | |
], | |
"end": [ | |
20, | |
7 | |
], | |
"members": [ | |
{ | |
"start": [ | |
18, | |
9 | |
], | |
"end": [ | |
18, | |
37 | |
], | |
"name": { | |
"span": [ | |
18, | |
32 | |
], | |
"name": "name" | |
}, | |
"attributes": [], | |
"type": { | |
"type": "string" | |
}, | |
"variadic": false, | |
"default": null, | |
"modifiers": [ | |
{ | |
"type": "public", | |
"value": { | |
"start": [ | |
18, | |
9 | |
], | |
"end": [ | |
18, | |
16 | |
] | |
} | |
}, | |
{ | |
"type": "readonly", | |
"value": { | |
"start": [ | |
18, | |
16 | |
], | |
"end": [ | |
18, | |
25 | |
] | |
} | |
} | |
], | |
"by_ref": false | |
}, | |
{ | |
"start": [ | |
19, | |
9 | |
], | |
"end": [ | |
19, | |
38 | |
], | |
"name": { | |
"span": [ | |
19, | |
32 | |
], | |
"name": "email" | |
}, | |
"attributes": [], | |
"type": { | |
"type": "string" | |
}, | |
"variadic": false, | |
"default": null, | |
"modifiers": [ | |
{ | |
"type": "public", | |
"value": { | |
"start": [ | |
19, | |
9 | |
], | |
"end": [ | |
19, | |
16 | |
] | |
} | |
}, | |
{ | |
"type": "readonly", | |
"value": { | |
"start": [ | |
19, | |
16 | |
], | |
"end": [ | |
19, | |
25 | |
] | |
} | |
} | |
], | |
"by_ref": false | |
} | |
] | |
}, | |
"body": [], | |
"modifiers": [ | |
{ | |
"type": "public", | |
"value": { | |
"start": [ | |
17, | |
5 | |
], | |
"end": [ | |
17, | |
12 | |
] | |
} | |
} | |
], | |
"return_type": null, | |
"by_ref": false | |
} | |
} | |
] | |
} | |
} | |
}, | |
{ | |
"type": "class", | |
"value": { | |
"span": [ | |
24, | |
7 | |
], | |
"name": { | |
"span": [ | |
24, | |
13 | |
], | |
"value": "Article" | |
}, | |
"modifiers": [ | |
{ | |
"type": "final", | |
"value": { | |
"start": [ | |
24, | |
1 | |
], | |
"end": [ | |
24, | |
7 | |
] | |
} | |
} | |
], | |
"extends": null, | |
"implements": null, | |
"attributes": [ | |
{ | |
"start": [ | |
23, | |
1 | |
], | |
"end": [ | |
23, | |
21 | |
], | |
"members": [ | |
{ | |
"start": [ | |
23, | |
3 | |
], | |
"end": [ | |
23, | |
21 | |
], | |
"expression": { | |
"type": "call", | |
"value": { | |
"target": { | |
"type": "identifier", | |
"value": { | |
"type": "simple_identifier", | |
"value": { | |
"span": [ | |
23, | |
3 | |
], | |
"value": "Entity" | |
} | |
} | |
}, | |
"args": [ | |
{ | |
"name": null, | |
"value": { | |
"type": "literal_string", | |
"value": { | |
"span": [ | |
23, | |
10 | |
], | |
"value": "articles" | |
} | |
}, | |
"unpack": false | |
} | |
] | |
} | |
} | |
} | |
] | |
} | |
], | |
"body": { | |
"start": [ | |
24, | |
21 | |
], | |
"end": [ | |
32, | |
1 | |
], | |
"members": [ | |
{ | |
"type": "method", | |
"value": { | |
"start": [ | |
25, | |
12 | |
], | |
"end": [ | |
31, | |
8 | |
], | |
"name": { | |
"span": [ | |
25, | |
21 | |
], | |
"value": "__construct" | |
}, | |
"attributes": [], | |
"parameters": { | |
"start": [ | |
25, | |
32 | |
], | |
"end": [ | |
31, | |
7 | |
], | |
"members": [ | |
{ | |
"start": [ | |
26, | |
9 | |
], | |
"end": [ | |
26, | |
37 | |
], | |
"name": { | |
"span": [ | |
26, | |
32 | |
], | |
"name": "uuid" | |
}, | |
"attributes": [], | |
"type": { | |
"type": "string" | |
}, | |
"variadic": false, | |
"default": null, | |
"modifiers": [ | |
{ | |
"type": "public", | |
"value": { | |
"start": [ | |
26, | |
9 | |
], | |
"end": [ | |
26, | |
16 | |
] | |
} | |
}, | |
{ | |
"type": "readonly", | |
"value": { | |
"start": [ | |
26, | |
16 | |
], | |
"end": [ | |
26, | |
25 | |
] | |
} | |
} | |
], | |
"by_ref": false | |
}, | |
{ | |
"start": [ | |
27, | |
9 | |
], | |
"end": [ | |
27, | |
38 | |
], | |
"name": { | |
"span": [ | |
27, | |
32 | |
], | |
"name": "title" | |
}, | |
"attributes": [], | |
"type": { | |
"type": "string" | |
}, | |
"variadic": false, | |
"default": null, | |
"modifiers": [ | |
{ | |
"type": "public", | |
"value": { | |
"start": [ | |
27, | |
9 | |
], | |
"end": [ | |
27, | |
16 | |
] | |
} | |
}, | |
{ | |
"type": "readonly", | |
"value": { | |
"start": [ | |
27, | |
16 | |
], | |
"end": [ | |
27, | |
25 | |
] | |
} | |
} | |
], | |
"by_ref": false | |
}, | |
{ | |
"start": [ | |
28, | |
9 | |
], | |
"end": [ | |
28, | |
40 | |
], | |
"name": { | |
"span": [ | |
28, | |
32 | |
], | |
"name": "content" | |
}, | |
"attributes": [], | |
"type": { | |
"type": "string" | |
}, | |
"variadic": false, | |
"default": null, | |
"modifiers": [ | |
{ | |
"type": "public", | |
"value": { | |
"start": [ | |
28, | |
9 | |
], | |
"end": [ | |
28, | |
16 | |
] | |
} | |
}, | |
{ | |
"type": "readonly", | |
"value": { | |
"start": [ | |
28, | |
16 | |
], | |
"end": [ | |
28, | |
25 | |
] | |
} | |
} | |
], | |
"by_ref": false | |
}, | |
{ | |
"start": [ | |
29, | |
9 | |
], | |
"end": [ | |
29, | |
46 | |
], | |
"name": { | |
"span": [ | |
29, | |
39 | |
], | |
"name": "author" | |
}, | |
"attributes": [], | |
"type": { | |
"type": "identifier", | |
"value": { | |
"span": [ | |
29, | |
25 | |
], | |
"value": "ArticleAuthor" | |
} | |
}, | |
"variadic": false, | |
"default": null, | |
"modifiers": [ | |
{ | |
"type": "public", | |
"value": { | |
"start": [ | |
29, | |
9 | |
], | |
"end": [ | |
29, | |
16 | |
] | |
} | |
}, | |
{ | |
"type": "readonly", | |
"value": { | |
"start": [ | |
29, | |
16 | |
], | |
"end": [ | |
29, | |
25 | |
] | |
} | |
} | |
], | |
"by_ref": false | |
}, | |
{ | |
"start": [ | |
30, | |
9 | |
], | |
"end": [ | |
30, | |
46 | |
], | |
"name": { | |
"span": [ | |
30, | |
39 | |
], | |
"name": "status" | |
}, | |
"attributes": [], | |
"type": { | |
"type": "identifier", | |
"value": { | |
"span": [ | |
30, | |
25 | |
], | |
"value": "ArticleStatus" | |
} | |
}, | |
"variadic": false, | |
"default": null, | |
"modifiers": [ | |
{ | |
"type": "public", | |
"value": { | |
"start": [ | |
30, | |
9 | |
], | |
"end": [ | |
30, | |
16 | |
] | |
} | |
}, | |
{ | |
"type": "readonly", | |
"value": { | |
"start": [ | |
30, | |
16 | |
], | |
"end": [ | |
30, | |
25 | |
] | |
} | |
} | |
], | |
"by_ref": false | |
} | |
] | |
}, | |
"body": [], | |
"modifiers": [ | |
{ | |
"type": "public", | |
"value": { | |
"start": [ | |
25, | |
5 | |
], | |
"end": [ | |
25, | |
12 | |
] | |
} | |
} | |
], | |
"return_type": null, | |
"by_ref": false | |
} | |
} | |
] | |
} | |
} | |
} | |
] | |
} | |
} | |
} | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment