From bab6fc4e24e19fc1b47cd66068d9d9dda5b38b70 Mon Sep 17 00:00:00 2001 From: Adrien Crivelli Date: Mon, 11 Dec 2023 09:06:11 +0100 Subject: [PATCH] More @param to native types --- phpstan-baseline.neon | 5 +++ .../Calculation/Calculation.php | 4 +- .../Calculation/Database/DatabaseAbstract.php | 5 +-- .../Calculation/DateTimeExcel/Difference.php | 7 +-- .../Calculation/DateTimeExcel/Helpers.php | 2 +- .../Calculation/Engineering/BitWise.php | 44 +++++++------------ .../Calculation/Engineering/Erf.php | 4 +- .../CashFlow/CashFlowValidations.php | 5 +-- src/PhpSpreadsheet/Calculation/Functions.php | 4 +- .../Calculation/LookupRef/Indirect.php | 4 +- .../Calculation/MathTrig/Helpers.php | 16 ++----- .../Calculation/MathTrig/Operations.php | 8 ++-- .../Calculation/MathTrig/Trunc.php | 8 ++-- .../Distributions/StandardNormal.php | 3 +- src/PhpSpreadsheet/Chart/Axis.php | 2 - src/PhpSpreadsheet/Chart/Chart.php | 6 --- src/PhpSpreadsheet/Chart/ChartColor.php | 11 +---- src/PhpSpreadsheet/Chart/DataSeriesValues.php | 6 +-- src/PhpSpreadsheet/Chart/Layout.php | 4 -- src/PhpSpreadsheet/Chart/Properties.php | 31 ++----------- src/PhpSpreadsheet/Chart/Title.php | 8 +--- src/PhpSpreadsheet/Document/Properties.php | 13 ++---- src/PhpSpreadsheet/Reader/Html.php | 4 +- src/PhpSpreadsheet/Reader/Xls.php | 6 +-- src/PhpSpreadsheet/Reader/Xlsx.php | 12 +---- src/PhpSpreadsheet/Reader/Xlsx/AutoFilter.php | 10 +---- src/PhpSpreadsheet/Reader/Xlsx/Chart.php | 3 -- .../Reader/Xlsx/ConditionalStyles.php | 10 +---- src/PhpSpreadsheet/Reader/Xlsx/Properties.php | 5 +-- src/PhpSpreadsheet/Reader/Xlsx/Styles.php | 4 +- src/PhpSpreadsheet/Shared/Date.php | 4 +- src/PhpSpreadsheet/Shared/Font.php | 4 +- src/PhpSpreadsheet/Shared/OLERead.php | 2 - src/PhpSpreadsheet/Shared/StringHelper.php | 4 +- src/PhpSpreadsheet/Shared/Trend/BestFit.php | 5 +-- src/PhpSpreadsheet/Spreadsheet.php | 10 +---- src/PhpSpreadsheet/Style/Border.php | 5 +-- .../ConditionalDataBarExtension.php | 6 +-- .../Style/NumberFormat/NumberFormatter.php | 5 +-- .../Style/NumberFormat/Wizard/DateTime.php | 5 +-- src/PhpSpreadsheet/Style/Supervisor.php | 4 +- src/PhpSpreadsheet/Worksheet/AutoFilter.php | 6 +-- src/PhpSpreadsheet/Worksheet/PageSetup.php | 2 - src/PhpSpreadsheet/Worksheet/SheetView.php | 6 --- src/PhpSpreadsheet/Worksheet/Table.php | 2 +- src/PhpSpreadsheet/Writer/Html.php | 26 ++++++----- src/PhpSpreadsheet/Writer/Xls.php | 5 +-- src/PhpSpreadsheet/Writer/Xls/Xf.php | 4 -- src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php | 13 ++---- .../PhpSpreadsheetTests/Shared/Date2Test.php | 2 - .../Worksheet/AutoFilter/AutoFilterTest.php | 12 ----- .../Worksheet/Table/TableTest.php | 10 ----- 52 files changed, 98 insertions(+), 298 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index a5573ea05d..fecf4eca6f 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1175,6 +1175,11 @@ parameters: count: 1 path: src/PhpSpreadsheet/Chart/DataSeriesValues.php + - + message: "#^Argument of an invalid type array\\\\|SimpleXMLElement\\|null supplied for foreach, only iterables are supported\\.$#" + count: 2 + path: src/PhpSpreadsheet/Reader/Xlsx/ConditionalStyles.php + - message: "#^Cannot access property \\$color on SimpleXMLElement\\|null\\.$#" count: 2 diff --git a/src/PhpSpreadsheet/Calculation/Calculation.php b/src/PhpSpreadsheet/Calculation/Calculation.php index 88caeefe71..f9da3c4ea2 100644 --- a/src/PhpSpreadsheet/Calculation/Calculation.php +++ b/src/PhpSpreadsheet/Calculation/Calculation.php @@ -5526,10 +5526,8 @@ private function getArgumentDefaultValue(ReflectionParameter $methodArgument): m /** * Add cell reference if needed while making sure that it is the last argument. - * - * @param array|string $functionCall */ - private function addCellReference(array $args, bool $passCellReference, $functionCall, ?Cell $cell = null): array + private function addCellReference(array $args, bool $passCellReference, array|string $functionCall, ?Cell $cell = null): array { if ($passCellReference) { if (is_array($functionCall)) { diff --git a/src/PhpSpreadsheet/Calculation/Database/DatabaseAbstract.php b/src/PhpSpreadsheet/Calculation/Database/DatabaseAbstract.php index a1542b7195..6905323c92 100644 --- a/src/PhpSpreadsheet/Calculation/Database/DatabaseAbstract.php +++ b/src/PhpSpreadsheet/Calculation/Database/DatabaseAbstract.php @@ -8,10 +8,7 @@ abstract class DatabaseAbstract { - /** - * @param null|int|string $field - */ - abstract public static function evaluate(array $database, $field, array $criteria): null|float|int|string; + abstract public static function evaluate(array $database, null|int|string $field, array $criteria): null|float|int|string; /** * fieldExtract. diff --git a/src/PhpSpreadsheet/Calculation/DateTimeExcel/Difference.php b/src/PhpSpreadsheet/Calculation/DateTimeExcel/Difference.php index 9052b8485b..daf70ad03f 100644 --- a/src/PhpSpreadsheet/Calculation/DateTimeExcel/Difference.php +++ b/src/PhpSpreadsheet/Calculation/DateTimeExcel/Difference.php @@ -22,8 +22,7 @@ class Difference * @param mixed $endDate Excel date serial value, PHP date/time stamp, PHP DateTime object * or a standard date string * Or can be an array of date values - * @param array|string $unit - * Or can be an array of unit values + * @param array|string $unit Or can be an array of unit values * * @return array|int|string Interval between the dates * If an array of values is passed for the $startDate or $endDays,arguments, then the returned result @@ -80,10 +79,8 @@ private static function initialDiff(float $startDate, float $endDate): float /** * Decide whether it's time to set retVal. - * - * @param bool|int $retVal */ - private static function replaceRetValue($retVal, string $unit, string $compare): null|bool|int + private static function replaceRetValue(bool|int $retVal, string $unit, string $compare): null|bool|int { if ($retVal !== false || $unit !== $compare) { return $retVal; diff --git a/src/PhpSpreadsheet/Calculation/DateTimeExcel/Helpers.php b/src/PhpSpreadsheet/Calculation/DateTimeExcel/Helpers.php index 5f355d47f7..3dd2e4bc6c 100644 --- a/src/PhpSpreadsheet/Calculation/DateTimeExcel/Helpers.php +++ b/src/PhpSpreadsheet/Calculation/DateTimeExcel/Helpers.php @@ -275,7 +275,7 @@ public static function dateParseSucceeded(array $dateArray): bool * * @param array|false $dateArray */ - private static function forceArray($dateArray): array + private static function forceArray(array|bool $dateArray): array { return is_array($dateArray) ? $dateArray : ['error_count' => 1]; } diff --git a/src/PhpSpreadsheet/Calculation/Engineering/BitWise.php b/src/PhpSpreadsheet/Calculation/Engineering/BitWise.php index f443c83be2..e1ace4f313 100644 --- a/src/PhpSpreadsheet/Calculation/Engineering/BitWise.php +++ b/src/PhpSpreadsheet/Calculation/Engineering/BitWise.php @@ -15,11 +15,9 @@ class BitWise /** * Split a number into upper and lower portions for full 32-bit support. * - * @param float|int $number - * * @return int[] */ - private static function splitNumber($number): array + private static function splitNumber(float|int $number): array { return [(int) floor($number / self::SPLIT_DIVISOR), (int) fmod($number, self::SPLIT_DIVISOR)]; } @@ -32,15 +30,13 @@ private static function splitNumber($number): array * Excel Function: * BITAND(number1, number2) * - * @param array|int $number1 - * Or can be an array of values - * @param array|int $number2 - * Or can be an array of values + * @param null|array|bool|float|int|string $number1 Or can be an array of values + * @param null|array|bool|float|int|string $number2 Or can be an array of values * * @return array|int|string If an array of numbers is passed as an argument, then the returned result will also be an array * with the same dimensions */ - public static function BITAND($number1, $number2): array|string|int + public static function BITAND(null|array|bool|float|int|string $number1, null|array|bool|float|int|string $number2): array|string|int { if (is_array($number1) || is_array($number2)) { return self::evaluateArrayArguments([self::class, __FUNCTION__], $number1, $number2); @@ -66,15 +62,13 @@ public static function BITAND($number1, $number2): array|string|int * Excel Function: * BITOR(number1, number2) * - * @param array|int $number1 - * Or can be an array of values - * @param array|int $number2 - * Or can be an array of values + * @param null|array|bool|float|int|string $number1 Or can be an array of values + * @param null|array|bool|float|int|string $number2 Or can be an array of values * * @return array|int|string If an array of numbers is passed as an argument, then the returned result will also be an array * with the same dimensions */ - public static function BITOR($number1, $number2): array|string|int + public static function BITOR(null|array|bool|float|int|string $number1, null|array|bool|float|int|string $number2): array|string|int { if (is_array($number1) || is_array($number2)) { return self::evaluateArrayArguments([self::class, __FUNCTION__], $number1, $number2); @@ -101,15 +95,13 @@ public static function BITOR($number1, $number2): array|string|int * Excel Function: * BITXOR(number1, number2) * - * @param array|int $number1 - * Or can be an array of values - * @param array|int $number2 - * Or can be an array of values + * @param null|array|bool|float|int|string $number1 Or can be an array of values + * @param null|array|bool|float|int|string $number2 Or can be an array of values * * @return array|int|string If an array of numbers is passed as an argument, then the returned result will also be an array * with the same dimensions */ - public static function BITXOR($number1, $number2): array|string|int + public static function BITXOR(null|array|bool|float|int|string $number1, null|array|bool|float|int|string $number2): array|string|int { if (is_array($number1) || is_array($number2)) { return self::evaluateArrayArguments([self::class, __FUNCTION__], $number1, $number2); @@ -136,15 +128,13 @@ public static function BITXOR($number1, $number2): array|string|int * Excel Function: * BITLSHIFT(number, shift_amount) * - * @param array|int $number - * Or can be an array of values - * @param array|int $shiftAmount - * Or can be an array of values + * @param null|array|bool|float|int|string $number Or can be an array of values + * @param null|array|bool|float|int|string $shiftAmount Or can be an array of values * * @return array|float|string If an array of numbers is passed as an argument, then the returned result will also be an array * with the same dimensions */ - public static function BITLSHIFT($number, $shiftAmount): array|string|float + public static function BITLSHIFT(null|array|bool|float|int|string $number, null|array|bool|float|int|string $shiftAmount): array|string|float { if (is_array($number) || is_array($shiftAmount)) { return self::evaluateArrayArguments([self::class, __FUNCTION__], $number, $shiftAmount); @@ -173,15 +163,13 @@ public static function BITLSHIFT($number, $shiftAmount): array|string|float * Excel Function: * BITRSHIFT(number, shift_amount) * - * @param array|int $number - * Or can be an array of values - * @param array|int $shiftAmount - * Or can be an array of values + * @param null|array|bool|float|int|string $number Or can be an array of values + * @param null|array|bool|float|int|string $shiftAmount Or can be an array of values * * @return array|float|string If an array of numbers is passed as an argument, then the returned result will also be an array * with the same dimensions */ - public static function BITRSHIFT($number, $shiftAmount): array|string|float + public static function BITRSHIFT(null|array|bool|float|int|string $number, null|array|bool|float|int|string $shiftAmount): array|string|float { if (is_array($number) || is_array($shiftAmount)) { return self::evaluateArrayArguments([self::class, __FUNCTION__], $number, $shiftAmount); diff --git a/src/PhpSpreadsheet/Calculation/Engineering/Erf.php b/src/PhpSpreadsheet/Calculation/Engineering/Erf.php index 8a64a23463..aee7e31751 100644 --- a/src/PhpSpreadsheet/Calculation/Engineering/Erf.php +++ b/src/PhpSpreadsheet/Calculation/Engineering/Erf.php @@ -82,10 +82,8 @@ private static function makeFloat(mixed $value): float /** * Method to calculate the erf value. - * - * @param float|int|string $value */ - public static function erfValue($value): float + public static function erfValue(float|int|string $value): float { $value = (float) $value; if (abs($value) > 2.2) { diff --git a/src/PhpSpreadsheet/Calculation/Financial/CashFlow/CashFlowValidations.php b/src/PhpSpreadsheet/Calculation/Financial/CashFlow/CashFlowValidations.php index ae5a794b0a..f5719b6992 100644 --- a/src/PhpSpreadsheet/Calculation/Financial/CashFlow/CashFlowValidations.php +++ b/src/PhpSpreadsheet/Calculation/Financial/CashFlow/CashFlowValidations.php @@ -9,10 +9,7 @@ class CashFlowValidations extends FinancialValidations { - /** - * @param mixed $rate - */ - public static function validateRate($rate): float + public static function validateRate(mixed $rate): float { $rate = self::validateFloat($rate); diff --git a/src/PhpSpreadsheet/Calculation/Functions.php b/src/PhpSpreadsheet/Calculation/Functions.php index 7aab6ec337..e838ef9cbb 100644 --- a/src/PhpSpreadsheet/Calculation/Functions.php +++ b/src/PhpSpreadsheet/Calculation/Functions.php @@ -200,11 +200,11 @@ private static function operandSpecialHandling(mixed $operand): mixed /** * Convert a multi-dimensional array to a simple 1-dimensional array. * - * @param array|mixed $array Array to be flattened + * @param mixed $array Array to be flattened * * @return array Flattened array */ - public static function flattenArray($array): array + public static function flattenArray(mixed $array): array { if (!is_array($array)) { return (array) $array; diff --git a/src/PhpSpreadsheet/Calculation/LookupRef/Indirect.php b/src/PhpSpreadsheet/Calculation/LookupRef/Indirect.php index aa480ab25c..d53900d420 100644 --- a/src/PhpSpreadsheet/Calculation/LookupRef/Indirect.php +++ b/src/PhpSpreadsheet/Calculation/LookupRef/Indirect.php @@ -34,10 +34,8 @@ private static function a1Format(mixed $a1fmt): bool /** * Convert cellAddress to string, verify not null string. - * - * @param array|string $cellAddress */ - private static function validateAddress($cellAddress): string + private static function validateAddress(array|string|null $cellAddress): string { $cellAddress = Functions::flattenSingleValue($cellAddress); if (!is_string($cellAddress) || !$cellAddress) { diff --git a/src/PhpSpreadsheet/Calculation/MathTrig/Helpers.php b/src/PhpSpreadsheet/Calculation/MathTrig/Helpers.php index fd8b2ea9da..57e05b1910 100644 --- a/src/PhpSpreadsheet/Calculation/MathTrig/Helpers.php +++ b/src/PhpSpreadsheet/Calculation/MathTrig/Helpers.php @@ -39,10 +39,8 @@ public static function validateNumericNullBool(mixed $number): int|float /** * Validate numeric, but allow substitute for null. - * - * @param null|float|int $substitute */ - public static function validateNumericNullSubstitution(mixed $number, $substitute): float|int + public static function validateNumericNullSubstitution(mixed $number, null|float|int $substitute): float|int { $number = Functions::flattenSingleValue($number); if ($number === null && $substitute !== null) { @@ -57,10 +55,8 @@ public static function validateNumericNullSubstitution(mixed $number, $substitut /** * Confirm number >= 0. - * - * @param float|int $number */ - public static function validateNotNegative($number, ?string $except = null): void + public static function validateNotNegative(float|int $number, ?string $except = null): void { if ($number >= 0) { return; @@ -71,10 +67,8 @@ public static function validateNotNegative($number, ?string $except = null): voi /** * Confirm number > 0. - * - * @param float|int $number */ - public static function validatePositive($number, ?string $except = null): void + public static function validatePositive(float|int $number, ?string $except = null): void { if ($number > 0) { return; @@ -85,10 +79,8 @@ public static function validatePositive($number, ?string $except = null): void /** * Confirm number != 0. - * - * @param float|int $number */ - public static function validateNotZero($number): void + public static function validateNotZero(float|int $number): void { if ($number) { return; diff --git a/src/PhpSpreadsheet/Calculation/MathTrig/Operations.php b/src/PhpSpreadsheet/Calculation/MathTrig/Operations.php index 2c224430be..9c4a6f44a5 100644 --- a/src/PhpSpreadsheet/Calculation/MathTrig/Operations.php +++ b/src/PhpSpreadsheet/Calculation/MathTrig/Operations.php @@ -52,16 +52,14 @@ public static function mod(mixed $dividend, mixed $divisor): array|string|float * * Computes x raised to the power y. * - * @param array|float|int $x - * Or can be an array of values - * @param array|float|int $y - * Or can be an array of values + * @param array|float|int|string $x Or can be an array of values + * @param array|float|int|string $y Or can be an array of values * * @return array|float|int|string The result, or a string containing an error * If an array of numbers is passed as an argument, then the returned result will also be an array * with the same dimensions */ - public static function power($x, $y) + public static function power(array|float|int|string $x, array|float|int|string $y): array|float|int|string { if (is_array($x) || is_array($y)) { return self::evaluateArrayArguments([self::class, __FUNCTION__], $x, $y); diff --git a/src/PhpSpreadsheet/Calculation/MathTrig/Trunc.php b/src/PhpSpreadsheet/Calculation/MathTrig/Trunc.php index 943e209dd2..44aedd2ca0 100644 --- a/src/PhpSpreadsheet/Calculation/MathTrig/Trunc.php +++ b/src/PhpSpreadsheet/Calculation/MathTrig/Trunc.php @@ -14,16 +14,14 @@ class Trunc * * Truncates value to the number of fractional digits by number_digits. * - * @param array|float $value - * Or can be an array of values - * @param array|int $digits - * Or can be an array of values + * @param array|float $value Or can be an array of values + * @param array|int $digits Or can be an array of values * * @return array|float|string Truncated value, or a string containing an error * If an array of numbers is passed as an argument, then the returned result will also be an array * with the same dimensions */ - public static function evaluate($value = 0, $digits = 0) + public static function evaluate(array|float|string|null $value = 0, array|int|string $digits = 0): array|float|string { if (is_array($value) || is_array($digits)) { return self::evaluateArrayArguments([self::class, __FUNCTION__], $value, $digits); diff --git a/src/PhpSpreadsheet/Calculation/Statistical/Distributions/StandardNormal.php b/src/PhpSpreadsheet/Calculation/Statistical/Distributions/StandardNormal.php index b7995d400d..a27870158e 100644 --- a/src/PhpSpreadsheet/Calculation/Statistical/Distributions/StandardNormal.php +++ b/src/PhpSpreadsheet/Calculation/Statistical/Distributions/StandardNormal.php @@ -87,8 +87,7 @@ public static function inverse(mixed $value) * Calculates the probability that a member of a standard normal population will fall between * the mean and z standard deviations from the mean. * - * @param mixed $value - * Or can be an array of values + * @param mixed $value Or can be an array of values * * @return array|float|string The result, or a string containing an error * If an array of numbers is passed as an argument, then the returned result will also be an array diff --git a/src/PhpSpreadsheet/Chart/Axis.php b/src/PhpSpreadsheet/Chart/Axis.php index 96c3d7f9d8..461a9f72c0 100644 --- a/src/PhpSpreadsheet/Chart/Axis.php +++ b/src/PhpSpreadsheet/Chart/Axis.php @@ -207,8 +207,6 @@ public function setAxisType(string $type): self /** * Set Fill Property. - * - * @param ?int $alpha */ public function setFillParameters(?string $color, ?int $alpha = null, ?string $AlphaType = ChartColor::EXCEL_COLOR_TYPE_RGB): void { diff --git a/src/PhpSpreadsheet/Chart/Chart.php b/src/PhpSpreadsheet/Chart/Chart.php index 65e74b1e3d..5d370bfc8c 100644 --- a/src/PhpSpreadsheet/Chart/Chart.php +++ b/src/PhpSpreadsheet/Chart/Chart.php @@ -398,9 +398,6 @@ public function setTopLeftCell(string $cellAddress): static /** * Set the offset position within the Top Left cell for the chart. * - * @param ?int $xOffset - * @param ?int $yOffset - * * @return $this */ public function setTopLeftOffset(?int $xOffset, ?int $yOffset): static @@ -514,9 +511,6 @@ public function getBottomRightCell(): string /** * Set the offset position within the Bottom Right cell for the chart. * - * @param ?int $xOffset - * @param ?int $yOffset - * * @return $this */ public function setBottomRightOffset(?int $xOffset, ?int $yOffset): static diff --git a/src/PhpSpreadsheet/Chart/ChartColor.php b/src/PhpSpreadsheet/Chart/ChartColor.php index ba530e7167..d6306de6bf 100644 --- a/src/PhpSpreadsheet/Chart/ChartColor.php +++ b/src/PhpSpreadsheet/Chart/ChartColor.php @@ -81,11 +81,7 @@ public function setBrightness(?int $brightness): self return $this; } - /** - * @param null|float|int|string $alpha - * @param null|float|int|string $brightness - */ - public function setColorProperties(?string $color, $alpha = null, ?string $type = null, $brightness = null): self + public function setColorProperties(?string $color, null|float|int|string $alpha = null, ?string $type = null, null|float|int|string $brightness = null): self { if (empty($type) && !empty($color)) { if (str_starts_with($color, '*')) { @@ -157,10 +153,7 @@ public static function alphaToXml(int $alpha): string return (string) (100 - $alpha) . '000'; } - /** - * @param float|int|string $alpha - */ - public static function alphaFromXml($alpha): int + public static function alphaFromXml(float|int|string $alpha): int { return 100 - ((int) $alpha / 1000); } diff --git a/src/PhpSpreadsheet/Chart/DataSeriesValues.php b/src/PhpSpreadsheet/Chart/DataSeriesValues.php index f2e913d400..9e10bf97d1 100644 --- a/src/PhpSpreadsheet/Chart/DataSeriesValues.php +++ b/src/PhpSpreadsheet/Chart/DataSeriesValues.php @@ -147,8 +147,6 @@ public function getDataSource(): ?string /** * Set Series Data Source (formula). * - * @param ?string $dataSource - * * @return $this */ public function setDataSource(?string $dataSource): static @@ -357,11 +355,9 @@ public function getLineWidth(): null|float|int /** * Set line width for the series. * - * @param null|float|int $width - * * @return $this */ - public function setLineWidth($width): static + public function setLineWidth(null|float|int $width): static { $this->lineStyleProperties['width'] = $width; diff --git a/src/PhpSpreadsheet/Chart/Layout.php b/src/PhpSpreadsheet/Chart/Layout.php index c572a1b3f1..54bde2347a 100644 --- a/src/PhpSpreadsheet/Chart/Layout.php +++ b/src/PhpSpreadsheet/Chart/Layout.php @@ -200,8 +200,6 @@ public function getXMode(): ?string /** * Set X-Mode. * - * @param ?string $mode - * * @return $this */ public function setXMode(?string $mode): static @@ -222,8 +220,6 @@ public function getYMode(): ?string /** * Set Y-Mode. * - * @param ?string $mode - * * @return $this */ public function setYMode(?string $mode): static diff --git a/src/PhpSpreadsheet/Chart/Properties.php b/src/PhpSpreadsheet/Chart/Properties.php index 343c40fef7..b22d5e03d9 100644 --- a/src/PhpSpreadsheet/Chart/Properties.php +++ b/src/PhpSpreadsheet/Chart/Properties.php @@ -178,10 +178,7 @@ public static function xmlToTenthOfPercent(string $value): float return ((float) $value) / self::PERCENTAGE_MULTIPLIER; } - /** - * @param null|float|int|string $alpha - */ - protected function setColorProperties(?string $color, $alpha, ?string $colorType): array + protected function setColorProperties(?string $color, null|float|int|string $alpha, ?string $colorType): array { return [ 'type' => $colorType, @@ -422,10 +419,6 @@ protected function getArrayElementsValue(mixed $properties, mixed $elements): mi /** * Set Glow Properties. - * - * @param ?string $colorValue - * @param ?int $colorAlpha - * @param ?string $colorType */ public function setGlowProperties(float $size, ?string $colorValue = null, ?int $colorAlpha = null, ?string $colorType = null): void { @@ -486,8 +479,6 @@ public function getGlowSize(): ?float /** * Set Glow Size. * - * @param ?float $size - * * @return $this */ protected function setGlowSize(?float $size) @@ -499,8 +490,6 @@ protected function setGlowSize(?float $size) /** * Set Soft Edges Size. - * - * @param ?float $size */ public function setSoftEdges(?float $size): void { @@ -532,10 +521,8 @@ public function setShadowProperty(string $propertyName, mixed $value): self /** * Set Shadow Properties. - * - * @param null|float|int|string $colorAlpha */ - public function setShadowProperties(int $presets, ?string $colorValue = null, ?string $colorType = null, $colorAlpha = null, ?float $blur = null, ?int $angle = null, ?float $distance = null): void + public function setShadowProperties(int $presets, ?string $colorValue = null, ?string $colorType = null, null|float|int|string $colorAlpha = null, ?float $blur = null, ?int $angle = null, ?float $distance = null): void { $this->activateObject()->setShadowPresetsProperties((int) $presets); if ($presets === 0) { @@ -602,8 +589,6 @@ protected function setShadowPropertiesMapValues(array $propertiesMap, ?array &$r /** * Set Shadow Blur. * - * @param ?float $blur - * * @return $this */ protected function setShadowBlur(?float $blur) @@ -618,11 +603,9 @@ protected function setShadowBlur(?float $blur) /** * Set Shadow Angle. * - * @param null|float|int|string $angle - * * @return $this */ - protected function setShadowAngle($angle) + protected function setShadowAngle(null|float|int|string $angle) { if (is_numeric($angle)) { $this->shadowProperties['direction'] = $angle; @@ -634,8 +617,6 @@ protected function setShadowAngle($angle) /** * Set Shadow Distance. * - * @param ?float $distance - * * @return $this */ protected function setShadowDistance(?float $distance) @@ -721,8 +702,6 @@ public function getLineColor(): ChartColor /** * Set Line Color Properties. - * - * @param ?int $alpha */ public function setLineColorProperties(?string $value, ?int $alpha = null, ?string $colorType = null): void { @@ -843,10 +822,8 @@ public function setLineStyleProperty(string $propertyName, mixed $value): self /** * Get Line Style Property. - * - * @param array|string $elements */ - public function getLineStyleProperty($elements): ?string + public function getLineStyleProperty(array|string $elements): ?string { return $this->getArrayElementsValue($this->lineStyleProperties, $elements); } diff --git a/src/PhpSpreadsheet/Chart/Title.php b/src/PhpSpreadsheet/Chart/Title.php index dd2742164b..9b657ecb1c 100644 --- a/src/PhpSpreadsheet/Chart/Title.php +++ b/src/PhpSpreadsheet/Chart/Title.php @@ -25,10 +25,8 @@ class Title /** * Create a new Title. - * - * @param array|RichText|string $caption */ - public function __construct($caption = '', ?Layout $layout = null, bool $overlay = false) + public function __construct(array|RichText|string $caption = '', ?Layout $layout = null, bool $overlay = false) { $this->caption = $caption; $this->layout = $layout; @@ -71,11 +69,9 @@ public function getCaptionText(): string /** * Set caption. * - * @param array|RichText|string $caption - * * @return $this */ - public function setCaption($caption): static + public function setCaption(array|RichText|string $caption): static { $this->caption = $caption; diff --git a/src/PhpSpreadsheet/Document/Properties.php b/src/PhpSpreadsheet/Document/Properties.php index 1212a258bb..1459458f87 100644 --- a/src/PhpSpreadsheet/Document/Properties.php +++ b/src/PhpSpreadsheet/Document/Properties.php @@ -140,10 +140,7 @@ public function setLastModifiedBy(string $modifiedBy): self return $this; } - /** - * @param null|float|int|string $timestamp - */ - private static function intOrFloatTimestamp($timestamp): float|int + private static function intOrFloatTimestamp(null|float|int|string $timestamp): float|int { if ($timestamp === null) { $timestamp = (float) (new DateTime())->format('U'); @@ -172,11 +169,9 @@ public function getCreated(): float|int /** * Set Created. * - * @param null|float|int|string $timestamp - * * @return $this */ - public function setCreated($timestamp): self + public function setCreated(null|float|int|string $timestamp): self { $this->created = self::intOrFloatTimestamp($timestamp); @@ -194,11 +189,9 @@ public function getModified(): float|int /** * Set Modified. * - * @param null|float|int|string $timestamp - * * @return $this */ - public function setModified($timestamp): self + public function setModified(null|float|int|string $timestamp): self { $this->modified = self::intOrFloatTimestamp($timestamp); diff --git a/src/PhpSpreadsheet/Reader/Html.php b/src/PhpSpreadsheet/Reader/Html.php index 2acb3fcf8e..5841a48039 100644 --- a/src/PhpSpreadsheet/Reader/Html.php +++ b/src/PhpSpreadsheet/Reader/Html.php @@ -238,10 +238,8 @@ protected function releaseTableStartColumn(): string /** * Flush cell. - * - * @param int|string $row */ - protected function flushCell(Worksheet $sheet, string $column, $row, mixed &$cellContent, array $attributeArray): void + protected function flushCell(Worksheet $sheet, string $column, int|string $row, mixed &$cellContent, array $attributeArray): void { if (is_string($cellContent)) { // Simple String content diff --git a/src/PhpSpreadsheet/Reader/Xls.php b/src/PhpSpreadsheet/Reader/Xls.php index c91ed8c3f8..f90d2decbc 100644 --- a/src/PhpSpreadsheet/Reader/Xls.php +++ b/src/PhpSpreadsheet/Reader/Xls.php @@ -7529,11 +7529,7 @@ private function readCFFormula(string $recordData, int $offset, int $size): floa return null; } - /** - * @param null|float|int|string $formula1 - * @param null|float|int|string $formula2 - */ - private function setCFRules(array $cellRanges, string $type, string $operator, $formula1, $formula2, Style $style): void + private function setCFRules(array $cellRanges, string $type, string $operator, null|float|int|string $formula1, null|float|int|string $formula2, Style $style): void { foreach ($cellRanges as $cellRange) { $conditional = new Conditional(); diff --git a/src/PhpSpreadsheet/Reader/Xlsx.php b/src/PhpSpreadsheet/Reader/Xlsx.php index 495e42a963..6d3b961c98 100644 --- a/src/PhpSpreadsheet/Reader/Xlsx.php +++ b/src/PhpSpreadsheet/Reader/Xlsx.php @@ -1950,20 +1950,12 @@ private function readRibbon(Spreadsheet $excel, string $customUITarget, ZipArchi } } - /** - * @param null|array|bool|SimpleXMLElement $array - * @param int|string $key - */ - private static function getArrayItem($array, $key = 0): mixed + private static function getArrayItem(null|array|bool|SimpleXMLElement $array, int|string $key = 0): mixed { return ($array === null || is_bool($array)) ? null : ($array[$key] ?? null); } - /** - * @param null|SimpleXMLElement|string $base - * @param null|SimpleXMLElement|string $add - */ - private static function dirAdd($base, $add): string + private static function dirAdd(null|SimpleXMLElement|string $base, null|SimpleXMLElement|string $add): string { $base = (string) $base; $add = (string) $add; diff --git a/src/PhpSpreadsheet/Reader/Xlsx/AutoFilter.php b/src/PhpSpreadsheet/Reader/Xlsx/AutoFilter.php index 68086cc145..49fe3609d8 100644 --- a/src/PhpSpreadsheet/Reader/Xlsx/AutoFilter.php +++ b/src/PhpSpreadsheet/Reader/Xlsx/AutoFilter.php @@ -11,17 +11,11 @@ class AutoFilter { - /** - * @var Table|Worksheet - */ - private $parent; + private Table|Worksheet $parent; private SimpleXMLElement $worksheetXml; - /** - * @param Table|Worksheet $parent - */ - public function __construct($parent, SimpleXMLElement $worksheetXml) + public function __construct(Table|Worksheet $parent, SimpleXMLElement $worksheetXml) { $this->parent = $parent; $this->worksheetXml = $worksheetXml; diff --git a/src/PhpSpreadsheet/Reader/Xlsx/Chart.php b/src/PhpSpreadsheet/Reader/Xlsx/Chart.php index 71777f230f..36ee58ea7e 100644 --- a/src/PhpSpreadsheet/Reader/Xlsx/Chart.php +++ b/src/PhpSpreadsheet/Reader/Xlsx/Chart.php @@ -1202,9 +1202,6 @@ private function parseFont(SimpleXMLElement $titleDetailPart): ?Font return $font; } - /** - * @param ?SimpleXMLElement $chartDetail - */ private function readChartAttributes(?SimpleXMLElement $chartDetail): array { $plotAttributes = []; diff --git a/src/PhpSpreadsheet/Reader/Xlsx/ConditionalStyles.php b/src/PhpSpreadsheet/Reader/Xlsx/ConditionalStyles.php index d8a3dfb1f4..8f9d42a1bf 100644 --- a/src/PhpSpreadsheet/Reader/Xlsx/ConditionalStyles.php +++ b/src/PhpSpreadsheet/Reader/Xlsx/ConditionalStyles.php @@ -250,10 +250,7 @@ private function readStyleRules(array $cfRules, SimpleXMLElement $extLst): array return $conditionalStyles; } - /** - * @param SimpleXMLElement|stdClass $cfRule - */ - private function readDataBarOfConditionalRule($cfRule, array $conditionalFormattingRuleExtensions): ConditionalDataBar + private function readDataBarOfConditionalRule(SimpleXMLElement $cfRule, array $conditionalFormattingRuleExtensions): ConditionalDataBar { $dataBar = new ConditionalDataBar(); //dataBar attribute @@ -319,10 +316,7 @@ private function readColorScale(simpleXMLElement|stdClass $cfRule): ConditionalC return $colorScale; } - /** - * @param SimpleXMLElement|stdClass $cfRule - */ - private function readDataBarExtLstOfConditionalRule(ConditionalDataBar $dataBar, $cfRule, array $conditionalFormattingRuleExtensions): void + private function readDataBarExtLstOfConditionalRule(ConditionalDataBar $dataBar, SimpleXMLElement $cfRule, array $conditionalFormattingRuleExtensions): void { if (isset($cfRule->extLst)) { $ns = $cfRule->extLst->getNamespaces(true); diff --git a/src/PhpSpreadsheet/Reader/Xlsx/Properties.php b/src/PhpSpreadsheet/Reader/Xlsx/Properties.php index d59fa28803..beac9f9a8c 100644 --- a/src/PhpSpreadsheet/Reader/Xlsx/Properties.php +++ b/src/PhpSpreadsheet/Reader/Xlsx/Properties.php @@ -96,10 +96,7 @@ public function readCustomProperties(string $propertyData): void } } - /** - * @param null|array|false $array - */ - private static function getArrayItem($array, mixed $key = 0): ?SimpleXMLElement + private static function getArrayItem(null|array|false $array, mixed $key = 0): ?SimpleXMLElement { return is_array($array) ? ($array[$key] ?? null) : null; } diff --git a/src/PhpSpreadsheet/Reader/Xlsx/Styles.php b/src/PhpSpreadsheet/Reader/Xlsx/Styles.php index ee51190d41..31a39af5a9 100644 --- a/src/PhpSpreadsheet/Reader/Xlsx/Styles.php +++ b/src/PhpSpreadsheet/Reader/Xlsx/Styles.php @@ -275,10 +275,8 @@ private static function formatGeneral(string $formatString): string /** * Read style. - * - * @param SimpleXMLElement|stdClass $style */ - public function readStyle(Style $docStyle, $style): void + public function readStyle(Style $docStyle, SimpleXMLElement|stdClass $style): void { if ($style instanceof SimpleXMLElement) { $this->readNumberFormat($docStyle->getNumberFormat(), $style->numFmt); diff --git a/src/PhpSpreadsheet/Shared/Date.php b/src/PhpSpreadsheet/Shared/Date.php index eabe6ae817..39d9a3b21c 100644 --- a/src/PhpSpreadsheet/Shared/Date.php +++ b/src/PhpSpreadsheet/Shared/Date.php @@ -318,11 +318,9 @@ public static function timestampToExcel($unixTimestamp): bool|float /** * formattedPHPToExcel. * - * @param float|int $seconds - * * @return float Excel date/time value */ - public static function formattedPHPToExcel(int $year, int $month, int $day, int $hours = 0, int $minutes = 0, $seconds = 0): float + public static function formattedPHPToExcel(int $year, int $month, int $day, int $hours = 0, int $minutes = 0, float|int $seconds = 0): float { if (self::$excelCalendar == self::CALENDAR_WINDOWS_1900) { // diff --git a/src/PhpSpreadsheet/Shared/Font.php b/src/PhpSpreadsheet/Shared/Font.php index 4b9c470dbe..1e200c79c9 100644 --- a/src/PhpSpreadsheet/Shared/Font.php +++ b/src/PhpSpreadsheet/Shared/Font.php @@ -328,10 +328,8 @@ public static function getTrueTypeFontPath(): string /** * Set pad amount for exact in pixels; use best guess if null. - * - * @param null|float|int $paddingAmountExact */ - public static function setPaddingAmountExact($paddingAmountExact): void + public static function setPaddingAmountExact(null|float|int $paddingAmountExact): void { self::$paddingAmountExact = $paddingAmountExact; } diff --git a/src/PhpSpreadsheet/Shared/OLERead.php b/src/PhpSpreadsheet/Shared/OLERead.php index 6911e732c2..645dbf779e 100644 --- a/src/PhpSpreadsheet/Shared/OLERead.php +++ b/src/PhpSpreadsheet/Shared/OLERead.php @@ -154,8 +154,6 @@ public function read(string $filename): void /** * Extract binary stream data. - * - * @param ?int $stream */ public function getStream(?int $stream): ?string { diff --git a/src/PhpSpreadsheet/Shared/StringHelper.php b/src/PhpSpreadsheet/Shared/StringHelper.php index f1c8ea3d3e..c214b8142c 100644 --- a/src/PhpSpreadsheet/Shared/StringHelper.php +++ b/src/PhpSpreadsheet/Shared/StringHelper.php @@ -334,10 +334,8 @@ public static function isUTF8(string $textValue): bool /** * Formats a numeric value as a string for output in various output writers forcing * point as decimal separator in case locale is other than English. - * - * @param float|int|string $numericValue */ - public static function formatNumber($numericValue): string + public static function formatNumber(float|int|string|null $numericValue): string { if (is_float($numericValue)) { return str_replace(',', '.', (string) $numericValue); diff --git a/src/PhpSpreadsheet/Shared/Trend/BestFit.php b/src/PhpSpreadsheet/Shared/Trend/BestFit.php index 9fcbccde8f..f9dacfb8a7 100644 --- a/src/PhpSpreadsheet/Shared/Trend/BestFit.php +++ b/src/PhpSpreadsheet/Shared/Trend/BestFit.php @@ -296,10 +296,7 @@ public function getYBestFitValues(): array return $this->yBestFitValues; } - /** - * @param bool|int $const - */ - protected function calculateGoodnessOfFit(float $sumX, float $sumY, float $sumX2, float $sumY2, float $sumXY, float $meanX, float $meanY, $const): void + protected function calculateGoodnessOfFit(float $sumX, float $sumY, float $sumX2, float $sumY2, float $sumXY, float $meanX, float $meanY, bool|int $const): void { $SSres = $SScov = $SStot = $SSsex = 0.0; foreach ($this->xValues as $xKey => $xValue) { diff --git a/src/PhpSpreadsheet/Spreadsheet.php b/src/PhpSpreadsheet/Spreadsheet.php index eb3c6bf7b3..40ad09d9ec 100644 --- a/src/PhpSpreadsheet/Spreadsheet.php +++ b/src/PhpSpreadsheet/Spreadsheet.php @@ -250,11 +250,8 @@ public function discardMacros(): void /** * set ribbon XML data. - * - * @param null|mixed $target - * @param null|mixed $xmlData */ - public function setRibbonXMLData($target, $xmlData): void + public function setRibbonXMLData(mixed $target, mixed $xmlData): void { if ($target !== null && $xmlData !== null) { $this->ribbonXMLData = ['target' => $target, 'data' => $xmlData]; @@ -289,11 +286,8 @@ public function getRibbonXMLData(string $what = 'all'): null|array|string //we n /** * store binaries ribbon objects (pictures). - * - * @param null|mixed $BinObjectsNames - * @param null|mixed $BinObjectsData */ - public function setRibbonBinObjects($BinObjectsNames, $BinObjectsData): void + public function setRibbonBinObjects(mixed $BinObjectsNames, mixed $BinObjectsData): void { if ($BinObjectsNames !== null && $BinObjectsData !== null) { $this->ribbonBinObjects = ['names' => $BinObjectsNames, 'data' => $BinObjectsData]; diff --git a/src/PhpSpreadsheet/Style/Border.php b/src/PhpSpreadsheet/Style/Border.php index e8f4ac2ec8..78c69f0934 100644 --- a/src/PhpSpreadsheet/Style/Border.php +++ b/src/PhpSpreadsheet/Style/Border.php @@ -141,13 +141,12 @@ public function getBorderStyle(): string /** * Set Border style. * - * @param bool|string $style - * When passing a boolean, FALSE equates Border::BORDER_NONE + * @param bool|string $style When passing a boolean, FALSE equates Border::BORDER_NONE * and TRUE to Border::BORDER_MEDIUM * * @return $this */ - public function setBorderStyle($style): static + public function setBorderStyle(bool|string $style): static { if (empty($style)) { $style = self::BORDER_NONE; diff --git a/src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalDataBarExtension.php b/src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalDataBarExtension.php index 8a4257e990..28cd94bbdb 100644 --- a/src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalDataBarExtension.php +++ b/src/PhpSpreadsheet/Style/ConditionalFormatting/ConditionalDataBarExtension.php @@ -222,11 +222,7 @@ public function getAxisColor(): array return $this->axisColor; } - /** - * @param null|mixed $theme - * @param null|mixed $tint - */ - public function setAxisColor(mixed $rgb, $theme = null, $tint = null): self + public function setAxisColor(mixed $rgb, mixed $theme = null, mixed $tint = null): self { $this->axisColor = [ 'rgb' => $rgb, diff --git a/src/PhpSpreadsheet/Style/NumberFormat/NumberFormatter.php b/src/PhpSpreadsheet/Style/NumberFormat/NumberFormatter.php index f927964d37..269ec3eb4c 100644 --- a/src/PhpSpreadsheet/Style/NumberFormat/NumberFormatter.php +++ b/src/PhpSpreadsheet/Style/NumberFormat/NumberFormatter.php @@ -253,10 +253,7 @@ public static function format(mixed $value, string $format): string return (string) $value; } - /** - * @param array|string $value - */ - private static function makeString($value): string + private static function makeString(array|string $value): string { return is_array($value) ? '' : "$value"; } diff --git a/src/PhpSpreadsheet/Style/NumberFormat/Wizard/DateTime.php b/src/PhpSpreadsheet/Style/NumberFormat/Wizard/DateTime.php index 292c1efc9d..2cd3d6d36b 100644 --- a/src/PhpSpreadsheet/Style/NumberFormat/Wizard/DateTime.php +++ b/src/PhpSpreadsheet/Style/NumberFormat/Wizard/DateTime.php @@ -28,10 +28,7 @@ public function __construct($separators, ...$formatBlocks) $this->formatBlocks = array_map([$this, 'mapFormatBlocks'], $formatBlocks); } - /** - * @param DateTimeWizard|string $value - */ - private function mapFormatBlocks($value): string + private function mapFormatBlocks(DateTimeWizard|string $value): string { // Any date masking codes are returned as lower case values if (is_object($value)) { diff --git a/src/PhpSpreadsheet/Style/Supervisor.php b/src/PhpSpreadsheet/Style/Supervisor.php index 4b796f46f5..8388ef6cd7 100644 --- a/src/PhpSpreadsheet/Style/Supervisor.php +++ b/src/PhpSpreadsheet/Style/Supervisor.php @@ -41,11 +41,9 @@ public function __construct(bool $isSupervisor = false) /** * Bind parent. Only used for supervisor. * - * @param Spreadsheet|Supervisor $parent - * * @return $this */ - public function bindParent($parent, ?string $parentPropertyName = null) + public function bindParent(Spreadsheet|self $parent, ?string $parentPropertyName = null) { $this->parent = $parent; $this->parentPropertyName = $parentPropertyName; diff --git a/src/PhpSpreadsheet/Worksheet/AutoFilter.php b/src/PhpSpreadsheet/Worksheet/AutoFilter.php index 3e53f51ba1..1201390f85 100644 --- a/src/PhpSpreadsheet/Worksheet/AutoFilter.php +++ b/src/PhpSpreadsheet/Worksheet/AutoFilter.php @@ -233,12 +233,12 @@ public function getColumnByOffset(int $columnOffset): AutoFilter\Column * * @return $this */ - public function setColumn($columnObjectOrString): static + public function setColumn(AutoFilter\Column|string $columnObjectOrString): static { $this->evaluated = false; if ((is_string($columnObjectOrString)) && (!empty($columnObjectOrString))) { $column = $columnObjectOrString; - } elseif (is_object($columnObjectOrString) && ($columnObjectOrString instanceof AutoFilter\Column)) { + } elseif ($columnObjectOrString instanceof AutoFilter\Column) { $column = $columnObjectOrString->getColumnIndex(); } else { throw new Exception('Column is not within the autofilter range.'); @@ -748,8 +748,6 @@ private function dynamicFilterDateRange(string $dynamicRuleType, AutoFilter\Colu /** * Apply the AutoFilter rules to the AutoFilter Range. - * - * @param ?string $ruleType */ private function calculateTopTenValue(string $columnID, int $startRow, int $endRow, ?string $ruleType, mixed $ruleValue): mixed { diff --git a/src/PhpSpreadsheet/Worksheet/PageSetup.php b/src/PhpSpreadsheet/Worksheet/PageSetup.php index 7b3fe83afe..fb383f1417 100644 --- a/src/PhpSpreadsheet/Worksheet/PageSetup.php +++ b/src/PhpSpreadsheet/Worksheet/PageSetup.php @@ -793,8 +793,6 @@ public function getFirstPageNumber(): ?int /** * Set first page number. * - * @param ?int $value - * * @return $this */ public function setFirstPageNumber(?int $value): static diff --git a/src/PhpSpreadsheet/Worksheet/SheetView.php b/src/PhpSpreadsheet/Worksheet/SheetView.php index b6054fa279..9e64a24bb3 100644 --- a/src/PhpSpreadsheet/Worksheet/SheetView.php +++ b/src/PhpSpreadsheet/Worksheet/SheetView.php @@ -69,8 +69,6 @@ public function getZoomScale(): ?int * Set ZoomScale. * Valid values range from 10 to 400. * - * @param ?int $zoomScale - * * @return $this */ public function setZoomScale(?int $zoomScale): static @@ -98,8 +96,6 @@ public function getZoomScaleNormal(): ?int * Set ZoomScale. * Valid values range from 10 to 400. * - * @param ?int $zoomScaleNormal - * * @return $this */ public function setZoomScaleNormal(?int $zoomScaleNormal): static @@ -142,8 +138,6 @@ public function getView(): string * 'pageLayout' self::SHEETVIEW_PAGE_LAYOUT * 'pageBreakPreview' self::SHEETVIEW_PAGE_BREAK_PREVIEW * - * @param ?string $sheetViewType - * * @return $this */ public function setView(?string $sheetViewType): static diff --git a/src/PhpSpreadsheet/Worksheet/Table.php b/src/PhpSpreadsheet/Worksheet/Table.php index 2ffac1bc78..76cfbd1fb1 100644 --- a/src/PhpSpreadsheet/Worksheet/Table.php +++ b/src/PhpSpreadsheet/Worksheet/Table.php @@ -437,7 +437,7 @@ public function getColumnByOffset(int $columnOffset): Table\Column * @param string|Table\Column $columnObjectOrString * A simple string containing a Column ID like 'A' is permitted */ - public function setColumn($columnObjectOrString): self + public function setColumn(string|Table\Column $columnObjectOrString): self { if ((is_string($columnObjectOrString)) && (!empty($columnObjectOrString))) { $column = $columnObjectOrString; diff --git a/src/PhpSpreadsheet/Writer/Html.php b/src/PhpSpreadsheet/Writer/Html.php index 046ab94e67..4b24f63abb 100644 --- a/src/PhpSpreadsheet/Writer/Html.php +++ b/src/PhpSpreadsheet/Writer/Html.php @@ -686,7 +686,7 @@ private function writeImageInCell(Worksheet $worksheet, string $coordinates): st // width: X sets width of supplied image. // As a result, images bigger than cell will be contained and images smaller will not get stretched $html .= '' . $filedesc . ''; + . $drawing->getOffsetX() . 'px; top: ' . $drawing->getOffsetY() . 'px;position: absolute; z-index: 1;" />'; } } } @@ -1322,11 +1322,7 @@ private function generateRowCellDataValue(Worksheet $worksheet, Cell $cell, stri } } - /** - * @param null|Cell|string $cell - * @param array|string $cssClass - */ - private function generateRowCellData(Worksheet $worksheet, $cell, &$cssClass): string + private function generateRowCellData(Worksheet $worksheet, null|Cell|string $cell, array|string &$cssClass): string { $cellData = ' '; if ($cell instanceof Cell) { @@ -1388,11 +1384,19 @@ private function generateRowSpans(string $html, int $rowSpan, int $colSpan): str return $html; } - /** - * @param array|string $cssClass - */ - private function generateRowWriteCell(string &$html, Worksheet $worksheet, string $coordinate, string $cellType, string $cellData, int $colSpan, int $rowSpan, $cssClass, int $colNum, int $sheetIndex, int $row): void - { + private function generateRowWriteCell( + string &$html, + Worksheet $worksheet, + string $coordinate, + string $cellType, + string $cellData, + int $colSpan, + int $rowSpan, + array|string $cssClass, + int $colNum, + int $sheetIndex, + int $row + ): void { // Image? $htmlx = $this->writeImageInCell($worksheet, $coordinate); // Chart? diff --git a/src/PhpSpreadsheet/Writer/Xls.php b/src/PhpSpreadsheet/Writer/Xls.php index 49835e9fd3..8b1cdb1af8 100644 --- a/src/PhpSpreadsheet/Writer/Xls.php +++ b/src/PhpSpreadsheet/Writer/Xls.php @@ -758,10 +758,7 @@ private function writeDocumentSummaryInformation(): string return $data; } - /** - * @param float|int $dataProp - */ - private function writeSummaryPropOle($dataProp, int &$dataSection_NumProps, array &$dataSection, int $sumdata, int $typdata): void + private function writeSummaryPropOle(float|int $dataProp, int &$dataSection_NumProps, array &$dataSection, int $sumdata, int $typdata): void { if ($dataProp) { $dataSection[] = [ diff --git a/src/PhpSpreadsheet/Writer/Xls/Xf.php b/src/PhpSpreadsheet/Writer/Xls/Xf.php index c3ea4dceec..2ab5a4ebca 100644 --- a/src/PhpSpreadsheet/Writer/Xls/Xf.php +++ b/src/PhpSpreadsheet/Writer/Xls/Xf.php @@ -352,8 +352,6 @@ private static function mapTextRotation(int $textRotation): int /** * Map locked values. - * - * @param ?string $locked */ private static function mapLocked(?string $locked): int { @@ -368,8 +366,6 @@ private static function mapLocked(?string $locked): int /** * Map hidden. - * - * @param ?string $hidden */ private static function mapHidden(?string $hidden): int { diff --git a/src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php b/src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php index 20c5e18561..17f794779b 100644 --- a/src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php +++ b/src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php @@ -1272,10 +1272,7 @@ private function writeSheetData(XMLWriter $objWriter, PhpspreadsheetWorksheet $w $objWriter->endElement(); } - /** - * @param RichText|string $cellValue - */ - private function writeCellInlineStr(XMLWriter $objWriter, string $mappedType, $cellValue): void + private function writeCellInlineStr(XMLWriter $objWriter, string $mappedType, RichText|string $cellValue): void { $objWriter->writeAttribute('t', $mappedType); if (!$cellValue instanceof RichText) { @@ -1293,10 +1290,9 @@ private function writeCellInlineStr(XMLWriter $objWriter, string $mappedType, $c } /** - * @param RichText|string $cellValue * @param string[] $flippedStringTable */ - private function writeCellString(XMLWriter $objWriter, string $mappedType, $cellValue, array $flippedStringTable): void + private function writeCellString(XMLWriter $objWriter, string $mappedType, RichText|string $cellValue, array $flippedStringTable): void { $objWriter->writeAttribute('t', $mappedType); if (!$cellValue instanceof RichText) { @@ -1306,10 +1302,7 @@ private function writeCellString(XMLWriter $objWriter, string $mappedType, $cell } } - /** - * @param float|int $cellValue - */ - private function writeCellNumeric(XMLWriter $objWriter, $cellValue): void + private function writeCellNumeric(XMLWriter $objWriter, float|int $cellValue): void { //force a decimal to be written if the type is float if (is_float($cellValue)) { diff --git a/tests/PhpSpreadsheetTests/Shared/Date2Test.php b/tests/PhpSpreadsheetTests/Shared/Date2Test.php index 687a34e230..d1cbb2346f 100644 --- a/tests/PhpSpreadsheetTests/Shared/Date2Test.php +++ b/tests/PhpSpreadsheetTests/Shared/Date2Test.php @@ -40,8 +40,6 @@ public function testInvalidType(): void /** * @dataProvider providerTimeOnly - * - * @param float|int $value */ public function testTimeOnly(int|float $expectedResult, int|float|string $value, ?string $format = null): void { diff --git a/tests/PhpSpreadsheetTests/Worksheet/AutoFilter/AutoFilterTest.php b/tests/PhpSpreadsheetTests/Worksheet/AutoFilter/AutoFilterTest.php index 7b1583d545..fc66817609 100644 --- a/tests/PhpSpreadsheetTests/Worksheet/AutoFilter/AutoFilterTest.php +++ b/tests/PhpSpreadsheetTests/Worksheet/AutoFilter/AutoFilterTest.php @@ -282,18 +282,6 @@ public function testSetInvalidColumnWithObject(): void $autoFilter->setColumn($invalidColumn); } - public function testSetColumnWithInvalidDataType(): void - { - $this->expectException(PhpSpreadsheetException::class); - - $sheet = $this->getSheet(); - $autoFilter = $sheet->getAutoFilter(); - $autoFilter->setRange(self::INITIAL_RANGE); - $invalidColumn = 123.456; - // @phpstan-ignore-next-line - $autoFilter->setColumn($invalidColumn); - } - public function testGetColumns(): void { $sheet = $this->getSheet(); diff --git a/tests/PhpSpreadsheetTests/Worksheet/Table/TableTest.php b/tests/PhpSpreadsheetTests/Worksheet/Table/TableTest.php index 0af783135d..20a4388e4f 100644 --- a/tests/PhpSpreadsheetTests/Worksheet/Table/TableTest.php +++ b/tests/PhpSpreadsheetTests/Worksheet/Table/TableTest.php @@ -372,16 +372,6 @@ public function testSetInvalidColumnWithObject(): void $table->setColumn($invalidColumn); } - public function testSetColumnWithInvalidDataType(): void - { - $this->expectException(PhpSpreadsheetException::class); - - $table = new Table(self::INITIAL_RANGE); - $invalidColumn = 123.456; - // @phpstan-ignore-next-line - $table->setColumn($invalidColumn); - } - public function testGetColumns(): void { $table = new Table(self::INITIAL_RANGE);