Skip to content

#57 - Mark the classes not meant to be extended @final and the infrastructure classes @internal - #60

Merged
njoubert-cleverage merged 1 commit into
mainfrom
57
Oct 19, 2026
Merged

njoubert-cleverage merged 1 commit into
mainfrom
57

Conversation

@njoubert-cleverage

Copy link
Copy Markdown
Member

Description

Fixes #57. Same model as cleverage/process-bundle#279: annotations only, so that the classes not meant to be extended can become final in 4.0.

  • @final since 3.3 (final in 4.0): the concrete tasks (DatabaseReaderTask, DatabaseUpdaterTask, DoctrineReaderTask, DoctrineWriterTask, DoctrineBatchWriterTask, DoctrineCleanerTask, DoctrineDetacherTask, DoctrineRefresherTask, DoctrineRemoverTask, ClearEntityManagerTask) and CleverAgeDoctrineProcessBundle. Extending them triggers a deprecation with the Symfony DebugClassLoader.
  • Stay open: AbstractDoctrineTask and AbstractDoctrineQueryTask.
  • @internal: CleverAgeDoctrineProcessExtension.
  • Tests: DatabaseReaderTaskTest, DatabaseUpdaterTaskTest and DoctrineReaderTaskTest extended the tasks with anonymous classes (16 tests) to inject the options and the connection, which PHPStan rejects once the tasks are @final (and which would fail in 4.0). They now build the real task: the options are returned by the mocked ProcessState::getContextualizedOptions() and the connection by the ManagerRegistry stub, so the option resolution and getConnection() are tested too (line coverage 286/286).

Checked in the container (composer update, PHP 8.5): PHPUnit with pcov, PHPStan, PHP-CS-Fixer and Rector OK.

Requirements

  • Documentation updates
    • Reference
    • Changelog
  • Unit tests

Breaking changes

None in 3.3: annotations only (extending a @final class triggers a deprecation). Major (4.0): the @final classes become final, the @internal classes are not covered by the BC promise.

🤖 Generated with Claude Code

…tructure classes @internal

- @Final since 3.3 (final in 4.0): the concrete tasks (DatabaseReaderTask,
  DatabaseUpdaterTask, DoctrineReaderTask, DoctrineWriterTask,
  DoctrineBatchWriterTask, DoctrineCleanerTask, DoctrineDetacherTask,
  DoctrineRefresherTask, DoctrineRemoverTask, ClearEntityManagerTask) and
  CleverAgeDoctrineProcessBundle. Extending them triggers a deprecation with
  the Symfony DebugClassLoader.
- Stay open: AbstractDoctrineTask and AbstractDoctrineQueryTask.
- @internal: CleverAgeDoctrineProcessExtension.
- Tests of DatabaseReaderTask, DatabaseUpdaterTask and DoctrineReaderTask no
  longer extend the tasks with anonymous classes: the options are given by the
  mocked ProcessState (getContextualizedOptions()) and the connection by the
  ManagerRegistry stub, so the real option resolution and getConnection() are
  tested.
- Same model as cleverage/process-bundle#279.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@njoubert-cleverage
njoubert-cleverage merged commit fae32b9 into main Oct 19, 2026
22 checks passed
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.

Define the public API: mark classes @final or @internal

1 participant