Intelephense flags reference in a trait to a local const as an error. The const has to be in the "using" class since trait do not support constants.
I am using the "free" version. I do not know if is an error in the licensed version.
<?php
namespace app\validnamespace;
/**
* this trait is used in SomeUsefulClass which has a public const NOTFOUND = 'Not found';
*//
trait SomeUsefulTrait
{
public function someUsefulMethod(): string
{
// this will _not_ pass intelephense
$var = static::NOTFOUND;
// this will _not_ pass intelephense
$var = self::NOTFOUND;
// this _will_ pass intelephense
$var = SomeUsefulClass::NOTFOUND;
return $var;
}
}
Intelephense flags reference in a trait to a local const as an error. The const has to be in the "using" class since trait do not support constants.
I am using the "free" version. I do not know if is an error in the licensed version.