Skip to content

Typo3 14#16

Merged
Mainbird merged 17 commits into
mainfrom
typo3-14
May 4, 2026
Merged

Typo3 14#16
Mainbird merged 17 commits into
mainfrom
typo3-14

Conversation

@Mainbird

@Mainbird Mainbird commented May 4, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features

    • Enhanced HTML minification with improved handling of JSON-LD blocks, unnecessary attributes, and whitespace normalization.
  • Documentation

    • Updated version support documentation for TYPO3 14 and PHP 8.5; added detailed minification optimization specifications.
  • Chores

    • Upgraded dependencies to support TYPO3 14 and PHP 8.5.

@coderabbitai

coderabbitai Bot commented May 4, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@Mainbird has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 2 minutes and 41 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6627f07e-c854-46ae-ab01-092342e1d56c

📥 Commits

Reviewing files that changed from the base of the PR and between fb12b8a and c0b4779.

📒 Files selected for processing (1)
  • version-bumper.yaml
📝 Walkthrough

Walkthrough

This PR upgrades the extension to support TYPO3 14 and PHP 8.5, modernizing event listeners with constructor injection and new component APIs, enhancing HTML minification with dedicated helper transformations, and updating dependency constraints and test tooling configuration.

Changes

Framework Upgrade to TYPO3 14 & PHP 8.5

Layer / File(s) Summary
Dependency Constraints
composer.json
doctrine/dbal bumped to ^4.4, networkteam/sentry-client to ^6.0, all typo3/cms-* packages to ^14.3, typo3fluid/fluid to ^5.3. Development dependencies updated (captainhook, version-bumper, typo3-console, translation-validator), and phpunit/phpunit removed from dev requirements.
Test Tool Configuration
Tests/CGL/rector.php, Tests/CGL/phpstan.neon
Rector now targets PHP 8.5 (LevelSetList::UP_TO_PHP_85) and TYPO3 14 (UP_TO_TYPO3_14). PHPStan vendor exclusion for phpunit removed.
Version Documentation
README.md
Updated supported TYPO3 badge from 13 to 14; added "Version support" table mapping extension versions 2.x/1.x to TYPO3 14.3/13.4 and PHP 8.4/8.5.

Event Listener & Asset Rendering Modernization

Layer / File(s) Summary
Dependency Injection
Classes/EventListener/SaveCloseButtonEventListener.php
SaveCloseButtonEventListener is now final readonly with constructor-injected ComponentFactory, IconFactory, and PageRenderer replacing GeneralUtility::makeInstance() calls.
Component Creation
Classes/EventListener/SaveCloseButtonEventListener.php
Button creation switched from $buttonBar->makeInputButton() to ComponentFactory->createInputButton(). Title localization updated to core.core:rm.saveCloseDoc key.
Localization Updates
Classes/EventListener/LastDeploymentEventListener.php
Toolbar label retrieves from extension's own localization key typo3_toolbox.be:system_information.last_updated instead of hardcoded LLL:EXT:... path.
Path Resolution
Classes/Page/AssetRenderer.php
getAbsoluteWebPath() changed to private, refactored from PathUtility/GeneralUtility versioned filenames to resource publisher API for generating URIs. Imports for PathUtility and GeneralUtility removed.

Content Minification Enhancement

Layer / File(s) Summary
Event-Based Content Flow
Classes/EventListener/ContentMinifierEventListener.php
__invoke() now calls $event->setContent() with minified result instead of directly mutating $event->getController()->content.
Minification Helpers
Classes/EventListener/ContentMinifierEventListener.php
Added five dedicated private transformation methods: removeUnnecessaryTypeAttributesForStyleAndScriptTags() (strips type on style/script), removeCkeditorDataAttributesFromListItems() (removes CKEditor data-list-item-id), removeWhitespacesAfterTagStartAndBeforeTagClose() (trims whitespace in specific tags), removeUnnecessaryWhitespacesFromClassAttributes() (normalizes class attribute spaces), removeUnnecessaryWhitespacesForJsonLdSchemas() (minifies JSON-LD with error handling).
Regex-Based Minification
Classes/EventListener/ContentMinifierEventListener.php
Updated docblock to reflect high-level regex operations; $replacements array applied after helper transformations.
Documentation
README.md
Added "Content Minifier" section with "Optimizations" table documenting minification rules: whitespace removal, tag/attribute normalization, JSON-LD minification, and CKEditor attribute stripping.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

Suggested reviewers

  • konradmichalik
  • danmoebius

Poem

🐰 A toolbox springs to life with TYPO3 fourteen,
Listeners lean on injection—clean and serene.
Content minified in layers, JSON gleams so bright,
Assets render swift with the publisher's light.
PHP 8.5 dances, the upgrade takes flight!

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'Typo3 14' is vague and doesn't convey what changes are being made in this pull request beyond a version reference. Use a more descriptive title that explains the primary change, such as 'Upgrade to TYPO3 14.3 and PHP 8.5' or 'Support TYPO3 14 with updated dependencies and refactored event listeners'.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch typo3-14

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 2 minutes and 41 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
Classes/EventListener/LastDeploymentEventListener.php (1)

23-26: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Pre-existing logic bug prevents this feature from working.

Line 24 has an inverted condition that causes the function to return early whenever the path is not empty:

if ($path !== '' || !file_exists($path)) {
    return;
}

