Skip to content

Commit

Permalink
[TASK] Fix phpstan checkFunctionArgumentTypes errors in ext:redirects
Browse files Browse the repository at this point in the history
This patch fixes incompatible type usage in function arguments
and is preparatory work for introducing native type hints and
strict mode in all core files.

Resolves: #92174
Releases: master, 10.4
Change-Id: I1a5421b844c36796dca1336c453ff0333295c320
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/65865
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Daniel Goerz <daniel.goerz@posteo.de>
Reviewed-by: Daniel Goerz <daniel.goerz@posteo.de>
  • Loading branch information
ervaude committed Sep 27, 2020
1 parent 31bbcf9 commit 2567563
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
Expand Up @@ -86,7 +86,7 @@ public function handleRequest(ServerRequestInterface $request): ResponseInterfac
$action = $request->getQueryParams()['action'] ?? $request->getParsedBody()['action'] ?? 'overview';
$this->initializeView($action);

$result = call_user_func_array([$this, $action . 'Action'], [$request]);
$result = $this->{$action . 'Action'}($request);
if ($result instanceof ResponseInterface) {
return $result;
}
Expand Down
Expand Up @@ -68,7 +68,7 @@ public function processDatamap_preProcessFieldArray(array $incomingFieldArray, s
return;
}

$record = BackendUtility::getRecordWSOL($table, $id, 'slug');
$record = BackendUtility::getRecordWSOL($table, (int)$id, 'slug');
$this->persistedSlugValues[(int)$id] = $record['slug'];
}

Expand Down
2 changes: 1 addition & 1 deletion typo3/sysext/redirects/Classes/Service/RedirectService.php
Expand Up @@ -110,7 +110,7 @@ public function matchRedirect(string $domain, string $path, string $query = '')
if (!empty($allRedirects[$domainName]['regexp'])) {
$allRegexps = array_keys($allRedirects[$domainName]['regexp']);
foreach ($allRegexps as $regexp) {
$matchResult = @preg_match($regexp, $path);
$matchResult = @preg_match((string)$regexp, $path);
if ($matchResult) {
$possibleRedirects += $allRedirects[$domainName]['regexp'][$regexp];
} elseif ($matchResult === false) {
Expand Down
3 changes: 3 additions & 0 deletions typo3/sysext/redirects/Classes/Service/SlugService.php
Expand Up @@ -118,6 +118,9 @@ public function __construct(Context $context, LanguageService $languageService,
public function rebuildSlugsForSlugChange(int $pageId, string $currentSlug, string $newSlug, CorrelationId $correlationId): void
{
$currentPageRecord = BackendUtility::getRecord('pages', $pageId);
if ($currentPageRecord === null) {
return;
}
$this->initializeSettings($pageId);
if ($this->autoUpdateSlugs || $this->autoCreateRedirects) {
$this->createCorrelationIds($pageId, $correlationId);
Expand Down

0 comments on commit 2567563

Please sign in to comment.