mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-03-09 16:59:37 +00:00
Fixed phpstan issues
This commit is contained in:
parent
bcbbb1ecb9
commit
7f8f5990a7
5 changed files with 100 additions and 5 deletions
86
phpstan.banned_code.neon
Normal file
86
phpstan.banned_code.neon
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
# Manually configure ekino/phpstan-banned-code to detect usage of echo, eval, die/exit, print, shell execution and a set of functions that should not be used in production code.
|
||||
|
||||
parametersSchema:
|
||||
banned_code: structure([
|
||||
nodes: listOf(structure([
|
||||
type: string()
|
||||
functions: schema(listOf(string()), nullable())
|
||||
]))
|
||||
use_from_tests: bool()
|
||||
non_ignorable: bool()
|
||||
])
|
||||
|
||||
parameters:
|
||||
banned_code:
|
||||
nodes:
|
||||
# enable detection of echo
|
||||
-
|
||||
type: Stmt_Echo
|
||||
functions: null
|
||||
|
||||
# enable detection of eval
|
||||
-
|
||||
type: Expr_Eval
|
||||
functions: null
|
||||
|
||||
# enable detection of die/exit
|
||||
-
|
||||
type: Expr_Exit
|
||||
functions: null
|
||||
|
||||
# enable detection of a set of functions
|
||||
-
|
||||
type: Expr_FuncCall
|
||||
functions:
|
||||
- dd
|
||||
- debug_backtrace
|
||||
- dump
|
||||
- exec
|
||||
- passthru
|
||||
- phpinfo
|
||||
- print_r
|
||||
- proc_open
|
||||
- shell_exec
|
||||
- system
|
||||
- var_dump
|
||||
|
||||
# enable detection of print statements
|
||||
-
|
||||
type: Expr_Print
|
||||
functions: null
|
||||
|
||||
# enable detection of shell execution by backticks
|
||||
-
|
||||
type: Expr_ShellExec
|
||||
functions: null
|
||||
|
||||
# enable detection of empty()
|
||||
#-
|
||||
# type: Expr_Empty
|
||||
# functions: null
|
||||
|
||||
# enable detection of `use Tests\Foo\Bar` in a non-test file
|
||||
use_from_tests: true
|
||||
|
||||
# when true, errors cannot be excluded
|
||||
non_ignorable: false
|
||||
|
||||
services:
|
||||
-
|
||||
class: Ekino\PHPStanBannedCode\Rules\BannedNodesRule
|
||||
tags:
|
||||
- phpstan.rules.rule
|
||||
arguments:
|
||||
- '%banned_code.nodes%'
|
||||
|
||||
-
|
||||
class: Ekino\PHPStanBannedCode\Rules\BannedUseTestRule
|
||||
tags:
|
||||
- phpstan.rules.rule
|
||||
arguments:
|
||||
- '%banned_code.use_from_tests%'
|
||||
|
||||
-
|
||||
class: Ekino\PHPStanBannedCode\Rules\BannedNodesErrorBuilder
|
||||
arguments:
|
||||
- '%banned_code.non_ignorable%'
|
||||
Loading…
Add table
Add a link
Reference in a new issue