for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Rinvex\Repository\Exceptions;
use RuntimeException;
class EntityNotFoundException extends RuntimeException
{
/**
* Id of the affected model.
*
* @var string
*/
protected $id;
* Name of the affected model.
protected $model;
* Set the affected model.
* @param string $model
* @param int $id
* @return void
@return
Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.
Please refer to the PHP core documentation on constructors.
public function __construct($model, $id)
$this->id = $id;
$id
string
integer
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.
$answer = 42; $correct = false; $correct = (bool) $answer;
$this->model = $model;
$this->message = "No results for model [{$model}] #{$id}.";
}
* Get the affected model.
* @return string
public function getModel(): string
return $this->model;
* Get the affected model Id.
public function getId(): string
return $this->id;
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.