Skip to content

Conversation

@jan888adams
Copy link
Contributor

@jan888adams jan888adams commented May 19, 2025

Summary by CodeRabbit

  • New Features

    • Added collection and display of HTTP cache tags in the Symfony profiler with toolbar/menu/panel and configuration view.
    • Added a data collector to inspect collected cache tags and config in the profiler UI.
  • Bug Fixes

    • Corrected a test method name to reflect object-class disabling.
  • Tests

    • Added comprehensive integration and unit tests for tag collection, configuration collection, and conditional data-collector behavior.
  • Refactor

    • Optimized internal cache tag storage and added a unified cache type identifier.
  • Chores

    • Updated service configuration and added a compiler pass to disable collectors when the profiler is absent.

@coderabbitai
Copy link

coderabbitai bot commented May 19, 2025

Walkthrough

Adds tag-collection and profiling support: a decorator that accumulates cache tags, a Symfony data collector with profiler UI, a compiler pass to disable collectors when profiler is absent, cache-type identifier additions, internal CacheTags storage changes, and related tests and service registrations.

Changes

Cohort / File(s) Change Summary
Service config & DI
config/services.php, src/DependencyInjection/NeustaPimcoreHttpCacheExtension.php, src/NeustaPimcoreHttpCacheBundle.php, src/DependencyInjection/CompilerPass/DisableDataCollectorPass.php
Adds a private decorator service to collect tags, registers a profiler data collector service and config parameter, registers a compiler pass to remove collector services when profiler is absent, and wires the bundle build step.
Cache tag collection & data collector
src/Cache/ResponseTagger/CacheTagCollectionResponseTagger.php, src/DataCollector.php
Introduces a decorator that accumulates CacheTags and exposes reset; adds a DataCollector that late-collects tags and exposes configuration for the Symfony profiler.
CacheTags storage change
src/Cache/CacheTags.php
Changes internal tags storage from a list to an associative array keyed by tag string; updates iteration, merging, and toArray behavior accordingly.
CacheType interface & implementations
src/Cache/CacheType.php, src/Cache/CacheType/CustomCacheType.php, src/Cache/CacheType/ElementCacheType.php, src/Cache/CacheType/EmptyCacheType.php
Adds identifier(): string to CacheType and implements it in custom, element, and empty cache type classes.
Profiler template
templates/profiler.html.twig
Adds a Twig profiler panel, menu, and toolbar rendering cache tags and configuration.
Integration tests — tag collection & config
tests/Integration/Tagging/CollectTagsDataTest.php, tests/Integration/Configuration/CollectConfigurationDataTest.php
Adds integration tests covering tag collection for various types, custom tags, config exposure, and behaviour when profiler or caching is disabled.
Integration test rename
tests/Integration/Tagging/TagObjectTest.php
Renames a test method to correctly reflect that it asserts behavior when an object class is disabled.
Unit tests — tag collector & data collector
tests/Unit/Cache/ResponseTagger/CacheTagCollectionResponseTaggerTest.php, tests/Unit/DataCollectorTest.php
Adds unit tests verifying accumulation, forwarding, reset behavior of the decorator, and DataCollector lifecycle (collect, lateCollect, reset, configuration).
Unit tests — compiler pass
tests/Unit/DependencyInjection/CompilerPass/DisableDataCollectorPassTest.php
Adds tests asserting the compiler pass removes collector services when profiler is absent and preserves them when present.

Sequence Diagram(s)

sequenceDiagram
    participant App as Application / Controller
    participant Collector as CacheTagCollectionResponseTagger
    participant Inner as Inner ResponseTagger
    participant Profiler as Symfony Profiler / DataCollector

    App->>Collector: tag(CacheTags)
    Collector->>Collector: merge/accumulate tags
    Collector->>Inner: tag(CacheTags)  -- delegate
    Profiler->>Collector: lateCollect()
    Collector->>Profiler: return collected tags
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~40 minutes

Possibly related PRs

Suggested reviewers

  • jdreesen
  • lukadschaak

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a2b7d26 and 9e7f6c9.

