diff --git a/typo3/sysext/impexp/Classes/Controller/ImportController.php b/typo3/sysext/impexp/Classes/Controller/ImportController.php index 422aad541f84827c077c166b3a27822a032daf5a..d9c07b152741a8779340411529965282478477b5 100644 --- a/typo3/sysext/impexp/Classes/Controller/ImportController.php +++ b/typo3/sysext/impexp/Classes/Controller/ImportController.php @@ -28,6 +28,7 @@ use TYPO3\CMS\Core\Messaging\FlashMessage; use TYPO3\CMS\Core\Resource\DuplicationBehavior; use TYPO3\CMS\Core\Resource\File; use TYPO3\CMS\Core\Resource\Filter\FileExtensionFilter; +use TYPO3\CMS\Core\Resource\ProcessedFile; use TYPO3\CMS\Core\Resource\ResourceFactory; use TYPO3\CMS\Core\Utility\File\ExtendedFileUtility; use TYPO3\CMS\Core\Utility\GeneralUtility; @@ -309,9 +310,9 @@ class ImportController extends ImportExportController * Gets a file by combined identifier. * * @param string $combinedIdentifier - * @return File|null + * @return File|ProcessedFile|null */ - protected function getFile(string $combinedIdentifier): ?File + protected function getFile(string $combinedIdentifier) { try { $file = GeneralUtility::makeInstance(ResourceFactory::class)->getFileObjectFromCombinedIdentifier($combinedIdentifier); diff --git a/typo3/sysext/impexp/Classes/Export.php b/typo3/sysext/impexp/Classes/Export.php index a353bc45428709182b729da1570d0af47b76b034..58b1d5f337e4a5500938022844c1639858a8f478 100644 --- a/typo3/sysext/impexp/Classes/Export.php +++ b/typo3/sysext/impexp/Classes/Export.php @@ -441,9 +441,9 @@ class Export extends ImportExport * * @param int $pid Page ID to select from * @param string $table Table to select from - * @return Statement Query statement + * @return \Doctrine\DBAL\Driver\ResultStatement|int Query statement */ - protected function execListQueryPid(int $pid, string $table): Statement + protected function execListQueryPid(int $pid, string $table) { $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($table); diff --git a/typo3/sysext/impexp/Classes/ImportExport.php b/typo3/sysext/impexp/Classes/ImportExport.php index 56477667de3f40267d90c0398e6cbdf5d3ddaaa0..5d751cbbd8e223bca43d79528dd58c9ac63a1ecb 100644 --- a/typo3/sysext/impexp/Classes/ImportExport.php +++ b/typo3/sysext/impexp/Classes/ImportExport.php @@ -1167,12 +1167,12 @@ abstract class ImportExport public function getOrCreateTemporaryFolderName(): string { if (empty($this->temporaryFolderName)) { - $this->createTemporaryFolderName(); + $this->temporaryFolderName = $this->createTemporaryFolderName(); } return $this->temporaryFolderName; } - protected function createTemporaryFolderName(): void + protected function createTemporaryFolderName(): string { $temporaryPath = Environment::getVarPath() . '/transient'; do { @@ -1184,7 +1184,7 @@ abstract class ImportExport ); } while (is_dir($temporaryFolderName)); GeneralUtility::mkdir($temporaryFolderName); - $this->temporaryFolderName = $temporaryFolderName; + return $temporaryFolderName; } public function removeTemporaryFolderName(): void diff --git a/typo3/sysext/impexp/Tests/Functional/ImportTest.php b/typo3/sysext/impexp/Tests/Functional/ImportTest.php index ec469de7cc9f1bc95faf792157c5e42cad6d6381..c631f897fd8eeee76054baef59c5e31c7e9789f3 100644 --- a/typo3/sysext/impexp/Tests/Functional/ImportTest.php +++ b/typo3/sysext/impexp/Tests/Functional/ImportTest.php @@ -335,7 +335,6 @@ class ImportTest extends AbstractImportExportTestCase 'ID' => '123456789', ]; $files = [$fileInfo]; - $importMock->_call('createTemporaryFolderName'); $importMock->_set('dat', $dat); $importMock->writeFilesToTemporaryFolder($files); // End of simulation diff --git a/typo3/sysext/indexed_search/Classes/Domain/Repository/IndexSearchRepository.php b/typo3/sysext/indexed_search/Classes/Domain/Repository/IndexSearchRepository.php index f62293ffd77ceb7e5bd07c1eaf0c31771567d317..8d12b43c616d5516645bd5f7fc04c9716c7fd591 100644 --- a/typo3/sysext/indexed_search/Classes/Domain/Repository/IndexSearchRepository.php +++ b/typo3/sysext/indexed_search/Classes/Domain/Repository/IndexSearchRepository.php @@ -297,7 +297,7 @@ class IndexSearchRepository * * @param array $searchWords Search words * @param int $freeIndexUid Pointer to which indexing configuration you want to search in. -1 means no filtering. 0 means only regular indexed content. - * @return Statement + * @return \Doctrine\DBAL\Driver\ResultStatement|int|bool */ protected function getResultRows_SQLpointer($searchWords, $freeIndexUid = -1) { @@ -322,7 +322,7 @@ class IndexSearchRepository * * @param array $searchWordsArray Search words * @param int $freeIndexUid Pointer to which indexing configuration you want to search in. -1 means no filtering. 0 means only regular indexed content. - * @return bool|\mysqli_result|object MySQLi result object / DBAL object + * @return \Doctrine\DBAL\Driver\ResultStatement|int|bool DBAL result statement */ protected function getResultRows_SQLpointerMysqlFulltext($searchWordsArray, $freeIndexUid = -1) { @@ -433,7 +433,7 @@ class IndexSearchRepository * * @param array $searchData Array with search string, boolean indicator, and fulltext index reference * @param int $freeIndexUid Pointer to which indexing configuration you want to search in. -1 means no filtering. 0 means only regular indexed content. - * @return Statement + * @return \Doctrine\DBAL\Driver\ResultStatement|int */ protected function execFinalQuery_fulltext($searchData, $freeIndexUid = -1) { @@ -652,7 +652,7 @@ class IndexSearchRepository * * @param string $wordSel WHERE clause selecting the word from phash * @param string $additionalWhereClause Additional AND clause in the end of the query. - * @return Statement + * @return \Doctrine\DBAL\Driver\ResultStatement|int */ protected function execPHashListQuery($wordSel, $additionalWhereClause = '') { @@ -678,7 +678,7 @@ class IndexSearchRepository * * @param string $sWord the search word * @param int $wildcard Bit-field of Utility\LikeWildcard - * @return Statement + * @return \Doctrine\DBAL\Driver\ResultStatement|int */ protected function searchWord($sWord, $wildcard) { @@ -696,7 +696,7 @@ class IndexSearchRepository * Search for one distinct word * * @param string $sWord the search word - * @return Statement + * @return \Doctrine\DBAL\Driver\ResultStatement|int */ protected function searchDistinct($sWord) { @@ -712,7 +712,7 @@ class IndexSearchRepository * Search for a sentence * * @param string $sWord the search word - * @return Statement + * @return \Doctrine\DBAL\Driver\ResultStatement|int */ protected function searchSentence($sWord) { @@ -741,7 +741,7 @@ class IndexSearchRepository * Search for a metaphone word * * @param string $sWord the search word - * @return Statement + * @return \Doctrine\DBAL\Driver\ResultStatement|int */ protected function searchMetaphone($sWord) { @@ -950,7 +950,7 @@ class IndexSearchRepository * * @param string $list List of phash integers which match the search. * @param int $freeIndexUid Pointer to which indexing configuration you want to search in. -1 means no filtering. 0 means only regular indexed content. - * @return Statement + * @return \Doctrine\DBAL\Driver\ResultStatement|int */ protected function execFinalQuery($list, $freeIndexUid = -1) { diff --git a/typo3/sysext/indexed_search/Classes/FileContentParser.php b/typo3/sysext/indexed_search/Classes/FileContentParser.php index 36a73040d97161fd7e75dff33be34fe357dc1a3a..bacef7cdf9aed252237abdefc15eb9284c235c22 100644 --- a/typo3/sysext/indexed_search/Classes/FileContentParser.php +++ b/typo3/sysext/indexed_search/Classes/FileContentParser.php @@ -294,7 +294,7 @@ class FileContentParser * Return title of entry in media type selector box. * * @param string $extension File extension - * @return string String with label value of entry in media type search selector box (frontend plugin). + * @return string|false String with label value of entry in media type search selector box (frontend plugin). */ public function searchTypeMediaTitle($extension) { @@ -458,7 +458,7 @@ class FileContentParser * @param string $ext File extension, eg. "pdf", "doc" etc. * @param string $absFile Absolute filename of file (must exist and be validated OK before calling function) * @param string $cPKey Pointer to section (zero for all other than PDF which will have an indication of pages into which the document should be split.) - * @return array Standard content array (title, description, keywords, body keys) + * @return array|false|null Standard content array (title, description, keywords, body keys), false if the extension is not supported or null if nothing found */ public function readFileContent($ext, $absFile, $cPKey) { diff --git a/typo3/sysext/indexed_search/Classes/Lexer.php b/typo3/sysext/indexed_search/Classes/Lexer.php index b57a8142bc6959d96c5560b809c8194dfe9272e1..28b1c8299f25dd356a10bc67d65d93713ad0178d 100644 --- a/typo3/sysext/indexed_search/Classes/Lexer.php +++ b/typo3/sysext/indexed_search/Classes/Lexer.php @@ -116,7 +116,7 @@ class Lexer // Get next chars unicode number and find type: $bc = 0; $cp = $this->utf8_ord($theWord, $bc); - $cType = $this->charType($cp); + $cType = $this->charType((int)$cp); // If string is a CJK sequence we follow this algorithm: /* DESCRIPTION OF (CJK) ALGORITHMContinuous letters and numbers make up words. Spaces and symbols @@ -238,7 +238,7 @@ class Lexer $pos += $bc; // Determine the type: $cType_prev = $cType; - $cType = $this->charType($cp); + $cType = $this->charType((int)$cp); if ($cType !== null) { continue; } @@ -282,7 +282,7 @@ class Lexer * @param int $len The length of the character (reference, return value) * @param int $pos Starting position in input string * @param bool $hex If set, then a hex. number is returned - * @return int UNICODE codepoint + * @return int|string UNICODE codepoint */ public function utf8_ord(&$str, &$len, $pos = 0, $hex = false) { diff --git a/typo3/sysext/indexed_search/Classes/Utility/DoubleMetaPhoneUtility.php b/typo3/sysext/indexed_search/Classes/Utility/DoubleMetaPhoneUtility.php index 140e1a37b7f0080040933899d9318a33b46c99ac..5d756a6183d23230e7ee28877225aaf20a025049 100644 --- a/typo3/sysext/indexed_search/Classes/Utility/DoubleMetaPhoneUtility.php +++ b/typo3/sysext/indexed_search/Classes/Utility/DoubleMetaPhoneUtility.php @@ -819,15 +819,15 @@ class DoubleMetaPhoneUtility public function StringAt($string, $start, $length, $list) { if ($start < 0 || $start >= strlen($string)) { - return 0; + return false; } $listCount = count($list); for ($i = 0; $i < $listCount; $i++) { if ($list[$i] == substr($string, $start, $length)) { - return 1; + return true; } } - return 0; + return false; } /** diff --git a/typo3/sysext/indexed_search/Classes/Utility/IndexedSearchUtility.php b/typo3/sysext/indexed_search/Classes/Utility/IndexedSearchUtility.php index 6aaee57afb5c263060cad9b99c7fe1aaff5f7fcc..7c50335f183d4a1f0c52284728bacfe8f2b74534 100644 --- a/typo3/sysext/indexed_search/Classes/Utility/IndexedSearchUtility.php +++ b/typo3/sysext/indexed_search/Classes/Utility/IndexedSearchUtility.php @@ -47,7 +47,7 @@ class IndexedSearchUtility */ public static function md5inthash($stringToHash) { - return hexdec(substr(md5($stringToHash), 0, 7)); + return (int)hexdec(substr(md5($stringToHash), 0, 7)); } /** @@ -174,6 +174,6 @@ class IndexedSearchUtility */ public static function milliseconds() { - return round(microtime(true) * 1000); + return (int)round(microtime(true) * 1000); } } diff --git a/typo3/sysext/info/Classes/Controller/PageInformationController.php b/typo3/sysext/info/Classes/Controller/PageInformationController.php index fd1f3c663011eb6e3fccb30a5b1096c4b600977e..37d27ab141346a6754dee4b94e05a4d38d046a47 100644 --- a/typo3/sysext/info/Classes/Controller/PageInformationController.php +++ b/typo3/sysext/info/Classes/Controller/PageInformationController.php @@ -501,7 +501,7 @@ class PageInformationController $icon = '<span ' . $toolTip . '>' . $this->iconFactory->getIconForRecord('pages', $row, Icon::SIZE_SMALL)->render() . '</span>'; // The icon with link if ($this->getBackendUser()->recordEditAccessInternals('pages', $row)) { - $icon = BackendUtility::wrapClickMenuOnIcon($icon, 'pages', $row['uid']); + $icon = (string)BackendUtility::wrapClickMenuOnIcon($icon, 'pages', $row['uid']); } return $icon; } diff --git a/typo3/sysext/install/Classes/ExtensionScanner/Php/CodeStatistics.php b/typo3/sysext/install/Classes/ExtensionScanner/Php/CodeStatistics.php index 3e7890d5cf87c1da9478d7eb1ef5a5fd4eecf77a..79e23a4daa2d881cb4586755b0100d10e4581fba 100644 --- a/typo3/sysext/install/Classes/ExtensionScanner/Php/CodeStatistics.php +++ b/typo3/sysext/install/Classes/ExtensionScanner/Php/CodeStatistics.php @@ -90,7 +90,7 @@ class CodeStatistics extends NodeVisitorAbstract * True if a @extensionScannerIgnoreFile has been found. * Called externally *after* traversing * - * @return int + * @return bool */ public function isFileIgnored() { diff --git a/typo3/sysext/install/Classes/ExtensionScanner/Php/Matcher/ConstructorArgumentMatcher.php b/typo3/sysext/install/Classes/ExtensionScanner/Php/Matcher/ConstructorArgumentMatcher.php index 1ada0e4ca0f577f93d450b6d42293b812adb44ab..1cb91544a7a32e3ccfcb55df415df555f0d88a7f 100644 --- a/typo3/sysext/install/Classes/ExtensionScanner/Php/Matcher/ConstructorArgumentMatcher.php +++ b/typo3/sysext/install/Classes/ExtensionScanner/Php/Matcher/ConstructorArgumentMatcher.php @@ -61,11 +61,12 @@ class ConstructorArgumentMatcher extends AbstractCoreMatcher * Test for "->deprecated()" (weak match) * * @param Node $node + * @return void|null */ public function enterNode(Node $node) { if ($this->isFileIgnored($node) || $this->isLineIgnored($node)) { - return; + return null; } $resolvedNode = $node->getAttribute(self::NODE_RESOLVED_AS, null) ?? $node; if (!$resolvedNode instanceof New_ @@ -73,13 +74,13 @@ class ConstructorArgumentMatcher extends AbstractCoreMatcher || is_object($node->class) && !method_exists($node->class, '__toString') || !array_key_exists((string)$resolvedNode->class, $this->matcherDefinitions) ) { - return; + return null; } // A method call is considered a match if it is not called with argument unpacking // and number of used arguments is lower than numberOfMandatoryArguments if ($this->isArgumentUnpackingUsed($resolvedNode->args)) { - return; + return null; } // $node reflects invocation, e.g. `GeneralUtility::makeInstance(MyClass::class, 123)` diff --git a/typo3/sysext/install/Classes/FolderStructure/AbstractNode.php b/typo3/sysext/install/Classes/FolderStructure/AbstractNode.php index de9b693cb9d69df0c88cd045a5f82152306e5ba1..064f03ebe31dc425b3c65753241c0e8d348f2d65 100644 --- a/typo3/sysext/install/Classes/FolderStructure/AbstractNode.php +++ b/typo3/sysext/install/Classes/FolderStructure/AbstractNode.php @@ -64,7 +64,7 @@ abstract class AbstractNode */ protected function getTargetPermission() { - return $this->targetPermission; + return $this->targetPermission ?? ''; } /** diff --git a/typo3/sysext/install/Classes/FolderStructure/LinkNode.php b/typo3/sysext/install/Classes/FolderStructure/LinkNode.php index cc7f502f33e8c935a6e91fd7708c620720a0a1af..b011790caa18c13a2f950532ce79f0b9be31945f 100644 --- a/typo3/sysext/install/Classes/FolderStructure/LinkNode.php +++ b/typo3/sysext/install/Classes/FolderStructure/LinkNode.php @@ -199,7 +199,7 @@ class LinkNode extends AbstractNode implements NodeInterface $result = true; } else { $actualTarget = $this->getCurrentTarget(); - if ($expectedTarget === rtrim($actualTarget, '/')) { + if ($expectedTarget === rtrim((string)$actualTarget, '/')) { $result = true; } } @@ -209,7 +209,7 @@ class LinkNode extends AbstractNode implements NodeInterface /** * Return current target of link * - * @return string target + * @return false|string target */ protected function getCurrentTarget() { diff --git a/typo3/sysext/install/Classes/Service/CoreVersionService.php b/typo3/sysext/install/Classes/Service/CoreVersionService.php index 11c8e0f01b7184324743f9eae822567069aeef0c..fe657ce5add4dcc60db6340bf0ce1e0d08b68ada 100644 --- a/typo3/sysext/install/Classes/Service/CoreVersionService.php +++ b/typo3/sysext/install/Classes/Service/CoreVersionService.php @@ -68,6 +68,7 @@ class CoreVersionService } /** + * @todo docblock * @return array{community: string[], elts: string[]} */ public function getSupportedMajorReleases(): array diff --git a/typo3/sysext/install/Classes/Service/Session/FileSessionHandler.php b/typo3/sysext/install/Classes/Service/Session/FileSessionHandler.php index b3c0a02e6ff499ebc3b938022ad3f7e2895a1a50..89826fcfd29054edbcf419ea55227c21787ad9a8 100644 --- a/typo3/sysext/install/Classes/Service/Session/FileSessionHandler.php +++ b/typo3/sysext/install/Classes/Service/Session/FileSessionHandler.php @@ -233,7 +233,7 @@ class FileSessionHandler implements \SessionHandlerInterface /** * Returns the session ID of the running session. * - * @return string the session ID + * @return string|false the session ID */ public function getSessionId() { diff --git a/typo3/sysext/install/Classes/Service/SessionService.php b/typo3/sysext/install/Classes/Service/SessionService.php index 0723d8a8ecdf41d5f6490892dbd19918c87a3dd7..1d12c094aef03e21ea26a29f12ed30d1faf95cca 100644 --- a/typo3/sysext/install/Classes/Service/SessionService.php +++ b/typo3/sysext/install/Classes/Service/SessionService.php @@ -101,7 +101,7 @@ class SessionService implements SingletonInterface /** * Starts a new session * - * @return string The session ID + * @return string|false The session ID */ public function startSession() { @@ -150,7 +150,7 @@ class SessionService implements SingletonInterface /** * Generates a new session ID and sends it to the client. * - * @return string the new session ID + * @return string|false the new session ID */ private function renewSession() { diff --git a/typo3/sysext/install/Classes/Service/WebServerConfigurationFileService.php b/typo3/sysext/install/Classes/Service/WebServerConfigurationFileService.php index fba860eee332e8373c35c32d859faa16a826edc1..a76967493f764a4597861c06cdf25b4348769fea 100644 --- a/typo3/sysext/install/Classes/Service/WebServerConfigurationFileService.php +++ b/typo3/sysext/install/Classes/Service/WebServerConfigurationFileService.php @@ -178,7 +178,7 @@ class WebServerConfigurationFileService string $newRewriteRule, string $configurationFileContent ): string { - return preg_replace_callback( + return (string)preg_replace_callback( $pattern, static function ($matches) use ($newRewriteRule) { return str_replace($matches[2], '', ($matches[1] . $newRewriteRule)) . $matches[3]; diff --git a/typo3/sysext/install/Classes/ViewHelpers/PhpInfoViewHelper.php b/typo3/sysext/install/Classes/ViewHelpers/PhpInfoViewHelper.php index e1e3f534c2c6231de4800c95303201934de29312..f7fd0ba5e93b36f8124e5ad7919cd19f77d0d151 100644 --- a/typo3/sysext/install/Classes/ViewHelpers/PhpInfoViewHelper.php +++ b/typo3/sysext/install/Classes/ViewHelpers/PhpInfoViewHelper.php @@ -62,8 +62,7 @@ class PhpInfoViewHelper extends AbstractViewHelper { ob_start(); phpinfo(); - - return ob_get_clean(); + return (string)ob_get_clean(); } /**