Commit Graph

282 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
e5698c85e9
Require single line for function calls
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2023-03-26 23:10:10 -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
Maurício Meneghini Fauth
f13bd41bac
Merge pull request #18247 from kamil-tekiela/Native-param-types
Native param types
2023-03-17 17:52:45 -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
Maximilian Krög
79ab3dfe11
Fix some comment typos
Signed-off-by: Maximilian Krög <maxi_kroeg@web.de>
2023-03-16 21:26:19 +01: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
Maurício Meneghini Fauth
47846068fa
Remove some useless comments
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2023-02-20 23:45:06 -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
d28982e1ab
Merge branch 'QA_5_2'
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2023-02-15 16:43:41 -03:00
Maurício Meneghini Fauth
b4f15ab6a0
Fix missing default_action parameter when copying rows
Related to https://github.com/phpmyadmin/phpmyadmin/pull/17923

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2023-02-15 16:37:05 -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
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
69f8d9f85c Replace switch with match
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2023-02-14 13:07:00 +00:00
Kamil Tekiela
5c5eeb9346 substr() now returns an empty string
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2023-02-13 21:11:17 +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
0819043d0e
Merge branch 'QA_5_2'
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2023-02-08 14:09:59 -03:00
Maurício Meneghini Fauth
551c317aee
Merge pull request #17982 from kamil-tekiela/Elvis
Remove usage of elvis operator

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-12-24 13:46:33 -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
9a8dc40ae9 Remove usage of elvis operator
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2022-12-20 19:50:58 +00:00
William Desportes
b9c593c67d
Fix #17766 - Allow to open in a new tab copy and edit row actions
Signed-off-by: William Desportes <williamdes@wdes.fr>
2022-11-25 19:55:53 +01:00
Kamil Tekiela
3b49a5bedb Implement quoteString()
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2022-11-06 19:06:48 +00:00
Mo Sureerat
15e629c9c1 [ISSUE-17793] UUID - Fix insert error
Signed-off-by: Mo Sureerat <sureemo@gmail.com>
2022-11-03 05:55:37 +07:00
Mo Sureerat
ddf928e6f3 [ISSUE-17793] Revert previous change + Fix default selection of uuid in alter table
Signed-off-by: Mo Sureerat <sureemo@gmail.com>
2022-11-03 05:25:14 +07:00
Mo Sureerat
f8bee4cd5d [ISSUE-17793] Insert record - fix null not selected if nullable UUID + insert error
Signed-off-by: Mo Sureerat <sureemo@gmail.com>
2022-11-03 05:25:04 +07:00
William Desportes
25c13d667b
Merge branch 'QA_5_2'
Signed-off-by: William Desportes <williamdes@wdes.fr>
2022-10-26 12:22:38 +02:00
Mo Sureerat
aeab8a1c41
Fix #17793 - insert UUID (#17797)
* Add/Change table schema - Add UUID in default options
* Insert/Update - Generate uuid only not defined and not check null option
* Add/Change table schema - Hide UUID from default options if database not support & add unit test

Fix #17793

Signed-off-by: Mo Sureerat <sureemo@gmail.com>
2022-10-20 15:57:53 -03:00
Liviu-Mihail Concioiu
5ab43f618d
Adds support for SHA2 function (#17809)
* Adds support for SHA2 function

Fixes #17760

Signed-off-by: Liviu-Mihail Concioiu <liviu.concioiu@gmail.com>
2022-10-18 16:12:06 -03:00
Kamil Tekiela
f2a83311ae Simplify onchange in InsertEdit.php
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2022-10-17 21:28:57 +01:00
Jesper Skytte Marcussen
23995b3c73
Adding inputmode numeric to integer fields (#17753)
* Adding inputmode numeric to integer fields

To easier use phpMyAdmin on touch devices with virtual keyboards, adding the inputmode ensures that the correct virtual keyboard is shown per default when focusing the field.

See https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/inputmode for more information.

Related to #17745.

Signed-off-by: Jesper Skytte <jesper@skytte.it>
2022-10-09 15:26:32 -03:00
Kamil Tekiela
f7f8722e1f
Refactor insert edit (#17684)
This is a major redesign of the code that handles these four actions: in-place edit(AJAX), edit of multiple rows, copying of rows, and insertion of new rows. The goal is to make the code easier to read and more understandable.

    I introduced a new DTO for better readability.
    Some of the methods were made private to the model
    The controller has access to two methods for getting the value for INSERT and for UPDATE
    Unfortunately, I have introduced method envy on EditField, but I do not want to move the functionality away from InsertEdit.php
    Unit tests have not improved in readability but I added helpful comments explaining what we are testing. There's probably a way to improve it too.

I will probably merge all commits once I decide it's ready for review.


Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2022-08-22 22:39:53 -03:00
Maurício Meneghini Fauth
0b2ab57ea2
Merge branch 'QA_5_2'
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-08-19 00:31:22 -03:00
Kamil Tekiela
fc932a9a8f Allow fields to be set to NULL
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2022-08-15 14:35:21 +01:00
Maurício Meneghini Fauth
f57ea10921
Merge branch 'QA_5_2'
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-08-12 21:13:24 -03:00
Kamil Tekiela
06d58c9662 Fix bug #17663
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2022-08-08 14:41:51 +01:00
Kamil Tekiela
1e70bba883 Fix bug not allowing insertion of set values
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2022-08-08 14:33:50 +01:00
Kamil Tekiela
6d0a30a391 Fix errors in InsertEdit
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2022-06-04 19:06:16 +01:00
Kamil Tekiela
b82027ef6d Redesign function fields in insert
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2022-06-03 20:15:58 +01:00
Maurício Meneghini Fauth
d104e8b1bb
Fixed some issues reported by PHPStan
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-06-02 22:36:55 -03:00
Maurício Meneghini Fauth
27bdd0d64d
Extract InsertEdit dependencies to constructor params
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-06-01 23:42:47 -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
20ebad0ec5
Merge pull request #17410 from kamil-tekiela/pr/17211
transfer the HTML content in InsertEdit.php for a twig file
2022-03-04 12:24:03 -03:00
Kamil Tekiela
aa9c6d7b3a Apply code style and fix issues
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2022-02-20 16:35:49 +00:00
Kamil Tekiela
848c4ef172 Fix broken Insert page
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2022-02-18 14:14:22 +00:00
Isaac Bennetch
985912f58f Fix merge conflicts from security branch
Signed-off-by: Isaac Bennetch <bennetch@gmail.com>
2022-01-20 12:28:17 -05:00
Maurício Meneghini Fauth
0bee94b27e
Merge branch 'QA_5_1-security' into master-security
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-01-11 14:31:56 -03:00
Maurício Meneghini Fauth
02e8588404
Merge branch 'QA_4_9-security' into QA_5_1-security
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2022-01-10 18:39:23 -03:00