1 | <?php namespace Arcanedev\Composer\Entities\PackageTraits; |
||
13 | trait ReferencesTrait |
||
14 | { |
||
15 | /* ------------------------------------------------------------------------------------------------ |
||
16 | | Main Functions |
||
17 | | ------------------------------------------------------------------------------------------------ |
||
18 | */ |
||
19 | /** |
||
20 | * Update the root packages reference information. |
||
21 | * |
||
22 | * @param \Composer\Package\RootPackageInterface $root |
||
23 | */ |
||
24 | protected function mergeReferences(RootPackageInterface $root) |
||
46 | |||
47 | /** |
||
48 | * Extract vcs revision from version constraint (dev-master#abc123). |
||
49 | * @see \Composer\Package\Loader\RootPackageLoader::extractReferences() |
||
50 | * |
||
51 | * @param array $requires |
||
52 | * @param array $references |
||
53 | * |
||
54 | * @return array |
||
55 | */ |
||
56 | private function extractReferences(array $requires, array $references) |
||
70 | } |
||
71 |
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.