mirror of
https://github.com/flextype/flextype.git
synced 2025-08-06 05:07:41 +02:00
refactor(core): code updates and improvements - phpstan level 2
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
parameters:
|
||||
level: 1
|
||||
level: 2
|
||||
reportUnmatchedIgnoredErrors: false
|
||||
bootstrapFiles:
|
||||
- src/flextype/defines.php
|
||||
|
@@ -23,12 +23,12 @@ class Actions extends Collection
|
||||
/**
|
||||
* Actions instance
|
||||
*/
|
||||
private static ?Actions $instance = null;
|
||||
protected static Actions|null $instance = null;
|
||||
|
||||
/**
|
||||
* Actions registry storage
|
||||
*/
|
||||
private static ?Collection $registry = null;
|
||||
protected static Collection|null $registry = null;
|
||||
|
||||
/**
|
||||
* Gets the instance via lazy initialization (created on first usage)
|
||||
|
@@ -777,7 +777,7 @@ class Entries
|
||||
* @param string $id Unique identifier of the entry.
|
||||
* @param string $newID New Unique identifier of the entry.
|
||||
*
|
||||
* @return boolы True on success, false on failure.
|
||||
* @return bool True on success, false on failure.
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
@@ -987,7 +987,7 @@ class Entries
|
||||
/**
|
||||
* Set Entries registry.
|
||||
*
|
||||
* @return void
|
||||
* @return self
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
@@ -1001,7 +1001,7 @@ class Entries
|
||||
/**
|
||||
* Set Entries options.
|
||||
*
|
||||
* @return void
|
||||
* @return self
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
@@ -1015,7 +1015,7 @@ class Entries
|
||||
/**
|
||||
* Get Entries options.
|
||||
*
|
||||
* @return array Returns entries options.
|
||||
* @return Collection Returns entries options.
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
|
@@ -16,7 +16,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace Flextype\Entries\Expressions;
|
||||
|
||||
use Glowy\Arrays\Arrays as Collection;
|
||||
use Glowy\Arrays\Arrays;
|
||||
use Glowy\Macroable\Macroable;
|
||||
use Symfony\Component\ExpressionLanguage\ExpressionFunction;
|
||||
use Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface;
|
||||
@@ -41,11 +41,11 @@ class EntriesTwigExpressionsMethods
|
||||
* @param string $id Unique identifier of the entry.
|
||||
* @param array $options Options array.
|
||||
*
|
||||
* @return self Returns instance of The Arrays class.
|
||||
* @return \Glowy\Arrays\Arrays Returns instance of The Arrays class.
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function fetch(string $id, array $options = []): Collection
|
||||
public function fetch(string $id, array $options = []): \Glowy\Arrays\Arrays
|
||||
{
|
||||
return entries()->fetch($id, $options);
|
||||
}
|
||||
@@ -53,11 +53,11 @@ class EntriesTwigExpressionsMethods
|
||||
/**
|
||||
* Get Entries Registry.
|
||||
*
|
||||
* @return Collection Returns entries registry.
|
||||
* @return \Glowy\Arrays\Arrays Returns entries registry.
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function registry(): Collection
|
||||
public function registry(): \Glowy\Arrays\Arrays
|
||||
{
|
||||
return entries()->registry();
|
||||
}
|
||||
|
@@ -41,10 +41,10 @@ class I18n
|
||||
* New translation keys for `en_US` locale
|
||||
* I18n::add(['auth_login' => 'Login', 'auth_password' => 'Password'], 'en_US');
|
||||
*
|
||||
* @param string $translates Translation keys and values to add
|
||||
* @param string $locale Locale
|
||||
* @param array $translates Translation keys and values to add
|
||||
* @param string|null $locale Locale
|
||||
*/
|
||||
public static function add(array $translates, ?string $locale = null): void
|
||||
public static function add(array $translates, string|null $locale = null): void
|
||||
{
|
||||
$locale ??= self::$locale;
|
||||
|
||||
|
@@ -27,7 +27,7 @@ class CsrfMiddleware
|
||||
/**
|
||||
* Invoke
|
||||
*
|
||||
* @param ServerRequest $request PSR-7 request
|
||||
* @param Request $request PSR-7 request
|
||||
* @param RequestHandler $handler PSR-15 request handler
|
||||
*/
|
||||
public function __invoke(Request $request, RequestHandler $handler): Response
|
||||
|
@@ -17,7 +17,6 @@ if (! function_exists('imageFile')) {
|
||||
* Create a new image instance for image file.
|
||||
*
|
||||
* @param string $file Image file.
|
||||
* @param array $options Options array.
|
||||
*/
|
||||
function imageFile(string $file): Image
|
||||
{
|
||||
|
@@ -18,7 +18,7 @@ if (! function_exists('generateToken')) {
|
||||
*
|
||||
* @param int $length Token string length.
|
||||
*
|
||||
* @return strings Token string.
|
||||
* @return string Token string.
|
||||
*/
|
||||
function generateToken(int $length = 16): string
|
||||
{
|
||||
@@ -30,7 +30,6 @@ if (! function_exists('generateTokenHash')) {
|
||||
/**
|
||||
* Generate token hash.
|
||||
*
|
||||
* @return strings Token string.
|
||||
* @return string Token string hashed.
|
||||
*/
|
||||
function generateTokenHash(string $token): string
|
||||
|
@@ -55,7 +55,7 @@ if (! function_exists('upload')) {
|
||||
$result->confirm();
|
||||
|
||||
// If upload file is image, do image file processing
|
||||
if ($result->name) {
|
||||
if (property_exists($result, 'name')) {
|
||||
$mediaFile = $uploadFolder . '/' . $result->name;
|
||||
|
||||
if (getimagesize($mediaFile)) {
|
||||
|
Reference in New Issue
Block a user