Merge pull request #19264 from kamil-tekiela/Readonly-value-objects

Make value objects readonly
This commit is contained in:
Maurício Meneghini Fauth 2024-08-16 19:23:11 -03:00 committed by GitHub
commit a44ae81ad0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
15 changed files with 101 additions and 101 deletions

View File

@ -4,15 +4,15 @@ declare(strict_types=1);
namespace PhpMyAdmin;
final class Column
final readonly class Column
{
public function __construct(
public readonly string $field,
public readonly string $type,
public readonly bool $isNull,
public readonly string $key,
public readonly string|null $default,
public readonly string $extra,
public string $field,
public string $type,
public bool $isNull,
public string $key,
public string|null $default,
public string $extra,
) {
}
}

View File

@ -4,18 +4,18 @@ declare(strict_types=1);
namespace PhpMyAdmin;
final class ColumnFull
final readonly class ColumnFull
{
public function __construct(
public readonly string $field,
public readonly string $type,
public readonly string|null $collation,
public readonly bool $isNull,
public readonly string $key,
public readonly string|null $default,
public readonly string $extra,
public readonly string $privileges,
public readonly string $comment,
public string $field,
public string $type,
public string|null $collation,
public bool $isNull,
public string $key,
public string|null $default,
public string $extra,
public string $privileges,
public string $comment,
) {
}
}

View File

