Skip to content

Commit f0d82bb

Browse files
committed
added more to phpstan.neon and fixed one error
1 parent b6c16fe commit f0d82bb

3 files changed

Lines changed: 14 additions & 4 deletions

File tree

‎adminer/include/editing.inc.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ function edit_fields(array $fields, array $collations, $type = "TABLE", array $f
343343
}
344344

345345
/** Move fields up and down or add field
346-
* @param Field[] $fields
346+
* @param array<array{field?: string, full_type: string, type: string, length: numeric-string|null, unsigned: string, default?: string, null: bool, auto_increment: bool, ...}> $fields
347347
*/
348348
function process_fields(array &$fields): bool {
349349
$offset = 0;

‎composer.json‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,16 @@
3232
"require": {
3333
"php": ">=7.4"
3434
},
35+
"require-dev": {
36+
"phpstan/phpstan": "^2.1.30"
37+
},
3538
"scripts": {
3639
"check": [
3740
"phpcs",
3841
"phpstan analyse -c phpstan.neon"
3942
],
4043
"compile": "@php compile.php",
4144
"clean": "rm -f adminer*.php editor*.php"
42-
}
45+
},
46+
"prefer-stable" : true
4347
}

‎phpstan.neon‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ parameters:
88
- "~Adminer\\\\Result.*mysqli_result~" # mysqli_result
99
- "~Function Adminer\\\\queries\\(\\) never returns Adminer\\\\Result~" # mysqli_result
1010

11+
# must check if needs fix
12+
- message: "~Function Adminer\\\\get_driver\\(\\) never returns null~"
13+
- message: "~Offset 'generated' does not exist~"
14+
- message: "~Parameter &\\$fields by-ref type of function Adminer\\\\process_fields~"
15+
- message: "~Offset 'orig' does not exist~"
16+
- message: "~Parameter #2 \\$row of function Adminer\\\\create_routine expects array\\{name\\?: string, fields: list<array\\{field: string, type: string, length: numeric-string, unsigned: string, null: bool, full_type: string, collation: string, inout\\?: string\\}>, comment: string, returns\\?: array\\{type: string, length: numeric-string, unsigned: string, collation: string\\}, definition: string, language\\?: string\\}, non-empty-array given~"
17+
- message: "~Parameter #2 \\$row of function Adminer\\\\routine_id expects array\\{name\\?: string, fields: list<array\\{field: string, type: string, length: numeric-string, unsigned: string, null: bool, full_type: string, collation: string, inout\\?: string\\}>, comment: string, returns\\?: array\\{type: string, length: numeric-string, unsigned: string, collation: string\\}, definition: string, language\\?: string\\}, non-empty-array given~"
18+
1119
# not real problems
1220
- identifier: include.fileNotFound # includes in include/ relative from index.php
1321
- identifier: includeOnce.fileNotFound # ./adminer-plugins.php
@@ -45,8 +53,6 @@ parameters:
4553
- identifier: if.alwaysTrue
4654
- identifier: isset.offset
4755
- identifier: deadCode.unreachable
48-
- "~Function Adminer\\\\get_driver\\(\\) never returns null~"
49-
- "~on array\\{}~"
5056

5157
paths:
5258
- adminer/drivers/mysql.inc.php # other drivers inherit the annotations so we take them from here

0 commit comments

Comments
 (0)