📒 Files selected for processing (1)
  • tests/Unit/DataCollectorTest.php (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/Unit/DataCollectorTest.php
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: PHPUnit with PHP 8.2 highest
  • GitHub Check: PHPUnit with PHP 8.1 lowest
  • GitHub Check: PHPUnit with PHP 8.1 highest
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch display-tags-in-symfony-profiler

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@jan888adams jan888adams changed the base branch from main to new-http-cache-bundle-logo May 19, 2025 14:32
Base automatically changed from new-http-cache-bundle-logo to main May 21, 2025 07:14
@jan888adams jan888adams force-pushed the display-tags-in-symfony-profiler branch 3 times, most recently from daa447c to 2531c6c Compare June 24, 2025 12:47
@jan888adams jan888adams force-pushed the display-tags-in-symfony-profiler branch 4 times, most recently from 2623c3b to 71d2669 Compare July 3, 2025 13:41
@jan888adams jan888adams force-pushed the display-tags-in-symfony-profiler branch from ec62f9d to 2dd244f Compare July 9, 2025 14:02
@jan888adams jan888adams force-pushed the display-tags-in-symfony-profiler branch 2 times, most recently from 64d93e5 to 53e0f01 Compare July 9, 2025 15:17
@jan888adams jan888adams force-pushed the display-tags-in-symfony-profiler branch 3 times, most recently from 2f6f1a9 to 1ed56bf Compare July 10, 2025 11:04
@jan888adams jan888adams force-pushed the display-tags-in-symfony-profiler branch from 1ed56bf to 32e1c23 Compare July 10, 2025 11:08
@jan888adams jan888adams marked this pull request as ready for review July 10, 2025 11:52
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
src/Cache/ResponseTagger/CacheTagCollectionResponseTagger.php (1)

1-2: Fix strict_types declaration formatting.

The strict_types declaration should be on the same line as the PHP opening tag to match the project's preferred format.

-<?php
-declare(strict_types=1);
+<?php declare(strict_types=1);
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6dc8a9c and 32e1c23.

📒 Files selected for processing (17)
  • config/services.php (3 hunks)
  • src/Cache/CacheTags.php (3 hunks)
  • src/Cache/CacheType.php (1 hunks)
  • src/Cache/CacheType/CustomCacheType.php (1 hunks)
  • src/Cache/CacheType/ElementCacheType.php (1 hunks)
  • src/Cache/CacheType/EmptyCacheType.php (1 hunks)
  • src/Cache/DataCollector/CacheTagDataCollector.php (1 hunks)
  • src/Cache/ResponseTagger/CacheTagCollectionResponseTagger.php (1 hunks)
  • src/DependencyInjection/CompilerPass/DisableCacheTagCollectionPass.php (1 hunks)
  • src/NeustaPimcoreHttpCacheBundle.php (2 hunks)
  • templates/cache_tags.html.twig (1 hunks)
  • tests/Integration/Tagging/CollectTagsDataTest.php (1 hunks)
  • tests/Integration/Tagging/TagObjectTest.php (1 hunks)
  • tests/Unit/Cache/DataCollector/CacheTagDataCollectorTest.php (1 hunks)
  • tests/Unit/Cache/ResponseTagger/CacheTagCollectionResponseTaggerTest.php (1 hunks)
  • tests/Unit/DependencyInjection/CompilerPass/DisableCacheTagCollectionPassTest.php (1 hunks)
  • tests/app/config/packages/web_profiler.yaml (1 hunks)
🧰 Additional context used
🧠 Learnings (10)
src/NeustaPimcoreHttpCacheBundle.php (3)
Learnt from: jan888adams
PR: teamneusta/pimcore-http-cache-bundle#0
File: :0-0
Timestamp: 2025-04-17T08:05:45.864Z
Learning: The PR #18 in teamneusta/pimcore-http-cache-bundle successfully standardized all PHP files in the repository to have the strict_types declaration on the same line as the PHP opening tag (<?php declare(strict_types=1);), except for configuration files (.php-cs-fixer.php and config/services.php) which intentionally omit strict_types declarations.
Learnt from: jan888adams
PR: teamneusta/pimcore-http-cache-bundle#0
File: :0-0
Timestamp: 2025-04-17T08:05:45.864Z
Learning: In the teamneusta/pimcore-http-cache-bundle project, a PR was created to ensure consistent formatting of strict_types declarations across the codebase, with the preferred format being to have the strict_types declaration on the same line as the PHP opening tag (<?php declare(strict_types=1);).
Learnt from: jan888adams
PR: teamneusta/pimcore-http-cache-bundle#17
File: tests/Integration/Helpers/ArrangeCacheTest.php:1-2
Timestamp: 2025-04-16T14:39:31.681Z
Learning: In the teamneusta/pimcore-http-cache-bundle project, the preferred formatting style for the strict types declaration is to have it on the same line as the PHP opening tag: `<?php declare(strict_types=1);` rather than on a separate line.
src/Cache/ResponseTagger/CacheTagCollectionResponseTagger.php (1)
Learnt from: jan888adams
PR: teamneusta/pimcore-http-cache-bundle#0
File: :0-0
Timestamp: 2025-04-17T08:05:45.864Z
Learning: The PR #18 in teamneusta/pimcore-http-cache-bundle successfully standardized all PHP files in the repository to have the strict_types declaration on the same line as the PHP opening tag (<?php declare(strict_types=1);), except for configuration files (.php-cs-fixer.php and config/services.php) which intentionally omit strict_types declarations.
src/DependencyInjection/CompilerPass/DisableCacheTagCollectionPass.php (3)
Learnt from: jan888adams
PR: teamneusta/pimcore-http-cache-bundle#0
File: :0-0
Timestamp: 2025-04-17T08:05:45.864Z
Learning: The PR #18 in teamneusta/pimcore-http-cache-bundle successfully standardized all PHP files in the repository to have the strict_types declaration on the same line as the PHP opening tag (<?php declare(strict_types=1);), except for configuration files (.php-cs-fixer.php and config/services.php) which intentionally omit strict_types declarations.
Learnt from: jan888adams
PR: teamneusta/pimcore-http-cache-bundle#0
File: :0-0
Timestamp: 2025-04-17T08:05:45.864Z
Learning: In the teamneusta/pimcore-http-cache-bundle project, a PR was created to ensure consistent formatting of strict_types declarations across the codebase, with the preferred format being to have the strict_types declaration on the same line as the PHP opening tag (<?php declare(strict_types=1);).
Learnt from: jan888adams
PR: teamneusta/pimcore-http-cache-bundle#17
File: tests/Integration/Helpers/ArrangeCacheTest.php:1-2
Timestamp: 2025-04-16T14:39:31.681Z
Learning: In the teamneusta/pimcore-http-cache-bundle project, the preferred formatting style for the strict types declaration is to have it on the same line as the PHP opening tag: `<?php declare(strict_types=1);` rather than on a separate line.
tests/Unit/Cache/ResponseTagger/CacheTagCollectionResponseTaggerTest.php (4)
Learnt from: jan888adams
PR: teamneusta/pimcore-http-cache-bundle#14
File: tests/Integration/Invalidation/CancelInvalidationTest.php:29-29
Timestamp: 2025-04-16T09:17:07.113Z
Learning: When writing PHP test classes, all properties (like $client or mock objects) must be explicitly declared with proper type hints at the class level. Dynamic properties (properties assigned without declaration) are deprecated in PHP 8.2+ and will cause warnings.
Learnt from: jan888adams
PR: teamneusta/pimcore-http-cache-bundle#0
File: :0-0
Timestamp: 2025-04-17T08:05:45.864Z
Learning: The PR #18 in teamneusta/pimcore-http-cache-bundle successfully standardized all PHP files in the repository to have the strict_types declaration on the same line as the PHP opening tag (<?php declare(strict_types=1);), except for configuration files (.php-cs-fixer.php and config/services.php) which intentionally omit strict_types declarations.
Learnt from: jan888adams
PR: teamneusta/pimcore-http-cache-bundle#17
File: tests/Integration/Helpers/ArrangeCacheTest.php:1-2
Timestamp: 2025-04-16T14:39:31.681Z
Learning: In the teamneusta/pimcore-http-cache-bundle project, the preferred formatting style for the strict types declaration is to have it on the same line as the PHP opening tag: `<?php declare(strict_types=1);` rather than on a separate line.
Learnt from: jan888adams
PR: teamneusta/pimcore-http-cache-bundle#0
File: :0-0
Timestamp: 2025-04-17T08:05:45.864Z
Learning: In the teamneusta/pimcore-http-cache-bundle project, a PR was created to ensure consistent formatting of strict_types declarations across the codebase, with the preferred format being to have the strict_types declaration on the same line as the PHP opening tag (<?php declare(strict_types=1);).
config/services.php (2)
Learnt from: jan888adams
PR: teamneusta/pimcore-http-cache-bundle#0
File: :0-0
Timestamp: 2025-04-17T08:05:45.864Z
Learning: The PR #18 in teamneusta/pimcore-http-cache-bundle successfully standardized all PHP files in the repository to have the strict_types declaration on the same line as the PHP opening tag (<?php declare(strict_types=1);), except for configuration files (.php-cs-fixer.php and config/services.php) which intentionally omit strict_types declarations.
Learnt from: jan888adams
PR: teamneusta/pimcore-http-cache-bundle#0
File: :0-0
Timestamp: 2025-04-17T08:05:45.864Z
Learning: In the teamneusta/pimcore-http-cache-bundle project, a PR was created to ensure consistent formatting of strict_types declarations across the codebase, with the preferred format being to have the strict_types declaration on the same line as the PHP opening tag (<?php declare(strict_types=1);).
tests/Unit/Cache/DataCollector/CacheTagDataCollectorTest.php (3)
Learnt from: jan888adams
PR: teamneusta/pimcore-http-cache-bundle#14
File: tests/Integration/Invalidation/CancelInvalidationTest.php:29-29
Timestamp: 2025-04-16T09:17:07.113Z
Learning: When writing PHP test classes, all properties (like $client or mock objects) must be explicitly declared with proper type hints at the class level. Dynamic properties (properties assigned without declaration) are deprecated in PHP 8.2+ and will cause warnings.
Learnt from: jan888adams
PR: teamneusta/pimcore-http-cache-bundle#0
File: :0-0
Timestamp: 2025-04-17T08:05:45.864Z
Learning: The PR #18 in teamneusta/pimcore-http-cache-bundle successfully standardized all PHP files in the repository to have the strict_types declaration on the same line as the PHP opening tag (<?php declare(strict_types=1);), except for configuration files (.php-cs-fixer.php and config/services.php) which intentionally omit strict_types declarations.
Learnt from: jan888adams
PR: teamneusta/pimcore-http-cache-bundle#0
File: :0-0
Timestamp: 2025-04-17T08:05:45.864Z
Learning: In the teamneusta/pimcore-http-cache-bundle project, a PR was created to ensure consistent formatting of strict_types declarations across the codebase, with the preferred format being to have the strict_types declaration on the same line as the PHP opening tag (<?php declare(strict_types=1);).
src/Cache/CacheTags.php (1)
Learnt from: jan888adams
PR: teamneusta/pimcore-http-cache-bundle#0
File: :0-0
Timestamp: 2025-04-17T08:05:45.864Z
Learning: The PR #18 in teamneusta/pimcore-http-cache-bundle successfully standardized all PHP files in the repository to have the strict_types declaration on the same line as the PHP opening tag (<?php declare(strict_types=1);), except for configuration files (.php-cs-fixer.php and config/services.php) which intentionally omit strict_types declarations.
tests/Unit/DependencyInjection/CompilerPass/DisableCacheTagCollectionPassTest.php (3)
Learnt from: jan888adams
PR: teamneusta/pimcore-http-cache-bundle#14
File: tests/Integration/Invalidation/CancelInvalidationTest.php:29-29
Timestamp: 2025-04-16T09:17:07.113Z
Learning: When writing PHP test classes, all properties (like $client or mock objects) must be explicitly declared with proper type hints at the class level. Dynamic properties (properties assigned without declaration) are deprecated in PHP 8.2+ and will cause warnings.
Learnt from: jan888adams
PR: teamneusta/pimcore-http-cache-bundle#0
File: :0-0
Timestamp: 2025-04-17T08:05:45.864Z
Learning: The PR #18 in teamneusta/pimcore-http-cache-bundle successfully standardized all PHP files in the repository to have the strict_types declaration on the same line as the PHP opening tag (<?php declare(strict_types=1);), except for configuration files (.php-cs-fixer.php and config/services.php) which intentionally omit strict_types declarations.
Learnt from: jdreesen
PR: teamneusta/pimcore-http-cache-bundle#13
File: tests/app/bin/console:4-4
Timestamp: 2025-04-01T13:40:08.587Z
Learning: The project uses `teamneusta/pimcore-testing-framework` (version ^0.12.8) in the require-dev section of composer.json, which provides the `Neusta\Pimcore\TestingFramework\Pimcore\BootstrapPimcore` class used in the test environment.
src/Cache/DataCollector/CacheTagDataCollector.php (1)
Learnt from: jan888adams
PR: teamneusta/pimcore-http-cache-bundle#0
File: :0-0
Timestamp: 2025-04-17T08:05:45.864Z
Learning: The PR #18 in teamneusta/pimcore-http-cache-bundle successfully standardized all PHP files in the repository to have the strict_types declaration on the same line as the PHP opening tag (<?php declare(strict_types=1);), except for configuration files (.php-cs-fixer.php and config/services.php) which intentionally omit strict_types declarations.
tests/Integration/Tagging/CollectTagsDataTest.php (3)
Learnt from: jan888adams
PR: teamneusta/pimcore-http-cache-bundle#0
File: :0-0
Timestamp: 2025-04-17T08:05:45.864Z
Learning: The PR #18 in teamneusta/pimcore-http-cache-bundle successfully standardized all PHP files in the repository to have the strict_types declaration on the same line as the PHP opening tag (<?php declare(strict_types=1);), except for configuration files (.php-cs-fixer.php and config/services.php) which intentionally omit strict_types declarations.
Learnt from: jan888adams
PR: teamneusta/pimcore-http-cache-bundle#14
File: tests/Integration/Invalidation/CancelInvalidationTest.php:29-29
Timestamp: 2025-04-16T09:17:07.113Z
Learning: When writing PHP test classes, all properties (like $client or mock objects) must be explicitly declared with proper type hints at the class level. Dynamic properties (properties assigned without declaration) are deprecated in PHP 8.2+ and will cause warnings.
Learnt from: jan888adams
PR: teamneusta/pimcore-http-cache-bundle#0
File: :0-0
Timestamp: 2025-04-17T08:05:45.864Z
Learning: In the teamneusta/pimcore-http-cache-bundle project, a PR was created to ensure consistent formatting of strict_types declarations across the codebase, with the preferred format being to have the strict_types declaration on the same line as the PHP opening tag (<?php declare(strict_types=1);).
🧬 Code Graph Analysis (7)
src/Cache/CacheType.php (3)
src/Cache/CacheType/ElementCacheType.php (1)
  • identifier (41-44)
src/Cache/CacheType/EmptyCacheType.php (1)
  • identifier (24-27)
src/Cache/CacheType/CustomCacheType.php (1)
  • identifier (33-36)
src/Cache/CacheType/EmptyCacheType.php (3)
src/Cache/CacheType/ElementCacheType.php (1)
  • identifier (41-44)
src/Cache/CacheType/CustomCacheType.php (1)
  • identifier (33-36)
src/Cache/CacheType.php (1)
  • identifier (13-13)
src/Cache/CacheType/ElementCacheType.php (3)
src/Cache/CacheType/EmptyCacheType.php (1)
  • identifier (24-27)
src/Cache/CacheType/CustomCacheType.php (1)
  • identifier (33-36)
src/Cache/CacheType.php (1)
  • identifier (13-13)
src/Cache/CacheType/CustomCacheType.php (3)
src/Cache/CacheType/ElementCacheType.php (1)
  • identifier (41-44)
src/Cache/CacheType/EmptyCacheType.php (1)
  • identifier (24-27)
src/Cache/CacheType.php (1)
  • identifier (13-13)
src/NeustaPimcoreHttpCacheBundle.php (1)
src/DependencyInjection/CompilerPass/DisableCacheTagCollectionPass.php (1)
  • DisableCacheTagCollectionPass (8-22)
tests/Unit/Cache/DataCollector/CacheTagDataCollectorTest.php (6)
src/Cache/CacheTag.php (1)
  • CacheTag (9-42)
src/Cache/CacheTags.php (2)
  • CacheTags (10-106)
  • fromString (30-33)
src/Cache/CacheTypeFactory.php (2)
  • CacheTypeFactory (11-31)
  • createFromString (18-25)
src/Cache/DataCollector/CacheTagDataCollector.php (4)
  • CacheTagDataCollector (11-49)
  • lateCollect (23-30)
  • getTags (35-38)
  • reset (45-48)
src/Cache/ResponseTagger/CacheTagCollectionResponseTagger.php (2)
  • CacheTagCollectionResponseTagger (9-24)
  • tag (19-23)
tests/Unit/Cache/ResponseTagger/CacheTagCollectionResponseTaggerTest.php (1)
  • setUp (22-26)
src/Cache/DataCollector/CacheTagDataCollector.php (2)
src/Cache/ResponseTagger/CacheTagCollectionResponseTagger.php (3)
  • CacheTagCollectionResponseTagger (9-24)
  • __construct (13-17)
  • tag (19-23)
src/Cache/CacheTags.php (2)
  • __construct (20-28)
  • toString (97-100)
🪛 PHPMD (2.15.0)
src/Cache/DataCollector/CacheTagDataCollector.php

18-18: Avoid unused parameters such as '$request'. (Unused Code Rules)

(UnusedFormalParameter)


18-18: Avoid unused parameters such as '$response'. (Unused Code Rules)

(UnusedFormalParameter)


18-18: Avoid unused parameters such as '$exception'. (Unused Code Rules)

(UnusedFormalParameter)

🔇 Additional comments (24)
tests/app/config/packages/web_profiler.yaml (1)

1-2: LGTM! Standard profiler configuration.

The configuration correctly enables the Symfony profiler with both enabled and collect set to true, which is necessary for the cache tag data collection functionality.

src/Cache/CacheType/EmptyCacheType.php (1)

24-27: LGTM! Consistent interface implementation.

The identifier() method correctly implements the new interface requirement, returning an appropriate string identifier for the empty cache type.

src/Cache/CacheType.php (1)

13-13: LGTM! Well-designed interface addition.

The identifier() method declaration is clean and provides a consistent way for all cache types to expose their string identifiers, which is essential for the cache tag collection and profiling functionality.

src/Cache/CacheType/CustomCacheType.php (1)

33-36: LGTM! Efficient implementation reusing existing property.

The identifier() method correctly implements the interface by returning the validated $type property, which is consistent with the existing toString() method behavior.

src/Cache/CacheType/ElementCacheType.php (1)

41-44: LGTM! Appropriate implementation using full enum value.

The identifier() method correctly returns the full enum value ($this->type->value) rather than just the first character like toString() does, which provides more descriptive identification for profiling purposes.

src/NeustaPimcoreHttpCacheBundle.php (1)

27-31: LGTM! Proper compiler pass registration.

The build method correctly calls the parent method first and registers the compiler pass to conditionally disable cache tag collection when profiler is not available.

tests/Integration/Tagging/TagObjectTest.php (1)

161-161: LGTM! Method name now accurately reflects the test scenario.

The method name correction properly indicates that the test verifies the behavior when an object class is disabled in the configuration.

tests/Unit/Cache/ResponseTagger/CacheTagCollectionResponseTaggerTest.php (2)

17-21: LGTM! Proper property declarations following PHP 8.2+ best practices.

All properties are explicitly declared with appropriate type hints, avoiding deprecated dynamic properties.


48-58: Verify forwarding uses the original tags argument
The unit test asserts that innerTagger->tag($tags) is called with the exact $tags passed into CacheTagCollectionResponseTagger::tag(). Please confirm that the implementation in CacheTagCollectionResponseTagger::tag() indeed does:

$this->inner->tag($tags);

rather than using an accumulated property ($this->collectedTags) or other value.

Locations to review:

  • src/…/CacheTagCollectionResponseTagger.php – public function tag(CacheTags $tags)
    • Ensure the call to $this->inner->tag() uses $tags.
  • tests/Unit/Cache/ResponseTagger/CacheTagCollectionResponseTaggerTest.php – Lines 48–58
    • If the implementation is intended to forward accumulated tags instead, update the test to expect $this->collectedTags.
src/DependencyInjection/CompilerPass/DisableCacheTagCollectionPass.php (1)

8-22: LGTM! Proper compiler pass implementation.

The compiler pass correctly implements the conditional logic to disable cache tag collection decoration when the profiler service is not available, following Symfony DI container patterns.

tests/Unit/Cache/DataCollector/CacheTagDataCollectorTest.php (1)

1-62: LGTM! Well-structured test class.

The test class follows proper PHPUnit conventions with:

  • Correct property declarations (addressing PHP 8.2+ requirements from learnings)
  • Appropriate use of Prophecy for mocking
  • Clear test scenarios covering both data collection and reset functionality
  • Proper setup and teardown patterns
src/Cache/CacheTags.php (4)

13-15: LGTM! Appropriate visibility change for cache tag collection.

The change from private to public readonly allows external access to the tags collection while maintaining immutability, which is necessary for the data collector functionality.


22-27: LGTM! Smart optimization with associative array storage.

The change to use associative array indexed by tag string prevents duplicate tags and enables efficient lookups, which is beneficial for the cache tag collection feature.


61-61: LGTM! Correct iterator implementation.

Using array_values() ensures the iterator returns CacheTag objects in the correct order without exposing the internal associative array keys.


88-90: LGTM! Consistent array handling.

The toArray() method correctly uses array_values() to maintain the expected list structure for string conversion.

templates/cache_tags.html.twig (1)

1-82: LGTM! Comprehensive profiler template implementation.

The template provides excellent user experience with:

  • Proper conditional rendering based on tag presence
  • Consistent visual styling with status colors
  • Clear data presentation in both toolbar and detailed panel
  • Appropriate empty state handling
  • Good integration with Symfony profiler conventions
config/services.php (3)

14-16: LGTM! Proper import additions.

The new imports are correctly added for the cache tag collection functionality.


57-59: LGTM! Correct decorator service configuration.

The decorator service is properly configured with:

  • Appropriate priority (1) to wrap the response tagger
  • Correct service dependency injection
  • Proper decoration pattern

95-101: LGTM! Proper data collector service configuration.

The data collector service is correctly configured with:

  • Appropriate dependency injection
  • Correct data_collector tag with template and priority
  • Proper integration with Symfony profiler
src/Cache/DataCollector/CacheTagDataCollector.php (3)

18-21: LGTM! Correct implementation for late data collection.

The empty collect() method with explanatory comment is appropriate since cache tags are added after the response is created, requiring the use of lateCollect().

The static analysis warnings about unused parameters are false positives - these parameters are required by the DataCollector interface.


23-30: LGTM! Proper cache tag data collection.

The lateCollect() method correctly:

  • Accesses the public collectedTags->tags property
  • Extracts tag string and type identifier
  • Stores data in the expected format for template consumption

32-48: LGTM! Complete data collector interface implementation.

The getter, name, and reset methods are properly implemented:

  • getTags() returns correctly typed array with null coalescing
  • getName() returns appropriate collector identifier
  • reset() properly clears collected data
tests/Unit/DependencyInjection/CompilerPass/DisableCacheTagCollectionPassTest.php (1)

1-53: LGTM! Well-structured unit test following established patterns.

The test class properly follows all established conventions:

  • Correct strict_types declaration format
  • Explicit property declarations with type hints
  • Proper use of Prophecy for mocking
  • Comprehensive test coverage for both scenarios (profiler enabled/disabled)
  • Clear test method names and assertions

The test logic correctly verifies that the compiler pass conditionally disables cache tag collection based on profiler availability.

tests/Integration/Tagging/CollectTagsDataTest.php (1)

29-236: Comprehensive test coverage for cache tag collection scenarios.

The test methods provide excellent coverage of various cache tag collection scenarios:

  • Different element types (documents, objects, assets)
  • Custom cache types via event listeners
  • Conditional collection based on configuration
  • Disabled scenarios for type, caching, object subtypes, and classes

The use of attributes for configuration and proper assertions makes the tests clear and maintainable.

coderabbitai bot added a commit that referenced this pull request Jul 10, 2025
Docstrings generation was requested by @jan888adams.

* #26 (comment)

The following files were modified:

* `src/Cache/CacheTags.php`
* `src/Cache/CacheType.php`
* `src/Cache/CacheType/CustomCacheType.php`
* `src/Cache/CacheType/ElementCacheType.php`
* `src/Cache/CacheType/EmptyCacheType.php`
* `src/Cache/DataCollector/CacheTagDataCollector.php`
* `src/Cache/ResponseTagger/CacheTagCollectionResponseTagger.php`
* `src/DependencyInjection/CompilerPass/DisableCacheTagCollectionPass.php`
* `src/NeustaPimcoreHttpCacheBundle.php`
@coderabbitai
Copy link

coderabbitai bot commented Jul 10, 2025

Note

Generated docstrings for this pull request at #35

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
templates/cache_tags.html.twig (2)

12-18: Improve accessibility for SVG icons.

The SVG icons lack proper accessibility attributes, making them less accessible to screen readers and assistive technologies.

Add role="img" and aria-label attributes to the SVG elements:

-<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" stroke="#EEE">
+<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" stroke="#EEE" role="img" aria-label="Cache tags icon">

Also applies to: 36-42


61-76: Enhance table accessibility.

The data table could benefit from better accessibility attributes for screen readers.

Add table caption and improve header association:

 <table class="table">
+    <caption class="sr-only">Cache tags collected during this request</caption>
     <thead>
     <tr>
-        <th>Tag</th>
-        <th>Type</th>
+        <th scope="col">Tag</th>
+        <th scope="col">Type</th>
     </tr>
     </thead>
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 06ac8bb and e10e290.

📒 Files selected for processing (1)
  • templates/cache_tags.html.twig (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: PHPUnit with PHP 8.2 highest
  • GitHub Check: PHPUnit with PHP 8.1 lowest
  • GitHub Check: PHPUnit with PHP 8.1 highest
  • GitHub Check: Quality Checks
🔇 Additional comments (3)
templates/cache_tags.html.twig (3)

1-31: Well-structured profiler toolbar implementation.

The toolbar block correctly implements the Symfony profiler toolbar pattern with conditional status colors and proper integration with the profiler URL.


77-81: Clean empty state implementation.

The empty state message is clear and user-friendly, providing appropriate feedback when no cache tags are present.


69-74: No issues with tag structure in Twig – data collector always provides both fields.

The CacheTagDataCollector’s lateCollect() method explicitly populates

$this->data['tags'][] = [
  'tag'  => $tag->toString(),
  'type' => $tag->type->identifier(),
];

and its docblock declares @return array<array{tag: string, type: string}>.
Since getTags() returns this structure (or an empty array), the template’s tag.tag and tag.type accesses are safe.

@jan888adams jan888adams force-pushed the display-tags-in-symfony-profiler branch from e10e290 to 23f0871 Compare July 11, 2025 13:31
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (2)
templates/profiler.html.twig (2)

3-31: Consider extracting the SVG icon for better maintainability.

The toolbar logic is correct and follows Symfony profiler conventions. However, the inline SVG (lines 12-18) is quite verbose and duplicated in the menu block.

Consider extracting the SVG to a separate Twig macro or using a simpler icon:

+{% macro cache_tag_icon() %}
+    <svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" stroke="#EEE">
+        <!-- SVG content here -->
+    </svg>
+{% endmacro %}

 {% set icon %}
     <span class="sf-toolbar-icon">
-        <svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" stroke="#EEE">
-            <!-- long SVG content -->
-        </svg>
+        {{ _self.cache_tag_icon() }}
         <span class="sf-toolbar-value">{{ collector.tags|length }}</span>
     </span>
 {% endset %}

33-47: Code duplication: SVG icon repeated from toolbar block.

The menu block logic is correct, but the SVG icon (lines 36-42) is duplicated from the toolbar block, violating DRY principles.

Extract the SVG to a reusable Twig macro as suggested in the toolbar block review to eliminate this duplication.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e10e290 and 44b560e.

📒 Files selected for processing (10)
  • config/services.php (3 hunks)
  • src/DataCollector.php (1 hunks)
  • src/DependencyInjection/CompilerPass/DisableDataCollectorPass.php (1 hunks)
  • src/DependencyInjection/NeustaPimcoreHttpCacheExtension.php (1 hunks)
  • src/NeustaPimcoreHttpCacheBundle.php (2 hunks)
  • templates/profiler.html.twig (1 hunks)
  • tests/Integration/Configuration/CollectConfigurationDataTest.php (1 hunks)
  • tests/Integration/Tagging/CollectTagsDataTest.php (1 hunks)
  • tests/Unit/CacheTagDataCollectorTest.php (1 hunks)
  • tests/Unit/DependencyInjection/CompilerPass/DisableDataCollectorPassTest.php (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • config/services.php
  • src/NeustaPimcoreHttpCacheBundle.php
  • tests/Integration/Tagging/CollectTagsDataTest.php
🧰 Additional context used
🧠 Learnings (7)
📓 Common learnings
Learnt from: jan888adams
PR: teamneusta/pimcore-http-cache-bundle#0
File: :0-0
Timestamp: 2025-04-17T08:05:45.864Z
Learning: The PR #18 in teamneusta/pimcore-http-cache-bundle successfully standardized all PHP files in the repository to have the strict_types declaration on the same line as the PHP opening tag (<?php declare(strict_types=1);), except for configuration files (.php-cs-fixer.php and config/services.php) which intentionally omit strict_types declarations.
Learnt from: jan888adams
PR: teamneusta/pimcore-http-cache-bundle#0
File: :0-0
Timestamp: 2025-04-17T08:05:45.864Z
Learning: In the teamneusta/pimcore-http-cache-bundle project, a PR was created to ensure consistent formatting of strict_types declarations across the codebase, with the preferred format being to have the strict_types declaration on the same line as the PHP opening tag (<?php declare(strict_types=1);).
src/DependencyInjection/NeustaPimcoreHttpCacheExtension.php (3)

Learnt from: jan888adams
PR: teamneusta/pimcore-http-cache-bundle#0
File: :0-0
Timestamp: 2025-04-17T08:05:45.864Z
Learning: The PR #18 in teamneusta/pimcore-http-cache-bundle successfully standardized all PHP files in the repository to have the strict_types declaration on the same line as the PHP opening tag (<?php declare(strict_types=1);), except for configuration files (.php-cs-fixer.php and config/services.php) which intentionally omit strict_types declarations.

Learnt from: jan888adams
PR: teamneusta/pimcore-http-cache-bundle#0
File: :0-0
Timestamp: 2025-04-17T08:05:45.864Z
Learning: In the teamneusta/pimcore-http-cache-bundle project, a PR was created to ensure consistent formatting of strict_types declarations across the codebase, with the preferred format being to have the strict_types declaration on the same line as the PHP opening tag (<?php declare(strict_types=1);).

Learnt from: jan888adams
PR: #17
File: tests/Integration/Helpers/ArrangeCacheTest.php:1-2
Timestamp: 2025-04-16T14:39:31.681Z
Learning: In the teamneusta/pimcore-http-cache-bundle project, the preferred formatting style for the strict types declaration is to have it on the same line as the PHP opening tag: <?php declare(strict_types=1); rather than on a separate line.

src/DependencyInjection/CompilerPass/DisableDataCollectorPass.php (3)

Learnt from: jan888adams
PR: teamneusta/pimcore-http-cache-bundle#0
File: :0-0
Timestamp: 2025-04-17T08:05:45.864Z
Learning: The PR #18 in teamneusta/pimcore-http-cache-bundle successfully standardized all PHP files in the repository to have the strict_types declaration on the same line as the PHP opening tag (<?php declare(strict_types=1);), except for configuration files (.php-cs-fixer.php and config/services.php) which intentionally omit strict_types declarations.

Learnt from: jan888adams
PR: teamneusta/pimcore-http-cache-bundle#0
File: :0-0
Timestamp: 2025-04-17T08:05:45.864Z
Learning: In the teamneusta/pimcore-http-cache-bundle project, a PR was created to ensure consistent formatting of strict_types declarations across the codebase, with the preferred format being to have the strict_types declaration on the same line as the PHP opening tag (<?php declare(strict_types=1);).

Learnt from: jan888adams
PR: #17
File: tests/Integration/Helpers/ArrangeCacheTest.php:1-2
Timestamp: 2025-04-16T14:39:31.681Z
Learning: In the teamneusta/pimcore-http-cache-bundle project, the preferred formatting style for the strict types declaration is to have it on the same line as the PHP opening tag: <?php declare(strict_types=1); rather than on a separate line.

tests/Unit/DependencyInjection/CompilerPass/DisableDataCollectorPassTest.php (3)

Learnt from: jan888adams
PR: #14
File: tests/Integration/Invalidation/CancelInvalidationTest.php:29-29
Timestamp: 2025-04-16T09:17:07.113Z
Learning: When writing PHP test classes, all properties (like $client or mock objects) must be explicitly declared with proper type hints at the class level. Dynamic properties (properties assigned without declaration) are deprecated in PHP 8.2+ and will cause warnings.

Learnt from: jdreesen
PR: #13
File: tests/app/bin/console:4-4
Timestamp: 2025-04-01T13:40:08.587Z
Learning: The project uses teamneusta/pimcore-testing-framework (version ^0.12.8) in the require-dev section of composer.json, which provides the Neusta\Pimcore\TestingFramework\Pimcore\BootstrapPimcore class used in the test environment.

Learnt from: jan888adams
PR: teamneusta/pimcore-http-cache-bundle#0
File: :0-0
Timestamp: 2025-04-17T08:05:45.864Z
Learning: The PR #18 in teamneusta/pimcore-http-cache-bundle successfully standardized all PHP files in the repository to have the strict_types declaration on the same line as the PHP opening tag (<?php declare(strict_types=1);), except for configuration files (.php-cs-fixer.php and config/services.php) which intentionally omit strict_types declarations.

tests/Unit/CacheTagDataCollectorTest.php (4)

Learnt from: jan888adams
PR: teamneusta/pimcore-http-cache-bundle#0
File: :0-0
Timestamp: 2025-04-17T08:05:45.864Z
Learning: The PR #18 in teamneusta/pimcore-http-cache-bundle successfully standardized all PHP files in the repository to have the strict_types declaration on the same line as the PHP opening tag (<?php declare(strict_types=1);), except for configuration files (.php-cs-fixer.php and config/services.php) which intentionally omit strict_types declarations.

Learnt from: jdreesen
PR: #13
File: tests/app/bin/console:4-4
Timestamp: 2025-04-01T13:40:08.587Z
Learning: The project uses teamneusta/pimcore-testing-framework (version ^0.12.8) in the require-dev section of composer.json, which provides the Neusta\Pimcore\TestingFramework\Pimcore\BootstrapPimcore class used in the test environment.

Learnt from: jan888adams
PR: teamneusta/pimcore-http-cache-bundle#0
File: :0-0
Timestamp: 2025-04-17T08:05:45.864Z
Learning: In the teamneusta/pimcore-http-cache-bundle project, a PR was created to ensure consistent formatting of strict_types declarations across the codebase, with the preferred format being to have the strict_types declaration on the same line as the PHP opening tag (<?php declare(strict_types=1);).

Learnt from: jan888adams
PR: #14
File: tests/Integration/Invalidation/CancelInvalidationTest.php:29-29
Timestamp: 2025-04-16T09:17:07.113Z
Learning: When writing PHP test classes, all properties (like $client or mock objects) must be explicitly declared with proper type hints at the class level. Dynamic properties (properties assigned without declaration) are deprecated in PHP 8.2+ and will cause warnings.

src/DataCollector.php (3)

Learnt from: jan888adams
PR: teamneusta/pimcore-http-cache-bundle#0
File: :0-0
Timestamp: 2025-04-17T08:05:45.864Z
Learning: The PR #18 in teamneusta/pimcore-http-cache-bundle successfully standardized all PHP files in the repository to have the strict_types declaration on the same line as the PHP opening tag (<?php declare(strict_types=1);), except for configuration files (.php-cs-fixer.php and config/services.php) which intentionally omit strict_types declarations.

Learnt from: jan888adams
PR: teamneusta/pimcore-http-cache-bundle#0
File: :0-0
Timestamp: 2025-04-17T08:05:45.864Z
Learning: In the teamneusta/pimcore-http-cache-bundle project, a PR was created to ensure consistent formatting of strict_types declarations across the codebase, with the preferred format being to have the strict_types declaration on the same line as the PHP opening tag (<?php declare(strict_types=1);).

Learnt from: jan888adams
PR: #17
File: tests/Integration/Helpers/ArrangeCacheTest.php:1-2
Timestamp: 2025-04-16T14:39:31.681Z
Learning: In the teamneusta/pimcore-http-cache-bundle project, the preferred formatting style for the strict types declaration is to have it on the same line as the PHP opening tag: <?php declare(strict_types=1); rather than on a separate line.

tests/Integration/Configuration/CollectConfigurationDataTest.php (4)

Learnt from: jan888adams
PR: teamneusta/pimcore-http-cache-bundle#0
File: :0-0
Timestamp: 2025-04-17T08:05:45.864Z
Learning: The PR #18 in teamneusta/pimcore-http-cache-bundle successfully standardized all PHP files in the repository to have the strict_types declaration on the same line as the PHP opening tag (<?php declare(strict_types=1);), except for configuration files (.php-cs-fixer.php and config/services.php) which intentionally omit strict_types declarations.

Learnt from: jdreesen
PR: #14
File: tests/Integration/ConfigurableWebTestcase.php:17-18
Timestamp: 2025-04-08T16:57:20.877Z
Learning: In the ConfigurableWebTestcase class, the $kernelConfigurations property should be documented as @var list<KernelConfiguration> to accurately reflect it's a sequential list of KernelConfiguration objects.

Learnt from: jdreesen
PR: #13
File: tests/app/bin/console:4-4
Timestamp: 2025-04-01T13:40:08.587Z
Learning: The project uses teamneusta/pimcore-testing-framework (version ^0.12.8) in the require-dev section of composer.json, which provides the Neusta\Pimcore\TestingFramework\Pimcore\BootstrapPimcore class used in the test environment.

Learnt from: jdreesen
PR: #14
File: tests/Integration/ConfigurableWebTestcase.php:17-18
Timestamp: 2025-04-08T16:53:53.232Z
Learning: In the ConfigurableWebTestcase class, the $kernelConfigurations property is an array of KernelConfiguration objects, not a single KernelConfiguration instance.

🧬 Code Graph Analysis (1)
src/DataCollector.php (1)
src/Cache/ResponseTagger/CacheTagCollectionResponseTagger.php (1)
  • CacheTagCollectionResponseTagger (9-24)
🪛 PHPMD (2.15.0)
src/DataCollector.php

20-20: Avoid unused parameters such as '$request'. (Unused Code Rules)

(UnusedFormalParameter)


20-20: Avoid unused parameters such as '$response'. (Unused Code Rules)

(UnusedFormalParameter)


20-20: Avoid unused parameters such as '$exception'. (Unused Code Rules)

(UnusedFormalParameter)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: PHPUnit with PHP 8.1 lowest
  • GitHub Check: PHPUnit with PHP 8.1 highest
  • GitHub Check: PHPUnit with PHP 8.2 highest
🔇 Additional comments (9)
src/DependencyInjection/NeustaPimcoreHttpCacheExtension.php (1)

73-74: LGTM! Clean configuration parameter registration.

The addition of the container parameter follows standard dependency injection patterns, making the elements configuration available to the data collector service.

src/DependencyInjection/CompilerPass/DisableDataCollectorPass.php (1)

8-17: LGTM! Effective conditional service registration.

The compiler pass correctly implements conditional service removal based on profiler availability, preventing unnecessary overhead when profiling is disabled.

tests/Unit/CacheTagDataCollectorTest.php (1)

16-80: LGTM! Comprehensive unit test coverage.

The test class effectively covers the core functionality of the DataCollector with proper mocking, clear assertions, and good separation of concerns across the three test methods.

src/DataCollector.php (1)

11-60: LGTM! Solid DataCollector implementation following Symfony patterns.

The implementation correctly follows Symfony's data collector architecture:

  • Configuration stored in collect() phase
  • Tag data processed in lateCollect() phase after request completion
  • Proper integration with CacheTagCollectionResponseTagger
  • Clean accessor methods and reset functionality

Note: The PHPMD warnings about unused parameters in the collect() method are false positives - these parameters are required by the DataCollectorInterface.

templates/profiler.html.twig (2)

1-2: LGTM!

Correctly extends the Symfony WebProfiler layout following standard conventions.


49-99: LGTM! Well-structured profiler panel implementation.

The panel block correctly implements:

  • Conditional rendering based on data availability
  • Proper use of Symfony profiler CSS classes
  • Clear presentation of both summary and detailed information
  • Configuration data display with appropriate JSON encoding

The structure follows Symfony profiler conventions and provides comprehensive debugging information.

tests/Integration/Configuration/CollectConfigurationDataTest.php (3)

1-30: LGTM! Proper test class structure following project conventions.

The class correctly:

  • Uses the standardized strict_types declaration format
  • Implements appropriate test configuration via attributes
  • Utilizes proper testing framework traits and setup
  • Follows the project's integration testing patterns

32-55: LGTM! Comprehensive test for configuration data collection.

The test properly:

  • Configures profiler to enable data collection
  • Sets up test data and makes realistic HTTP request
  • Verifies correct collector type and configuration data
  • Follows AAA testing pattern with clear assertions

57-75: LGTM! Proper negative test case for disabled profiler.

The test correctly:

  • Configures profiler as disabled to test the negative scenario
  • Uses consistent test setup pattern
  • Verifies that no profile data is collected when profiler is disabled
  • Validates the compiler pass behavior for disabling data collection

@jan888adams jan888adams force-pushed the display-tags-in-symfony-profiler branch from 44b560e to 015166e Compare July 28, 2025 15:15
@jan888adams jan888adams force-pushed the display-tags-in-symfony-profiler branch from 015166e to e287845 Compare July 29, 2025 07:24
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
src/DataCollector.php (2)

21-24: Empty collect(): suppress unused-parameter warnings

The method must exist to satisfy the abstract contract, but the unused parameters trigger PHPMD noise. Prefix them with underscores or add an ignore/suppress attribute to make the intent explicit.

-    public function collect(Request $request, Response $response, ?\Throwable $exception = null): void
-    {
-    }
+    /** @inheritDoc */
+    public function collect(Request $_, Response $__ , ?\Throwable $___ = null): void
+    {
+        // intentionally left blank – collection happens in lateCollect()
+    }

18-19: Pre-initialise the tags storage

Seeding $this->data['tags'] in the constructor avoids undefined-index checks later and makes intent clearer.

     ) {
         $this->data['configuration'] = $this->configuration;
+        $this->data['tags'] = [];
     }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 015166e and e287845.

📒 Files selected for processing (10)
  • config/services.php (3 hunks)
  • src/DataCollector.php (1 hunks)
  • src/DependencyInjection/CompilerPass/DisableDataCollectorPass.php (1 hunks)
  • src/DependencyInjection/NeustaPimcoreHttpCacheExtension.php (1 hunks)
  • src/NeustaPimcoreHttpCacheBundle.php (2 hunks)
  • templates/profiler.html.twig (1 hunks)
  • tests/Integration/Configuration/CollectConfigurationDataTest.php (1 hunks)
  • tests/Integration/Tagging/CollectTagsDataTest.php (1 hunks)
  • tests/Unit/CacheTagDataCollectorTest.php (1 hunks)
  • tests/Unit/DependencyInjection/CompilerPass/DisableDataCollectorPassTest.php (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • tests/Integration/Configuration/CollectConfigurationDataTest.php
🚧 Files skipped from review as they are similar to previous changes (8)
  • src/DependencyInjection/NeustaPimcoreHttpCacheExtension.php
  • src/NeustaPimcoreHttpCacheBundle.php
  • src/DependencyInjection/CompilerPass/DisableDataCollectorPass.php
  • tests/Unit/CacheTagDataCollectorTest.php
  • tests/Unit/DependencyInjection/CompilerPass/DisableDataCollectorPassTest.php
  • config/services.php
  • templates/profiler.html.twig
  • tests/Integration/Tagging/CollectTagsDataTest.php
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: jan888adams
PR: teamneusta/pimcore-http-cache-bundle#0
File: :0-0
Timestamp: 2025-04-17T08:05:45.864Z
Learning: The PR #18 in teamneusta/pimcore-http-cache-bundle successfully standardized all PHP files in the repository to have the strict_types declaration on the same line as the PHP opening tag (<?php declare(strict_types=1);), except for configuration files (.php-cs-fixer.php and config/services.php) which intentionally omit strict_types declarations.
Learnt from: jan888adams
PR: teamneusta/pimcore-http-cache-bundle#0
File: :0-0
Timestamp: 2025-04-17T08:05:45.864Z
Learning: In the teamneusta/pimcore-http-cache-bundle project, a PR was created to ensure consistent formatting of strict_types declarations across the codebase, with the preferred format being to have the strict_types declaration on the same line as the PHP opening tag (<?php declare(strict_types=1);).
src/DataCollector.php (3)

Learnt from: jan888adams
PR: teamneusta/pimcore-http-cache-bundle#0
File: :0-0
Timestamp: 2025-04-17T08:05:45.864Z
Learning: The PR #18 in teamneusta/pimcore-http-cache-bundle successfully standardized all PHP files in the repository to have the strict_types declaration on the same line as the PHP opening tag (<?php declare(strict_types=1);), except for configuration files (.php-cs-fixer.php and config/services.php) which intentionally omit strict_types declarations.

Learnt from: jan888adams
PR: teamneusta/pimcore-http-cache-bundle#0
File: :0-0
Timestamp: 2025-04-17T08:05:45.864Z
Learning: In the teamneusta/pimcore-http-cache-bundle project, a PR was created to ensure consistent formatting of strict_types declarations across the codebase, with the preferred format being to have the strict_types declaration on the same line as the PHP opening tag (<?php declare(strict_types=1);).

Learnt from: jan888adams
PR: #17
File: tests/Integration/Helpers/ArrangeCacheTest.php:1-2
Timestamp: 2025-04-16T14:39:31.681Z
Learning: In the teamneusta/pimcore-http-cache-bundle project, the preferred formatting style for the strict types declaration is to have it on the same line as the PHP opening tag: <?php declare(strict_types=1); rather than on a separate line.

🧬 Code Graph Analysis (1)
src/DataCollector.php (1)
src/Cache/ResponseTagger/CacheTagCollectionResponseTagger.php (1)
  • CacheTagCollectionResponseTagger (9-24)
🪛 PHPMD (2.15.0)
src/DataCollector.php

21-21: Avoid unused parameters such as '$request'. (Unused Code Rules)

(UnusedFormalParameter)


21-21: Avoid unused parameters such as '$response'. (Unused Code Rules)

(UnusedFormalParameter)


21-21: Avoid unused parameters such as '$exception'. (Unused Code Rules)

(UnusedFormalParameter)

@jan888adams jan888adams force-pushed the display-tags-in-symfony-profiler branch 2 times, most recently from 6d599ad to a3f09e4 Compare July 30, 2025 10:47
@jan888adams jan888adams force-pushed the display-tags-in-symfony-profiler branch from a3f09e4 to 5de7513 Compare July 30, 2025 10:50
@jan888adams jan888adams force-pushed the display-tags-in-symfony-profiler branch from 5de7513 to 94125fe Compare July 30, 2025 11:18
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
src/DataCollector.php (1)

23-25: Empty collect() → silence PHPMD or store trivial data

collect() intentionally does nothing (late-collector pattern) but the unused parameters trigger PHPMD warnings. Either:

  1. Add a suppress-warning annotation
  2. Or explicitly unset the parameters.
+/** @SuppressWarnings(PHPMD.UnusedFormalParameter) */
 public function collect(Request $request, Response $response, ?\Throwable $exception = null): void
 {
-}
+    // Intentionally left blank – all work happens in lateCollect().
+}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6d599ad and 94125fe.

📒 Files selected for processing (2)
  • src/DataCollector.php (1 hunks)
  • tests/Unit/CacheTagDataCollectorTest.php (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/Unit/CacheTagDataCollectorTest.php
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: jan888adams
PR: teamneusta/pimcore-http-cache-bundle#0
File: :0-0
Timestamp: 2025-04-17T08:05:45.864Z
Learning: The PR #18 in teamneusta/pimcore-http-cache-bundle successfully standardized all PHP files in the repository to have the strict_types declaration on the same line as the PHP opening tag (<?php declare(strict_types=1);), except for configuration files (.php-cs-fixer.php and config/services.php) which intentionally omit strict_types declarations.
Learnt from: jan888adams
PR: teamneusta/pimcore-http-cache-bundle#0
File: :0-0
Timestamp: 2025-04-17T08:05:45.864Z
Learning: In the teamneusta/pimcore-http-cache-bundle project, a PR was created to ensure consistent formatting of strict_types declarations across the codebase, with the preferred format being to have the strict_types declaration on the same line as the PHP opening tag (<?php declare(strict_types=1);).
src/DataCollector.php (2)

Learnt from: jan888adams
PR: teamneusta/pimcore-http-cache-bundle#0
File: :0-0
Timestamp: 2025-04-17T08:05:45.864Z
Learning: The PR #18 in teamneusta/pimcore-http-cache-bundle successfully standardized all PHP files in the repository to have the strict_types declaration on the same line as the PHP opening tag (<?php declare(strict_types=1);), except for configuration files (.php-cs-fixer.php and config/services.php) which intentionally omit strict_types declarations.

Learnt from: jan888adams
PR: teamneusta/pimcore-http-cache-bundle#0
File: :0-0
Timestamp: 2025-04-17T08:05:45.864Z
Learning: In the teamneusta/pimcore-http-cache-bundle project, a PR was created to ensure consistent formatting of strict_types declarations across the codebase, with the preferred format being to have the strict_types declaration on the same line as the PHP opening tag (<?php declare(strict_types=1);).

🧬 Code Graph Analysis (1)
src/DataCollector.php (1)
src/Cache/ResponseTagger/CacheTagCollectionResponseTagger.php (1)
  • CacheTagCollectionResponseTagger (9-24)
🪛 PHPMD (2.15.0)
src/DataCollector.php

23-23: Avoid unused parameters such as '$request'. (Unused Code Rules)

(UnusedFormalParameter)


23-23: Avoid unused parameters such as '$response'. (Unused Code Rules)

(UnusedFormalParameter)


23-23: Avoid unused parameters such as '$exception'. (Unused Code Rules)

(UnusedFormalParameter)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: PHPUnit with PHP 8.1 highest
  • GitHub Check: PHPUnit with PHP 8.2 highest
  • GitHub Check: PHPUnit with PHP 8.1 lowest

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/Cache/ResponseTagger/CacheTagCollectionResponseTagger.php (1)

11-11: Consider encapsulation by making the property private.

The $collectedTags property is public, which breaks encapsulation and allows external code to modify the internal state directly. Consider making it private and providing a getter method if external access is needed.

-    public CacheTags $collectedTags;
+    private CacheTags $collectedTags;
+
+    public function getCollectedTags(): CacheTags
+    {
+        return $this->collectedTags;
+    }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 94125fe and 6fd5e98.

📒 Files selected for processing (5)
  • src/Cache/ResponseTagger/CacheTagCollectionResponseTagger.php (1 hunks)
  • src/DataCollector.php (1 hunks)
  • tests/Unit/Cache/ResponseTagger/CacheTagCollectionResponseTaggerTest.php (1 hunks)
  • tests/Unit/CacheTagDataCollectorTest.php (1 hunks)
  • tests/Unit/DependencyInjection/CompilerPass/DisableDataCollectorPassTest.php (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • tests/Unit/DependencyInjection/CompilerPass/DisableDataCollectorPassTest.php
  • tests/Unit/CacheTagDataCollectorTest.php
  • tests/Unit/Cache/ResponseTagger/CacheTagCollectionResponseTaggerTest.php
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: jan888adams
PR: teamneusta/pimcore-http-cache-bundle#0
File: :0-0
Timestamp: 2025-04-17T08:05:45.864Z
Learning: The PR #18 in teamneusta/pimcore-http-cache-bundle successfully standardized all PHP files in the repository to have the strict_types declaration on the same line as the PHP opening tag (<?php declare(strict_types=1);), except for configuration files (.php-cs-fixer.php and config/services.php) which intentionally omit strict_types declarations.
Learnt from: jan888adams
PR: teamneusta/pimcore-http-cache-bundle#0
File: :0-0
Timestamp: 2025-04-17T08:05:45.864Z
Learning: In the teamneusta/pimcore-http-cache-bundle project, a PR was created to ensure consistent formatting of strict_types declarations across the codebase, with the preferred format being to have the strict_types declaration on the same line as the PHP opening tag (<?php declare(strict_types=1);).
📚 Learning: the pr #18 in teamneusta/pimcore-http-cache-bundle successfully standardized all php files in the re...
Learnt from: jan888adams
PR: teamneusta/pimcore-http-cache-bundle#0
File: :0-0
Timestamp: 2025-04-17T08:05:45.864Z
Learning: The PR #18 in teamneusta/pimcore-http-cache-bundle successfully standardized all PHP files in the repository to have the strict_types declaration on the same line as the PHP opening tag (<?php declare(strict_types=1);), except for configuration files (.php-cs-fixer.php and config/services.php) which intentionally omit strict_types declarations.

Applied to files:

  • src/Cache/ResponseTagger/CacheTagCollectionResponseTagger.php
  • src/DataCollector.php
📚 Learning: in the teamneusta/pimcore-http-cache-bundle project, a pr was created to ensure consistent formattin...
Learnt from: jan888adams
PR: teamneusta/pimcore-http-cache-bundle#0
File: :0-0
Timestamp: 2025-04-17T08:05:45.864Z
Learning: In the teamneusta/pimcore-http-cache-bundle project, a PR was created to ensure consistent formatting of strict_types declarations across the codebase, with the preferred format being to have the strict_types declaration on the same line as the PHP opening tag (<?php declare(strict_types=1);).

Applied to files:

  • src/DataCollector.php
📚 Learning: in the teamneusta/pimcore-http-cache-bundle project, the preferred formatting style for the strict t...
Learnt from: jan888adams
PR: teamneusta/pimcore-http-cache-bundle#17
File: tests/Integration/Helpers/ArrangeCacheTest.php:1-2
Timestamp: 2025-04-16T14:39:31.681Z
Learning: In the teamneusta/pimcore-http-cache-bundle project, the preferred formatting style for the strict types declaration is to have it on the same line as the PHP opening tag: `<?php declare(strict_types=1);` rather than on a separate line.

Applied to files:

  • src/DataCollector.php
🧬 Code Graph Analysis (1)
src/DataCollector.php (1)
src/Cache/ResponseTagger/CacheTagCollectionResponseTagger.php (4)
  • CacheTagCollectionResponseTagger (9-29)
  • __construct (13-17)
  • tag (19-23)
  • reset (25-28)
🪛 PHPMD (2.15.0)
src/DataCollector.php

23-23: Avoid unused parameters such as '$request'. (Unused Code Rules)

(UnusedFormalParameter)


23-23: Avoid unused parameters such as '$response'. (Unused Code Rules)

(UnusedFormalParameter)


23-23: Avoid unused parameters such as '$exception'. (Unused Code Rules)

(UnusedFormalParameter)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: PHPUnit with PHP 8.1 lowest
  • GitHub Check: PHPUnit with PHP 8.1 highest
  • GitHub Check: PHPUnit with PHP 8.2 highest
🔇 Additional comments (6)
src/Cache/ResponseTagger/CacheTagCollectionResponseTagger.php (2)

13-17: LGTM!

The constructor properly uses dependency injection with readonly modifier and correctly initializes the collected tags to an empty state.


19-28: LGTM!

The tag forwarding logic has been correctly implemented based on previous feedback - only new tags are forwarded to the inner tagger while still accumulating all tags for collection. The reset method properly clears the accumulated state.

src/DataCollector.php (4)

1-11: LGTM!

The class structure follows Symfony data collector conventions properly, with correct strict_types formatting and appropriate use of LateDataCollectorInterface for collecting data after response preparation.


13-21: LGTM!

The constructor properly handles dependency injection and configuration storage. The optional configuration parameter with default empty array is well implemented.


23-35: LGTM!

The collect method is correctly empty since tag collection is deferred to lateCollect(). The lateCollect() method properly extracts and stores tag data. The unused parameters in collect() are required by the interface signature and can be safely ignored.


37-62: LGTM!

The getter methods are properly defensive with null coalescing. The reset() method correctly clears both the data collector's internal state and calls reset on the tagger to prevent tag accumulation across requests, addressing previous architectural concerns.

@jan888adams jan888adams changed the title Display tags in symfony profiler Data collection for profiler Aug 6, 2025
@jan888adams jan888adams force-pushed the display-tags-in-symfony-profiler branch from 4666b5f to a2b7d26 Compare August 7, 2025 12:38
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
tests/Unit/DataCollectorTest.php (1)

47-62: Fix method name typo

The test logic is correct and properly verifies late collection of cache tags. However, there's a minor typo in the method name.

-    public function lateCollect_collect_tag_data(): void
+    public function lateCollect_collects_tag_data(): void
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4666b5f and a2b7d26.

📒 Files selected for processing (3)
  • src/Cache/ResponseTagger/CacheTagCollectionResponseTagger.php (1 hunks)
  • src/DataCollector.php (1 hunks)
  • tests/Unit/DataCollectorTest.php (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/Cache/ResponseTagger/CacheTagCollectionResponseTagger.php
🧰 Additional context used
🧠 Learnings (7)
📓 Common learnings
Learnt from: jan888adams
PR: teamneusta/pimcore-http-cache-bundle#26
File: src/DataCollector.php:30-35
Timestamp: 2025-08-06T08:34:49.797Z
Learning: In the teamneusta/pimcore-http-cache-bundle, the CacheTags class uses an associative array indexed by tag string (array<string, CacheTag>) which automatically deduplicates cache tags when the same tag is added multiple times within the same collection.
Learnt from: jan888adams
PR: teamneusta/pimcore-http-cache-bundle#0
File: :0-0
Timestamp: 2025-04-17T08:05:45.864Z
Learning: The PR #18 in teamneusta/pimcore-http-cache-bundle successfully standardized all PHP files in the repository to have the strict_types declaration on the same line as the PHP opening tag (<?php declare(strict_types=1);), except for configuration files (.php-cs-fixer.php and config/services.php) which intentionally omit strict_types declarations.
Learnt from: jan888adams
PR: teamneusta/pimcore-http-cache-bundle#0
File: :0-0
Timestamp: 2025-04-17T08:05:45.864Z
Learning: In the teamneusta/pimcore-http-cache-bundle project, a PR was created to ensure consistent formatting of strict_types declarations across the codebase, with the preferred format being to have the strict_types declaration on the same line as the PHP opening tag (<?php declare(strict_types=1);).
📚 Learning: in the teamneusta/pimcore-http-cache-bundle, the cachetags class uses an associative array indexed b...
Learnt from: jan888adams
PR: teamneusta/pimcore-http-cache-bundle#26
File: src/DataCollector.php:30-35
Timestamp: 2025-08-06T08:34:49.797Z
Learning: In the teamneusta/pimcore-http-cache-bundle, the CacheTags class uses an associative array indexed by tag string (array<string, CacheTag>) which automatically deduplicates cache tags when the same tag is added multiple times within the same collection.

Applied to files:

  • tests/Unit/DataCollectorTest.php
  • src/DataCollector.php
📚 Learning: the pr #18 in teamneusta/pimcore-http-cache-bundle successfully standardized all php files in the re...
Learnt from: jan888adams
PR: teamneusta/pimcore-http-cache-bundle#0
File: :0-0
Timestamp: 2025-04-17T08:05:45.864Z
Learning: The PR #18 in teamneusta/pimcore-http-cache-bundle successfully standardized all PHP files in the repository to have the strict_types declaration on the same line as the PHP opening tag (<?php declare(strict_types=1);), except for configuration files (.php-cs-fixer.php and config/services.php) which intentionally omit strict_types declarations.

Applied to files:

  • tests/Unit/DataCollectorTest.php
  • src/DataCollector.php
📚 Learning: the project uses `teamneusta/pimcore-testing-framework` (version ^0.12.8) in the require-dev section...
Learnt from: jdreesen
PR: teamneusta/pimcore-http-cache-bundle#13
File: tests/app/bin/console:4-4
Timestamp: 2025-04-01T13:40:08.587Z
Learning: The project uses `teamneusta/pimcore-testing-framework` (version ^0.12.8) in the require-dev section of composer.json, which provides the `Neusta\Pimcore\TestingFramework\Pimcore\BootstrapPimcore` class used in the test environment.

Applied to files:

  • tests/Unit/DataCollectorTest.php
📚 Learning: when writing php test classes, all properties (like $client or mock objects) must be explicitly decl...
Learnt from: jan888adams
PR: teamneusta/pimcore-http-cache-bundle#14
File: tests/Integration/Invalidation/CancelInvalidationTest.php:29-29
Timestamp: 2025-04-16T09:17:07.113Z
Learning: When writing PHP test classes, all properties (like $client or mock objects) must be explicitly declared with proper type hints at the class level. Dynamic properties (properties assigned without declaration) are deprecated in PHP 8.2+ and will cause warnings.

Applied to files:

  • tests/Unit/DataCollectorTest.php
📚 Learning: in the teamneusta/pimcore-http-cache-bundle project, a pr was created to ensure consistent formattin...
Learnt from: jan888adams
PR: teamneusta/pimcore-http-cache-bundle#0
File: :0-0
Timestamp: 2025-04-17T08:05:45.864Z
Learning: In the teamneusta/pimcore-http-cache-bundle project, a PR was created to ensure consistent formatting of strict_types declarations across the codebase, with the preferred format being to have the strict_types declaration on the same line as the PHP opening tag (<?php declare(strict_types=1);).

Applied to files:

  • src/DataCollector.php
📚 Learning: in the teamneusta/pimcore-http-cache-bundle project, the preferred formatting style for the strict t...
Learnt from: jan888adams
PR: teamneusta/pimcore-http-cache-bundle#17
File: tests/Integration/Helpers/ArrangeCacheTest.php:1-2
Timestamp: 2025-04-16T14:39:31.681Z
Learning: In the teamneusta/pimcore-http-cache-bundle project, the preferred formatting style for the strict types declaration is to have it on the same line as the PHP opening tag: `<?php declare(strict_types=1);` rather than on a separate line.

Applied to files:

  • src/DataCollector.php
🧬 Code Graph Analysis (2)
tests/Unit/DataCollectorTest.php (5)
src/Cache/CacheTag.php (1)
  • CacheTag (9-42)
src/Cache/CacheTags.php (1)
  • CacheTags (10-106)
src/Cache/CacheTypeFactory.php (2)
  • CacheTypeFactory (11-31)
  • createFromString (18-25)
src/Cache/ResponseTagger/CacheTagCollectionResponseTagger.php (3)
  • CacheTagCollectionResponseTagger (10-30)
  • tag (20-24)
  • reset (26-29)
src/DataCollector.php (6)
  • DataCollector (11-62)
  • collect (23-26)
  • getConfiguration (48-51)
  • lateCollect (28-35)
  • getTags (40-43)
  • reset (58-61)
src/DataCollector.php (1)
src/Cache/ResponseTagger/CacheTagCollectionResponseTagger.php (4)
  • CacheTagCollectionResponseTagger (10-30)
  • __construct (14-18)
  • tag (20-24)
  • reset (26-29)
🪛 PHPMD (2.15.0)
src/DataCollector.php

23-23: Avoid unused parameters such as '$request'. (Unused Code Rules)

(UnusedFormalParameter)


23-23: Avoid unused parameters such as '$response'. (Unused Code Rules)

(UnusedFormalParameter)


23-23: Avoid unused parameters such as '$exception'. (Unused Code Rules)

(UnusedFormalParameter)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: PHPUnit with PHP 8.2 highest
  • GitHub Check: PHPUnit with PHP 8.1 lowest
  • GitHub Check: PHPUnit with PHP 8.1 highest
🔇 Additional comments (9)
tests/Unit/DataCollectorTest.php (3)

16-32: LGTM - Well-structured test class with proper setup

The test class follows excellent practices with proper property declarations, appropriate use of ProphecyTrait for mocking, and a clean setUp method that correctly initializes the test dependencies.


34-45: LGTM - Configuration collection test is correct

The test properly verifies that configuration data is stored during construction and retrievable via getConfiguration(). The test data structure aligns with the bundle's element configuration format.


64-78: LGTM - Reset functionality test is comprehensive

The test properly verifies that the reset() method clears collected tags while maintaining proper test isolation by setting up the initial state before testing the reset behavior.

src/DataCollector.php (6)

13-21: LGTM - Constructor properly initializes static configuration

The constructor correctly stores the configuration immediately since it's static data that doesn't change between requests. The dependency injection and type hints are well-implemented.


23-26: LGTM - Intentionally empty collect method is correct

The empty implementation is appropriate since all data collection is deferred to lateCollect(). The static analysis warnings about unused parameters are false positives - these parameters are required by the interface contract.


28-35: LGTM - Late collection correctly processes cache tags

The implementation properly iterates through collected tags and stores them in the expected format. The cross-request accumulation concerns from previous reviews have been addressed since Symfony automatically calls reset() after each request.


37-51: LGTM - Getter methods are well-implemented

Both getter methods properly use null coalescing for defensive programming and have accurate return type annotations that match their actual return values.


53-56: LGTM - Data collector name is appropriate

The name clearly identifies this as the Pimcore HTTP cache data collector and aligns with the service configuration.


58-61: Reset method is sufficient for current architecture

The current implementation correctly clears the DataCollector's internal tag storage. While previous reviews suggested also calling reset() on the CacheTagCollectionResponseTagger, the service implements ResetInterface and Symfony's profiler system will handle calling reset() on all resettable services automatically.

Co-authored-by: Jacob Dreesen <[email protected]>
@jan888adams jan888adams merged commit 8dd01f4 into main Aug 13, 2025
5 checks passed
@jan888adams jan888adams deleted the display-tags-in-symfony-profiler branch August 13, 2025 10:58
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.

3 participants