Skip to content

Commit b72dc2a

Browse files
committed
[FIX] phpstan findings
1 parent 4ced1aa commit b72dc2a

11 files changed

Lines changed: 34 additions & 6 deletions

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/Core.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
use UrlProcessor;
3030

3131
/**
32+
* @phpstan-consistent-constructor
3233
* @see: https://github.com/laravel/framework/blob/5.6/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php
3334
* @property Mail $mail
3435
* $this->loadExtension('MODxMailer');
@@ -6638,7 +6639,9 @@ public function terminating($callback)
66386639
{}
66396640

66406641
public function hasDebugModeEnabled()
6641-
{}
6642+
{
6643+
return false;
6644+
}
66426645

66436646
public function getFallbackLocale()
66446647
{}

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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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

core/src/Providers/ModUsersServiceProvider.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 modUsers;
55

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

0 commit comments

Comments
 (0)