Skip to content

Commit ad9fe0a

Browse files
committed
Remove all mixed in param type where reasonable (except Calculcation/)
1 parent 5faaf26 commit ad9fe0a

File tree

22 files changed

+36
-50
lines changed

22 files changed

+36
-50
lines changed

src/PhpSpreadsheet/Cell/AdvancedValueBinder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class AdvancedValueBinder extends DefaultValueBinder implements IValueBinder
1717
* @param Cell $cell Cell to bind value to
1818
* @param mixed $value Value to bind in cell
1919
*/
20-
public function bindValue(Cell $cell, $value = null): bool
20+
public function bindValue(Cell $cell, mixed $value = null): bool
2121
{
2222
if ($value === null) {
2323
return parent::bindValue($cell, $value);

src/PhpSpreadsheet/Cell/CellAddress.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,18 @@ public function __destruct()
3434
* @phpstan-assert int|numeric-string $columnId
3535
* @phpstan-assert int|numeric-string $rowId
3636
*/
37-
private static function validateColumnAndRow(mixed $columnId, mixed $rowId): void
37+
private static function validateColumnAndRow(int|string $columnId, int|string $rowId): void
3838
{
3939
if (!is_numeric($columnId) || $columnId <= 0 || !is_numeric($rowId) || $rowId <= 0) {
4040
throw new Exception('Row and Column Ids must be positive integer values');
4141
}
4242
}
4343

44-
public static function fromColumnAndRow(mixed $columnId, mixed $rowId, ?Worksheet $worksheet = null): self
44+
public static function fromColumnAndRow(int|string $columnId, int|string $rowId, ?Worksheet $worksheet = null): self
4545
{
4646
self::validateColumnAndRow($columnId, $rowId);
4747

48-
return new self(Coordinate::stringFromColumnIndex($columnId) . ((string) $rowId), $worksheet);
48+
return new self(Coordinate::stringFromColumnIndex($columnId) . $rowId, $worksheet);
4949
}
5050

5151
public static function fromColumnRowArray(array $array, ?Worksheet $worksheet = null): self
@@ -55,7 +55,7 @@ public static function fromColumnRowArray(array $array, ?Worksheet $worksheet =
5555
return self::fromColumnAndRow($columnId, $rowId, $worksheet);
5656
}
5757

58-
public static function fromCellAddress(mixed $cellAddress, ?Worksheet $worksheet = null): self
58+
public static function fromCellAddress(string $cellAddress, ?Worksheet $worksheet = null): self
5959
{
6060
return new self($cellAddress, $worksheet);
6161
}

src/PhpSpreadsheet/Cell/DefaultValueBinder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class DefaultValueBinder implements IValueBinder
1616
* @param Cell $cell Cell to bind value to
1717
* @param mixed $value Value to bind in cell
1818
*/
19-
public function bindValue(Cell $cell, $value): bool
19+
public function bindValue(Cell $cell, mixed $value): bool
2020
{
2121
// sanitize UTF-8 strings
2222
if (is_string($value)) {

src/PhpSpreadsheet/Cell/StringValueBinder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function setConversionForAllValueTypes(bool $suppressConversion = false):
6767
* @param Cell $cell Cell to bind value to
6868
* @param mixed $value Value to bind in cell
6969
*/
70-
public function bindValue(Cell $cell, $value): bool
70+
public function bindValue(Cell $cell, mixed $value): bool
7171
{
7272
if (is_object($value)) {
7373
return $this->bindObjectValue($cell, $value);

src/PhpSpreadsheet/Chart/Axis.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ public function __construct()
112112
/**
113113
* Get Series Data Type.
114114
*/
115-
public function setAxisNumberProperties(mixed $format_code, ?bool $numeric = null, int $sourceLinked = 0): void
115+
public function setAxisNumberProperties(string $format_code, ?bool $numeric = null, int $sourceLinked = 0): void
116116
{
117-
$format = (string) $format_code;
117+
$format = $format_code;
118118
$this->axisNumber['format'] = $format;
119119
$this->axisNumber['source_linked'] = $sourceLinked;
120120
if (is_bool($numeric)) {

src/PhpSpreadsheet/Chart/Chart.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ class Chart
126126
* Create a new Chart.
127127
* majorGridlines and minorGridlines are deprecated, moved to Axis.
128128
*/
129-
public function __construct(mixed $name, ?Title $title = null, ?Legend $legend = null, ?PlotArea $plotArea = null, mixed $plotVisibleOnly = true, string $displayBlanksAs = DataSeries::EMPTY_AS_GAP, ?Title $xAxisLabel = null, ?Title $yAxisLabel = null, ?Axis $xAxis = null, ?Axis $yAxis = null, ?GridLines $majorGridlines = null, ?GridLines $minorGridlines = null)
129+
public function __construct(string $name, ?Title $title = null, ?Legend $legend = null, ?PlotArea $plotArea = null, bool $plotVisibleOnly = true, string $displayBlanksAs = DataSeries::EMPTY_AS_GAP, ?Title $xAxisLabel = null, ?Title $yAxisLabel = null, ?Axis $xAxis = null, ?Axis $yAxis = null, ?GridLines $majorGridlines = null, ?GridLines $minorGridlines = null)
130130
{
131131
$this->name = $name;
132132
$this->title = $title;

src/PhpSpreadsheet/Chart/DataSeries.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ public function getPlotLabels(): array
232232
*
233233
* @return DataSeriesValues|false
234234
*/
235-
public function getPlotLabelByIndex(mixed $index): bool|DataSeriesValues
235+
public function getPlotLabelByIndex(int $index): bool|DataSeriesValues
236236
{
237237
$keys = array_keys($this->plotLabel);
238238
if (in_array($index, $keys)) {
@@ -257,7 +257,7 @@ public function getPlotCategories(): array
257257
*
258258
* @return DataSeriesValues|false
259259
*/
260-
public function getPlotCategoryByIndex(mixed $index): bool|DataSeriesValues
260+
public function getPlotCategoryByIndex(int $index): bool|DataSeriesValues
261261
{
262262
$keys = array_keys($this->plotCategory);
263263
if (in_array($index, $keys)) {
@@ -304,7 +304,7 @@ public function getPlotValues(): array
304304
*
305305
* @return DataSeriesValues|false
306306
*/
307-
public function getPlotValuesByIndex(mixed $index): bool|DataSeriesValues
307+
public function getPlotValuesByIndex(int $index): bool|DataSeriesValues
308308
{
309309
$keys = array_keys($this->plotValues);
310310
if (in_array($index, $keys)) {

src/PhpSpreadsheet/Chart/PlotArea.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public function getPlotGroup(): array
8888
/**
8989
* Get Plot Series by Index.
9090
*/
91-
public function getPlotGroupByIndex(mixed $index): DataSeries
91+
public function getPlotGroupByIndex(int $index): DataSeries
9292
{
9393
return $this->plotSeries[$index];
9494
}

src/PhpSpreadsheet/Chart/Properties.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ protected function getShadowPresetsMap(int $presetsOption): array
403403
/**
404404
* Get value of array element.
405405
*/
406-
protected function getArrayElementsValue(mixed $properties, mixed $elements): mixed
406+
protected function getArrayElementsValue(array $properties, array|int|string $elements): mixed
407407
{
408408
$reference = &$properties;
409409
if (!is_array($elements)) {

src/PhpSpreadsheet/Helper/Dimension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class Dimension
5656
* Phpstan bug has been fixed; this function allows us to
5757
* pass Phpstan whether fixed or not.
5858
*/
59-
private static function stanBugFixed(mixed $value): array
59+
private static function stanBugFixed(array|int|null $value): array
6060
{
6161
return is_array($value) ? $value : [null, null];
6262
}

0 commit comments

Comments
 (0)