Skip to content

feat!: change TYPE_NAME visibility #362

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/MartinGeorgiev/Doctrine/DBAL/Types/BaseType.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ abstract class BaseType extends Type
/**
* @var string
*/
protected const TYPE_NAME = '';
public const TYPE_NAME = '';

public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform): string
{
Expand Down
2 changes: 1 addition & 1 deletion src/MartinGeorgiev/Doctrine/DBAL/Types/BigIntArray.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class BigIntArray extends BaseIntegerArray
/**
* @var string
*/
protected const TYPE_NAME = 'bigint[]';
public const TYPE_NAME = 'bigint[]';

protected function getMinValue(): int
{
Expand Down
2 changes: 1 addition & 1 deletion src/MartinGeorgiev/Doctrine/DBAL/Types/BooleanArray.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class BooleanArray extends BaseArray
/**
* @var string
*/
protected const TYPE_NAME = 'bool[]';
public const TYPE_NAME = 'bool[]';

public function convertToDatabaseValue($phpArray, AbstractPlatform $platform): ?string
{
Expand Down
2 changes: 1 addition & 1 deletion src/MartinGeorgiev/Doctrine/DBAL/Types/Cidr.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Cidr extends BaseType
{
use CidrValidationTrait;

protected const TYPE_NAME = 'cidr';
public const TYPE_NAME = 'cidr';

public function convertToDatabaseValue($value, AbstractPlatform $platform): ?string
{
Expand Down
2 changes: 1 addition & 1 deletion src/MartinGeorgiev/Doctrine/DBAL/Types/CidrArray.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class CidrArray extends BaseNetworkTypeArray
{
use CidrValidationTrait;

protected const TYPE_NAME = 'cidr[]';
public const TYPE_NAME = 'cidr[]';

protected function isValidNetworkAddress(string $value): bool
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/
class DoublePrecisionArray extends BaseFloatArray
{
protected const TYPE_NAME = 'double precision[]';
public const TYPE_NAME = 'double precision[]';

protected function getMinValue(): string
{
Expand Down
2 changes: 1 addition & 1 deletion src/MartinGeorgiev/Doctrine/DBAL/Types/Inet.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Inet extends BaseType
{
use InetValidationTrait;

protected const TYPE_NAME = 'inet';
public const TYPE_NAME = 'inet';

public function convertToDatabaseValue($value, AbstractPlatform $platform): ?string
{
Expand Down
2 changes: 1 addition & 1 deletion src/MartinGeorgiev/Doctrine/DBAL/Types/InetArray.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class InetArray extends BaseNetworkTypeArray
{
use InetValidationTrait;

protected const TYPE_NAME = 'inet[]';
public const TYPE_NAME = 'inet[]';

protected function isValidNetworkAddress(string $value): bool
{
Expand Down
2 changes: 1 addition & 1 deletion src/MartinGeorgiev/Doctrine/DBAL/Types/IntegerArray.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class IntegerArray extends BaseIntegerArray
/**
* @var string
*/
protected const TYPE_NAME = 'integer[]';
public const TYPE_NAME = 'integer[]';

protected function getMinValue(): int
{
Expand Down
2 changes: 1 addition & 1 deletion src/MartinGeorgiev/Doctrine/DBAL/Types/Jsonb.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Jsonb extends BaseType
/**
* @var string
*/
protected const TYPE_NAME = 'jsonb';
public const TYPE_NAME = 'jsonb';

/**
* Converts a value from its PHP representation to its database representation of the type.
Expand Down
2 changes: 1 addition & 1 deletion src/MartinGeorgiev/Doctrine/DBAL/Types/JsonbArray.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class JsonbArray extends BaseArray
{
use JsonTransformer;

protected const TYPE_NAME = 'jsonb[]';
public const TYPE_NAME = 'jsonb[]';

protected function transformArrayItemForPostgres(mixed $item): string
{
Expand Down
2 changes: 1 addition & 1 deletion src/MartinGeorgiev/Doctrine/DBAL/Types/Macaddr.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Macaddr extends BaseType
{
use MacaddrValidationTrait;

protected const TYPE_NAME = 'macaddr';
public const TYPE_NAME = 'macaddr';

public function convertToDatabaseValue($value, AbstractPlatform $platform): ?string
{
Expand Down
2 changes: 1 addition & 1 deletion src/MartinGeorgiev/Doctrine/DBAL/Types/MacaddrArray.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
class MacaddrArray extends BaseNetworkTypeArray
{
protected const TYPE_NAME = 'macaddr[]';
public const TYPE_NAME = 'macaddr[]';

protected function isValidNetworkAddress(string $value): bool
{
Expand Down
2 changes: 1 addition & 1 deletion src/MartinGeorgiev/Doctrine/DBAL/Types/Point.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
class Point extends BaseType
{
protected const TYPE_NAME = 'point';
public const TYPE_NAME = 'point';

public function convertToDatabaseValue($value, AbstractPlatform $platform): ?string
{
Expand Down
2 changes: 1 addition & 1 deletion src/MartinGeorgiev/Doctrine/DBAL/Types/PointArray.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
class PointArray extends BaseArray
{
protected const TYPE_NAME = 'point[]';
public const TYPE_NAME = 'point[]';

protected function transformArrayItemForPostgres(mixed $item): string
{
Expand Down
2 changes: 1 addition & 1 deletion src/MartinGeorgiev/Doctrine/DBAL/Types/RealArray.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/
class RealArray extends BaseFloatArray
{
protected const TYPE_NAME = 'real[]';
public const TYPE_NAME = 'real[]';

protected function getMinValue(): string
{
Expand Down
2 changes: 1 addition & 1 deletion src/MartinGeorgiev/Doctrine/DBAL/Types/SmallIntArray.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class SmallIntArray extends BaseIntegerArray
/**
* @var string
*/
protected const TYPE_NAME = 'smallint[]';
public const TYPE_NAME = 'smallint[]';

protected function getMinValue(): int
{
Expand Down
2 changes: 1 addition & 1 deletion src/MartinGeorgiev/Doctrine/DBAL/Types/TextArray.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class TextArray extends BaseType
/**
* @var string
*/
protected const TYPE_NAME = 'text[]';
public const TYPE_NAME = 'text[]';

/**
* Converts a value from its PHP representation to its database representation of the type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ protected function setUp(): void
$this->platform = $this->createMock(AbstractPlatform::class);
// Create a concrete implementation of the abstract class for testing
$this->fixture = new class extends BaseNetworkTypeArray {
protected const TYPE_NAME = 'test_network_array';
public const TYPE_NAME = 'test_network_array';

protected function isValidNetworkAddress(string $value): bool
{
Expand Down
10 changes: 5 additions & 5 deletions tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/BaseTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ protected function setUp(): void
public function throws_exception_when_type_name_not_configured(): void
{
$type = new class extends BaseType {
protected const TYPE_NAME = '';
public const TYPE_NAME = '';
};

$this->expectException(\LogicException::class);
Expand All @@ -42,7 +42,7 @@ public function throws_exception_when_type_name_not_configured(): void
public function throws_exception_when_getting_sql_declaration_with_no_type_name(): void
{
$type = new class extends BaseType {
protected const TYPE_NAME = '';
public const TYPE_NAME = '';
};

$this->expectException(\LogicException::class);
Expand All @@ -57,7 +57,7 @@ public function throws_exception_when_getting_sql_declaration_with_no_type_name(
public function returns_correct_type_name(): void
{
$type = new class extends BaseType {
protected const TYPE_NAME = 'custom_type';
public const TYPE_NAME = 'custom_type';
};

self::assertEquals('custom_type', $type->getName());
Expand All @@ -69,7 +69,7 @@ public function returns_correct_type_name(): void
public function gets_correct_sql_declaration(): void
{
$type = new class extends BaseType {
protected const TYPE_NAME = 'custom_type';
public const TYPE_NAME = 'custom_type';
};

$this->platform
Expand All @@ -88,7 +88,7 @@ public function gets_correct_sql_declaration(): void
public function requires_sql_comment_hint_returns_false(): void
{
$type = new class extends BaseType {
protected const TYPE_NAME = 'custom_type';
public const TYPE_NAME = 'custom_type';
};

// @phpstan-ignore-next-line Not all Doctrine version like this method as it's deprecated. For now, we ignore the deprecation.
Expand Down
Loading