@ -30,30 +30,30 @@ use PhpMyAdmin\Version;
use function is_string;
/** @psalm-immutable */
final class RelationParameters
final readonly class RelationParameters
{
/** @param non-empty-string|null $user */
public function __construct(
public readonly string|null $user,
public readonly DatabaseName|null $db = null,
public readonly BookmarkFeature|null $bookmarkFeature = null,
public readonly BrowserTransformationFeature|null $browserTransformationFeature = null,
public readonly CentralColumnsFeature|null $centralColumnsFeature = null,
public readonly ColumnCommentsFeature|null $columnCommentsFeature = null,
public readonly ConfigurableMenusFeature|null $configurableMenusFeature = null,
public readonly DatabaseDesignerSettingsFeature|null $databaseDesignerSettingsFeature = null,
public readonly DisplayFeature|null $displayFeature = null,
public readonly ExportTemplatesFeature|null $exportTemplatesFeature = null,
public readonly FavoriteTablesFeature|null $favoriteTablesFeature = null,
public readonly NavigationItemsHidingFeature|null $navigationItemsHidingFeature = null,
public readonly PdfFeature|null $pdfFeature = null,
public readonly RecentlyUsedTablesFeature|null $recentlyUsedTablesFeature = null,
public readonly RelationFeature|null $relationFeature = null,
public readonly SavedQueryByExampleSearchesFeature|null $savedQueryByExampleSearchesFeature = null,
public readonly SqlHistoryFeature|null $sqlHistoryFeature = null,
public readonly TrackingFeature|null $trackingFeature = null,
public readonly UiPreferencesFeature|null $uiPreferencesFeature = null,
public readonly UserPreferencesFeature|null $userPreferencesFeature = null,
public string|null $user,
public DatabaseName|null $db = null,
public BookmarkFeature|null $bookmarkFeature = null,
public BrowserTransformationFeature|null $browserTransformationFeature = null,
public CentralColumnsFeature|null $centralColumnsFeature = null,
public ColumnCommentsFeature|null $columnCommentsFeature = null,
public ConfigurableMenusFeature|null $configurableMenusFeature = null,
public DatabaseDesignerSettingsFeature|null $databaseDesignerSettingsFeature = null,
public DisplayFeature|null $displayFeature = null,
public ExportTemplatesFeature|null $exportTemplatesFeature = null,
public FavoriteTablesFeature|null $favoriteTablesFeature = null,
public NavigationItemsHidingFeature|null $navigationItemsHidingFeature = null,
public PdfFeature|null $pdfFeature = null,
public RecentlyUsedTablesFeature|null $recentlyUsedTablesFeature = null,
public RelationFeature|null $relationFeature = null,
public SavedQueryByExampleSearchesFeature|null $savedQueryByExampleSearchesFeature = null,
public SqlHistoryFeature|null $sqlHistoryFeature = null,
public TrackingFeature|null $trackingFeature = null,
public UiPreferencesFeature|null $uiPreferencesFeature = null,
public UserPreferencesFeature|null $userPreferencesFeature = null,
) {
}

View File

@ -4,11 +4,11 @@ declare(strict_types=1);
namespace PhpMyAdmin\Database\Designer;
final class ColumnInfo
final readonly class ColumnInfo
{
public function __construct(
public readonly string $name,
public readonly string $type,
public string $name,
public string $type,
) {
}
}

View File

@ -4,12 +4,12 @@ declare(strict_types=1);
namespace PhpMyAdmin\Database;
final class Routine
final readonly class Routine
{
public function __construct(
public readonly string $name,
public readonly string $type,
public readonly string $returns,
public string $name,
public string $type,
public string $returns,
) {
}
}

View File

@ -5,17 +5,17 @@ declare(strict_types=1);
namespace PhpMyAdmin\Display;
/** @psalm-immutable */
final class DisplayParts
final readonly class DisplayParts
{
private function __construct(
public readonly bool $hasEditLink,
public readonly DeleteLinkEnum $deleteLink,
public readonly bool $hasSortLink,
public readonly bool $hasNavigationBar,
public readonly bool $hasBookmarkForm,
public readonly bool $hasTextButton,
public readonly bool $hasPrintLink,
public readonly bool $hasQueryStats,
public bool $hasEditLink,
public DeleteLinkEnum $deleteLink,
public bool $hasSortLink,
public bool $hasNavigationBar,
public bool $hasBookmarkForm,
public bool $hasTextButton,
public bool $hasPrintLink,
public bool $hasQueryStats,
) {
}

View File

@ -4,13 +4,13 @@ declare(strict_types=1);
namespace PhpMyAdmin\Display;
final class ForeignKeyRelatedTable
final readonly class ForeignKeyRelatedTable
{
public function __construct(
public readonly string $table,
public readonly string $field,
public readonly string $displayField,
public readonly string $database,
public string $table,
public string $field,
public string $displayField,
public string $database,
) {
}
}

View File

@ -8,9 +8,9 @@ use JsonSerializable;
use PhpMyAdmin\Identifiers\DatabaseName;
use PhpMyAdmin\Identifiers\TableName;
final class RecentFavoriteTable implements JsonSerializable
final readonly class RecentFavoriteTable implements JsonSerializable
{
public function __construct(public readonly DatabaseName $db, public readonly TableName $table)
public function __construct(public DatabaseName $db, public TableName $table)
{
}

View File

@ -7,9 +7,9 @@ namespace PhpMyAdmin\Gis\Ds;
use function max;
use function min;
final class Point
final readonly class Point
{
public function __construct(public readonly float $x, public readonly float $y)
public function __construct(public float $x, public float $y)
{
}

View File

@ -9,9 +9,9 @@ use Stringable;
use function mb_strlen;
use function mb_strpos;
final class DecimalSize implements Stringable
final readonly class DecimalSize implements Stringable
{
private function __construct(public readonly int $precision, public readonly int $scale)
private function __construct(public int $precision, public int $scale)
{
}

View File

@ -9,29 +9,29 @@ use function md5;
use function preg_match;
use function preg_replace;
final class InsertEditColumn
final readonly class InsertEditColumn
{
public readonly string|null $default;
public readonly string $md5;
public string|null $default;
public string $md5;
/**
* trueType contains only the type (stops at first bracket)
*/
public readonly string $trueType;
public readonly string $pmaType;
public readonly int $length;
public readonly bool $firstTimestamp;
public string $trueType;
public string $pmaType;
public int $length;
public bool $firstTimestamp;
public function __construct(
public readonly string $field,
public readonly string $type,
public readonly bool $isNull,
public readonly string $key,
public string $field,
public string $type,
public bool $isNull,
public string $key,
string|null $default,
public readonly string $extra,
public string $extra,
int $columnLength,
public readonly bool $isBinary,
public readonly bool $isBlob,
public readonly bool $isChar,
public bool $isBinary,
public bool $isBlob,
public bool $isChar,
bool $insertMode,
) {
if (

View File

@ -4,13 +4,13 @@ declare(strict_types=1);
namespace PhpMyAdmin;
final class Release
final readonly class Release
{
public function __construct(
public readonly string $version,
public readonly string $date,
public readonly string $phpVersions,
public readonly string $mysqlVersions,
public string $version,
public string $date,
public string $phpVersions,
public string $mysqlVersions,
) {
}
}

View File

@ -4,19 +4,19 @@ declare(strict_types=1);
namespace PhpMyAdmin\Tracking;
final class TrackedData
final readonly class TrackedData
{
/**
* @psalm-param list<array{date: string, username: string, statement: string}> $ddlog
* @psalm-param list<array{date: string, username: string, statement: string}> $dmlog
*/
public function __construct(
public readonly string $dateFrom,
public readonly string $dateTo,
public readonly array $ddlog,
public readonly array $dmlog,
public readonly string $tracking,
public readonly string $schemaSnapshot,
public string $dateFrom,
public string $dateTo,
public array $ddlog,
public array $dmlog,
public string $tracking,
public string $schemaSnapshot,
) {
}
}

View File

@ -6,9 +6,9 @@ namespace PhpMyAdmin\Tracking;
use PhpMyAdmin\Identifiers\TableName;
final class TrackedTable
final readonly class TrackedTable
{
public function __construct(public readonly TableName $name, public readonly bool $active)
public function __construct(public TableName $name, public bool $active)
{
}
}

View File

@ -11,15 +11,15 @@ use PhpMyAdmin\Util;
use Webmozart\Assert\Assert;
use Webmozart\Assert\InvalidArgumentException;
final class Trigger
final readonly class Trigger
{
public function __construct(
public readonly TriggerName $name,
public readonly Timing $timing,
public readonly Event $event,
public readonly TableName $table,
public readonly string $statement,
public readonly string $definer,
public TriggerName $name,
public Timing $timing,
public Event $event,
public TableName $table,
public string $statement,
public string $definer,
) {
}