1
0
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 4

This commit is contained in:
Awilum
2022-07-07 17:26:43 +03:00
parent 0d62940be6
commit c3434629a6
7 changed files with 9 additions and 20 deletions

View File

@@ -1,5 +1,5 @@
parameters:
level: 3
level: 4
reportUnmatchedIgnoredErrors: false
bootstrapFiles:
- src/flextype/defines.php

View File

@@ -47,7 +47,7 @@ class Driver implements AggregatablePoolInterface
{
use IOHelperTrait;
private static string $ext = 'php';
protected static string $ext = 'php';
/**
* @throws PhpfastcacheIOException

View File

@@ -38,7 +38,7 @@ class TokensVerifyHashCommand extends Command
protected function execute(InputInterface $input, OutputInterface $output): int
{
dd($input->getArgument('token-hash'));
if (verifyTokenHash($input->getArgument('token'), $input->getArgument('token-hash'))) {
$output->write(
renderToString(

View File

@@ -566,9 +566,6 @@ class Entries
// Return entries array
return collection($this->registry()->get('methods.fetch.result'));
}
// Return entries array
return collection($this->registry()->get('methods.fetch.result'));
}
/**

View File

@@ -44,22 +44,14 @@ parsers()->shortcodes()->addHandler('strings', static function (ShortcodeInterfa
$vars = $value !== null ? strings($value)->contains($varsDelimeter) ? explode($varsDelimeter, $value) : [$value] : [];
// Parse shortcodes for each var.
$vars = array_map(static fn ($v) => parsers()->shortcodes()->parse(is_string($v) ? $v : ''), $vars);
$vars = array_map(static fn ($v) => parsers()->shortcodes()->parse((string) $v), $vars);
if ($key === 'append') {
if (is_iterable($vars)) {
$content = strings($content)->{'append'}(...$vars)->toString();
} else {
$content = strings($content)->{'append'}($vars[0])->toString();
}
$content = strings($content)->{'append'}(...$vars)->toString();
}
if ($key === 'prepend') {
if (is_iterable($vars)) {
$content = strings($content)->{'prepend'}(...$vars)->toString();
} else {
$content = strings($content)->{'prepend'}($vars[0])->toString();
}
$content = strings($content)->{'prepend'}(...$vars)->toString();
}
if ($key === 'after') {

View File

@@ -31,8 +31,8 @@ parsers()->shortcodes()->addHandler('var', static function (ShortcodeInterface $
if (! registry()->get('flextype.settings.parsers.shortcodes.shortcodes.var.enabled')) {
return '';
}
$params = $s->getParameters() ?? '';
$params = $s->getParameters();
if (isset($params['set'])) {
if (isset($params['value'])) {

View File

@@ -23,7 +23,7 @@ if (! function_exists('find')) {
{
$find = filesystem()->find()->in($path);
isset($options['depth']) and $find->depth($options['depth']) or $find->depth(1);
isset($options['depth']) ? $find->depth($options['depth']) : $find->depth(1);
isset($options['date']) and $find->date($options['date']);
isset($options['size']) and $find->size($options['size']);
isset($options['exclude']) and $find->exclude($options['exclude']);