Commit Graph

84 Commits

Author SHA1 Message Date
Maurício Meneghini Fauth
dd885dc7b8
Use single-line arrays when possible
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2023-03-27 17:39:17 -03:00
Maurício Meneghini Fauth
c7855f6e95
Create the PhpMyAdmin\Replication namespace
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2023-03-20 14:16:01 -03:00
Kamil Tekiela
555c6798eb Add native param types
Includes TypeHints.UnionTypeHintFormat

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2023-03-17 12:45:18 +00:00
Kamil Tekiela
0bdcaba2d2
Add native property types (#18143)
* Add native property types

Includes TypeHints.UnionTypeHintFormat

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Set some default values for properties

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Format and promote properties

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Remove redundant asserts

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Redundant cast

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* $tmanager->theme is never null

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Redundant variable

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Fix empty on $statementInfo bool

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Redundant casts

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Redundant issets

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* getPacked() returns nullable string

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Redundant if

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* $this->content can be null

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Simplify ThemeManager::getInstance()

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Use isset for checking if property is initialized

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Use nullable instead of uninitialized property

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* password is no longer nullable

I can't verify that none of the globals ever tried to set it to null, but the variable should never be nullable.

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Update baselines

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* $same_wide_width param can be float or int

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Update Message.php

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Cast Sub_part to int

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Fix one line doc comments

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

---------

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2023-02-26 23:30:41 -03:00
Maurício Meneghini Fauth
77957a69a5
Add trailing comma for multi-line functions
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2023-02-24 20:48:46 -03:00
Maurício Meneghini Fauth
2137664f82
Merge pull request #18116 from kamil-tekiela/Remove-strlen
Remove strlen when used in a condition
2023-02-24 20:20:12 -03:00
Kamil Tekiela
e8c5eef6f8
Remove annoying empty statements (#18114)
* Remove annoying empty statements

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Make $extra strict and stop passing false to it

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Make $page strict and stop passing null

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

---------

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2023-02-24 20:11:37 -03:00
Kamil Tekiela
dcc912fdef Remove strlen when used in a condition
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2023-02-24 22:58:47 +00:00
Maurício Meneghini Fauth
4ff3724c3f
Use union with null instead of short nullable type
Since union type are now possible, using union with null makes more
clear that it is a union type.

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2023-02-20 21:48:19 -03:00
Maurício Meneghini Fauth
785f8c1c00
Use constructor property promotion where possible
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2023-02-20 19:39:02 -03:00
Maurício Meneghini Fauth
613678f8f5
Replace assignments with null coalesce equal operator
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2023-02-20 17:03:05 -03:00
Kamil Tekiela
2b35303aae
Remove redundant code (#18063)
PHPStorm has been a little annoying with showing all these code issues. I took some time to analyse most of them and fix whichever were easy to fix. This kind of change should improve future maintenance as developers do not need to wonder what a line of code does. Code that has no impact on functionality should be removed.

* Remove redundant variables
* Invert condition for better clarity
* Remove some of the redundant casts
* Replace switch with an if
* Fix foreach variable
* Remove redundant variable concat
* Remove redundant concats
* Replace for loop with str_repeat
* Remove always true param
* Turn property $position into local var
* Turn Pdf properties into local vars
* Remove unused properties in Pdf
* Change ternary into condition
* Remove redundant assignments
   They are immediately overwritten with a different value.
* Redundant array append
* Collapse if statements into assignments
* Use boolean constants instead of variables
* Remove unneeded parameter
* Remove null-coalesce
* Unnecessary assignment
* Remove redundant isset
* Remove readOnly flag for InsertEdit fields
* Remove function_exists and $mode var
* Remove duplicate condition
* Remove redundant elseif
* Remove redundant isset
* Use hasBodyParam()
* Simplify isRoutesCacheFileValid()
   Psalm complains but is wrong.

https://github.com/phpmyadmin/phpmyadmin/pull/18063

---------

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2023-02-15 09:11:05 -03:00
Kamil Tekiela
8a1d6f1eaa Convert var annotations to typed properties
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2023-02-12 21:31:04 +00:00
Maurício Meneghini Fauth
41dec1effc
Extract connection type constants to the Connection class
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2023-01-17 02:21:27 -03:00
ru-asdx
87bd27621e
Ref #17769 - replace superglobals with serverrequest in server/ controllers (#17978)
* replace superglobals with serverrequest in server/ controllers
* replace $_POST['param'] ?? $_GET['value'] with $request->getParam

Signed-off-by: Evgeny Skorlov <eugene@skorlov.name>
2023-01-10 21:22:04 -03:00
Kamil Tekiela
65ab1608f8 Remove dependency in DatabasesController
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2022-12-16 20:58:48 +00:00
Maurício Meneghini Fauth
d0d90551c3 Remove the dblist global variable
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-11-13 21:08:00 -03:00
Maurício Meneghini Fauth
3c618c22a9
Add ServerRequest parameter to all controllers
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-07-28 01:00:08 -03:00
Maurício Meneghini Fauth
905214ae0b
Merge branch 'QA_5_2'
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-06-11 14:13:30 -03:00
Maurício Meneghini Fauth
bf084233ea
Add ChangeLog entry for #17586
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-06-11 14:04:58 -03:00
Liviu-Mihail Concioiu
479f8472b3 Fix statistics
Signed-off-by: Liviu-Mihail Concioiu <liviu.concioiu@gmail.com>
2022-06-06 21:12:47 +02:00
Maurício Meneghini Fauth
5950693fb3
Fix possible undefined globals
Related to https://github.com/phpmyadmin/phpmyadmin/pull/17427.

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-03-10 18:05:21 -03:00
Maurício Meneghini Fauth
1438cb211e
Replace global keyword with $GLOBALS
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-03-07 17:31:11 -03:00
Maurício Meneghini Fauth
fa5c684f27
Replace the master/slave terminology
Replaces master with primary and slave with replica.

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-12-18 14:26:56 -03:00
Maurício Meneghini Fauth
c411121fd8
Move Relation classes into the ConfigStorage namespace
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-12-17 12:09:13 -03:00
Kamil Tekiela
945d887a10 Fix var annotation for Charset and Collation
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2021-12-09 22:25:58 +00:00
Maurício Meneghini Fauth
f00d70cccb
Remove useless whitespaces
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-09-15 17:05:40 -03:00
Maurício Meneghini Fauth
3531775b7c
Add type declarations to the controllers contructors
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-09-11 17:32:22 -03:00
Maurício Meneghini Fauth
e3554879ef
Extract actions from controllers to new controllers
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-09-07 21:19:43 -03:00
Maurício Meneghini Fauth
6ae07c96fb
Replace strpos !== false with str_contains
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-07-09 22:30:42 -03:00
Maurício Meneghini Fauth
9adaa912e1
Rename Response class to ResponseRenderer
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-06-30 12:35:22 -03:00
Maurício Meneghini Fauth
1c084de30b
Fix coding standard errors
Related to 62f142c9fa.

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-06-03 16:50:33 -03:00
Maurício Meneghini Fauth
91bd0df2e5
Rename $err_url global to $errorUrl
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-03-24 19:39:28 -03:00
Maurício Meneghini Fauth
d83abf63e7
Use PSR-12 for control structures spacing
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-03-05 15:27:03 -03:00
Maurício Meneghini Fauth
0b8edc5bde
Use PSR-12 for namespace use statements
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-03-05 14:18:35 -03:00
Maurício Meneghini Fauth
1e5fbd57fc
Create Twig\AssetExtension and image Twig function
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-01-28 16:09:17 -03:00
Maurício Meneghini Fauth
6b81080127 Remove Common::server method
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2020-11-02 18:48:23 -03:00
Maurício Meneghini Fauth
a83ec78ebf Make DatabaseInterface::isUserType method private
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2020-10-24 00:40:03 -03:00
Maurício Meneghini Fauth
db3da81056 Remove some useless comments
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2020-10-13 19:56:56 -03:00
Maurício Meneghini Fauth
e6ec9df84e Remove DBI dep from Controllers/AbstractController
Moves the DatabaseInterface class dependency to the classes that use it.

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2020-10-11 22:48:44 -03:00
Maurício Meneghini Fauth
f2e49a92c6 Fix some type errors detected by PHPStan
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2020-09-30 19:23:01 -03:00
Maurício Meneghini Fauth
cd862d4f00 Remove replication_info global variable
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2020-09-12 09:04:44 -03:00
Maurício Meneghini Fauth
952e2f9ee8 Remove replication_types PHP global
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2020-09-08 15:54:02 -03:00
Maurício Meneghini Fauth
3c21cf1853 Remove url_query PHP global
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2020-09-08 13:32:25 -03:00
Maurício Meneghini Fauth
ceac762e09 Remove pmaThemePath and pmaThemeImage PHP globals
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2020-09-02 10:57:57 -03:00
Maurício Meneghini Fauth
1dccc10493 Extract method for adding script files
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2020-07-12 16:58:33 -03:00
Maurício Meneghini Fauth
b30f06455c Remove the blacklist/whitelist terminology
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2020-06-15 17:51:24 -03:00
William Desportes
761045bcc9
Move getSystemSchemas and isSystemSchema to Query\Utilities
If you think the class name could be better, feel free to improve it.
Everybody know naming classes is difficult ^^
Signed-off-by: William Desportes <williamdes@wdes.fr>
2020-05-31 01:42:53 +02:00
William Desportes
aba5e27a82
Some code fixes and improvements
Signed-off-by: William Desportes <williamdes@wdes.fr>
2020-05-27 18:55:58 +02:00
Maurício Meneghini Fauth
f4582e083e Use early exit when possible
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2020-05-27 00:35:24 -03:00