Commit Graph

340 Commits

Author SHA1 Message Date
Kamil Tekiela
74c48a499b Fix error in normalization
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2023-03-19 21:56:01 +00:00
Kamil Tekiela
fce745a874 Fix #18275
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2023-03-19 10:04:49 +00:00
Kamil Tekiela
c0b367cc57 Create Tracking namespace
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2023-03-17 22:35:32 +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
342ab3f67a
Merge branch 'QA_5_2'
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2023-02-27 14:36:32 -03: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
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
902d1a1e77
Add native return type hints (#18126)
* Add remaining native return type hints to flush out bugs

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

* Cast the mixed value to int

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

* Fix tests

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

* getAutoIncrement() is supposed to return string

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

* Cast values to string in DummyResult

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

* Make getCollation() return non-nullable string

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

* Cast seqInIndex to int

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

* Cast $cardinality to int

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

* createFile may return false

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

* Remove redundant cast

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

* Update baselines

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

---------

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2023-02-23 15:43:36 -03:00
Kamil Tekiela
aa63c6821a Fix bug related to tables with numerical names
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2023-02-22 13:18:06 +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
Kamil Tekiela
cfe54a501b Add union types
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2023-02-15 15:23:28 +00:00
Kamil Tekiela
164bf08f4c Move getColumnMapFromSql() to SystemDatabase
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2023-02-15 12:41:47 +00: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
Maurício Meneghini Fauth
e854e79d3b
Merge pull request #18086 from kamil-tekiela/Replace-switch-with-match
Replace switch with match
2023-02-14 20:04:17 -03:00
Maurício Meneghini Fauth
26b5860484
Merge pull request #18089 from kamil-tekiela/first-class-callable
Convert to first class callables
2023-02-14 17:36:13 -03:00
Kamil Tekiela
b6f0da1c09 Convert to first class callables
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2023-02-14 14:18:23 +00:00
Kamil Tekiela
87e42d591c Use short closures where possible
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2023-02-14 13:44:42 +00:00
Kamil Tekiela
69f8d9f85c Replace switch with match
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2023-02-14 13:07:00 +00: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
4129bfe23e
Create Dbal/Statement interface
Wraps mysqli_stmt class with the Dbal\MysqliStatement class.

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2023-01-20 00:36:01 -03: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
Maurício Meneghini Fauth
a6bdf8a811
Create Dbal\Connection class
Wraps the connection object with the Connection class.

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2023-01-16 15:31:02 -03:00
Maurício Meneghini Fauth
591bc50e22
Extract method to get warning count from DatabaseInterface
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2023-01-16 14:03:21 -03:00
Maurício Meneghini Fauth
fdf474abf9
Merge pull request #17981 from kamil-tekiela/getTables-investigation
Improve some type inference in various places

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-12-24 13:44:45 -03:00
Maurício Meneghini Fauth
d5f3c91b29
Merge pull request #17979 from kamil-tekiela/Optimize-fetchResult
Microoptimization of fetchResult()

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-12-24 13:32:45 -03: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
Kamil Tekiela
bc6fb312db Improve type inference in getTables()
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2022-12-19 23:29:25 +00:00
Kamil Tekiela
fd52b85eed Microoptimization of fetchResult()
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2022-12-19 19:30:13 +00:00
Kamil Tekiela
dd699f348d Clean up LIKE escaping
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2022-11-25 00:06:52 +00:00
Maurício Meneghini Fauth
e194eb3961
Improve type DatabaseInterface's $link params
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-11-21 14:50:52 -03:00
Maurício Meneghini Fauth
ca489f3b41
Improve type of DatabaseInterface::getLowerCaseNames()
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-11-19 15:50:14 -03:00
Maurício Meneghini Fauth
219a665c8f
Improve type of DatabaseInterface::getCurrentUserGrants()
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-11-19 15:50:14 -03:00
Maurício Meneghini Fauth
3ec0a92a0b
Improve type inference of getCurrentUserAndHost()
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-11-19 13:05:23 -03:00
Maurício Meneghini Fauth
3c26a938cb
Add better type inference for DatabaseInterface::$links
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-11-18 21:36:38 -03: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
Kamil Tekiela
3b49a5bedb Implement quoteString()
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2022-11-06 19:06:48 +00:00
Kamil Tekiela
95a93ba909
Minor stylistic changes (#17865)
* Stylistic changes to make refactoring easier
* Parameter $where was unnecessarily nullable
* Refactor Routines::getDetails()
* Refactor Events::getDetails()
* Refactor Triggers::getDetails()
* Split up QueryGenerator::getInformationSchemaColumnsFullRequest

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2022-11-05 12:55:44 -03:00
Maurício Meneghini Fauth
103968f352
Replace fatalError() with exception in Core::warnMissingExtension()
Also moves some other calls to Core::warnMissingExtension() to the
Common::checkRequiredPhpExtensions() method.

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-10-31 20:25:55 -03:00
William Desportes
d82b43c5ff
Fixup testGetMySQLDocuURL after changing setVersion() in DBI
and fix a phpc issue

See: cac09436c9

Signed-off-by: William Desportes <williamdes@wdes.fr>
2022-10-13 20:38:12 +02:00
William Desportes
fd13e506d0
Fixup tests and DBI after changing setVersion() in DBI
Signed-off-by: William Desportes <williamdes@wdes.fr>

See: cac09436c9
2022-10-13 20:28:32 +02:00
William Desportes
6da193304f
Merge branch 'QA_5_2'
Signed-off-by: William Desportes <williamdes@wdes.fr>
2022-10-13 20:13:48 +02:00
Mo Sureerat
a07474f997 Handle array re-index + fix setVersion logic + hardcode version int
Signed-off-by: Mo Sureerat <sureemo@gmail.com>
2022-10-11 17:32:03 +07:00
Mo Sureerat
9ff395e888 Fix type
Signed-off-by: Mo Sureerat <sureemo@gmail.com>
2022-10-11 13:40:20 +07:00
Mo Sureerat
d97df6c00b Define type
Signed-off-by: Mo Sureerat <sureemo@gmail.com>
2022-10-11 13:12:07 +07:00
Mo Sureerat
cac09436c9 Rewrite method to set database info
Signed-off-by: Mo Sureerat <sureemo@gmail.com>
2022-10-11 13:01:19 +07:00
Mo Sureerat
7ea0a95646 Update code style
Signed-off-by: Mo Sureerat <sureemo@gmail.com>
2022-10-11 01:24:39 +07:00
Mo Sureerat
8c93351647 Relocate method and fix unit test fail
Signed-off-by: Mo Sureerat <sureemo@gmail.com>
2022-10-11 01:18:52 +07:00
Maurício Meneghini Fauth
e96fab654d
Move DBI's getProceduresOrFunctions into Routines class
Splits the method into Routines::getFunctionNames and
Routines::getProcedureNames and adds tests.

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-09-11 17:32:44 -03:00
Maurício Meneghini Fauth
7975f5fb05
Move DBI's getDefinition into the Routines and Events classes
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-09-11 15:48:26 -03:00