Skip to content

Commit 6059c83

Browse files
authored
Merge pull request #3556 from paulbalandan/phpstan-neon-errors-resolution
Update phpstan.neon and resolve some errors
2 parents f7dfea6 + 219cfc8 commit 6059c83

File tree

5 files changed

+95
-47
lines changed

5 files changed

+95
-47
lines changed

.github/workflows/test-phpstan.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ jobs:
3636
run: composer install --no-progress --no-suggest --no-interaction
3737

3838
- name: Run static analysis
39-
run: vendor/bin/phpstan analyze --level=5 app system
39+
run: vendor/bin/phpstan analyse

app/Config/Autoload.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
*/
1717
class Autoload extends AutoloadConfig
1818
{
19-
2019
/**
2120
* -------------------------------------------------------------------
2221
* Namespaces

phpstan.neon

Lines changed: 47 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,48 @@
11
parameters:
2-
treatPhpDocTypesAsCertain: false
3-
bootstrapFiles:
4-
- qa-bootstrap.php
5-
excludes_analyse:
6-
- app/Views/errors/cli/error_404.php
7-
- app/Views/errors/cli/error_exception.php
8-
- app/Views/errors/html/error_exception.php
9-
- system/Commands/Generators/Views/migration.tpl.php
10-
- system/Config/Routes.php
11-
- system/Debug/Toolbar/Views/toolbar.tpl.php
12-
- system/Validation/Views/single.php
13-
- system/ThirdParty/*
14-
ignoreErrors:
15-
- '#Unsafe usage of new static\(\)*#'
16-
- '#Call to an undefined method CodeIgniter\\Database\\BaseConnection::_(disable|enable)ForeignKeyChecks\(\)#'
17-
- '#Access to an undefined property CodeIgniter\\Config\\AutoloadConfig::(\$psr4|\$classmap)#'
18-
- '#Access to an undefined property CodeIgniter\\Database\\Forge::\$dropConstraintStr#'
19-
- '#Access to an undefined property CodeIgniter\\Config\\View::(\$filters|\$plugins)#'
20-
- '#Access to protected property CodeIgniter\\Database\\BaseConnection::(\$DBDebug|\$DBPrefix|\$swapPre|\$charset|\$DBCollat)#'
21-
- '#Access to an undefined property CodeIgniter\\Database\\BaseConnection::\$mysqli#'
22-
- '#Access to an undefined property CodeIgniter\\Database\\ConnectionInterface::(\$DBDriver|\$connID|\$likeEscapeStr|\$likeEscapeChar|\$escapeChar|\$protectIdentifiers)#'
23-
- '#Call to an undefined method CodeIgniter\\Database\\BaseConnection::supportsForeignKeys\(\)#'
24-
- '#Cannot call method [a-zA-Z_]+\(\) on ((bool\|)?object\|resource)#'
25-
- '#Cannot access property [\$a-z_]+ on ((bool\|)?object\|resource)#'
26-
- '#Call to an undefined method CodeIgniter\\HTTP\\Request::(getPath|getSegments|getMethod|setLocale|getPost)\(\)#'
27-
- '#Access to an undefined property CodeIgniter\\HTTP\\Request::\$uri#'
28-
- '#Call to an undefined method CodeIgniter\\HTTP\\Message::setStatusCode\(\)#'
29-
- '#Call to an undefined method CodeIgniter\\Database\\ConnectionInterface::(tableExists|protectIdentifiers|setAliasedTables|escapeIdentifiers|affectedRows|addTableAlias)\(\)#'
30-
- '#Method CodeIgniter\\Database\\ConnectionInterface::query\(\) invoked with 3 parameters, 1-2 required#'
31-
- '#Return type \(bool\) of method CodeIgniter\\Test\\TestLogger::log\(\) should be compatible with return type \(null\) of method Psr\\Log\\LoggerInterface::log\(\)#'
32-
- '#Call to an undefined method CodeIgniter\\Router\\RouteCollectionInterface::(getDefaultNamespace|isFiltered|getFilterForRoute|getRoutesOptions)\(\)#'
33-
- '#Method CodeIgniter\\Router\\RouteCollectionInterface::getRoutes\(\) invoked with 1 parameter, 0 required#'
34-
- '#Call to an undefined method CodeIgniter\\Validation\\ValidationInterface::loadRuleGroup\(\)#'
35-
- '#Method CodeIgniter\\Validation\\ValidationInterface::run\(\) invoked with 3 parameters, 0-2 required#'
36-
- '#Return type \(bool\) of method CodeIgniter\\Log\\Logger::(emergency|alert|critical|error|warning|notice|info|debug|log)\(\) should be compatible with return type \(null\) of method Psr\\Log\\LoggerInterface::(emergency|alert|critical|error|warning|notice|info|debug|log)\(\)#'
37-
- '#Return type \(bool\) of method CodeIgniter\\HTTP\\Files\\UploadedFile::move\(\) should be compatible with return type \(CodeIgniter\\Files\\File\) of method CodeIgniter\\Files\\File::move\(\)#'
38-
- '#Call to function is_null\(\) with mysqli_stmt\|resource will always evaluate to false#'
39-
- '#Negated boolean expression is always (true|false)#'
40-
- '#Parameter \#1 \$db of class CodeIgniter\\Database\\SQLite3\\Table constructor expects CodeIgniter\\Database\\SQLite3\\Connection, CodeIgniter\\Database\\BaseConnection given#'
41-
scanDirectories:
42-
- system/Helpers
43-
dynamicConstantNames:
44-
- ENVIRONMENT
45-
- CI_DEBUG
2+
level: 5
3+
paths:
4+
- app
5+
- system
6+
treatPhpDocTypesAsCertain: false
7+
bootstrapFiles:
8+
- qa-bootstrap.php
9+
excludes_analyse:
10+
- app/Views/errors/cli/*
11+
- app/Views/errors/html/*
12+
- system/Commands/Generators/Views/*
13+
- system/Config/Routes.php
14+
- system/Debug/Toolbar/Views/toolbar.tpl.php
15+
- system/Validation/Views/single.php
16+
- system/ThirdParty/*
17+
ignoreErrors:
18+
- '#Unsafe usage of new static\(\)*#'
19+
- '#Call to an undefined method CodeIgniter\\Database\\BaseConnection::_(disable|enable)ForeignKeyChecks\(\)#'
20+
- '#Access to an undefined property CodeIgniter\\Database\\Forge::\$dropConstraintStr#'
21+
- '#Access to protected property CodeIgniter\\Database\\BaseConnection::(\$DBDebug|\$DBPrefix|\$swapPre|\$charset|\$DBCollat)#'
22+
- '#Access to an undefined property CodeIgniter\\Database\\BaseConnection::\$mysqli#'
23+
- '#Access to an undefined property CodeIgniter\\Database\\ConnectionInterface::(\$DBDriver|\$connID|\$likeEscapeStr|\$likeEscapeChar|\$escapeChar|\$protectIdentifiers)#'
24+
- '#Call to an undefined method CodeIgniter\\Database\\BaseConnection::supportsForeignKeys\(\)#'
25+
- '#Cannot call method [a-zA-Z_]+\(\) on ((bool\|)?object\|resource)#'
26+
- '#Cannot access property [\$a-z_]+ on ((bool\|)?object\|resource)#'
27+
- '#Call to an undefined method CodeIgniter\\HTTP\\Request::(getPath|getSegments|getMethod|setLocale|getPost)\(\)#'
28+
- '#Access to an undefined property CodeIgniter\\HTTP\\Request::\$uri#'
29+
- '#Call to an undefined method CodeIgniter\\HTTP\\Message::setStatusCode\(\)#'
30+
- '#Call to an undefined method CodeIgniter\\Database\\ConnectionInterface::(tableExists|protectIdentifiers|setAliasedTables|escapeIdentifiers|affectedRows|addTableAlias)\(\)#'
31+
- '#Method CodeIgniter\\Database\\ConnectionInterface::query\(\) invoked with 3 parameters, 1-2 required#'
32+
- '#Return type \(bool\) of method CodeIgniter\\Test\\TestLogger::log\(\) should be compatible with return type \(null\) of method Psr\\Log\\LoggerInterface::log\(\)#'
33+
- '#Call to an undefined method CodeIgniter\\Router\\RouteCollectionInterface::(getDefaultNamespace|isFiltered|getFilterForRoute|getRoutesOptions)\(\)#'
34+
- '#Method CodeIgniter\\Router\\RouteCollectionInterface::getRoutes\(\) invoked with 1 parameter, 0 required#'
35+
- '#Call to an undefined method CodeIgniter\\Validation\\ValidationInterface::loadRuleGroup\(\)#'
36+
- '#Method CodeIgniter\\Validation\\ValidationInterface::run\(\) invoked with 3 parameters, 0-2 required#'
37+
- '#Return type \(bool\) of method CodeIgniter\\Log\\Logger::(emergency|alert|critical|error|warning|notice|info|debug|log)\(\) should be compatible with return type \(null\) of method Psr\\Log\\LoggerInterface::(emergency|alert|critical|error|warning|notice|info|debug|log)\(\)#'
38+
- '#Return type \(bool\) of method CodeIgniter\\HTTP\\Files\\UploadedFile::move\(\) should be compatible with return type \(CodeIgniter\\Files\\File\) of method CodeIgniter\\Files\\File::move\(\)#'
39+
- '#Call to function is_null\(\) with mysqli_stmt\|resource will always evaluate to false#'
40+
- '#Negated boolean expression is always (true|false)#'
41+
- '#Parameter \#1 \$db of class CodeIgniter\\Database\\SQLite3\\Table constructor expects CodeIgniter\\Database\\SQLite3\\Connection, CodeIgniter\\Database\\BaseConnection given#'
42+
parallel:
43+
processTimeout: 300.0
44+
scanDirectories:
45+
- system/Helpers
46+
dynamicConstantNames:
47+
- ENVIRONMENT
48+
- CI_DEBUG

system/Config/AutoloadConfig.php

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,43 @@
4040
namespace CodeIgniter\Config;
4141

4242
/**
43-
* AUTO-LOADER
43+
* AUTOLOADER
4444
*
4545
* This file defines the namespaces and class maps so the Autoloader
4646
* can find the files as needed.
4747
*/
4848
class AutoloadConfig
4949
{
50+
/**
51+
* -------------------------------------------------------------------
52+
* Namespaces
53+
* -------------------------------------------------------------------
54+
* This maps the locations of any namespaces in your application to
55+
* their location on the file system. These are used by the autoloader
56+
* to locate files the first time they have been instantiated.
57+
*
58+
* The '/app' and '/system' directories are already mapped for you.
59+
* you may change the name of the 'App' namespace if you wish,
60+
* but this should be done prior to creating any namespaced classes,
61+
* else you will need to modify all of those classes for this to work.
62+
*
63+
* @var array
64+
*/
65+
public $psr4 = [];
66+
67+
/**
68+
* -------------------------------------------------------------------
69+
* Class Map
70+
* -------------------------------------------------------------------
71+
* The class map provides a map of class names and their exact
72+
* location on the drive. Classes loaded in this manner will have
73+
* slightly faster performance because they will not have to be
74+
* searched for within one or more directories as they would if they
75+
* were being autoloaded through a namespace.
76+
*
77+
* @var array
78+
*/
79+
public $classmap = [];
5080

5181
/**
5282
* -------------------------------------------------------------------

system/Config/View.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,22 @@
4444
*/
4545
class View extends BaseConfig
4646
{
47+
/**
48+
* Parser Filters map a filter name with any PHP callable. When the
49+
* Parser prepares a variable for display, it will chain it
50+
* through the filters in the order defined, inserting any parameters.
51+
*
52+
* To prevent potential abuse, all filters MUST be defined here
53+
* in order for them to be available for use within the Parser.
54+
*/
55+
public $filters = [];
56+
57+
/**
58+
* Parser Plugins provide a way to extend the functionality provided
59+
* by the core Parser by creating aliases that will be replaced with
60+
* any callable. Can be single or tag pair.
61+
*/
62+
public $plugins = [];
4763

4864
/**
4965
* Built-in View filters.

0 commit comments

Comments
 (0)