Skip to content

Commit 257e7f4

Browse files
authored
Added template to Types that defines underlying data type (#1326)
* Added template to Types that defines underlying data type * CS Fixes
1 parent 972da37 commit 257e7f4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+107
-18
lines changed

src/core/etl/src/Flow/ETL/PHP/Type/Caster/ArrayCastingHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public function supports(Type $type) : bool
1616
return $type instanceof ArrayType;
1717
}
1818

19-
public function value(mixed $value, Type $type, Caster $caster, Options $options) : mixed
19+
public function value(mixed $value, Type $type, Caster $caster, Options $options) : array
2020
{
2121
try {
2222
if (\is_array($value)) {

src/core/etl/src/Flow/ETL/PHP/Type/Caster/BooleanCastingHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public function supports(Type $type) : bool
1414
return $type instanceof BooleanType;
1515
}
1616

17-
public function value(mixed $value, Type $type, Caster $caster, Options $options) : mixed
17+
public function value(mixed $value, Type $type, Caster $caster, Options $options) : bool
1818
{
1919
if (\is_bool($value)) {
2020
return $value;

src/core/etl/src/Flow/ETL/PHP/Type/Caster/CastingHandler.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,12 @@ interface CastingHandler
1010
{
1111
public function supports(Type $type) : bool;
1212

13+
/**
14+
* @template T
15+
*
16+
* @param Type<T> $type
17+
*
18+
* @return T
19+
*/
1320
public function value(mixed $value, Type $type, Caster $caster, Options $options) : mixed;
1421
}

src/core/etl/src/Flow/ETL/PHP/Type/Caster/DateCastingHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public function supports(Type $type) : bool
1515
return $type instanceof DateType;
1616
}
1717

18-
public function value(mixed $value, Type $type, Caster $caster, Options $options) : mixed
18+
public function value(mixed $value, Type $type, Caster $caster, Options $options) : \DateTimeImmutable
1919
{
2020
if ($value instanceof \DateTimeImmutable) {
2121
return $value->setTime(0, 0, 0, 0);

src/core/etl/src/Flow/ETL/PHP/Type/Caster/DateTimeCastingHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public function supports(Type $type) : bool
1616
return $type instanceof DateTimeType;
1717
}
1818

19-
public function value(mixed $value, Type $type, Caster $caster, Options $options) : mixed
19+
public function value(mixed $value, Type $type, Caster $caster, Options $options) : \DateTimeImmutable
2020
{
2121
if ($value instanceof \DateTimeImmutable) {
2222
return $value;

src/core/etl/src/Flow/ETL/PHP/Type/Caster/EnumCastingHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public function supports(Type $type) : bool
1515
return $type instanceof EnumType;
1616
}
1717

18-
public function value(mixed $value, Type $type, Caster $caster, Options $options) : mixed
18+
public function value(mixed $value, Type $type, Caster $caster, Options $options) : \UnitEnum
1919
{
2020
/** @var EnumType $type */
2121
if ($value instanceof $type->class) {

src/core/etl/src/Flow/ETL/PHP/Type/Caster/FloatCastingHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public function supports(Type $type) : bool
1818
return $type instanceof FloatType;
1919
}
2020

21-
public function value(mixed $value, Type $type, Caster $caster, Options $options) : mixed
21+
public function value(mixed $value, Type $type, Caster $caster, Options $options) : float
2222
{
2323
/**
2424
* @var FloatType $type

src/core/etl/src/Flow/ETL/PHP/Type/Caster/IntegerCastingHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public function supports(Type $type) : bool
1414
return $type instanceof IntegerType;
1515
}
1616

17-
public function value(mixed $value, Type $type, Caster $caster, Options $options) : mixed
17+
public function value(mixed $value, Type $type, Caster $caster, Options $options) : int
1818
{
1919
if (\is_int($value)) {
2020
return $value;

src/core/etl/src/Flow/ETL/PHP/Type/Caster/ListCastingHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public function supports(Type $type) : bool
1515
return $type instanceof ListType;
1616
}
1717

18-
public function value(mixed $value, Type $type, Caster $caster, Options $options) : mixed
18+
public function value(mixed $value, Type $type, Caster $caster, Options $options) : array
1919
{
2020
/** @var ListType $type */
2121
try {

src/core/etl/src/Flow/ETL/PHP/Type/Caster/MapCastingHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public function supports(Type $type) : bool
1515
return $type instanceof MapType;
1616
}
1717

18-
public function value(mixed $value, Type $type, Caster $caster, Options $options) : mixed
18+
public function value(mixed $value, Type $type, Caster $caster, Options $options) : array
1919
{
2020
/** @var MapType $type */
2121
try {

0 commit comments

Comments
 (0)