1 | <?php |
||
18 | class SpaceShip |
||
19 | { |
||
20 | use BusinessEntityTrait; |
||
21 | use Translatable; |
||
22 | |||
23 | /** |
||
24 | * @var int |
||
25 | * |
||
26 | * @ORM\Column(name="id", type="integer") |
||
27 | * @ORM\Id |
||
28 | * @ORM\GeneratedValue(strategy="AUTO") |
||
29 | */ |
||
30 | private $id; |
||
31 | |||
32 | /** |
||
33 | * @return int |
||
34 | */ |
||
35 | public function getId() |
||
39 | |||
40 | public function __toString() |
||
44 | |||
45 | public function getName() |
||
49 | |||
50 | public function setName($name, $locale = null) |
||
55 | |||
56 | public function getSlug() |
||
60 | |||
61 | public function setSlug($slug, $locale = null) |
||
66 | } |
||
67 |
This check looks for methods that are used by a trait but not required by it.
To illustrate, let’s look at the following code example
The trait
Idable
provides a methodequalsId
that in turn relies on the methodgetId()
. If this method does not exist on a class mixing in this trait, the method will fail.Adding the
getId()
as an abstract method to the trait will make sure it is available.