Make phpstan happier
This commit is contained in:
parent
8ec035c2ce
commit
d9382954bc
20 changed files with 33 additions and 22 deletions
|
|
@ -9,7 +9,7 @@ use Monolog\Logger;
|
|||
use Slim\Psr7\Request;
|
||||
use Slim\Psr7\Response;
|
||||
|
||||
abstract class Controller
|
||||
abstract class AbstractController
|
||||
{
|
||||
protected Logger $logger;
|
||||
protected AbstractService $service;
|
||||
|
|
@ -7,7 +7,7 @@ use Laminas\Db\Adapter\Exception\InvalidQueryException;
|
|||
use Slim\Psr7\Request;
|
||||
use Slim\Psr7\Response;
|
||||
|
||||
abstract class CrudController extends Controller
|
||||
abstract class AbstractCrudController extends AbstractController
|
||||
{
|
||||
public function listRequest(Request $request, Response $response): Response
|
||||
{
|
||||
|
|
@ -8,7 +8,7 @@ use Slim\Psr7\Request;
|
|||
use Slim\Psr7\Response;
|
||||
use Slim\Views\Twig;
|
||||
|
||||
abstract class HtmlController extends Controller
|
||||
abstract class AbstractHTMLController extends AbstractController
|
||||
{
|
||||
protected Twig $twig;
|
||||
protected DebugBar $debugBar;
|
||||
7
src/Exceptions/WorkerException.php
Normal file
7
src/Exceptions/WorkerException.php
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace Benzine\Exceptions;
|
||||
|
||||
class WorkerException extends BenzineException
|
||||
{
|
||||
}
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Benzine\Redis\Lua;
|
||||
|
||||
abstract class LuaExtension
|
||||
abstract class AbstractLuaExtension
|
||||
{
|
||||
protected \Redis $redis;
|
||||
protected ?string $hash = null;
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Benzine\Redis\Lua;
|
||||
|
||||
class SetIfHigher extends LuaExtension
|
||||
class SetIfHigher extends AbstractLuaExtension
|
||||
{
|
||||
protected function getScript(): string
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Benzine\Redis\Lua;
|
||||
|
||||
class SetIfLower extends LuaExtension
|
||||
class SetIfLower extends AbstractLuaExtension
|
||||
{
|
||||
protected function getScript(): string
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Benzine\Redis\Lua;
|
||||
|
||||
class ZAddIfHigher extends LuaExtension
|
||||
class ZAddIfHigher extends AbstractLuaExtension
|
||||
{
|
||||
protected function getScript(): string
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Benzine\Redis\Lua;
|
||||
|
||||
class ZAddIfLower extends LuaExtension
|
||||
class ZAddIfLower extends AbstractLuaExtension
|
||||
{
|
||||
protected function getScript(): string
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ namespace Benzine\Redis;
|
|||
|
||||
class Redis extends \Redis
|
||||
{
|
||||
/** @var Lua\LuaExtension[] */
|
||||
/** @var Lua\AbstractLuaExtension[] */
|
||||
private array $scripts;
|
||||
|
||||
public function __call($name, $arguments)
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ class Router
|
|||
|
||||
private bool $routesArePopulated = false;
|
||||
|
||||
public function __construct(\Redis $redis, Logger $logger, CachePoolChain $cachePoolChain)
|
||||
public function __construct(Logger $logger, CachePoolChain $cachePoolChain)
|
||||
{
|
||||
$this->logger = $logger;
|
||||
$this->cachePoolChain = $cachePoolChain;
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
namespace Benzine\Services;
|
||||
|
||||
use Benzine\App;
|
||||
use Symfony\Component\Filesystem\Filesystem;
|
||||
use Symfony\Component\Yaml\Yaml;
|
||||
|
||||
class ConfigurationService
|
||||
|
|
@ -103,7 +104,8 @@ class ConfigurationService
|
|||
$path = getcwd();
|
||||
//$path = dirname($this->environmentService->get('SCRIPT_FILENAME'));
|
||||
}
|
||||
if (!file_exists($path.'/.benzine.yml')) {
|
||||
|
||||
if (!(new Filesystem())->exists($path.'/.benzine.yml')) {
|
||||
$currentDirElem = explode(DIRECTORY_SEPARATOR, $path);
|
||||
array_pop($currentDirElem);
|
||||
$parentPath = implode(DIRECTORY_SEPARATOR, $currentDirElem);
|
||||
|
|
|
|||
|
|
@ -11,10 +11,10 @@ class InflectionExtension extends AbstractExtension
|
|||
public function getFilters()
|
||||
{
|
||||
$filters = [];
|
||||
$filters['pluralize'] = new TwigFilter('pluralize', function ($word) {
|
||||
$filters['pluralize'] = new TwigFilter('pluralize', function ($word): string {
|
||||
return Inflect::pluralize($word);
|
||||
});
|
||||
$filters['singularize'] = new TwigFilter('singularize', function ($word) {
|
||||
$filters['singularize'] = new TwigFilter('singularize', function ($word): string {
|
||||
return Inflect::singularize($word);
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ class TransformExtension extends AbstractExtension
|
|||
$name = 'transform_'.strtolower($fromTransformer).'_to_'.strtolower($toTransformer);
|
||||
$context = $this;
|
||||
$filters[$name] =
|
||||
new TwigFilter($name, function ($word) use ($context, $fromTransformer, $toTransformer) {
|
||||
new TwigFilter($name, function (string $word) use ($context, $fromTransformer, $toTransformer): string {
|
||||
return $context->transform($word, $fromTransformer, $toTransformer);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,13 +2,13 @@
|
|||
|
||||
namespace Benzine\Workers;
|
||||
|
||||
abstract class ForeverLoopWorker extends AbstractWorker implements WorkerInterface
|
||||
abstract class AbstractForeverLoopWorker extends AbstractWorker implements WorkerInterface
|
||||
{
|
||||
public function run(): void
|
||||
{
|
||||
$this->logger->debug("Running with an interval of {$this->timeBetweenRuns} seconds.");
|
||||
while (true) {
|
||||
$didWork = $this->iterate();
|
||||
$this->iterate();
|
||||
sleep($this->timeBetweenRuns);
|
||||
}
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Benzine\Workers;
|
||||
|
||||
use Benzine\Exceptions\WorkerException;
|
||||
use Benzine\ORM\Abstracts\AbstractModel;
|
||||
|
||||
class WorkerWorkItem
|
||||
|
|
@ -20,7 +21,7 @@ class WorkerWorkItem
|
|||
case 'get':
|
||||
return $this->data[$field];
|
||||
default:
|
||||
throw new \Exception("Method {$name} doesn't exist");
|
||||
throw new WorkerException("Method {$name} doesn't exist");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,9 +5,8 @@ namespace Benzine\Tests;
|
|||
use Faker\Factory as FakerFactory;
|
||||
use Faker\Generator;
|
||||
use Faker\Provider;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
abstract class BaseTestCase extends TestCase
|
||||
abstract class AbstractBaseTestCase extends AbstractTestCase
|
||||
{
|
||||
// Set this to true if you want to see whats going on inside some unit tests..
|
||||
public const DEBUG_MODE = false;
|
||||
|
|
@ -6,7 +6,7 @@ use Benzine\Tests\Traits\AppTestTrait;
|
|||
use Psr\Http\Message\ResponseInterface;
|
||||
use Slim\Http\Request;
|
||||
|
||||
abstract class RoutesTestCase extends BaseTestCase
|
||||
abstract class AbstractRoutesTestCase extends AbstractBaseTestCase
|
||||
{
|
||||
use AppTestTrait;
|
||||
|
||||
|
|
@ -5,7 +5,7 @@ namespace Benzine\Tests;
|
|||
use Facebook\WebDriver\Remote\RemoteWebDriver;
|
||||
use Facebook\WebDriver\Remote\WebDriverCapabilityType;
|
||||
|
||||
abstract class SeleniumTestCase extends BaseTestCase
|
||||
abstract class AbstractSeleniumTestCase extends AbstractBaseTestCase
|
||||
{
|
||||
/** @var RemoteWebDriver */
|
||||
protected static $webDriver;
|
||||
|
|
@ -2,7 +2,9 @@
|
|||
|
||||
namespace Benzine\Tests;
|
||||
|
||||
abstract class TestCase extends \PHPUnit\Framework\TestCase
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
abstract class AbstractTestCase extends TestCase
|
||||
{
|
||||
use Traits\OverrideProtectionTrait;
|
||||
use Traits\ArrayEquitabilityTrait;
|
||||
Loading…
Reference in a new issue