| Conditions | 2 |
| Paths | 1 |
| Total Lines | 15 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 20 | public static function findByTechnicalName(string $technicalName): Article |
||
| 21 | { |
||
| 22 | return Cache::rememberForever( |
||
| 23 | "article.findByTechnicalName.{$technicalName}", |
||
| 24 | function () use ($technicalName): Article { |
||
| 25 | $article = static::where('technical_name', $technicalName)->first(); |
||
| 26 | |||
| 27 | if ($article === null) { |
||
| 28 | throw new Exception("Article `{$technicalName}` not found"); |
||
| 29 | } |
||
| 30 | |||
| 31 | return $article; |
||
| 32 | } |
||
| 33 | ); |
||
| 34 | } |
||
| 35 | |||
| 53 |
Since your code implements the magic getter
_get, this function will be called for any read access on an undefined variable. You can add the@propertyannotation to your class or interface to document the existence of this variable.If the property has read access only, you can use the @property-read annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.