Commit Graph

58 Commits

Author SHA1 Message Date
Kamil Tekiela
1d180c5482 Use null as sentinel value in getColumn
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2023-05-19 16:33:01 +01:00
Kamil Tekiela
4ec3b99ba3
Improve boolean conditions with arrays (#18417)
* Remove empty() on array

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

* Remove boolean count()

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

---------

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2023-05-12 15:16:26 -03:00
Maurício Meneghini Fauth
6a2c12bdc8
Add missing traversable type hints
Replace array type hint with mixed[] type hint, since it means the same.
This way it's possible to require traversable type hint for new code.

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2023-04-02 01:32:12 -03:00
Liviu-Mihail Concioiu
d9e0b9d7e7
Fix move columns (#18271)
Fix #18232 - Fix issues when moving a column

Signed-off-by: Liviu-Mihail Concioiu <liviu.concioiu@gmail.com>
Co-authored-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2023-03-29 17:23:52 -03:00
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
437215cab2
Rename variables to use camel case format
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2023-03-26 21:47:50 -03:00
Kamil Tekiela
3ecf14df34 Fixing erroneous params
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2023-03-17 12:47:43 +00: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
Maurício Meneghini Fauth
556594b4cd
Fix coding standard spacing issues
- Fixes one line doc comments
- Fixes parent call spacing
- Fixes constant spacing

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2023-02-24 21:06:17 -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
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
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
7cde53ed0d
Merge branch 'QA_5_2'
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2023-01-09 18:41:44 -03:00
Liviu-Mihail Concioiu
38deec06cd Fix uuid column move
Signed-off-by: Liviu-Mihail Concioiu <liviu.concioiu@gmail.com>
2023-01-07 18:05:14 +01:00
Kamil Tekiela
6264f6f1ea
Various refactorings 2 (#17965)
* Remove extra blank lines
* Remove useless param annotations
* Refactor Index::singleton
* Refactor Config.php
* Refactor Header::addRecentTable()
* Collapse return statement into a single line
* Refactor Message.php
* Convert $getUniqueCondition into a scalar
* Code style
* Fix invalid return phpdoc
* Remove unused variable
* Remove redundant empty array checks
* Refactor Export::closeFile()
* Simplify else statement
* Remove redundant else
* Refactor TablePartitionDefinition::getDetails
* Simpler returns
* Add types for getCellContent()
* Remove useless method mngInsideStructComm

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2022-12-24 12:54:23 -03:00
Maurício Meneghini Fauth
95c9fa430c
Merge pull request #17889 from kamil-tekiela/Index-controllers
Refactor Index controllers
2022-11-30 13:58:56 -03:00
Maurício Meneghini Fauth
49865fe647
Remove Indexes object from the Window global object
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-11-29 14:39:16 -03:00
Kamil Tekiela
2f769c00c3 Move getAddIndexSql() to Generator
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2022-11-12 15:22:30 +00:00
Kamil Tekiela
ff2e7f6334 Move methods to Indexes.php
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2022-11-11 22:24:27 +00:00
Kamil Tekiela
0131d39fe8 Extract executeAddIndexSql()
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2022-11-11 22:02:50 +00:00
Kamil Tekiela
a56a44b2cc Extract getAddIndexSql()
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2022-11-11 22:02:50 +00:00
Kamil Tekiela
3581f28c7f AbstractIndexController
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2022-11-11 21:37:32 +00:00
Tobias Speicher
0f215ed0f6
Fix broken single column change page introduced by #17862
Signed-off-by: Tobias Speicher <rootcommander@gmail.com>
2022-11-09 11:06:02 +01:00
Kamil Tekiela
ba41957e5f Redesign PrimaryController
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2022-11-08 00:31:47 +00:00
Kamil Tekiela
959849f446
Introduce ServerRequest::hasBodyParam() (#17870)
* Drop Sql::setUiProp()
* Remove ternary operator
* Improve array guard
* Remove redundant isset
* Implement hasBodyParam()
* Add has() and hasQueryParam()

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2022-11-05 13:04:45 -03:00
Kamil Tekiela
b3d97a47ef Refactor ChangeController and use ServerRequest
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2022-11-02 21:57:31 +00:00
Sebastian Walther
edfe8a5881
Replace POST-var access with Serverrequest object - pt 2 (#17787)
* Use ServerRequestObject to access POST-vars

Signed-off-by: Sebastian Walther <swalther@complex-it.de>
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
Co-authored-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-10-19 22:06:35 -03:00
Kamil Tekiela
2c416128e5 Pass as argument to Table
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2022-10-17 22:30:33 +01: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
59b8f31a83
Merge branch 'QA_5_2'
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-07-16 02:05:39 -03:00
William Desportes
6a69face6c
Fix PHP 8.2: ${var} deprecated string interpolation syntax
Ref: https://php.watch/versions/8.2/$%7Bvar%7D-string-interpolation-deprecated

Left over to patch:
- libraries/classes/Git.php#L397
- libraries/classes/Database/Qbe.php#L878
- libraries/classes/Database/Qbe.php#L879

Signed-off-by: William Desportes <williamdes@wdes.fr>
2022-07-13 11:14:20 +02:00
Maurício Meneghini Fauth
eb3703882b
Move Routing::getCurrentRoute to ServerRequest
The route is retrieved from the request, so it makes sense to move the
method to the Http\ServerRequest class.

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-06-06 23:36:57 -03:00
Maurício Meneghini Fauth
10b937511d
Replace $analyzedSqlResults array with StatementInfo object
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-05-24 21:35:30 -03: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
ec4baa6583
Remove calls of Util::getValueByKey where path doesn't have a dot
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-03-08 14:30:19 -03:00
Maurício Meneghini Fauth
f940693c75
Move Util::checkParameters method to the AbstractController
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-03-07 22:59:33 -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
9b5b210fc4
Remove action global var from ColumnsDefinition class
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-03-03 17:41:52 -03:00
Maurício Meneghini Fauth
c0eb02d7d3
Extract ColumnsDefinition construction from controllers
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-03-02 18:59:27 -03:00
Maurício Meneghini Fauth
5a34a3bb04
Remove db and table properties from controllers
Replaces them with their respective globals.

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-02-02 14:48:43 -03:00
Maurício Meneghini Fauth
a8d514a350
Remove db and table globals from DbTableExists class
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-01-28 16:43:48 -03:00
Kamil Tekiela
47a039d70c Implement ResultInterface & MysqliResult
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2021-12-31 23:59:24 +00:00
Maurício Meneghini Fauth
feca48cc76
Change return type of DatabaseInterface::getError method
Now, it returns last error message or an empty string instead of false
if no errors occurred.

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-12-27 14:43:14 -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
ce527035c2 PHPStan checkAlwaysTrueCheckTypeFunctionCall fixes
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2021-12-08 15:26:52 +00:00
Kamil Tekiela
f446e6da88 Remove unused variables
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2021-12-03 15:12:56 +00:00