Skip to content

Commit e60bcff

Browse files
committed
Make implementation coherent
1 parent 65dfcc6 commit e60bcff

File tree

3 files changed

+9
-11
lines changed

3 files changed

+9
-11
lines changed

src/Mapper/Serializer.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,10 @@ private function getArguments(ReflectionProperty|ReflectionMethod $target, array
8686
throw new CellMappingFailed('Using more than one '.Cell::class.' attribute on a class property or method is not supported.');
8787
}
8888

89-
/** @var Cell $column */
90-
$column = $attributes[0]->newInstance();
91-
$offset = $column->offset;
92-
$cast = $this->getTypeCasting($column);
89+
/** @var Cell $cell */
90+
$cell = $attributes[0]->newInstance();
91+
$offset = $cell->offset;
92+
$cast = $this->getTypeCasting($cell);
9393
if (is_int($offset)) {
9494
return match (true) {
9595
0 > $offset,
@@ -99,27 +99,27 @@ private function getArguments(ReflectionProperty|ReflectionMethod $target, array
9999
}
100100

101101
if ([] === $header) {
102-
throw new CellMappingFailed(__CLASS__.' can only use named column if the tabular data has a non-empty header.');
102+
throw new CellMappingFailed('Cell name as string are only supported if the tabular data has a non-empty header.');
103103
}
104104

105105
/** @var int<0, max>|false $index */
106106
$index = array_search($offset, $header, true);
107107
if (false === $index) {
108-
throw new CellMappingFailed(__CLASS__.' cound not find the offset `'.$offset.'` in the header; Pleaser verify your header data.');
108+
throw new CellMappingFailed('The offset `'.$offset.'` could not be found in the header; Pleaser verify your header data.');
109109
}
110110

111111
return [$index, $cast];
112112
}
113113

114-
private function getTypeCasting(Cell $column): TypeCasting
114+
private function getTypeCasting(Cell $cell): TypeCasting
115115
{
116-
$caster = $column->cast;
116+
$caster = $cell->cast;
117117
if (null === $caster) {
118118
return new CastToScalar();
119119
}
120120

121121
/** @var TypeCasting $cast */
122-
$cast = new $caster(...$column->castArguments);
122+
$cast = new $caster(...$cell->castArguments);
123123

124124
return $cast;
125125
}

src/Reader.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
use Closure;
1818
use Iterator;
1919
use JsonSerializable;
20-
use League\Csv\Mapper\Aggregate;
2120
use League\Csv\Mapper\Serializer;
2221
use SplFileObject;
2322

src/ResultSet.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
use Generator;
2020
use Iterator;
2121
use JsonSerializable;
22-
use League\Csv\Mapper\Aggregate;
2322
use League\Csv\Mapper\Serializer;
2423
use LimitIterator;
2524

0 commit comments

Comments
 (0)