| Conditions | 3 | 
| Paths | 2 | 
| Total Lines | 10 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
| 1 | <?php | ||
| 16 | public function links($controller = null, $parameters = null): LinkResource | ||
| 17 |     { | ||
| 18 | $resource = LinkResource::create($this->resource, LinkResourceType::ITEM)->link($controller, $parameters); | ||
|  | |||
| 19 | |||
| 20 |         if (property_exists($this, 'withCollectionLinks') && $this->withCollectionLinks === true) { | ||
| 21 | $resource->withCollectionLinks(); | ||
| 22 | } | ||
| 23 | |||
| 24 | return $resource; | ||
| 25 | } | ||
| 26 | |||
| 38 | 
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: