refactor: PHP 8.5 language features via Rector
rector.php gets the PHP sets up to 8.5. Mostly constructor promotion with readonly properties, typed class constants, ??=, arrow functions, str_contains/str_starts_with, catch without unused variables, array_any and #[\Override] on overridden properties; array_key_exists() keys are cast to string (null keys are deprecated in PHP 8.5). Long promoted constructor signatures are wrapped one parameter per line. Checked locally: a crawl of ~1,900 frontend URLs over all sites and the backchannel APIs (/api/hotel, /api/product, content feed manifest and records of every type) render the same as before. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
96632edf44
commit
b51fa4ddad
61 files changed
+320
-609
No files matched your search
@@ -9,11 +9,13 @@ class Page extends AbstractEntity
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
#[\Override]
|
||||
protected ?int $uid = null;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
#[\Override]
|
||||
protected ?int $pid = null;
|
||||
|
||||
/**
|
||||
|
||||
@@ -10,6 +10,7 @@ class PageRepository extends Repository
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
#[\Override]
|
||||
protected $defaultOrderings = [
|
||||
'sorting' => 'ASC',
|
||||
];
|
||||
|
||||
@@ -46,7 +46,7 @@ abstract class AbstractMappedFinisher extends AbstractFinisher
|
||||
$formValues = $this->finisherContext->getFormValues();
|
||||
|
||||
foreach ($this->parseMapping() as $remote => $local) {
|
||||
if (false === array_key_exists($local, $formValues)) {
|
||||
if (false === array_key_exists((string) $local, $formValues)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -130,13 +130,13 @@ abstract class AbstractMappedFinisher extends AbstractFinisher
|
||||
if ($value instanceof FileReference) {
|
||||
$resource = $value->getOriginalResource();
|
||||
|
||||
return null !== $resource ? $resource->getName() : null;
|
||||
return $resource?->getName();
|
||||
}
|
||||
|
||||
if (true === is_object($value)) {
|
||||
$this->logWarning('Form value skipped while collecting labeled values: unsupported type.', [
|
||||
'element' => $identifier,
|
||||
'class' => get_class($value),
|
||||
'class' => $value::class,
|
||||
]);
|
||||
|
||||
return null;
|
||||
|
||||
@@ -31,7 +31,7 @@ class ApplicationApiFinisher extends AbstractMappedFinisher
|
||||
// without keeping a list of identifiers. Taken from the definition rather than
|
||||
// through TranslationService: a translated label would differ per site language.
|
||||
$payload['formLabel'] = '' !== $formLabel ? $formLabel : $formDefinition->getIdentifier();
|
||||
$payload['submittedAt'] = (new \DateTimeImmutable())->format(\DateTimeInterface::ATOM);
|
||||
$payload['submittedAt'] = new \DateTimeImmutable()->format(\DateTimeInterface::ATOM);
|
||||
$payload = array_merge($payload, $this->resolvePageContext());
|
||||
$payload['details'] = $this->buildLabeledValues();
|
||||
|
||||
|
||||
@@ -32,11 +32,11 @@ use TYPO3\CMS\Core\Http\Stream;
|
||||
*
|
||||
* Registered after the page resolver, so the /api/* responses of ep_products never pass here.
|
||||
*/
|
||||
final class CdnImageMiddleware implements MiddlewareInterface
|
||||
final readonly class CdnImageMiddleware implements MiddlewareInterface
|
||||
{
|
||||
private const PATTERN = '/(["\'])\/?(fileadmin|uploads|typo3temp\/assets\/(?:_processed_|images))/';
|
||||
private const string PATTERN = '/(["\'])\/?(fileadmin|uploads|typo3temp\/assets\/(?:_processed_|images))/';
|
||||
|
||||
public function __construct(private readonly ExtensionConfiguration $extensionConfiguration)
|
||||
public function __construct(private ExtensionConfiguration $extensionConfiguration)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ class ContainerViewHelper extends AbstractViewHelper
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
#[\Override]
|
||||
protected $escapeOutput = false;
|
||||
|
||||
/**
|
||||
@@ -45,9 +46,7 @@ class ContainerViewHelper extends AbstractViewHelper
|
||||
public function render()
|
||||
{
|
||||
$content = $this->renderChildren();
|
||||
if ($content === null) {
|
||||
$content = $this->arguments['content'];
|
||||
}
|
||||
$content ??= $this->arguments['content'];
|
||||
$classes = [];
|
||||
if (\in_array($this->arguments['data']['colPos'] ?? null, static::$columnsWithoutContainers, false)) {
|
||||
$classes[] = 'container';
|
||||
|
||||
@@ -11,6 +11,7 @@ class FilterSettingsEncoderViewHelper extends AbstractViewHelper
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
#[\Override]
|
||||
protected $escapeOutput = false;
|
||||
|
||||
public function initializeArguments()
|
||||
@@ -29,9 +30,7 @@ class FilterSettingsEncoderViewHelper extends AbstractViewHelper
|
||||
public function render()
|
||||
{
|
||||
$argument = $this->renderChildren();
|
||||
if ($argument === null) {
|
||||
$argument = $this->arguments['argument'];
|
||||
}
|
||||
$argument ??= $this->arguments['argument'];
|
||||
if ($argument === null) {
|
||||
return '';
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ class GmapsUrlViewHelper extends AbstractViewHelper
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
#[\Override]
|
||||
protected $escapeOutput = false;
|
||||
|
||||
const URLBASE = 'http://maps.google.com/maps?q=%s,%s&t=%s&z=%d';
|
||||
|
||||
@@ -11,6 +11,7 @@ class IconViewHelper extends AbstractTagBasedViewHelper
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
#[\Override]
|
||||
protected $tagName = 'svg';
|
||||
|
||||
public function initializeArguments()
|
||||
|
||||
@@ -11,6 +11,7 @@ class RatingViewHelper extends AbstractViewHelper
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
#[\Override]
|
||||
protected $escapeOutput = false;
|
||||
|
||||
public function initializeArguments()
|
||||
@@ -29,9 +30,7 @@ class RatingViewHelper extends AbstractViewHelper
|
||||
public function render()
|
||||
{
|
||||
$product = $this->renderChildren();
|
||||
if ($product === null) {
|
||||
$product = $this->arguments['product'];
|
||||
}
|
||||
$product ??= $this->arguments['product'];
|
||||
$ratingAverage = $product->getRatingAverage();
|
||||
$ratingVotesCount = $product->getRatingVotesCount();
|
||||
$fullStars = floor($ratingAverage);
|
||||
|
||||
@@ -24,7 +24,7 @@ class ThemeClassesViewHelper extends AbstractViewHelper
|
||||
public function render()
|
||||
{
|
||||
$themeKey = $this->arguments['key'];
|
||||
if (!array_key_exists($themeKey, $this->arguments['classes'])) {
|
||||
if (!array_key_exists((string) $themeKey, $this->arguments['classes'])) {
|
||||
return '';
|
||||
}
|
||||
return $this->arguments['classes'][$themeKey];
|
||||
|
||||
@@ -10,6 +10,7 @@ class VideoViewHelper extends AbstractViewHelper
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
#[\Override]
|
||||
protected $escapeOutput = false;
|
||||
|
||||
public function initializeArguments()
|
||||
|
||||
Reference in new issue
Block a user