[phpMyAdmin Git] [phpmyadmin/phpmyadmin] dea4c9: Refactor relations.php (#17210)

Kamil Tekiela tekiela246 at gmail.com
Thu Dec 2 21:17:44 CET 2021


Branch: refs/heads/master
Home: https://github.com/phpmyadmin/phpmyadmin
Commit: dea4c972afce6ba8d7bc904d2706924befc503de
https://github.com/phpmyadmin/phpmyadmin/commit/dea4c972afce6ba8d7bc904d2706924befc503de
Author: Kamil Tekiela <tekiela246 at gmail.com>
Date: 2021-12-02 (Thu, 12 December 2021) -03:00

Changed paths: 
M libraries/classes/Relation.php
M psalm-baseline.xml

Log Message:
-----------
Refactor relations.php (#17210)

* Refactor getComments()

Use early return and remove redundant if statement.

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

* Fix indentation

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

* Remove temporary variable

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

* Remove redundant code

Remove redundant if statement.
Break at the end of the loop.
elseif when there is no other choice.
Redundant ! empty().

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

* Collapse if statement into an elvis operator

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

* Better type hinting for return array

We can tell Psalm what to expect, but we should declare the variables first.

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

* Remove dead code

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

* Use array_keys instead of unused variable

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

* Add type declaration and psalm-return

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

* Add psalm-return to checkChildForeignReferences()

Also added type declaration, and simplified the code

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

* Refactor getChildReferences()

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

* Improve type inference for foreignDropdown

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

* [bugfix] Cast the value to a string to avoid type mismatch.

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

* Add proper string type declaration to $foreign_filter

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



More information about the Git mailing list