Skip to content

Commit 714e49b

Browse files
committed
refactor: apply quality baseline on master
1 parent 387655e commit 714e49b

28 files changed

Lines changed: 132 additions & 94 deletions

composer.json

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,12 @@
1111
],
1212
"homepage": "https://github.com/psfs/core",
1313
"require": {
14-
"php": ">=8",
14+
"php": ">=8.2",
1515
"ext-json": "*",
1616
"ext-curl": "*",
17-
"ext-gmp": "*",
1817
"psfs/propel": "dev-master",
1918
"symfony/console": "7.4.18",
2019
"symfony/finder": "7.4.17",
21-
"symfony/translation": "7.4.17",
2220
"twig/twig": "3.28.0",
2321
"monolog/monolog": "3.11.0",
2422
"matthiasmullie/minify": "1.3.75",
@@ -27,8 +25,7 @@
2725
},
2826
"require-dev": {
2927
"phpunit/phpunit": "11.5.56",
30-
"roave/security-advisories": "dev-master",
31-
"symfony/process": "7.4.18"
28+
"roave/security-advisories": "dev-master"
3229
},
3330
"config": {
3431
"optimize-autoloader": true,

src/base/dto/ValidatableDtoTrait.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
trait ValidatableDtoTrait
66
{
7+
abstract protected function checkCastedValue(mixed $rawValue, string $type);
8+
79
private static ?\WeakMap $__validationInputMap = null;
810
private ?ValidationResult $__validationResult = null;
911

@@ -60,4 +62,3 @@ private function getValidationInputData(): array
6062
return is_array($data) ? $data : [];
6163
}
6264
}
63-

src/base/extension/traits/CssTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ protected function loopCssLines($file)
110110
}
111111

112112
/**
113-
* @param array $source
113+
* @param array{0:string,1:string} $source
114114
* @param string $file
115115
*/
116116
protected function extractCssResources($source, $file)

src/base/types/AuthApi.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function init()
3838
*/
3939
private function checkAuth()
4040
{
41-
$namespace = explode('\\', $this->getModelTableMap());
41+
$namespace = explode('\\', (string)$this->getModelTableMap());
4242
$module = strtolower($namespace[0]);
4343
$secret = Config::getInstance()->get($module . '.api.secret');
4444
if (null === $secret) {

src/base/types/helpers/AssetsHelper.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ class AssetsHelper
1414
{
1515

1616
/**
17-
* @param string $source
17+
* @param array{1:string} $source
1818
* @return string
1919
*/
20-
public static function extractSourceFilename($source): string
20+
public static function extractSourceFilename(array $source): string
2121
{
2222
$sourceFile = preg_replace("/'/", "", $source[1]);
2323
if (preg_match('/\#/', $sourceFile)) {

src/base/types/helpers/FileHelper.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,9 @@ public static function deleteFile(string $path): bool
7777
}
7878

7979
/**
80-
* @template T
8180
* @param string $lockPath
82-
* @param callable():T $callback
83-
* @return T|null
81+
* @param callable $callback
82+
* @return mixed
8483
*/
8584
public static function withExclusiveLock(string $lockPath, callable $callback): mixed
8685
{

src/base/types/helpers/FilesystemTreeHelper.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace PSFS\base\types\helpers;
44

55
use PSFS\base\exception\ConfigException;
6+
use PSFS\base\Logger;
67

78
class FilesystemTreeHelper
89
{
@@ -12,7 +13,9 @@ public static function deleteDir(string $dir): void
1213
return;
1314
}
1415
if (is_link($dir)) {
15-
@unlink($dir);
16+
if (!@unlink($dir)) {
17+
Logger::log('[FilesystemTreeHelper] Unable to remove symlink: ' . $dir, LOG_WARNING);
18+
}
1619
return;
1720
}
1821
$objects = scandir($dir) ?: [];

src/base/types/helpers/InjectorDefinitionHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public static function buildVariableDefinition(string $instanceType, bool $requi
7777
}
7878

7979
/**
80-
* @return array{string,bool}
80+
* @return array{0:string,1:bool}
8181
*/
8282
private static function normalizeInstanceType(string $instanceType): array
8383
{

src/base/types/helpers/InjectorHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ public static function getLabel($doc, ReflectionProperty $property = null)
173173

174174
/**
175175
* @param $doc
176-
* @return null|array
176+
* @return array|string|null
177177
*/
178178
public static function getValues($doc, ReflectionProperty $property = null)
179179
{

src/base/types/helpers/MetadataReader.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,11 @@ public static function resetEngineCaches(): void
9797

9898
private static function engine(): MetadataEngineInterface
9999
{
100-
if (!(self::$engine instanceof MetadataEngineInterface)) {
101-
self::$engine = new MetadataEngine();
100+
$engine = self::$engine;
101+
if (!$engine instanceof MetadataEngineInterface) {
102+
$engine = new MetadataEngine();
103+
self::$engine = $engine;
102104
}
103-
return self::$engine;
105+
return $engine;
104106
}
105107
}

0 commit comments

Comments
 (0)