Skip to content

Commit 510e442

Browse files
Merge pull request #19156 from MauricioFauth/setup-controllers
Refactor setup controllers to implement InvocableController
2 parents 6c5c481 + c7963ea commit 510e442

28 files changed

Lines changed: 723 additions & 619 deletions

app/services_controllers.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
use PhpMyAdmin\Controllers\Preferences;
3030
use PhpMyAdmin\Controllers\SchemaExportController;
3131
use PhpMyAdmin\Controllers\Server;
32+
use PhpMyAdmin\Controllers\Setup;
3233
use PhpMyAdmin\Controllers\Sql;
3334
use PhpMyAdmin\Controllers\Table;
3435
use PhpMyAdmin\Controllers\TableController;
@@ -866,6 +867,18 @@
866867
'class' => Server\VariablesController::class,
867868
'arguments' => ['$response' => '@response', '$template' => '@template', '$dbi' => '@dbi'],
868869
],
870+
Setup\MainController::class => [
871+
'class' => Setup\MainController::class,
872+
'arguments' => ['@' . ResponseFactory::class, '@response', '@template', '@config'],
873+
],
874+
Setup\ShowConfigController::class => [
875+
'class' => Setup\ShowConfigController::class,
876+
'arguments' => ['@' . ResponseFactory::class, '@template', '@config'],
877+
],
878+
Setup\ValidateController::class => [
879+
'class' => Setup\ValidateController::class,
880+
'arguments' => ['@' . ResponseFactory::class, '@template', '@config'],
881+
],
869882
Sql\ColumnPreferencesController::class => [
870883
'class' => Sql\ColumnPreferencesController::class,
871884
'arguments' => ['$response' => '@response', '$dbi' => '@dbi'],

phpstan-baseline.neon

Lines changed: 16 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -3025,81 +3025,26 @@ parameters:
30253025
count: 1
30263026
path: src/Controllers/Operations/ViewController.php
30273027

3028-
-
3029-
message: "#^Cannot call method getConfigArray\\(\\) on mixed\\.$#"
3030-
count: 1
3031-
path: src/Controllers/Preferences/ExportController.php
3032-
3033-
-
3034-
message: "#^Parameter \\#1 \\$configArray of method PhpMyAdmin\\\\UserPreferences\\:\\:save\\(\\) expects array, mixed given\\.$#"
3035-
count: 1
3036-
path: src/Controllers/Preferences/ExportController.php
3037-
30383028
-
30393029
message: "#^Parameter \\#1 \\$string of function ltrim expects string, mixed given\\.$#"
30403030
count: 1
30413031
path: src/Controllers/Preferences/ExportController.php
30423032

3043-
-
3044-
message: "#^Cannot call method getConfigArray\\(\\) on mixed\\.$#"
3045-
count: 1
3046-
path: src/Controllers/Preferences/FeaturesController.php
3047-
3048-
-
3049-
message: "#^Parameter \\#1 \\$configArray of method PhpMyAdmin\\\\UserPreferences\\:\\:save\\(\\) expects array, mixed given\\.$#"
3050-
count: 1
3051-
path: src/Controllers/Preferences/FeaturesController.php
3052-
30533033
-
30543034
message: "#^Parameter \\#1 \\$string of function ltrim expects string, mixed given\\.$#"
30553035
count: 1
30563036
path: src/Controllers/Preferences/FeaturesController.php
30573037

3058-
-
3059-
message: "#^Cannot call method getConfigArray\\(\\) on mixed\\.$#"
3060-
count: 1
3061-
path: src/Controllers/Preferences/ImportController.php
3062-
3063-
-
3064-
message: "#^Parameter \\#1 \\$configArray of method PhpMyAdmin\\\\UserPreferences\\:\\:save\\(\\) expects array, mixed given\\.$#"
3065-
count: 1
3066-
path: src/Controllers/Preferences/ImportController.php
3067-
30683038
-
30693039
message: "#^Parameter \\#1 \\$string of function ltrim expects string, mixed given\\.$#"
30703040
count: 1
30713041
path: src/Controllers/Preferences/ImportController.php
30723042

3073-
-
3074-
message: "#^Cannot call method getConfigArray\\(\\) on mixed\\.$#"
3075-
count: 1
3076-
path: src/Controllers/Preferences/MainPanelController.php
3077-
3078-
-
3079-
message: "#^Parameter \\#1 \\$configArray of method PhpMyAdmin\\\\UserPreferences\\:\\:save\\(\\) expects array, mixed given\\.$#"
3080-
count: 1
3081-
path: src/Controllers/Preferences/MainPanelController.php
3082-
30833043
-
30843044
message: "#^Parameter \\#1 \\$string of function ltrim expects string, mixed given\\.$#"
30853045
count: 1
30863046
path: src/Controllers/Preferences/MainPanelController.php
30873047

3088-
-
3089-
message: "#^Cannot call method getConfigArray\\(\\) on mixed\\.$#"
3090-
count: 2
3091-
path: src/Controllers/Preferences/ManageController.php
3092-
3093-
-
3094-
message: "#^Cannot call method getFlatDefaultConfig\\(\\) on mixed\\.$#"
3095-
count: 1
3096-
path: src/Controllers/Preferences/ManageController.php
3097-
3098-
-
3099-
message: "#^Cannot call method resetConfigData\\(\\) on mixed\\.$#"
3100-
count: 1
3101-
path: src/Controllers/Preferences/ManageController.php
3102-
31033048
-
31043049
message: "#^Only booleans are allowed in an if condition, PhpMyAdmin\\\\Message\\|string given\\.$#"
31053050
count: 1
@@ -3115,16 +3060,6 @@ parameters:
31153060
count: 1
31163061
path: src/Controllers/Preferences/ManageController.php
31173062

3118-
-
3119-
message: "#^Parameter \\#1 \\$cf of class PhpMyAdmin\\\\Config\\\\Forms\\\\User\\\\UserFormList constructor expects PhpMyAdmin\\\\Config\\\\ConfigFile, mixed given\\.$#"
3120-
count: 1
3121-
path: src/Controllers/Preferences/ManageController.php
3122-
3123-
-
3124-
message: "#^Parameter \\#1 \\$configArray of method PhpMyAdmin\\\\UserPreferences\\:\\:save\\(\\) expects array, mixed given\\.$#"
3125-
count: 1
3126-
path: src/Controllers/Preferences/ManageController.php
3127-
31283063
-
31293064
message: "#^Parameter \\#1 \\$fileName of method PhpMyAdmin\\\\UserPreferences\\:\\:redirect\\(\\) expects string, string\\|false given\\.$#"
31303065
count: 1
@@ -3160,46 +3095,16 @@ parameters:
31603095
count: 1
31613096
path: src/Controllers/Preferences/ManageController.php
31623097

3163-
-
3164-
message: "#^Parameter \\#1 \\.\\.\\.\\$arrays of function array_merge expects array, mixed given\\.$#"
3165-
count: 2
3166-
path: src/Controllers/Preferences/ManageController.php
3167-
3168-
-
3169-
message: "#^Parameter \\#2 \\.\\.\\.\\$arrays of function array_merge expects array, mixed given\\.$#"
3170-
count: 1
3171-
path: src/Controllers/Preferences/ManageController.php
3172-
31733098
-
31743099
message: "#^Parameter \\#3 \\$subject of function str_replace expects array\\|string, \\(int\\|string\\) given\\.$#"
31753100
count: 1
31763101
path: src/Controllers/Preferences/ManageController.php
31773102

3178-
-
3179-
message: "#^Cannot call method getConfigArray\\(\\) on mixed\\.$#"
3180-
count: 1
3181-
path: src/Controllers/Preferences/NavigationController.php
3182-
3183-
-
3184-
message: "#^Parameter \\#1 \\$configArray of method PhpMyAdmin\\\\UserPreferences\\:\\:save\\(\\) expects array, mixed given\\.$#"
3185-
count: 1
3186-
path: src/Controllers/Preferences/NavigationController.php
3187-
31883103
-
31893104
message: "#^Parameter \\#1 \\$string of function ltrim expects string, mixed given\\.$#"
31903105
count: 1
31913106
path: src/Controllers/Preferences/NavigationController.php
31923107

3193-
-
3194-
message: "#^Cannot call method getConfigArray\\(\\) on mixed\\.$#"
3195-
count: 1
3196-
path: src/Controllers/Preferences/SqlController.php
3197-
3198-
-
3199-
message: "#^Parameter \\#1 \\$configArray of method PhpMyAdmin\\\\UserPreferences\\:\\:save\\(\\) expects array, mixed given\\.$#"
3200-
count: 1
3201-
path: src/Controllers/Preferences/SqlController.php
3202-
32033108
-
32043109
message: "#^Parameter \\#1 \\$string of function ltrim expects string, mixed given\\.$#"
32053110
count: 1
@@ -3751,62 +3656,52 @@ parameters:
37513656
path: src/Controllers/Server/Variables/SetVariableController.php
37523657

37533658
-
3754-
message: "#^Only booleans are allowed in a ternary operator condition, mixed given\\.$#"
3659+
message: "#^Parameter \\#1 \\$filename of function file_exists expects string, mixed given\\.$#"
37553660
count: 1
3756-
path: src/Controllers/Setup/HomeController.php
3661+
path: src/Controllers/Setup/ConfigController.php
37573662

37583663
-
3759-
message: "#^Parameter \\#1 \\$id of method PhpMyAdmin\\\\Config\\\\ConfigFile\\:\\:getServerName\\(\\) expects int, \\(int\\|string\\) given\\.$#"
3664+
message: "#^Parameter \\#1 \\$filename of function file_exists expects string, mixed given\\.$#"
37603665
count: 1
3761-
path: src/Controllers/Setup/HomeController.php
3666+
path: src/Controllers/Setup/FormController.php
37623667

37633668
-
3764-
message: "#^Parameter \\#1 \\$server of method PhpMyAdmin\\\\Config\\\\ConfigFile\\:\\:getServerDSN\\(\\) expects int, \\(int\\|string\\) given\\.$#"
3669+
message: "#^Only booleans are allowed in a ternary operator condition, mixed given\\.$#"
37653670
count: 1
37663671
path: src/Controllers/Setup/HomeController.php
37673672

37683673
-
3769-
message: "#^Parameter \\#1 \\$config of class PhpMyAdmin\\\\Controllers\\\\Setup\\\\ConfigController constructor expects PhpMyAdmin\\\\Config\\\\ConfigFile, mixed given\\.$#"
3770-
count: 1
3771-
path: src/Controllers/Setup/MainController.php
3772-
3773-
-
3774-
message: "#^Parameter \\#1 \\$config of class PhpMyAdmin\\\\Controllers\\\\Setup\\\\FormController constructor expects PhpMyAdmin\\\\Config\\\\ConfigFile, mixed given\\.$#"
3674+
message: "#^Parameter \\#1 \\$filename of function file_exists expects string, mixed given\\.$#"
37753675
count: 1
3776-
path: src/Controllers/Setup/MainController.php
3676+
path: src/Controllers/Setup/HomeController.php
37773677

37783678
-
3779-
message: "#^Parameter \\#1 \\$config of class PhpMyAdmin\\\\Controllers\\\\Setup\\\\HomeController constructor expects PhpMyAdmin\\\\Config\\\\ConfigFile, mixed given\\.$#"
3679+
message: "#^Parameter \\#1 \\$id of method PhpMyAdmin\\\\Config\\\\ConfigFile\\:\\:getServerName\\(\\) expects int, \\(int\\|string\\) given\\.$#"
37803680
count: 1
3781-
path: src/Controllers/Setup/MainController.php
3681+
path: src/Controllers/Setup/HomeController.php
37823682

37833683
-
3784-
message: "#^Parameter \\#1 \\$config of class PhpMyAdmin\\\\Controllers\\\\Setup\\\\ServersController constructor expects PhpMyAdmin\\\\Config\\\\ConfigFile, mixed given\\.$#"
3684+
message: "#^Parameter \\#1 \\$server of method PhpMyAdmin\\\\Config\\\\ConfigFile\\:\\:getServerDSN\\(\\) expects int, \\(int\\|string\\) given\\.$#"
37853685
count: 1
3786-
path: src/Controllers/Setup/MainController.php
3686+
path: src/Controllers/Setup/HomeController.php
37873687

37883688
-
37893689
message: "#^Parameter \\#1 \\$filename of function file_exists expects string, mixed given\\.$#"
37903690
count: 1
3791-
path: src/Controllers/Setup/MainController.php
3691+
path: src/Controllers/Setup/ServerDestroyController.php
37923692

37933693
-
3794-
message: "#^Cannot call method resetConfigData\\(\\) on mixed\\.$#"
3795-
count: 1
3796-
path: src/Controllers/Setup/ShowConfigController.php
3797-
3798-
-
3799-
message: "#^Parameter \\#1 \\$cf of class PhpMyAdmin\\\\Config\\\\Forms\\\\Setup\\\\ConfigForm constructor expects PhpMyAdmin\\\\Config\\\\ConfigFile, mixed given\\.$#"
3694+
message: "#^Parameter \\#1 \\$filename of function file_exists expects string, mixed given\\.$#"
38003695
count: 1
3801-
path: src/Controllers/Setup/ShowConfigController.php
3696+
path: src/Controllers/Setup/ServersController.php
38023697

38033698
-
3804-
message: "#^Parameter \\#1 \\$cf of static method PhpMyAdmin\\\\Setup\\\\ConfigGenerator\\:\\:getConfigFile\\(\\) expects PhpMyAdmin\\\\Config\\\\ConfigFile, mixed given\\.$#"
3699+
message: "#^Parameter \\#1 \\$filename of function file_exists expects string, mixed given\\.$#"
38053700
count: 1
38063701
path: src/Controllers/Setup/ShowConfigController.php
38073702

38083703
-
3809-
message: "#^Parameter \\#1 \\$cf of static method PhpMyAdmin\\\\Config\\\\Validator\\:\\:validate\\(\\) expects PhpMyAdmin\\\\Config\\\\ConfigFile, mixed given\\.$#"
3704+
message: "#^Parameter \\#1 \\$filename of function file_exists expects string, mixed given\\.$#"
38103705
count: 1
38113706
path: src/Controllers/Setup/ValidateController.php
38123707

@@ -15230,11 +15125,6 @@ parameters:
1523015125
count: 2
1523115126
path: tests/unit/Config/ServerConfigChecksTest.php
1523215127

15233-
-
15234-
message: "#^Parameter \\#1 \\$cfg of class PhpMyAdmin\\\\Config\\\\ServerConfigChecks constructor expects PhpMyAdmin\\\\Config\\\\ConfigFile, mixed given\\.$#"
15235-
count: 3
15236-
path: tests/unit/Config/ServerConfigChecksTest.php
15237-
1523815128
-
1523915129
message: "#^Property PhpMyAdmin\\\\Tests\\\\Config\\\\ServerConfigChecksTest\\:\\:\\$sessionID \\(string\\) does not accept mixed\\.$#"
1524015130
count: 1

0 commit comments

Comments
 (0)