Skip to content

Commit 17f7330

Browse files
authored
Merge pull request #2203 from elcreator/fix-phpstan-findings
[FIX] phpstan findings
2 parents 57666c0 + b72dc2a commit 17f7330

13 files changed

Lines changed: 193 additions & 152 deletions

File tree

core/includes/aliases.inc.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,5 @@ class Helper extends \EvolutionCMS\Facades\HelperProcessor {}
3838
class UserManager extends \EvolutionCMS\UserManager\Facades\UserManager {}
3939
class DocumentManager extends \EvolutionCMS\DocumentManager\Facades\DocumentManager {}
4040
class Tailwind extends \EvolutionCMS\Facades\Tailwind {}
41+
class DLTemplate extends \EvolutionCMS\Parser {}
4142
}

core/src/AbstractLaravel.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Symfony\Component\Finder\Finder;
1515
use Illuminate\Log\LogServiceProvider;
1616

17+
/** @phpstan-consistent-constructor */
1718
abstract class AbstractLaravel extends Container implements ApplicationContract
1819
{
1920
/**

core/src/AliasLoader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ class AliasLoader
3030
/**
3131
* Create a new AliasLoader instance.
3232
*
33-
* @param array $aliases
33+
* @param array $aliases
3434
* @return void
3535
*/
36-
private function __construct($aliases)
36+
final private function __construct(array $aliases)
3737
{
3838
$this->aliases = $aliases;
3939
}

core/src/Console/Packages/RunPackageConsoleCommand.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ class RunPackageConsoleCommand extends Command
2626
*/
2727
protected $composer = EVO_CORE_PATH . 'custom/composer.json';
2828

29+
/**
30+
* The path to the package directory
31+
*
32+
* @var string
33+
*/
34+
protected $packagePath;
35+
2936
/**
3037
* Execute the console command.
3138
*

core/src/Core.php

Lines changed: 110 additions & 101 deletions
Large diffs are not rendered by default.

core/src/Database.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,9 @@ public function setDebug($flag)
185185
{
186186
parent::setDebug($flag);
187187
$driver = $this->getDriver();
188+
/* @phpstan-ignore-next-line class.notFound deprecated */
188189
if ($driver instanceof Drivers\IlluminateDriver) {
190+
/* @phpstan-ignore-next-line method.notFound deprecated */
189191
if ($this->isDebug()) {
190192
$driver->getConnect()->enableQueryLog();
191193
} else {

core/src/HelperProcessor.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ public function phpThumb($input = '', $options = '', $webp = true)
3535
$newFolderAccessMode = empty($new) ? 0777 : octdec($newFolderAccessMode);
3636

3737
$defaultCacheFolder = 'assets/cache/';
38-
$cacheFolder = isset($cacheFolder) ? $cacheFolder : $defaultCacheFolder . 'images';
39-
$phpThumbNoImagePath = isset($phpThumbNoImagePath) ? $phpThumbNoImagePath : 'assets/images/';
38+
$cacheFolder = $defaultCacheFolder . 'images';
39+
$phpThumbNoImagePath = 'assets/images/';
4040

4141
/**
4242
* @see: https://github.com/kalessil/phpinspectionsea/blob/master/docs/probable-bugs.md#mkdir-race-condition
@@ -51,7 +51,7 @@ public function phpThumb($input = '', $options = '', $webp = true)
5151
}
5252

5353
if (empty($input) || !file_exists(MODX_BASE_PATH . $input)) {
54-
$input = isset($noImage) ? $noImage : $phpThumbNoImagePath . 'noimage.png';
54+
$input = $phpThumbNoImagePath . 'noimage.png';
5555
}
5656

5757
/**

core/src/Models/SiteContent.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,10 @@ class SiteContent extends Eloquent\Model
170170
'alias_visible' => 'int',
171171
];
172172

173+
/*
174+
* @phpstan-consistent-constructor
175+
* @param array<string, mixed> $attributes
176+
*/
173177
public function __construct(array $attributes = [])
174178
{
175179
$position = $this->getPositionColumn();

core/src/Providers/FsServiceProvider.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
use EvolutionCMS\ServiceProvider;
44
use Helpers\FS;
55

6+
/**
7+
* @deprecated
8+
* @TODO: remove in 3.7
9+
*/
610
class FsServiceProvider extends ServiceProvider
711
{
812
/**
@@ -13,6 +17,7 @@ class FsServiceProvider extends ServiceProvider
1317
public function register()
1418
{
1519
$this->app->bind('FS', function ($modx) {
20+
/* @phpstan-ignore-next-line class.notFound */
1621
return FS::getInstance();
1722
});
1823

core/src/Providers/ModResourceServiceProvider.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
use EvolutionCMS\ServiceProvider;
44
use modResource;
55

6+
/**
7+
* @deprecated
8+
* @TODO: remove in 3.7
9+
*/
610
class ModResourceServiceProvider extends ServiceProvider
711
{
812
/**
@@ -13,6 +17,7 @@ class ModResourceServiceProvider extends ServiceProvider
1317
public function register()
1418
{
1519
$this->app->bind('modResource', function ($modx) {
20+
/* @phpstan-ignore-next-line class.notFound */
1621
return new modResource($modx);
1722
});
1823

0 commit comments

Comments
 (0)