Skip to content

Commit

Permalink
docs: remove PHPDoc @template
Browse files Browse the repository at this point in the history
Psalm does not support class @template in static methods.
And in PHPStan it does not protect.
See
- vimeo/psalm#2697
- phpstan/phpstan#2738
  • Loading branch information
kenjis committed Jan 23, 2024
1 parent ef3ea83 commit 14b9c71
Show file tree
Hide file tree
Showing 12 changed files with 6 additions and 38 deletions.
2 changes: 0 additions & 2 deletions system/DataCaster/Cast/ArrayCast.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
*
* (PHP) [array --> string] --> (DB driver) --> (DB column) string
* [ <-- string] <-- (DB driver) <-- (DB column) string
*
* @extends BaseCast<mixed[], string, mixed>
*/
class ArrayCast extends BaseCast implements CastInterface
{
Expand Down
7 changes: 0 additions & 7 deletions system/DataCaster/Cast/BaseCast.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,6 @@

use TypeError;

/**
* @template TPhpValue PHP data type
* @template TToDb Data type to pass to database driver
* @template TDbColumn Data type from database driver
*
* @implements CastInterface<TPhpValue, TToDb, TDbColumn>
*/
abstract class BaseCast implements CastInterface
{
public static function get(mixed $value, array $params = []): mixed
Expand Down
2 changes: 0 additions & 2 deletions system/DataCaster/Cast/BooleanCast.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
*
* (PHP) [bool --> bool ] --> (DB driver) --> (DB column) bool|int(0/1)
* [ <-- string|int] <-- (DB driver) <-- (DB column) bool|int(0/1)
*
* @extends BaseCast<bool, bool, mixed>
*/
class BooleanCast extends BaseCast
{
Expand Down
2 changes: 0 additions & 2 deletions system/DataCaster/Cast/CSVCast.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
*
* (PHP) [array --> string] --> (DB driver) --> (DB column) string
* [ <-- string] <-- (DB driver) <-- (DB column) string
*
* @extends BaseCast<array, string, mixed>
*/
class CSVCast extends BaseCast
{
Expand Down
17 changes: 6 additions & 11 deletions system/DataCaster/Cast/CastInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,25 @@

namespace CodeIgniter\DataCaster\Cast;

/**
* @template TPhpValue PHP native value type
* @template TToDb Data type to pass to database driver
* @template TDbColumn Data type from database driver
*/
interface CastInterface
{
/**
* Takes value from DataSource, returns its value for PHP.
* Takes a value from DataSource, returns its value for PHP.
*
* @param TDbColumn $value Data from database driver
* @param mixed $value Data from database driver
* @param list<string> $params Additional param
*
* @return TPhpValue PHP native value
* @return mixed PHP native value
*/
public static function get(mixed $value, array $params = []): mixed;

/**
* Takes the PHP value, returns its value for DataSource.
* Takes a PHP value, returns its value for DataSource.
*
* @param TPhpValue $value PHP native value
* @param mixed $value PHP native value
* @param list<string> $params Additional param
*
* @return TToDb Data to pass to database driver
* @return mixed Data to pass to database driver
*/
public static function set(mixed $value, array $params = []): mixed;
}
2 changes: 0 additions & 2 deletions system/DataCaster/Cast/DatetimeCast.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
*
* (PHP) [Time --> string] --> (DB driver) --> (DB column) datetime
* [ <-- string] <-- (DB driver) <-- (DB column) datetime
*
* @extends BaseCast<Time, string, mixed>
*/
class DatetimeCast extends BaseCast
{
Expand Down
2 changes: 0 additions & 2 deletions system/DataCaster/Cast/FloatCast.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
*
* (PHP) [float --> float ] --> (DB driver) --> (DB column) float
* [ <-- float|string] <-- (DB driver) <-- (DB column) float
*
* @extends BaseCast<float, float, mixed>
*/
class FloatCast extends BaseCast
{
Expand Down
2 changes: 0 additions & 2 deletions system/DataCaster/Cast/IntBoolCast.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
*
* (PHP) [bool --> int ] --> (DB driver) --> (DB column) int(0/1)
* [ <-- int|string] <-- (DB driver) <-- (DB column) int(0/1)
*
* @extends BaseCast<bool, int, mixed>
*/
final class IntBoolCast extends BaseCast
{
Expand Down
2 changes: 0 additions & 2 deletions system/DataCaster/Cast/IntegerCast.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
*
* (PHP) [int --> int ] --> (DB driver) --> (DB column) int
* [ <-- int|string] <-- (DB driver) <-- (DB column) int
*
* @extends BaseCast<int, int, mixed>
*/
class IntegerCast extends BaseCast
{
Expand Down
2 changes: 0 additions & 2 deletions system/DataCaster/Cast/JsonCast.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
*
* (PHP) [array|stdClass --> string] --> (DB driver) --> (DB column) string
* [ <-- string] <-- (DB driver) <-- (DB column) string
*
* @extends BaseCast<array|stdClass, string, mixed>
*/
class JsonCast extends BaseCast
{
Expand Down
2 changes: 0 additions & 2 deletions system/DataCaster/Cast/TimestampCast.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
*
* (PHP) [Time --> int ] --> (DB driver) --> (DB column) int
* [ <-- int|string] <-- (DB driver) <-- (DB column) int
*
* @extends BaseCast<Time, int, mixed>
*/
class TimestampCast extends BaseCast
{
Expand Down
2 changes: 0 additions & 2 deletions system/DataCaster/Cast/URICast.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
*
* (PHP) [URI --> string] --> (DB driver) --> (DB column) string
* [ <-- string] <-- (DB driver) <-- (DB column) string
*
* @extends BaseCast<URI, string, mixed>
*/
class URICast extends BaseCast
{
Expand Down

0 comments on commit 14b9c71

Please sign in to comment.