Passed
Push — main ( e55545...3ca3cd )
by Pavel
01:30
created

docs/examples/Person.php (1 issue)

Labels
Severity
1
<?php
2
3
use JSONAPI\\Resource\\Attributes as JSONAPI;
0 ignored issues
show
A parse error occurred: Syntax error, unexpected T_NS_SEPARATOR, expecting T_STRING or '{' on line 3 at column 12
Loading history...
4
5
#[JSONAPI\\Resource('person')]
6
class Person {
7
8
    protected int $id;
9
10
    protected string $name;
11
12
    protected int $age;
13
14
    protected array $children;
15
16
    public function __construct(int $id, string $name, int $age, array $children = [])
17
    {
18
        $this->id = $id;
19
        $this->name = $name;
20
        $this->age = $age;
21
        $this->children = $children;
22
    }
23
24
    public function getId(): int
25
    {
26
        return $this->id;
27
    }
28
29
    #[JSONAPI\\Resource('person')]
30
    public function getName(): string
31
    {
32
        return $this->name;
33
    }
34
35
    #[JSONAPI\\Attribute('age')]
36
    public function getAge(): int
37
    {
38
        return $this->age;
39
    }
40
41
    #[JSONAPI\\Relationship('children')]
42
    public function getChildren(): array
43
    {
44
        return $this->children
45
    }
46
}
47