Merge pull request #2858 from PHPOffice/PhpStan-Cleanups
Declare a few return datatypes
This commit is contained in:
commit
daffce00d6
|
|
@ -2265,11 +2265,6 @@ parameters:
|
||||||
count: 1
|
count: 1
|
||||||
path: src/PhpSpreadsheet/Reader/Xlsx.php
|
path: src/PhpSpreadsheet/Reader/Xlsx.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:boolean\\(\\) has no return type specified\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/PhpSpreadsheet/Reader/Xlsx.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:boolean\\(\\) has parameter \\$value with no type specified\\.$#"
|
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:boolean\\(\\) has parameter \\$value with no type specified\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
|
@ -2340,11 +2335,6 @@ parameters:
|
||||||
count: 1
|
count: 1
|
||||||
path: src/PhpSpreadsheet/Reader/Xlsx.php
|
path: src/PhpSpreadsheet/Reader/Xlsx.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:dirAdd\\(\\) has no return type specified\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/PhpSpreadsheet/Reader/Xlsx.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:dirAdd\\(\\) has parameter \\$add with no type specified\\.$#"
|
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:dirAdd\\(\\) has parameter \\$add with no type specified\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
|
@ -2405,21 +2395,11 @@ parameters:
|
||||||
count: 1
|
count: 1
|
||||||
path: src/PhpSpreadsheet/Reader/Xlsx.php
|
path: src/PhpSpreadsheet/Reader/Xlsx.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:stripWhiteSpaceFromStyleString\\(\\) has no return type specified\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/PhpSpreadsheet/Reader/Xlsx.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:stripWhiteSpaceFromStyleString\\(\\) has parameter \\$string with no type specified\\.$#"
|
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:stripWhiteSpaceFromStyleString\\(\\) has parameter \\$string with no type specified\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
path: src/PhpSpreadsheet/Reader/Xlsx.php
|
path: src/PhpSpreadsheet/Reader/Xlsx.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:toCSSArray\\(\\) has no return type specified\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/PhpSpreadsheet/Reader/Xlsx.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:toCSSArray\\(\\) has parameter \\$style with no type specified\\.$#"
|
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Xlsx\\:\\:toCSSArray\\(\\) has parameter \\$style with no type specified\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
|
@ -4885,8 +4865,3 @@ parameters:
|
||||||
count: 2
|
count: 2
|
||||||
path: src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php
|
path: src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Xlfn\\:\\:addXlfn\\(\\) should return string but returns string\\|null\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/PhpSpreadsheet/Writer/Xlsx/Xlfn.php
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ class Trim
|
||||||
* @param mixed $stringValue String Value to check
|
* @param mixed $stringValue String Value to check
|
||||||
* Or can be an array of values
|
* Or can be an array of values
|
||||||
*
|
*
|
||||||
* @return null|array|string
|
* @return array|string
|
||||||
* If an array of values is passed as the argument, then the returned result will also be an array
|
* If an array of values is passed as the argument, then the returned result will also be an array
|
||||||
* with the same dimensions
|
* with the same dimensions
|
||||||
*/
|
*/
|
||||||
|
|
@ -26,7 +26,7 @@ class Trim
|
||||||
|
|
||||||
$stringValue = Helpers::extractString($stringValue);
|
$stringValue = Helpers::extractString($stringValue);
|
||||||
|
|
||||||
return preg_replace('/[\\x00-\\x1f]/', '', "$stringValue");
|
return (string) preg_replace('/[\\x00-\\x1f]/', '', "$stringValue");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1461,7 +1461,7 @@ class Xlsx extends BaseReader
|
||||||
}
|
}
|
||||||
|
|
||||||
// unparsed drawing AlternateContent
|
// unparsed drawing AlternateContent
|
||||||
$xmlAltDrawing = $this->loadZip($fileDrawing, Namespaces::COMPATIBILITY);
|
$xmlAltDrawing = $this->loadZip((string) $fileDrawing, Namespaces::COMPATIBILITY);
|
||||||
|
|
||||||
if ($xmlAltDrawing->AlternateContent) {
|
if ($xmlAltDrawing->AlternateContent) {
|
||||||
foreach ($xmlAltDrawing->AlternateContent as $alternateContent) {
|
foreach ($xmlAltDrawing->AlternateContent as $alternateContent) {
|
||||||
|
|
@ -1821,12 +1821,12 @@ class Xlsx extends BaseReader
|
||||||
return $array[$key] ?? null;
|
return $array[$key] ?? null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function dirAdd($base, $add)
|
private static function dirAdd($base, $add): string
|
||||||
{
|
{
|
||||||
return preg_replace('~[^/]+/\.\./~', '', dirname($base) . "/$add");
|
return (string) preg_replace('~[^/]+/\.\./~', '', dirname($base) . "/$add");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function toCSSArray($style)
|
private static function toCSSArray($style): array
|
||||||
{
|
{
|
||||||
$style = self::stripWhiteSpaceFromStyleString($style);
|
$style = self::stripWhiteSpaceFromStyleString($style);
|
||||||
|
|
||||||
|
|
@ -1857,12 +1857,12 @@ class Xlsx extends BaseReader
|
||||||
return $style;
|
return $style;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function stripWhiteSpaceFromStyleString($string)
|
public static function stripWhiteSpaceFromStyleString($string): string
|
||||||
{
|
{
|
||||||
return trim(str_replace(["\r", "\n", ' '], '', $string), ';');
|
return trim(str_replace(["\r", "\n", ' '], '', $string), ';');
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function boolean($value)
|
private static function boolean($value): bool
|
||||||
{
|
{
|
||||||
if (is_object($value)) {
|
if (is_object($value)) {
|
||||||
$value = (string) $value;
|
$value = (string) $value;
|
||||||
|
|
|
||||||
|
|
@ -152,7 +152,7 @@ class Xlfn
|
||||||
*/
|
*/
|
||||||
public static function addXlfn(string $funcstring): string
|
public static function addXlfn(string $funcstring): string
|
||||||
{
|
{
|
||||||
return preg_replace(self::XLFNREGEXP, '_xlfn.$1', $funcstring);
|
return (string) preg_replace(self::XLFNREGEXP, '_xlfn.$1', $funcstring);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue