From b31402b1877a1d238b0a60b116a95b6e5a1b2a51 Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 24 Nov 2023 10:15:51 +0900 Subject: [PATCH] refactor: change namespace to CodeIgniter\DataConverter --- deptrac.yaml | 11 ++++++-- .../DataConverter/Cast/ArrayCast.php | 2 +- .../DataConverter/Cast/BaseCast.php | 2 +- .../DataConverter/Cast/BooleanCast.php | 2 +- .../DataConverter/Cast/CSVCast.php | 2 +- .../DataConverter/Cast/CastInterface.php | 2 +- .../DataConverter/Cast/DatetimeCast.php | 2 +- .../DataConverter/Cast/FloatCast.php | 2 +- .../DataConverter/Cast/IntBoolCast.php | 2 +- .../DataConverter/Cast/IntegerCast.php | 2 +- .../DataConverter/Cast/JsonCast.php | 4 +-- .../DataConverter/Cast/TimestampCast.php | 2 +- .../DataConverter/Cast/URICast.php | 2 +- .../DataConverter/DataConverter.php | 28 +++++++++---------- .../Exceptions/CastException.php | 2 +- .../DataConverter/DataConverterTest.php | 6 ++-- 16 files changed, 40 insertions(+), 33 deletions(-) rename system/{Database => }/DataConverter/Cast/ArrayCast.php (95%) rename system/{Database => }/DataConverter/Cast/BaseCast.php (95%) rename system/{Database => }/DataConverter/Cast/BooleanCast.php (94%) rename system/{Database => }/DataConverter/Cast/CSVCast.php (94%) rename system/{Database => }/DataConverter/Cast/CastInterface.php (95%) rename system/{Database => }/DataConverter/Cast/DatetimeCast.php (95%) rename system/{Database => }/DataConverter/Cast/FloatCast.php (93%) rename system/{Database => }/DataConverter/Cast/IntBoolCast.php (94%) rename system/{Database => }/DataConverter/Cast/IntegerCast.php (93%) rename system/{Database => }/DataConverter/Cast/JsonCast.php (92%) rename system/{Database => }/DataConverter/Cast/TimestampCast.php (95%) rename system/{Database => }/DataConverter/Cast/URICast.php (94%) rename system/{Database => }/DataConverter/DataConverter.php (85%) rename system/{Database => }/DataConverter/Exceptions/CastException.php (88%) rename tests/system/{Database => }/DataConverter/DataConverterTest.php (98%) diff --git a/deptrac.yaml b/deptrac.yaml index 8041c67d178a..cdb4a3c9b84b 100644 --- a/deptrac.yaml +++ b/deptrac.yaml @@ -35,6 +35,10 @@ parameters: collectors: - type: className regex: ^Codeigniter\\Database\\.* + - name: DataConverter + collectors: + - type: className + regex: ^Codeigniter\\DataConverter\\.* - name: Email collectors: - type: className @@ -166,6 +170,9 @@ parameters: - Entity - Events - I18n + DataConverter: + - I18n + - URI Email: - I18n - Events @@ -227,8 +234,8 @@ parameters: - CodeIgniter\HTTP\CLIRequest - CodeIgniter\HTTP\IncomingRequest - CodeIgniter\HTTP\ResponseInterface - CodeIgniter\Database\DataConverter\Cast\URICast: - - CodeIgniter\HTTP\URI + CodeIgniter\DataConverter\Exceptions\CastException: + - CodeIgniter\Entity\Exceptions\CastException CodeIgniter\Entity\Cast\URICast: - CodeIgniter\HTTP\URI CodeIgniter\Log\Handlers\ChromeLoggerHandler: diff --git a/system/Database/DataConverter/Cast/ArrayCast.php b/system/DataConverter/Cast/ArrayCast.php similarity index 95% rename from system/Database/DataConverter/Cast/ArrayCast.php rename to system/DataConverter/Cast/ArrayCast.php index 9375e00bef84..c207a9492978 100644 --- a/system/Database/DataConverter/Cast/ArrayCast.php +++ b/system/DataConverter/Cast/ArrayCast.php @@ -9,7 +9,7 @@ * the LICENSE file that was distributed with this source code. */ -namespace CodeIgniter\Database\DataConverter\Cast; +namespace CodeIgniter\DataConverter\Cast; /** * Class ArrayCast diff --git a/system/Database/DataConverter/Cast/BaseCast.php b/system/DataConverter/Cast/BaseCast.php similarity index 95% rename from system/Database/DataConverter/Cast/BaseCast.php rename to system/DataConverter/Cast/BaseCast.php index 121b27cfc8af..0de3884d5319 100644 --- a/system/Database/DataConverter/Cast/BaseCast.php +++ b/system/DataConverter/Cast/BaseCast.php @@ -9,7 +9,7 @@ * the LICENSE file that was distributed with this source code. */ -namespace CodeIgniter\Database\DataConverter\Cast; +namespace CodeIgniter\DataConverter\Cast; use TypeError; diff --git a/system/Database/DataConverter/Cast/BooleanCast.php b/system/DataConverter/Cast/BooleanCast.php similarity index 94% rename from system/Database/DataConverter/Cast/BooleanCast.php rename to system/DataConverter/Cast/BooleanCast.php index 3943cab8ae52..2e802e7c8bc3 100644 --- a/system/Database/DataConverter/Cast/BooleanCast.php +++ b/system/DataConverter/Cast/BooleanCast.php @@ -9,7 +9,7 @@ * the LICENSE file that was distributed with this source code. */ -namespace CodeIgniter\Database\DataConverter\Cast; +namespace CodeIgniter\DataConverter\Cast; /** * Class BooleanCast diff --git a/system/Database/DataConverter/Cast/CSVCast.php b/system/DataConverter/Cast/CSVCast.php similarity index 94% rename from system/Database/DataConverter/Cast/CSVCast.php rename to system/DataConverter/Cast/CSVCast.php index 3eb5538a0ea9..36a045ed942c 100644 --- a/system/Database/DataConverter/Cast/CSVCast.php +++ b/system/DataConverter/Cast/CSVCast.php @@ -9,7 +9,7 @@ * the LICENSE file that was distributed with this source code. */ -namespace CodeIgniter\Database\DataConverter\Cast; +namespace CodeIgniter\DataConverter\Cast; /** * Class CSVCast diff --git a/system/Database/DataConverter/Cast/CastInterface.php b/system/DataConverter/Cast/CastInterface.php similarity index 95% rename from system/Database/DataConverter/Cast/CastInterface.php rename to system/DataConverter/Cast/CastInterface.php index fb79752b5ba7..32290ee79518 100644 --- a/system/Database/DataConverter/Cast/CastInterface.php +++ b/system/DataConverter/Cast/CastInterface.php @@ -9,7 +9,7 @@ * the LICENSE file that was distributed with this source code. */ -namespace CodeIgniter\Database\DataConverter\Cast; +namespace CodeIgniter\DataConverter\Cast; /** * @template TPhpValue PHP data type diff --git a/system/Database/DataConverter/Cast/DatetimeCast.php b/system/DataConverter/Cast/DatetimeCast.php similarity index 95% rename from system/Database/DataConverter/Cast/DatetimeCast.php rename to system/DataConverter/Cast/DatetimeCast.php index fea1ae687d33..750d7c8117fe 100644 --- a/system/Database/DataConverter/Cast/DatetimeCast.php +++ b/system/DataConverter/Cast/DatetimeCast.php @@ -9,7 +9,7 @@ * the LICENSE file that was distributed with this source code. */ -namespace CodeIgniter\Database\DataConverter\Cast; +namespace CodeIgniter\DataConverter\Cast; use CodeIgniter\I18n\Time; diff --git a/system/Database/DataConverter/Cast/FloatCast.php b/system/DataConverter/Cast/FloatCast.php similarity index 93% rename from system/Database/DataConverter/Cast/FloatCast.php rename to system/DataConverter/Cast/FloatCast.php index d19c4b840d8e..72552746548f 100644 --- a/system/Database/DataConverter/Cast/FloatCast.php +++ b/system/DataConverter/Cast/FloatCast.php @@ -9,7 +9,7 @@ * the LICENSE file that was distributed with this source code. */ -namespace CodeIgniter\Database\DataConverter\Cast; +namespace CodeIgniter\DataConverter\Cast; /** * Class FloatCast diff --git a/system/Database/DataConverter/Cast/IntBoolCast.php b/system/DataConverter/Cast/IntBoolCast.php similarity index 94% rename from system/Database/DataConverter/Cast/IntBoolCast.php rename to system/DataConverter/Cast/IntBoolCast.php index dc3642371aab..9d05682fcfe7 100644 --- a/system/Database/DataConverter/Cast/IntBoolCast.php +++ b/system/DataConverter/Cast/IntBoolCast.php @@ -9,7 +9,7 @@ * the LICENSE file that was distributed with this source code. */ -namespace CodeIgniter\Database\DataConverter\Cast; +namespace CodeIgniter\DataConverter\Cast; /** * Int Bool Cast diff --git a/system/Database/DataConverter/Cast/IntegerCast.php b/system/DataConverter/Cast/IntegerCast.php similarity index 93% rename from system/Database/DataConverter/Cast/IntegerCast.php rename to system/DataConverter/Cast/IntegerCast.php index 04ef5596bc23..7207a18e3330 100644 --- a/system/Database/DataConverter/Cast/IntegerCast.php +++ b/system/DataConverter/Cast/IntegerCast.php @@ -9,7 +9,7 @@ * the LICENSE file that was distributed with this source code. */ -namespace CodeIgniter\Database\DataConverter\Cast; +namespace CodeIgniter\DataConverter\Cast; /** * Class IntegerCast diff --git a/system/Database/DataConverter/Cast/JsonCast.php b/system/DataConverter/Cast/JsonCast.php similarity index 92% rename from system/Database/DataConverter/Cast/JsonCast.php rename to system/DataConverter/Cast/JsonCast.php index a7ded03e7c7f..a73f3d85e6ed 100644 --- a/system/Database/DataConverter/Cast/JsonCast.php +++ b/system/DataConverter/Cast/JsonCast.php @@ -9,9 +9,9 @@ * the LICENSE file that was distributed with this source code. */ -namespace CodeIgniter\Database\DataConverter\Cast; +namespace CodeIgniter\DataConverter\Cast; -use CodeIgniter\Database\DataConverter\Exceptions\CastException; +use CodeIgniter\DataConverter\Exceptions\CastException; use JsonException; use stdClass; diff --git a/system/Database/DataConverter/Cast/TimestampCast.php b/system/DataConverter/Cast/TimestampCast.php similarity index 95% rename from system/Database/DataConverter/Cast/TimestampCast.php rename to system/DataConverter/Cast/TimestampCast.php index 26fb45df2f39..32914da59d78 100644 --- a/system/Database/DataConverter/Cast/TimestampCast.php +++ b/system/DataConverter/Cast/TimestampCast.php @@ -9,7 +9,7 @@ * the LICENSE file that was distributed with this source code. */ -namespace CodeIgniter\Database\DataConverter\Cast; +namespace CodeIgniter\DataConverter\Cast; use CodeIgniter\I18n\Time; diff --git a/system/Database/DataConverter/Cast/URICast.php b/system/DataConverter/Cast/URICast.php similarity index 94% rename from system/Database/DataConverter/Cast/URICast.php rename to system/DataConverter/Cast/URICast.php index b5c9f237b2d9..6f7e35918ebc 100644 --- a/system/Database/DataConverter/Cast/URICast.php +++ b/system/DataConverter/Cast/URICast.php @@ -9,7 +9,7 @@ * the LICENSE file that was distributed with this source code. */ -namespace CodeIgniter\Database\DataConverter\Cast; +namespace CodeIgniter\DataConverter\Cast; use CodeIgniter\HTTP\URI; diff --git a/system/Database/DataConverter/DataConverter.php b/system/DataConverter/DataConverter.php similarity index 85% rename from system/Database/DataConverter/DataConverter.php rename to system/DataConverter/DataConverter.php index 409ad0ad0215..dfef63d1994e 100644 --- a/system/Database/DataConverter/DataConverter.php +++ b/system/DataConverter/DataConverter.php @@ -9,25 +9,25 @@ * the LICENSE file that was distributed with this source code. */ -namespace CodeIgniter\Database\DataConverter; - -use CodeIgniter\Database\DataConverter\Cast\ArrayCast; -use CodeIgniter\Database\DataConverter\Cast\BooleanCast; -use CodeIgniter\Database\DataConverter\Cast\CastInterface; -use CodeIgniter\Database\DataConverter\Cast\CSVCast; -use CodeIgniter\Database\DataConverter\Cast\DatetimeCast; -use CodeIgniter\Database\DataConverter\Cast\FloatCast; -use CodeIgniter\Database\DataConverter\Cast\IntBoolCast; -use CodeIgniter\Database\DataConverter\Cast\IntegerCast; -use CodeIgniter\Database\DataConverter\Cast\JsonCast; -use CodeIgniter\Database\DataConverter\Cast\TimestampCast; -use CodeIgniter\Database\DataConverter\Cast\URICast; +namespace CodeIgniter\DataConverter; + +use CodeIgniter\DataConverter\Cast\ArrayCast; +use CodeIgniter\DataConverter\Cast\BooleanCast; +use CodeIgniter\DataConverter\Cast\CastInterface; +use CodeIgniter\DataConverter\Cast\CSVCast; +use CodeIgniter\DataConverter\Cast\DatetimeCast; +use CodeIgniter\DataConverter\Cast\FloatCast; +use CodeIgniter\DataConverter\Cast\IntBoolCast; +use CodeIgniter\DataConverter\Cast\IntegerCast; +use CodeIgniter\DataConverter\Cast\JsonCast; +use CodeIgniter\DataConverter\Cast\TimestampCast; +use CodeIgniter\DataConverter\Cast\URICast; use InvalidArgumentException; /** * PHP data <==> DataSource data converter * - * @see \CodeIgniter\Database\DataConverter\DataConverterTest + * @see \CodeIgniter\DataConverter\DataConverterTest */ class DataConverter { diff --git a/system/Database/DataConverter/Exceptions/CastException.php b/system/DataConverter/Exceptions/CastException.php similarity index 88% rename from system/Database/DataConverter/Exceptions/CastException.php rename to system/DataConverter/Exceptions/CastException.php index a5576c822c70..139bd7acd863 100644 --- a/system/Database/DataConverter/Exceptions/CastException.php +++ b/system/DataConverter/Exceptions/CastException.php @@ -9,7 +9,7 @@ * the LICENSE file that was distributed with this source code. */ -namespace CodeIgniter\Database\DataConverter\Exceptions; +namespace CodeIgniter\DataConverter\Exceptions; use CodeIgniter\Entity\Exceptions\CastException as EntityCastException; diff --git a/tests/system/Database/DataConverter/DataConverterTest.php b/tests/system/DataConverter/DataConverterTest.php similarity index 98% rename from tests/system/Database/DataConverter/DataConverterTest.php rename to tests/system/DataConverter/DataConverterTest.php index 7dc89d2dbe7a..4cdb55165fa1 100644 --- a/tests/system/Database/DataConverter/DataConverterTest.php +++ b/tests/system/DataConverter/DataConverterTest.php @@ -9,7 +9,7 @@ * the LICENSE file that was distributed with this source code. */ -namespace CodeIgniter\Database\DataConverter; +namespace CodeIgniter\DataConverter; use CodeIgniter\HTTP\URI; use CodeIgniter\I18n\Time; @@ -451,7 +451,7 @@ public function testInvalidValue(): void { $this->expectException(TypeError::class); $this->expectExceptionMessage( - '[CodeIgniter\Database\DataConverter\Cast\JsonCast] Invalid value type: bool, and its value: true' + '[CodeIgniter\DataConverter\Cast\JsonCast] Invalid value type: bool, and its value: true' ); $types = [ @@ -471,7 +471,7 @@ public function testInvalidCastHandler(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage( - 'Invalid class type. It must implement CastInterface. class: CodeIgniter\Database\DataConverter\DataConverter' + 'Invalid class type. It must implement CastInterface. class: CodeIgniter\DataConverter\DataConverter' ); $types = [