Make phpstan happier

This commit is contained in:
Greyscale 2020-08-31 20:57:20 +02:00
parent 1b049d46a1
commit 8ec035c2ce
4 changed files with 15 additions and 27 deletions

View file

@ -4,7 +4,7 @@ namespace Benzine\Controllers;
use Benzine\Controllers\Filters\Filter;
use Benzine\Exceptions\FilterDecodeException;
use Benzine\ORM\Abstracts\Service;
use Benzine\ORM\Abstracts\AbstractService;
use Monolog\Logger;
use Slim\Psr7\Request;
use Slim\Psr7\Response;
@ -12,7 +12,7 @@ use Slim\Psr7\Response;
abstract class Controller
{
protected Logger $logger;
protected Service $service;
protected AbstractService $service;
protected bool $apiExplorerEnabled = true;
public function __construct(Logger $logger)
@ -21,12 +21,12 @@ abstract class Controller
$this->logger->debug(sprintf('Entered Controller in %sms', number_format((microtime(true) - $_SERVER['REQUEST_TIME_FLOAT']) * 1000, 2)));
}
public function getService(): Service
public function getService(): AbstractService
{
return $this->service;
}
public function setService(Service $service): self
public function setService(AbstractService $service): self
{
$this->service = $service;

View file

@ -83,13 +83,15 @@ class ConfigurationService
protected function setupDefines(): void
{
if (defined('APP_ROOT')) {
return;
if (!defined('APP_ROOT')) {
define('APP_ROOT', $this->appRoot);
}
if (!defined('APP_NAME')) {
define('APP_NAME', $this->get('application/name'));
}
if (!defined('APP_START')) {
define('APP_START', microtime(true));
}
define('APP_ROOT', $this->appRoot);
define('APP_NAME', $this->get('application/name'));
define('APP_START', microtime(true));
}
/**

View file

@ -2,7 +2,7 @@
namespace Benzine\Workers;
use Benzine\ORM\Abstracts\Model;
use Benzine\ORM\Abstracts\AbstractModel;
class WorkerWorkItem
{
@ -67,7 +67,7 @@ class WorkerWorkItem
public function getKey(string $key)
{
if ($this->data[$key] instanceof Model) {
if ($this->data[$key] instanceof AbstractModel) {
$this->data[$key]->__setUp();
}

View file

@ -11,26 +11,12 @@ abstract class BaseTestCase extends TestCase
{
// Set this to true if you want to see whats going on inside some unit tests..
public const DEBUG_MODE = false;
/**
* @see https://github.com/fzaninotto/Faker
*
* @var Generator
*/
private static $faker;
private $app;
private $container;
private $singleTestTime;
private $waypoint_count;
private $waypoint_last_time;
private static Generator $faker;
public function __construct($name = null, array $data = [], $dataName = '')
{
parent::__construct($name, $data, $dataName);
// @var \Slim\App $app
// Force Kint into CLI mode.
\Kint::$mode_default = \Kint::MODE_CLI;