for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* @package Application Utils
* @subpackage Traits
* @see \AppUtils\Traits\RenderableTrait
*/
declare(strict_types=1);
namespace AppUtils\Traits;
use AppUtils\Interfaces\RenderableInterface;
use Throwable;
* Trait used to quickly implement the interface
* {@see RenderableInterface}: Only the `render()`
* method needs to be implemented.
*
* @author Sebastian Mordziol <[email protected]>
* @see RenderableInterface
trait RenderableTrait
{
public function display() : void
echo $this->render();
render()
If this is a false-positive, you can also ignore this issue in your code via the ignore-call annotation
ignore-call
echo $this->/** @scrutinizer ignore-call */ render();
}
public function __toString() : string
try
return $this->render();
catch (Throwable $e)
return sprintf(
'Exception while rendering [%s]: %s',
get_class($this),
$e->getMessage()
);