This repository was archived by the owner on Jul 31, 2018. It is now read-only.
Commit 72d45cb
authored
Update AlgoliaEloquentTrait.php
See example below.
Call to static::$var fail when this trait is implemented on a parent model and the child is called.
<?php
trait T {
private static $traitVar = "trait";
public function getTraitSelf() {
return self::$traitVar;
}
public function getTraitStatic() {
return static::$traitVar;
}
}
class Person {
use T;
}
class Guest extends Person {
}
echo (new Guest())->getTraitSelf() . PHP_EOL; // Fail
echo (new Guest())->getTraitStatic() . PHP_EOL;
echo (new Person())->getTraitSelf() . PHP_EOL; // Fail
echo (new Person())->getTraitStatic() . PHP_EOL;1 parent b93988c commit 72d45cb
1 file changed
+2
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
241 | 241 | | |
242 | 242 | | |
243 | 243 | | |
244 | | - | |
245 | | - | |
| 244 | + | |
| 245 | + | |
246 | 246 | | |
247 | 247 | | |
248 | 248 | | |
| |||
0 commit comments