The return type ViewAwareTrait is a trait, and thus cannot be used for type-hinting in PHP. Maybe consider adding an interface and use that for type-hinting?
In PHP traits cannot be used for type-hinting as they do not define a well-defined
structure. This is because any class that uses a trait can rename that trait’s methods.
If you would like to return an object that has a guaranteed set of methods, you
could create a companion interface that lists these methods explicitly.
Loading history...
24
* @required
25
*/
26
public function setViewResolver(ViewResolver $viewResolver)
27
{
28
$this->viewResolver = $viewResolver;
29
30
return $this;
31
}
32
33
/**
34
* @param string $view A short notation view (a:b:c) "AppBundle:Default:homepage" or "homepage"
35
* (for same name view class as controller under View folder with suffix View instead of
36
* Controller for e.g. For AppBundle\Controller\DefaultController AppBundle\View\DefaultView
In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.
If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.