refactor: type declarations via Rector
rector.php gets the typeDeclarations set: return types (void, array, unions) where the code proves them, typed closures and arrow functions, typed properties from constructors and assignments in the DTOs. Skipped: rules that infer scalar or array parameter types from call sites or docblocks, and the removal of casts the docblocks call redundant. Values from the database, form input and the import feeds arrive as strings and would throw instead of being converted (e.g. the (int) cast of the newsletter list ids stays). Checked locally: cache warmup, frontend crawl (~1,900 URLs), the backchannel APIs and the newsletter form validation behave as before. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
4fe06267c9
commit
ecd5ea66c5
87 files changed
+461
-552
No files matched your search
@@ -43,7 +43,7 @@ class ContextProcessor implements DataProcessorInterface
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
private function getPaCodeFromRequest()
|
||||
private function getPaCodeFromRequest(): string|array
|
||||
{
|
||||
$currentUri = GeneralUtility::getIndpEnv('REQUEST_URI');
|
||||
$query = parse_url($currentUri, \PHP_URL_QUERY);
|
||||
@@ -67,7 +67,7 @@ class ContextProcessor implements DataProcessorInterface
|
||||
* @return array
|
||||
* @throws \Doctrine\DBAL\DBALException
|
||||
*/
|
||||
private function getContextRecord($uid, $table)
|
||||
private function getContextRecord($uid, $table): array|false
|
||||
{
|
||||
$qb = $this->getDbConnection()->createQueryBuilder();
|
||||
|
||||
|
||||
@@ -67,10 +67,7 @@ class SliderProcessor implements DataProcessorInterface
|
||||
return $processedData;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|int
|
||||
*/
|
||||
private function getParentPageWithSlides()
|
||||
private function getParentPageWithSlides(): ?int
|
||||
{
|
||||
$rootlineUtility = new RootlineUtility($GLOBALS['TYPO3_REQUEST']->getAttribute('frontend.page.information')->getId());
|
||||
$rootline = $rootlineUtility->get();
|
||||
|
||||
@@ -45,7 +45,7 @@ class Page extends AbstractEntity
|
||||
/**
|
||||
* @param bool $hidden
|
||||
*/
|
||||
public function setHidden($hidden)
|
||||
public function setHidden($hidden): void
|
||||
{
|
||||
$this->hidden = $hidden;
|
||||
}
|
||||
@@ -61,7 +61,7 @@ class Page extends AbstractEntity
|
||||
/**
|
||||
* @param string $title
|
||||
*/
|
||||
public function setTitle($title)
|
||||
public function setTitle($title): void
|
||||
{
|
||||
$this->title = $title;
|
||||
}
|
||||
@@ -77,7 +77,7 @@ class Page extends AbstractEntity
|
||||
/**
|
||||
* @param string $seoTitle
|
||||
*/
|
||||
public function setSeoTitle($seoTitle)
|
||||
public function setSeoTitle($seoTitle): void
|
||||
{
|
||||
$this->seoTitle = $seoTitle;
|
||||
}
|
||||
@@ -93,7 +93,7 @@ class Page extends AbstractEntity
|
||||
/**
|
||||
* @param string $description
|
||||
*/
|
||||
public function setDescription($description)
|
||||
public function setDescription($description): void
|
||||
{
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ class ContainerViewHelper extends AbstractViewHelper
|
||||
/**
|
||||
* @var int[]
|
||||
*/
|
||||
private static $scale = [
|
||||
private static array $scale = [
|
||||
'default' => 0,
|
||||
'small' => 8,
|
||||
'large' => 16,
|
||||
@@ -22,12 +22,9 @@ class ContainerViewHelper extends AbstractViewHelper
|
||||
#[\Override]
|
||||
protected $escapeOutput = false;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private static $columnsWithoutContainers = [ 0, 1, 3 ];
|
||||
private static array $columnsWithoutContainers = [ 0, 1, 3 ];
|
||||
|
||||
public function initializeArguments()
|
||||
public function initializeArguments(): void
|
||||
{
|
||||
parent::initializeArguments();
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ class FilterSettingsEncoderViewHelper extends AbstractViewHelper
|
||||
#[\Override]
|
||||
protected $escapeOutput = false;
|
||||
|
||||
public function initializeArguments()
|
||||
public function initializeArguments(): void
|
||||
{
|
||||
parent::initializeArguments();
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ class GmapsUrlViewHelper extends AbstractViewHelper
|
||||
|
||||
const URLBASE = 'http://maps.google.com/maps?q=%s,%s&t=%s&z=%d';
|
||||
|
||||
public function initializeArguments()
|
||||
public function initializeArguments(): void
|
||||
{
|
||||
parent::initializeArguments();
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ class IconViewHelper extends AbstractTagBasedViewHelper
|
||||
#[\Override]
|
||||
protected $tagName = 'svg';
|
||||
|
||||
public function initializeArguments()
|
||||
public function initializeArguments(): void
|
||||
{
|
||||
parent::initializeArguments();
|
||||
$this->registerArgument('icon', 'string', 'Icon name', true);
|
||||
@@ -33,7 +33,7 @@ class IconViewHelper extends AbstractTagBasedViewHelper
|
||||
return $this->tag->render();
|
||||
}
|
||||
|
||||
private function getImageService()
|
||||
private function getImageService(): object
|
||||
{
|
||||
return GeneralUtility::makeInstance(ImageService::class);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
|
||||
|
||||
class NightsOptionsViewHelper extends AbstractViewHelper
|
||||
{
|
||||
public function initializeArguments()
|
||||
public function initializeArguments(): void
|
||||
{
|
||||
parent::initializeArguments();
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
|
||||
|
||||
class PriceRangeViewHelper extends AbstractViewHelper
|
||||
{
|
||||
public function initializeArguments()
|
||||
public function initializeArguments(): void
|
||||
{
|
||||
parent::initializeArguments();
|
||||
|
||||
|
||||
@@ -19,21 +19,18 @@ class PriceViewHelper extends AbstractViewHelper
|
||||
{
|
||||
use CompileWithContentArgumentAndRenderStatic;
|
||||
|
||||
public function initializeArguments()
|
||||
public function initializeArguments(): void
|
||||
{
|
||||
parent::initializeArguments();
|
||||
|
||||
$this->registerArgument('value', 'mixed', 'Amount in euros');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public static function renderStatic(
|
||||
array $arguments,
|
||||
\Closure $renderChildrenClosure,
|
||||
RenderingContextInterface $renderingContext
|
||||
) {
|
||||
): string {
|
||||
$amount = round((float) $renderChildrenClosure(), 2);
|
||||
$decimals = floor($amount) === $amount ? 0 : 2;
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ class RatingViewHelper extends AbstractViewHelper
|
||||
#[\Override]
|
||||
protected $escapeOutput = false;
|
||||
|
||||
public function initializeArguments()
|
||||
public function initializeArguments(): void
|
||||
{
|
||||
parent::initializeArguments();
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
|
||||
|
||||
class ThemeClassesViewHelper extends AbstractViewHelper
|
||||
{
|
||||
public function initializeArguments()
|
||||
public function initializeArguments(): void
|
||||
{
|
||||
parent::initializeArguments();
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
|
||||
|
||||
class ProductViewHelper extends AbstractViewHelper
|
||||
{
|
||||
public function initializeArguments()
|
||||
public function initializeArguments(): void
|
||||
{
|
||||
parent::initializeArguments();
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ class VideoViewHelper extends AbstractViewHelper
|
||||
#[\Override]
|
||||
protected $escapeOutput = false;
|
||||
|
||||
public function initializeArguments()
|
||||
public function initializeArguments(): void
|
||||
{
|
||||
parent::initializeArguments();
|
||||
|
||||
|
||||
Reference in new issue
Block a user