larastan: [0.5.8] Class self was not found while trying to analyse it - autoloading is probably not configured properly.
- Larastan Version: 0.5.8
--levelused: 8
Description
In a model that calls self::, Larastan/phpstan crashes:
Line xxx/Translation.php
------ --------------------------------------------------------------------------------------------------------
Class self was not found while trying to analyse it - autoloading is probably not configured properly.
💡 Learn more at https://phpstan.org/user-guide/autoloading
This used to work fine in the version we used before we updated, version v0.5.0.
Laravel code where the issue was found
public static function getGroupsByNamespace()
{
$groupsByNamespace = self
::select('group', 'namespace')
->orderBy('namespace')
->orderBy('group')
->distinct()
->get()
->groupBy('namespace');
return $groupsByNamespace;
}
It also happens with a method that uses a scope, like so:
public function scopeForContext(Builder $query, string $locale, string $namespace, string $group)
{
$query->where('locale', $locale)
->where('namespace', $namespace)
->where('group', $group);
}
public static function getGroupTranslations($locale, $group, $namespace)
{
return self::forContext($locale, $namespace, $group)
->orderBy('name', 'asc')
->get();
}
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 15 (7 by maintainers)
@johanvanhelden I think we’ll release it this week, or latest, beginning of next week.