Skip to content

Commit 29cddd9

Browse files
committed
Rector StrictStringParamConcatRector
1 parent 915bb7e commit 29cddd9

File tree

19 files changed

+26
-47
lines changed

19 files changed

+26
-47
lines changed

src/PhpSpreadsheet/Calculation/Calculation.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3426,11 +3426,9 @@ public static function localeFunc($function)
34263426
/**
34273427
* Wrap string values in quotes.
34283428
*
3429-
* @param mixed $value
3430-
*
34313429
* @return mixed
34323430
*/
3433-
public static function wrapResult($value)
3431+
public static function wrapResult(mixed $value)
34343432
{
34353433
if (is_string($value)) {
34363434
// Error values cannot be "wrapped"

src/PhpSpreadsheet/Calculation/TextData/Text.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,10 +239,7 @@ private static function formatValueMode0($cellValue): string
239239
return (string) $cellValue;
240240
}
241241

242-
/**
243-
* @param mixed $cellValue
244-
*/
245-
private static function formatValueMode1($cellValue): string
242+
private static function formatValueMode1(mixed $cellValue): string
246243
{
247244
if (is_string($cellValue) && ErrorValue::isError($cellValue) === false) {
248245
return Calculation::FORMULA_STRING_QUOTE . $cellValue . Calculation::FORMULA_STRING_QUOTE;

src/PhpSpreadsheet/Cell/Coordinate.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ abstract class Coordinate
2929
*
3030
* @return array{0: string, 1: string} Array containing column and row (indexes 0 and 1)
3131
*/
32-
public static function coordinateFromString($cellAddress): array
32+
public static function coordinateFromString(string $cellAddress): array
3333
{
3434
if (preg_match(self::A1_COORDINATE_REGEX, $cellAddress, $matches)) {
3535
return [$matches['col'], $matches['row']];
@@ -594,7 +594,7 @@ private static function getCellBlocksFromRangeString($rangeString)
594594
* @param int $currentRow
595595
* @param int $endRow
596596
*/
597-
private static function validateRange($cellBlock, $startColumnIndex, $endColumnIndex, $currentRow, $endRow): void
597+
private static function validateRange(string $cellBlock, $startColumnIndex, $endColumnIndex, $currentRow, $endRow): void
598598
{
599599
if ($startColumnIndex >= $endColumnIndex || $currentRow > $endRow) {
600600
throw new Exception('Invalid range: "' . $cellBlock . '"');

src/PhpSpreadsheet/Collection/Cells.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public function update(Cell $cell): Cell
112112
*
113113
* @param string $cellCoordinate Coordinate of the cell to delete
114114
*/
115-
public function delete($cellCoordinate): void
115+
public function delete(string $cellCoordinate): void
116116
{
117117
if ($cellCoordinate === $this->currentCoordinate && $this->currentCell !== null) {
118118
$this->currentCell->detach();
@@ -404,7 +404,7 @@ public function add($cellCoordinate, Cell $cell): Cell
404404
*
405405
* @return null|Cell Cell that was found, or null if not found
406406
*/
407-
public function get($cellCoordinate)
407+
public function get(string $cellCoordinate)
408408
{
409409
if ($cellCoordinate === $this->currentCoordinate) {
410410
return $this->currentCell;

src/PhpSpreadsheet/Helper/Html.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -617,11 +617,9 @@ private function initialise(): void
617617
/**
618618
* Parse HTML formatting and return the resulting RichText.
619619
*
620-
* @param string $html
621-
*
622620
* @return RichText
623621
*/
624-
public function toRichTextObject($html)
622+
public function toRichTextObject(string $html)
625623
{
626624
$this->initialise();
627625

src/PhpSpreadsheet/Helper/Sample.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,8 @@ public function getTemporaryFolder(): string
159159
* Returns the filename that should be used for sample output.
160160
*
161161
* @param string $filename
162-
* @param string $extension
163162
*/
164-
public function getFilename($filename, $extension = 'xlsx'): string
163+
public function getFilename($filename, string $extension = 'xlsx'): string
165164
{
166165
$originalExtension = pathinfo($filename, PATHINFO_EXTENSION);
167166

@@ -170,10 +169,8 @@ public function getFilename($filename, $extension = 'xlsx'): string
170169

171170
/**
172171
* Return a random temporary file name.
173-
*
174-
* @param string $extension
175172
*/
176-
public function getTemporaryFilename($extension = 'xlsx'): string
173+
public function getTemporaryFilename(string $extension = 'xlsx'): string
177174
{
178175
$temporaryFilename = tempnam($this->getTemporaryFolder(), 'phpspreadsheet-');
179176
if ($temporaryFilename === false) {

src/PhpSpreadsheet/Reader/Html.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -281,11 +281,10 @@ protected function releaseTableStartColumn(): string
281281
/**
282282
* Flush cell.
283283
*
284-
* @param string $column
285284
* @param int|string $row
286285
* @param mixed $cellContent
287286
*/
288-
protected function flushCell(Worksheet $sheet, $column, $row, &$cellContent, array $attributeArray): void
287+
protected function flushCell(Worksheet $sheet, string $column, $row, &$cellContent, array $attributeArray): void
289288
{
290289
if (is_string($cellContent)) {
291290
// Simple String content
@@ -663,10 +662,8 @@ protected function processDomElement(DOMNode $element, Worksheet $sheet, int &$r
663662

664663
/**
665664
* Loads PhpSpreadsheet from file into PhpSpreadsheet instance.
666-
*
667-
* @param string $filename
668665
*/
669-
public function loadIntoExisting($filename, Spreadsheet $spreadsheet): Spreadsheet
666+
public function loadIntoExisting(string $filename, Spreadsheet $spreadsheet): Spreadsheet
670667
{
671668
// Validate
672669
if (!$this->canRead($filename)) {
@@ -879,9 +876,8 @@ public function setSheetIndex($sheetIndex): static
879876
* - Implement to other propertie, such as border
880877
*
881878
* @param int $row
882-
* @param string $column
883879
*/
884-
private function applyInlineStyle(Worksheet &$sheet, $row, $column, array $attributeArray): void
880+
private function applyInlineStyle(Worksheet &$sheet, $row, string $column, array $attributeArray): void
885881
{
886882
if (!isset($attributeArray['style'])) {
887883
return;

src/PhpSpreadsheet/Reader/Xml.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,9 @@ public function canRead(string $filename): bool
108108
/**
109109
* Check if the file is a valid SimpleXML.
110110
*
111-
* @param string $filename
112-
*
113111
* @return false|SimpleXMLElement
114112
*/
115-
public function trySimpleXMLLoadString($filename): SimpleXMLElement|bool
113+
public function trySimpleXMLLoadString(string $filename): SimpleXMLElement|bool
116114
{
117115
try {
118116
$xml = simplexml_load_string(

src/PhpSpreadsheet/ReferenceHelper.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ protected function __construct()
6060
* @param string $a First column to test (e.g. 'AA')
6161
* @param string $b Second column to test (e.g. 'Z')
6262
*/
63-
public static function columnSort($a, $b): int
63+
public static function columnSort(string $a, string $b): int
6464
{
6565
return strcasecmp(strlen($a) . $a, strlen($b) . $b);
6666
}
@@ -873,7 +873,7 @@ private function updateCellReference($cellReference = 'A1', bool $includeAbsolut
873873
* @param string $oldName Old name (name to replace)
874874
* @param string $newName New name
875875
*/
876-
public function updateNamedFormulae(Spreadsheet $spreadsheet, $oldName = '', $newName = ''): void
876+
public function updateNamedFormulae(Spreadsheet $spreadsheet, string $oldName = '', string $newName = ''): void
877877
{
878878
if ($oldName == '') {
879879
return;

src/PhpSpreadsheet/Shared/OLE/PPS/File.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function init(): bool
5555
*
5656
* @param string $data The data to append
5757
*/
58-
public function append($data): void
58+
public function append(string $data): void
5959
{
6060
$this->_data .= $data;
6161
}

0 commit comments

Comments
 (0)