Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f236fef

Browse files
committed
Register the cache-handler and services-argument rules and require ext-sqlite3
1 parent 3d8ffb3 commit f236fef

3 files changed

Lines changed: 11 additions & 1 deletion

File tree

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
},
2424
"require": {
2525
"php": "^8.2",
26+
"ext-sqlite3": "*",
2627
"phpstan/phpstan": "^2.2"
2728
},
2829
"require-dev": {

docs/rules.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ toggled by `codeigniter.checkArgumentTypeOfConfig` and `codeigniter.checkArgumen
4040
Fixable: No
4141

4242
This rule validates the service method name passed to either `service()` or `single_service()` function
43-
if coming from a valid Services class. It also validates the return if a valid object instance.
43+
if coming from a valid Services class. It also validates the return if a valid object instance. The rule is
44+
registered only when `codeigniter.checkArgumentTypeOfServices` is `true`.
4445

4546
## Superglobals
4647

extension.neon

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ parameters:
1414
checkArgumentTypeOfConfig: true
1515
checkArgumentTypeOfModel: true
1616
checkArgumentTypeOfFactories: true
17+
checkArgumentTypeOfServices: true
1718
schemaCacheDirectory: %currentWorkingDirectory%/tmp
1819
schemaNamespace: null
1920

@@ -26,6 +27,7 @@ parametersSchema:
2627
checkArgumentTypeOfConfig: bool()
2728
checkArgumentTypeOfModel: bool()
2829
checkArgumentTypeOfFactories: bool()
30+
checkArgumentTypeOfServices: bool()
2931
schemaCacheDirectory: string()
3032
schemaNamespace: schema(string(), nullable())
3133
])
@@ -159,11 +161,17 @@ services:
159161
checkArgumentTypeOfConfig: %codeigniter.checkArgumentTypeOfConfig%
160162
checkArgumentTypeOfModel: %codeigniter.checkArgumentTypeOfModel%
161163

164+
-
165+
class: CodeIgniter\PHPStan\Rules\Functions\ServicesFunctionArgumentTypeRule
166+
162167
conditionalTags:
163168
CodeIgniter\PHPStan\Rules\Functions\FactoriesFunctionArgumentTypeRule:
164169
phpstan.rules.rule: %codeigniter.checkArgumentTypeOfFactories%
170+
CodeIgniter\PHPStan\Rules\Functions\ServicesFunctionArgumentTypeRule:
171+
phpstan.rules.rule: %codeigniter.checkArgumentTypeOfServices%
165172

166173
rules:
174+
- CodeIgniter\PHPStan\Rules\Classes\CacheHandlerInstantiationRule
167175
- CodeIgniter\PHPStan\Rules\Classes\FrameworkExceptionInstantiationRule
168176
- CodeIgniter\PHPStan\Rules\Superglobals\SuperglobalsGlobalAssignRule
169177
- CodeIgniter\PHPStan\Rules\Superglobals\SuperglobalsOffsetAccessRule

0 commit comments

Comments
 (0)