Skip to content

Commit

Permalink
Split long lines
Browse files Browse the repository at this point in the history
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
  • Loading branch information
kamil-tekiela committed Mar 17, 2023
1 parent bd1850c commit 8a5ce0b
Show file tree
Hide file tree
Showing 12 changed files with 78 additions and 25 deletions.
13 changes: 11 additions & 2 deletions libraries/classes/Database/Designer/Common.php
Expand Up @@ -534,8 +534,17 @@ public function saveDisplayField(string $db, string $table, string $field): arra
* @return array<int,string|bool> array of success/failure and message
* @psalm-return array{0: bool, 1: string}
*/
public function addNewRelation(string $db, string $T1, string $F1, string $T2, string $F2, string $on_delete, string $on_update, string $DB1, string $DB2): array
{
public function addNewRelation(
string $db,
string $T1,
string $F1,
string $T2,
string $F2,
string $on_delete,
string $on_update,
string $DB1,
string $DB2,
): array {
$tables = $this->dbi->getTablesFull($DB1, $T1);
$type_T1 = mb_strtoupper($tables[$T1]['ENGINE'] ?? '');
$tables = $this->dbi->getTablesFull($DB2, $T2);
Expand Down
7 changes: 5 additions & 2 deletions libraries/classes/Database/Events.php
Expand Up @@ -62,8 +62,11 @@ class Events
'MINUTE_SECOND',
];

public function __construct(private DatabaseInterface $dbi, private Template $template, private ResponseRenderer $response)
{
public function __construct(
private DatabaseInterface $dbi,
private Template $template,
private ResponseRenderer $response,
) {
}

/**
Expand Down
7 changes: 5 additions & 2 deletions libraries/classes/Database/Routines.php
Expand Up @@ -57,8 +57,11 @@ class Routines
/** @var array<int, string> */
private array $numericOptions = ['UNSIGNED', 'ZEROFILL', 'UNSIGNED ZEROFILL'];

public function __construct(private DatabaseInterface $dbi, private Template $template, private ResponseRenderer $response)
{
public function __construct(
private DatabaseInterface $dbi,
private Template $template,
private ResponseRenderer $response,
) {
}

/**
Expand Down
7 changes: 5 additions & 2 deletions libraries/classes/Database/Triggers.php
Expand Up @@ -37,8 +37,11 @@ class Triggers
/** @var array<int, string> */
private array $event = ['INSERT', 'UPDATE', 'DELETE'];

public function __construct(private DatabaseInterface $dbi, private Template $template, private ResponseRenderer $response)
{
public function __construct(
private DatabaseInterface $dbi,
private Template $template,
private ResponseRenderer $response,
) {
}

/**
Expand Down
10 changes: 8 additions & 2 deletions libraries/classes/Display/Results.php
Expand Up @@ -245,8 +245,14 @@ class Results
* @param string $goto the URL to go back in case of errors
* @param string $sqlQuery the SQL query
*/
public function __construct(private DatabaseInterface $dbi, string $db, string $table, int $server, string $goto, string $sqlQuery)
{
public function __construct(
private DatabaseInterface $dbi,
string $db,
string $table,
int $server,
string $goto,
string $sqlQuery,
) {
$this->relation = new Relation($this->dbi);
$this->transformations = new Transformations();
$this->template = new Template();
Expand Down
8 changes: 6 additions & 2 deletions libraries/classes/Html/MySQLDocumentation.php
Expand Up @@ -66,8 +66,12 @@ public static function show(
*
* @return string the html link
*/
public static function showDocumentation(string $page, string $anchor = '', bool $bbcode = false, bool $disableTabIndex = false): string
{
public static function showDocumentation(
string $page,
string $anchor = '',
bool $bbcode = false,
bool $disableTabIndex = false,
): string {
return Generator::showDocumentationLink(
self::getDocumentationLink($page, $anchor),
'documentation',
Expand Down
9 changes: 7 additions & 2 deletions libraries/classes/Language.php
Expand Up @@ -33,8 +33,13 @@ class Language
* @param string $regex Match regular expression
* @param string $mysql MySQL locale code
*/
public function __construct(protected string $code, protected string $name, protected string $native, string $regex, protected string $mysql)
{
public function __construct(
protected string $code,
protected string $name,
protected string $native,
string $regex,
protected string $mysql,
) {
if (! str_contains($regex, '[-_]')) {
$regex = str_replace('|', '([-_][[:alpha:]]{2,3})?|', $regex);
}
Expand Down
8 changes: 6 additions & 2 deletions libraries/classes/Normalization.php
Expand Up @@ -498,8 +498,12 @@ public function getHtmlForNewTables2NF(array $partialDependencies, string $table
*
* @return array{legendText: string, headText: string, queryError: bool, extra: Message}
*/
public function createNewTablesFor2NF(array $partialDependencies, object $tablesName, string $table, string $db): array
{
public function createNewTablesFor2NF(
array $partialDependencies,
object $tablesName,
string $table,
string $db,
): array {
$dropCols = false;
$nonPKCols = [];
$queries = [];
Expand Down
8 changes: 6 additions & 2 deletions libraries/classes/Operations.php
Expand Up @@ -756,8 +756,12 @@ public function getWarningMessagesArray(): array
* @param string $newDb Database name after table renaming/ moving table
* @param string $newTable Table name after table renaming/moving table
*/
public function adjustPrivilegesRenameOrMoveTable(string $oldDb, string $oldTable, string $newDb, string $newTable): void
{
public function adjustPrivilegesRenameOrMoveTable(
string $oldDb,
string $oldTable,
string $newDb,
string $newTable,
): void {
if (! $GLOBALS['table_priv'] || ! $GLOBALS['col_priv'] || ! $GLOBALS['is_reload_priv']) {
return;
}
Expand Down
9 changes: 7 additions & 2 deletions libraries/classes/Plugins/ExportPlugin.php
Expand Up @@ -263,8 +263,13 @@ public function initAlias(array $aliases, string &$db, string|null &$table = nul
*
* @return string alias of the identifier if found or ''
*/
public function getAlias(array $aliases, string $id, string $type = 'dbtblcol', string $db = '', string $tbl = ''): string
{
public function getAlias(
array $aliases,
string $id,
string $type = 'dbtblcol',
string $db = '',
string $tbl = '',
): string {
if ($db !== '' && isset($aliases[$db])) {
$aliases = [
$db => $aliases[$db],
Expand Down
8 changes: 6 additions & 2 deletions libraries/classes/Sql.php
Expand Up @@ -210,8 +210,12 @@ private function resultSetContainsUniqueKey(string $db, string $table, array $fi
*
* @return string html for the dropdown
*/
public function getHtmlForRelationalColumnDropdown(string $db, string $table, string $column, string $currentValue): string
{
public function getHtmlForRelationalColumnDropdown(
string $db,
string $table,
string $column,
string $currentValue,
): string {
$foreigners = $this->relation->getForeigners($db, $table, $column);

$foreignData = $this->relation->getForeignData($foreigners, $column, false, '', '');
Expand Down
9 changes: 6 additions & 3 deletions test/classes/Controllers/Table/ChangeControllerTest.php
Expand Up @@ -55,22 +55,25 @@ public function testChangeController(): void
'<input type="text" name="fields[multi_edit][0][b80bb7740288fda1f201890375a60c8f]" value="NULL"'
. ' size="4" min="-2147483648" max="2147483647" data-type="INT" class="textfield"'
. ' onchange="return'
. ' verificationsAfterFieldChange(&quot;b80bb7740288fda1f201890375a60c8f&quot;, &quot;0&quot;,&quot;int(11)&quot;)"'
. ' verificationsAfterFieldChange(&quot;b80bb7740288fda1f201890375a60c8f&quot;,'
. ' &quot;0&quot;,&quot;int(11)&quot;)"'
. ' tabindex="1" inputmode="numeric" id="field_1_3"><input type="hidden"'
. ' name="auto_increment[multi_edit][0][b80bb7740288fda1f201890375a60c8f]" value="1">',
$actual,
);
$this->assertStringContainsString(
'<input type="text" name="fields[multi_edit][0][b068931cc450442b63f5b3d276ea4297]" value="NULL" size="20"'
. ' data-maxlength="20" data-type="CHAR" class="textfield" onchange="return'
. ' verificationsAfterFieldChange(&quot;b068931cc450442b63f5b3d276ea4297&quot;, &quot;0&quot;,&quot;varchar(20)&quot;)"'
. ' verificationsAfterFieldChange(&quot;b068931cc450442b63f5b3d276ea4297&quot;,'
. ' &quot;0&quot;,&quot;varchar(20)&quot;)"'
. ' tabindex="2" id="field_2_3">',
$actual,
);
$this->assertStringContainsString(
'<input type="text" name="fields[multi_edit][0][a55dbdcc1a45ed90dbee68864d566b99]" value="NULL.000000"'
. ' size="4" data-type="DATE" class="textfield datetimefield" onchange="return'
. ' verificationsAfterFieldChange(&quot;a55dbdcc1a45ed90dbee68864d566b99&quot;, &quot;0&quot;,&quot;datetime&quot;)"'
. ' verificationsAfterFieldChange(&quot;a55dbdcc1a45ed90dbee68864d566b99&quot;,'
. ' &quot;0&quot;,&quot;datetime&quot;)"'
. ' tabindex="3" id="field_3_3"><input type="hidden"'
. ' name="fields_type[multi_edit][0][a55dbdcc1a45ed90dbee68864d566b99]" value="datetime">',
$actual,
Expand Down

0 comments on commit 8a5ce0b

Please sign in to comment.