Add phpstan until level 7

This commit is contained in:
Antoine Lamirault committed 2021-09-18 18:09:14 +02:00
1 parent ab973cab34
commit bfb7c2c68f
114 files changed
+527 -319

No files matched your search

@@ -2,7 +2,6 @@
namespace Box\Spout\Reader\Common\Creator;
use Box\Spout\Common\Exception\UnsupportedTypeException;
use Box\Spout\Common\Type;
use Box\Spout\Reader\ReaderInterface;
@@ -31,11 +30,10 @@ class ReaderEntityFactory
*/
public static function createCSVReader()
{
try {
return ReaderFactory::createFromType(Type::CSV);
} catch (UnsupportedTypeException $e) {
// should never happen
}
/** @var \Box\Spout\Reader\CSV\Reader $csvReader */
$csvReader = ReaderFactory::createFromType(Type::CSV);
return $csvReader;
}
/**
@@ -45,11 +43,10 @@ class ReaderEntityFactory
*/
public static function createXLSXReader()
{
try {
return ReaderFactory::createFromType(Type::XLSX);
} catch (UnsupportedTypeException $e) {
// should never happen
}
/** @var \Box\Spout\Reader\XLSX\Reader $xlsxReader */
$xlsxReader = ReaderFactory::createFromType(Type::XLSX);
return $xlsxReader;
}
/**
@@ -59,10 +56,9 @@ class ReaderEntityFactory
*/
public static function createODSReader()
{
try {
return ReaderFactory::createFromType(Type::ODS);
} catch (UnsupportedTypeException $e) {
// should never happen
}
/** @var \Box\Spout\Reader\ODS\Reader $odsReader */
$odsReader = ReaderFactory::createFromType(Type::ODS);
return $odsReader;
}
}
+7 -7
View File
@@ -25,7 +25,7 @@ class XMLProcessor
/** @var \Box\Spout\Reader\Wrapper\XMLReader The XMLReader object that will help read sheet's XML data */
protected $xmlReader;
/** @var array Registered callbacks */
/** @var array<string, array> Registered callbacks */
private $callbacks = [];
/**
@@ -39,7 +39,7 @@ class XMLProcessor
/**
* @param string $nodeName A callback may be triggered when a node with this name is read
* @param int $nodeType Type of the node [NODE_TYPE_START || NODE_TYPE_END]
* @param callable $callback Callback to execute when the read node has the given name and type
* @param array{object, string} $callback Callback to execute when the read node has the given name and type
* @return XMLProcessor
*/
public function registerCallback($nodeName, $nodeType, $callback)
@@ -66,8 +66,8 @@ class XMLProcessor
* Since some functions can be called a lot, we pre-process the callback to only return the elements that
* will be needed to invoke the callback later.
*
* @param callable $callback Array reference to a callback: [OBJECT, METHOD_NAME]
* @return array Associative array containing the elements needed to invoke the callback using Reflection
* @param array{object, string} $callback Array reference to a callback: [OBJECT, METHOD_NAME]
* @return array<string, mixed> Associative array containing the elements needed to invoke the callback using Reflection
*/
private function getInvokableCallbackData($callback)
{
@@ -113,7 +113,7 @@ class XMLProcessor
* @param string $nodeNamePossiblyWithPrefix Name of the node, possibly prefixed
* @param string $nodeNameWithoutPrefix Name of the same node, un-prefixed
* @param int $nodeType Type of the node [NODE_TYPE_START || NODE_TYPE_END]
* @return array|null Callback data to be used for execution when a node of the given name/type is read or NULL if none found
* @return array<mixed>|null Callback data to be used for execution when a node of the given name/type is read or NULL if none found
*/
private function getRegisteredCallbackData($nodeNamePossiblyWithPrefix, $nodeNameWithoutPrefix, $nodeType)
{
@@ -134,8 +134,8 @@ class XMLProcessor
}
/**
* @param array $callbackData Associative array containing data to invoke the callback using Reflection
* @param array $args Arguments to pass to the callback
* @param array<string, mixed> $callbackData Associative array containing data to invoke the callback using Reflection
* @param array<mixed> $args Arguments to pass to the callback
* @return int Callback response
*/
private function invokeCallback($callbackData, $args)