Commit f0ef135d authored by crell's avatar crell Committed by Stefan Bürk
Browse files

[TASK] Note nullable parameters and returns as such

Based on the code, these parameters are nullable. The doc
comments should reflect that. Doing so eliminates several
PHPStan warnings.

Whether these parameters ought to be nullable is a question
for another time.

Resolves: #97648
Releases: main, 11.5
Change-Id: Id0cc51d159ebb0321e94f7fb77a5d560950cfb05
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/74676


Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Oliver Klee's avatarOliver Klee <typo3-coding@oliverklee.de>
Tested-by: Simon Schaufelberger's avatarSimon Schaufelberger <simonschaufi+typo3@gmail.com>
Tested-by: Nikita Hovratov's avatarNikita Hovratov <nikita.h@live.de>
Tested-by: Stefan Bürk's avatarStefan Bürk <stefan@buerk.tech>
Reviewed-by: Simon Schaufelberger's avatarSimon Schaufelberger <simonschaufi+typo3@gmail.com>
Reviewed-by: Nikita Hovratov's avatarNikita Hovratov <nikita.h@live.de>
Reviewed-by: Stefan Bürk's avatarStefan Bürk <stefan@buerk.tech>
parent 538046cd
......@@ -495,11 +495,6 @@ parameters:
count: 1
path: ../../typo3/sysext/core/Classes/DataHandling/DataHandler.php
-
message: "#^Strict comparison using \\=\\=\\= between string and null will always evaluate to false\\.$#"
count: 1
path: ../../typo3/sysext/core/Classes/DataHandling/DataHandler.php
-
message: "#^Variable \\$fieldArray in empty\\(\\) always exists and is not falsy\\.$#"
count: 1
......@@ -610,11 +605,6 @@ parameters:
count: 1
path: ../../typo3/sysext/core/Classes/Database/ReferenceIndex.php
-
message: "#^Strict comparison using \\=\\=\\= between string and null will always evaluate to false\\.$#"
count: 1
path: ../../typo3/sysext/core/Classes/Database/ReferenceIndex.php
-
message: "#^Variable \\$hashList in empty\\(\\) always exists and is not falsy\\.$#"
count: 1
......@@ -2045,11 +2035,6 @@ parameters:
count: 1
path: ../../typo3/sysext/core/Tests/Unit/TypoScript/Parser/TypoScriptParserTest.php
-
message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertNull\\(\\) with string will always evaluate to false\\.$#"
count: 1
path: ../../typo3/sysext/core/Tests/Unit/Utility/GeneralUtilityTest.php
-
message: "#^Static method TYPO3\\\\CMS\\\\Core\\\\Utility\\\\GeneralUtility\\:\\:callUserFunction\\(\\) invoked with 4 parameters, 2\\-3 required\\.$#"
count: 1
......@@ -2175,16 +2160,6 @@ parameters:
count: 1
path: ../../typo3/sysext/extbase/Classes/Persistence/Generic/Backend.php
-
message: "#^Result of && is always false\\.$#"
count: 1
path: ../../typo3/sysext/extbase/Classes/Persistence/Generic/Backend.php
-
message: "#^Strict comparison using \\=\\=\\= between string and null will always evaluate to false\\.$#"
count: 1
path: ../../typo3/sysext/extbase/Classes/Persistence/Generic/Backend.php
-
message: "#^Call to an undefined method TYPO3\\\\CMS\\\\Extbase\\\\DomainObject\\\\DomainObjectInterface\\:\\:_memorizeCleanState\\(\\)\\.$#"
count: 1
......@@ -3220,11 +3195,6 @@ parameters:
count: 1
path: ../../typo3/sysext/form/Classes/Domain/Finishers/ClosureFinisher.php
-
message: "#^Strict comparison using \\=\\=\\= between Closure and null will always evaluate to false\\.$#"
count: 1
path: ../../typo3/sysext/form/Classes/Domain/Finishers/ClosureFinisher.php
-
message: "#^Method TYPO3\\\\CMS\\\\Form\\\\Domain\\\\Finishers\\\\DeleteUploadsFinisher\\:\\:executeInternal\\(\\) should return string\\|null but return statement is missing\\.$#"
count: 1
......@@ -4190,16 +4160,6 @@ parameters:
count: 1
path: ../../typo3/sysext/install/Classes/Service/EnableFileService.php
-
message: "#^If condition is always false\\.$#"
count: 1
path: ../../typo3/sysext/install/Classes/Service/LanguagePackService.php
-
message: "#^Negated boolean expression is always true\\.$#"
count: 1
path: ../../typo3/sysext/install/Classes/Service/LanguagePackService.php
-
message: "#^Offset string on array\\{\\} on left side of \\?\\? does not exist\\.$#"
count: 2
......@@ -4210,11 +4170,6 @@ parameters:
count: 1
path: ../../typo3/sysext/install/Classes/Service/LanguagePackService.php
-
message: "#^Strict comparison using \\=\\=\\= between string and null will always evaluate to false\\.$#"
count: 1
path: ../../typo3/sysext/install/Classes/Service/LanguagePackService.php
-
message: "#^Unreachable statement \\- code above always terminates\\.$#"
count: 1
......
......@@ -1571,7 +1571,7 @@ class DataHandler implements LoggerAwareInterface
/**
* Evaluate "text" type values.
*
* @param string $value The value to set.
* @param string|null $value The value to set.
* @param array $tcaFieldConf Field configuration from TCA
* @param string $table Table name
* @param int $realPid The real PID value of the record. For updates, this is just the pid of the record. For new records this is the PID of the page where it is inserted.
......
......@@ -764,7 +764,7 @@ class ReferenceIndex implements LoggerAwareInterface
*
* @param array $refRec sys_refindex record
* @param array $itemArray Array of references from that field
* @param string $newValue Value to substitute current value with (or NULL to unset it)
* @param string|null $newValue Value to substitute current value with (or NULL to unset it)
* @param array $dataArray Data array in which the new value is set (passed by reference)
* @param string $flexPointer Flexform pointer, if in a flex form field.
* @return string Error message if any, otherwise FALSE = OK
......
......@@ -1653,7 +1653,7 @@ class GeneralUtility
*
* @param string $filepath Absolute file path to write within the typo3temp/ or Environment::getVarPath() folder - the file path must be prefixed with this path
* @param string $content Content string to write
* @return string Returns NULL on success, otherwise an error string telling about the problem.
* @return string|null Returns NULL on success, otherwise an error string telling about the problem.
*/
public static function writeFileToTypo3tempDir($filepath, $content)
{
......
......@@ -412,7 +412,7 @@ class DataMap
/**
* Returns the name of a column indicating the 'deleted' state of the row
*
* @return string The field name
* @return string|null The field name
*/
public function getDeletedFlagColumnName()
{
......
......@@ -56,7 +56,7 @@ class ClosureFinisher extends AbstractFinisher
*/
protected function executeInternal()
{
/** @var \Closure $closure */
/** @var \Closure|null $closure */
$closure = $this->parseOption('closure');
if ($closure === null) {
return;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment