Skip to content

Commit 619a6b4

Browse files
committed
Rector ReturnTypeFromStrictNewArrayRector
1 parent de85aa2 commit 619a6b4

File tree

17 files changed

+33
-71
lines changed

17 files changed

+33
-71
lines changed

src/PhpSpreadsheet/Calculation/Calculation.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5248,10 +5248,8 @@ private function validateBinaryOperand(&$operand, &$stack): bool
52485248
/**
52495249
* @param mixed $operand1
52505250
* @param mixed $operand2
5251-
*
5252-
* @return array
52535251
*/
5254-
private function executeArrayComparison($operand1, $operand2, string $operation, Stack &$stack, bool $recursingArrays)
5252+
private function executeArrayComparison($operand1, $operand2, string $operation, Stack &$stack, bool $recursingArrays): array
52555253
{
52565254
$result = [];
52575255
if (!is_array($operand2)) {
@@ -5472,9 +5470,9 @@ protected function raiseFormulaError(string $errorMessage, int $code = 0, ?Throw
54725470
* @param Worksheet $worksheet Worksheet
54735471
* @param bool $resetLog Flag indicating whether calculation log should be reset or not
54745472
*
5475-
* @return mixed Array of values in range if range contains more than one element. Otherwise, a single value is returned.
5473+
* @return array Array of values in range if range contains more than one element. Otherwise, a single value is returned.
54765474
*/
5477-
public function extractCellRange(&$range = 'A1', ?Worksheet $worksheet = null, bool $resetLog = true)
5475+
public function extractCellRange(&$range = 'A1', ?Worksheet $worksheet = null, bool $resetLog = true): array
54785476
{
54795477
// Return value
54805478
$returnValue = [];
@@ -5603,10 +5601,8 @@ public static function getFunctions(): array
56035601

56045602
/**
56055603
* Get a list of implemented Excel function names.
5606-
*
5607-
* @return array
56085604
*/
5609-
public function getImplementedFunctionNames()
5605+
public function getImplementedFunctionNames(): array
56105606
{
56115607
$returnValue = [];
56125608
foreach (self::$phpSpreadsheetFunctions as $functionName => $function) {

src/PhpSpreadsheet/Calculation/Engineering/ConvertUOM.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -451,10 +451,8 @@ public static function getConversionCategories(): array
451451
* Returns an array of units of measure, for a specified conversion group, or for all groups.
452452
*
453453
* @param string $category The group whose units of measure you want to retrieve
454-
*
455-
* @return array
456454
*/
457-
public static function getConversionCategoryUnits($category = null)
455+
public static function getConversionCategoryUnits($category = null): array
458456
{
459457
$conversionGroups = [];
460458
foreach (self::$conversionUnits as $conversionUnit => $conversionGroup) {
@@ -470,10 +468,8 @@ public static function getConversionCategoryUnits($category = null)
470468
* getConversionGroupUnitDetails.
471469
*
472470
* @param string $category The group whose units of measure you want to retrieve
473-
*
474-
* @return array
475471
*/
476-
public static function getConversionCategoryUnitDetails($category = null)
472+
public static function getConversionCategoryUnitDetails($category = null): array
477473
{
478474
$conversionGroups = [];
479475
foreach (self::$conversionUnits as $conversionUnit => $conversionGroup) {

src/PhpSpreadsheet/Calculation/LookupRef/Matrix.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,8 @@ public static function isRowVector(array $values): bool
3131
* TRANSPOSE.
3232
*
3333
* @param array|mixed $matrixData A matrix of values
34-
*
35-
* @return array
3634
*/
37-
public static function transpose($matrixData)
35+
public static function transpose($matrixData): array
3836
{
3937
$returnMatrix = [];
4038
if (!is_array($matrixData)) {

src/PhpSpreadsheet/Helper/Sample.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public function getPageHeading(): string
6666
*
6767
* @return string[][] [$name => $path]
6868
*/
69-
public function getSamples()
69+
public function getSamples(): array
7070
{
7171
// Populate samples
7272
$baseDir = realpath(__DIR__ . '/../../../samples');

src/PhpSpreadsheet/Reader/Gnumeric.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,8 @@ private static function matchXml(XMLReader $xml, string $expectedLocalName): boo
100100

101101
/**
102102
* Reads names of the worksheets from a file, without parsing the whole file to a Spreadsheet object.
103-
*
104-
* @return array
105103
*/
106-
public function listWorksheetNames(string $filename)
104+
public function listWorksheetNames(string $filename): array
107105
{
108106
File::assertFile($filename);
109107
if (!$this->canRead($filename)) {
@@ -133,10 +131,8 @@ public function listWorksheetNames(string $filename)
133131
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns).
134132
*
135133
* @param string $filename
136-
*
137-
* @return array
138134
*/
139-
public function listWorksheetInfo($filename)
135+
public function listWorksheetInfo($filename): array
140136
{
141137
File::assertFile($filename);
142138
if (!$this->canRead($filename)) {

src/PhpSpreadsheet/Reader/Ods.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public function canRead(string $filename): bool
9090
*
9191
* @return string[]
9292
*/
93-
public function listWorksheetNames(string $filename)
93+
public function listWorksheetNames(string $filename): array
9494
{
9595
File::assertFile($filename, self::INITIAL_FILE);
9696

@@ -136,10 +136,8 @@ public function listWorksheetNames(string $filename)
136136

137137
/**
138138
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns).
139-
*
140-
* @return array
141139
*/
142-
public function listWorksheetInfo(string $filename)
140+
public function listWorksheetInfo(string $filename): array
143141
{
144142
File::assertFile($filename, self::INITIAL_FILE);
145143

src/PhpSpreadsheet/Reader/Slk.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,8 @@ public function getInputEncoding()
131131

132132
/**
133133
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns).
134-
*
135-
* @return array
136134
*/
137-
public function listWorksheetInfo(string $filename)
135+
public function listWorksheetInfo(string $filename): array
138136
{
139137
// Open file
140138
$this->canReadOrBust($filename);

src/PhpSpreadsheet/Reader/Xls.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -466,10 +466,8 @@ public function getCodepage(): string
466466

467467
/**
468468
* Reads names of the worksheets from a file, without parsing the whole file to a PhpSpreadsheet object.
469-
*
470-
* @return array
471469
*/
472-
public function listWorksheetNames(string $filename)
470+
public function listWorksheetNames(string $filename): array
473471
{
474472
File::assertFile($filename);
475473

@@ -526,10 +524,8 @@ public function listWorksheetNames(string $filename)
526524

527525
/**
528526
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns).
529-
*
530-
* @return array
531527
*/
532-
public function listWorksheetInfo(string $filename)
528+
public function listWorksheetInfo(string $filename): array
533529
{
534530
File::assertFile($filename);
535531

src/PhpSpreadsheet/Reader/Xlsx.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,8 @@ private function loadZipNonamespace(string $filename, string $ns): SimpleXMLElem
174174

175175
/**
176176
* Reads names of the worksheets from a file, without parsing the whole file to a Spreadsheet object.
177-
*
178-
* @return array
179177
*/
180-
public function listWorksheetNames(string $filename)
178+
public function listWorksheetNames(string $filename): array
181179
{
182180
File::assertFile($filename, self::INITIAL_FILE);
183181

@@ -211,10 +209,8 @@ public function listWorksheetNames(string $filename)
211209

212210
/**
213211
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns).
214-
*
215-
* @return array
216212
*/
217-
public function listWorksheetInfo(string $filename)
213+
public function listWorksheetInfo(string $filename): array
218214
{
219215
File::assertFile($filename, self::INITIAL_FILE);
220216

src/PhpSpreadsheet/Reader/Xml.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,8 @@ public function trySimpleXMLLoadString($filename)
130130

131131
/**
132132
* Reads names of the worksheets from a file, without parsing the whole file to a Spreadsheet object.
133-
*
134-
* @return array
135133
*/
136-
public function listWorksheetNames(string $filename)
134+
public function listWorksheetNames(string $filename): array
137135
{
138136
File::assertFile($filename);
139137
if (!$this->canRead($filename)) {
@@ -160,10 +158,8 @@ public function listWorksheetNames(string $filename)
160158
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns).
161159
*
162160
* @param string $filename
163-
*
164-
* @return array
165161
*/
166-
public function listWorksheetInfo($filename)
162+
public function listWorksheetInfo($filename): array
167163
{
168164
File::assertFile($filename);
169165
if (!$this->canRead($filename)) {

0 commit comments

Comments
 (0)