phpmyadmin/phpmyadmin

`DatabaseName` and `TableName` should be used for `$db` and `$table`

Aperta

#17.727 aperta il 17 set 2022

 (11 commenti) (1 reazione) (0 assegnatari)PHP (3454 fork)batch import
Enhancementgood first issuehacktoberfesthelp wantednewbierefactoring

Metriche repository

Star
 (6886 stelle)
Metriche merge PR
 (Merge medio 2g 17h) (11 PR mergiate in 30 g)

Descrizione

The PhpMyAdmin\Dbal\DatabaseName and PhpMyAdmin\Dbal\TableName classes should be used as a type for the database and table names instead of using plain strings.

- public function foo(string $db, string $table)
+ public function foo(DatabaseName $db, TableName $table)

The current database and table names can also be got as strings using the Current::$database and Current::$table static properties of the class PhpMyAdmin\Current. These should be using the value objects as well.

- $db = Current::$database;
+ $db = DatabaseName::fromValue(Current::$database);

If you're willing to work on this, you don't need to change all cases before opening a pull request, you can change a small piece of code, test if it's working and then open a pull request. That will make your PR easier to review and merge.

Guida contributor