This should check if the path IS empty or doesn't exist:

🐛 Proposed fix
-        if ($path !== '' || !file_exists($path)) {
+        if ($path === '' || !file_exists($path)) {
             return;
         }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Classes/EventListener/LastDeploymentEventListener.php` around lines 23 - 26,
In LastDeploymentEventListener, the early-return condition is inverted: change
the check on $path in the method where $path is set from
GeneralUtility::getFileAbsFileName so that it returns only when the path IS
empty or the file does not exist (i.e. use if ($path === '' ||
!file_exists($path)) return; or equivalent empty() logic) instead of the current
($path !== '' || !file_exists($path)); update the condition in that function to
the corrected form to allow execution when a valid path exists.
🧹 Nitpick comments (1)
Classes/EventListener/ContentMinifierEventListener.php (1)

100-105: 💤 Low value

Consider adding JSON_THROW_ON_ERROR to json_decode for consistent error handling.

Currently json_decode doesn't use JSON_THROW_ON_ERROR, so invalid JSON returns null silently, which is then caught by the 'null' === $minifiedJson check at line 107. For consistency with the try/catch pattern and clearer intent:

♻️ Proposed refactor
                 try {
-                    $minifiedJson = json_encode(json_decode($json, true), JSON_THROW_ON_ERROR | JSON_UNESCAPED_SLASHES);
+                    $decoded = json_decode($json, true, 512, JSON_THROW_ON_ERROR);
+                    $minifiedJson = json_encode($decoded, JSON_THROW_ON_ERROR | JSON_UNESCAPED_SLASHES);
                 } catch (\JsonException) {
                     return '';
                 }
-
-                if ('null' === $minifiedJson) {
-                    return '';
-                }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Classes/EventListener/ContentMinifierEventListener.php` around lines 100 -
105, In the try/catch around building $minifiedJson in
ContentMinifierEventListener (the json_encode/json_decode block), update the
json_decode call to pass JSON_THROW_ON_ERROR via the options parameter (e.g.,
json_decode($json, true, 512, JSON_THROW_ON_ERROR)) so malformed JSON throws a
JsonException that the existing catch (\JsonException) will handle; this makes
error handling consistent with the json_encode usage and avoids relying on
null-return checks for invalid JSON.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@composer.json`:
- Around line 9-21: The TYPO3 package constraints ("typo3/cms-core",
"typo3/cms-backend", "typo3/cms-frontend", "typo3/cms-adminpanel",
"typo3/cms-linkvalidator") are set to "^14.3" which is not available on
Packagist; update those composer version constraints to either a resolvable
release like "^14.2" or to the development branch "14.3.x-dev" (or mix as
appropriate) so composer can install dependencies successfully.

In `@README.md`:
- Line 7: The badge markdown "[![Supported TYPO3
versions](https://badgen.net/badge/TYPO3/14/orange)]()" has an empty link
causing MD042; fix it by either supplying a meaningful URL (e.g., the TYPO3
project page or release notes) inside the parentheses or remove the link wrapper
so the image stands alone ("[![Supported TYPO3
versions](https://badgen.net/badge/TYPO3/14/orange)]" or simply "![Supported
TYPO3 versions](https://badgen.net/badge/TYPO3/14/orange)"); update the
README.md line containing that exact badge markup accordingly.

---

Outside diff comments:
In `@Classes/EventListener/LastDeploymentEventListener.php`:
- Around line 23-26: In LastDeploymentEventListener, the early-return condition
is inverted: change the check on $path in the method where $path is set from
GeneralUtility::getFileAbsFileName so that it returns only when the path IS
empty or the file does not exist (i.e. use if ($path === '' ||
!file_exists($path)) return; or equivalent empty() logic) instead of the current
($path !== '' || !file_exists($path)); update the condition in that function to
the corrected form to allow execution when a valid path exists.

---

Nitpick comments:
In `@Classes/EventListener/ContentMinifierEventListener.php`:
- Around line 100-105: In the try/catch around building $minifiedJson in
ContentMinifierEventListener (the json_encode/json_decode block), update the
json_decode call to pass JSON_THROW_ON_ERROR via the options parameter (e.g.,
json_decode($json, true, 512, JSON_THROW_ON_ERROR)) so malformed JSON throws a
JsonException that the existing catch (\JsonException) will handle; this makes
error handling consistent with the json_encode usage and avoids relying on
null-return checks for invalid JSON.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b1348593-50ad-4887-9a7f-91c81c7a8436

📥 Commits

Reviewing files that changed from the base of the PR and between 6833373 and fb12b8a.

⛔ Files ignored due to path filters (1)
  • composer.lock is excluded by !**/*.lock
📒 Files selected for processing (8)
  • Classes/EventListener/ContentMinifierEventListener.php
  • Classes/EventListener/LastDeploymentEventListener.php
  • Classes/EventListener/SaveCloseButtonEventListener.php
  • Classes/Page/AssetRenderer.php
  • README.md
  • Tests/CGL/phpstan.neon
  • Tests/CGL/rector.php
  • composer.json
💤 Files with no reviewable changes (1)
  • Tests/CGL/phpstan.neon

Comment thread composer.json
Comment thread README.md
@Mainbird
Mainbird merged commit 144a533 into main May 4, 2026
2 checks passed
@Mainbird
Mainbird deleted the typo3-14 branch May 4, 2026 07:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants