Stacks

Migrate a deprecated API across every callsite in Symfony with Atlas in 2026

Updated 8 min read

To move an entire Symfony codebase off a deprecated function or module onto its replacement without missing a caller, Atlas leverages its `lsp` and `grep` tools to enumerate every callsite, tracks progress with `todowrite`, applies changes via `apply_patch`, and validates each step using `PHPUnit (WebTestCase)` and `PHP-CS-Fixer` through `bash` commands, all within your terminal.

How Atlas finds every deprecated API callsite in Symfony

In 2026, Atlas ensures 100% coverage when migrating deprecated Symfony APIs by combining precise language server protocol (LSP) references with robust keyword searching. This dual approach guarantees that every single callsite, whether explicit or dynamic, is identified and accounted for.

Atlas begins by using its `lsp` tool to invoke the language server's `findReferences` operation on the deprecated symbol. This provides a complete, syntax-aware list of all direct callers within your Symfony project, including those in controllers, services, and Doctrine entities. For instance, if you're deprecating a method in `src/Service/LegacyService.php`, Atlas will find all references across your `src/Controller/`, `src/Service/`, and `src/Entity/` directories. To catch any dynamic or string-based usages that an LSP might miss, Atlas then cross-checks this list with its `grep` tool. This ensures that even references within configuration files like `config/services.yaml` or `config/routes.yaml`, or dynamic calls that might appear in Twig templates or custom bundle extensions, are identified. This comprehensive enumeration prevents any deprecated calls from being silently skipped, a critical step for a clean migration.

Tracking migration progress across a Symfony codebase with Atlas

Tracking progress for a large Symfony API migration is crucial, and Atlas provides a clear, visible workflow by creating 1 `todowrite` entry for each identified callsite. This granular approach ensures that partial progress is always visible and no migration task is ever silently overlooked.

Once Atlas has enumerated every callsite of the deprecated Symfony API, it uses the `todowrite` tool to create a distinct entry for each one. This transforms the migration into a series of manageable, trackable tasks. For example, if a deprecated method is called in `src/Controller/ProductController.php` and `src/Service/OrderProcessor.php`, Atlas will generate two separate `todowrite` entries. This approach provides immediate visibility into the migration's status. As each callsite is addressed and validated, its corresponding `todowrite` entry is marked as complete. This prevents the common pitfall of losing track of remaining work in a large codebase, especially when dealing with multiple bundles or complex service configurations. The `todowrite` entries serve as a persistent checklist, ensuring that the migration proceeds systematically until every single deprecated usage is resolved.

Safely migrating Symfony API calls with Atlas's apply_patch

Atlas safely migrates deprecated Symfony API calls by generating context-anchored patches, ensuring that 0 misapplications occur even if files have drifted. The `apply_patch` tool meticulously seeks the exact hunk context and old lines, failing explicitly rather than guessing, providing robust protection for your codebase.

For each `todowrite` entry, Atlas uses its `apply_patch` tool to perform the actual migration. This tool is designed for maximum safety and reliability. Instead of simply applying changes based on line numbers, `apply_patch` generates a context-anchored patch. This means the patch includes not only the lines to be changed but also surrounding lines of code, known as the 'hunk context,' and the exact 'old_lines' that are expected to be present. If the target file, such as `src/Controller/UserController.php` or `src/Entity/BlogPost.php`, has drifted since the initial enumeration - perhaps due to concurrent development - `apply_patch` will detect this mismatch. Rather than attempting a potentially incorrect modification, it will throw a 'Failed to find expected lines' error. This explicit failure mechanism prevents silent corruption of your Symfony application's code, giving you full control and confidence in every automated change. Atlas will then present the issue for your review, allowing you to resolve any conflicts before proceeding.

Automated testing and formatting for Symfony migrations

After each file modification, Atlas immediately runs affected tests using `PHPUnit (WebTestCase)` to validate changes, often completing in under 1 second for targeted tests. This rapid feedback loop ensures that every migration step maintains the integrity of your Symfony application, followed by `PHP-CS-Fixer` for consistent code style.

A core principle of Atlas's migration workflow is continuous validation. After `apply_patch` modifies a file, Atlas immediately executes the relevant tests using its `bash` tool. For Symfony projects, this means running `bin/phpunit --filter 'Namespace\To\Affected\Test'` or similar targeted `PHPUnit (WebTestCase)` commands. This ensures that the migration of a deprecated API, for example, from `src/Service/OldMailer.php` to `src/Service/NewMailer.php`, does not introduce regressions. Only once the affected tests pass is the corresponding `todowrite` entry marked as completed. This strict gate prevents incomplete or faulty migrations from progressing. Furthermore, Atlas can be configured to run `PHP-CS-Fixer` over the diff of the changes, using a command like `vendor/bin/php-cs-fixer fix --diff --dry-run --rules=@Symfony` to ensure that all new or modified code adheres to your project's coding standards, maintaining a clean and consistent codebase throughout the migration process.

Reviewing and committing Symfony API migrations with Atlas

Every change Atlas proposes for your Symfony application is presented as a unified diff, allowing for a 1-step approval process before writing to disk. This transparent review mechanism, combined with Atlas's deep Git integration, provides complete control over the migration of deprecated APIs.

Atlas prioritizes transparency and user control throughout the migration process. Before any changes are written to your Symfony project's files, Atlas computes a unified diff for every proposed edit. This diff is surfaced directly in the terminal, allowing you to review exactly what will change in files like `src/Controller/DefaultController.php` or `config/services.yaml`. Every Atlas tool call is permission-gated, meaning you explicitly allow, ask for confirmation, or deny its execution. This ensures that no changes are made without your explicit approval. Atlas also reads your Git branches, status, and diffs, and can stage and create commits on your behalf. It snapshots file changes as Git patches, so edits can be easily diffed and rolled back if necessary. This robust review and safety framework ensures that your deprecated API migration in Symfony is not only efficient but also secure and fully auditable, culminating in a final `grep` for the deprecated symbol to confirm zero remaining hits before deleting the old implementation.

Step by step

  1. 01Enumerate every caller of the deprecated Symfony symbol using `atlas lsp findReferences <symbol>` and cross-check with `atlas grep <deprecated_string>` for dynamic usages across your `src/` and `config/` directories.
  2. 02Create one `todowrite` entry per identified callsite, ensuring partial progress is visible and no Symfony-specific migration task is silently skipped.
  3. 03Migrate each callsite using `atlas apply_patch`, which seeks the hunk's context and old_lines, throwing 'Failed to find expected lines' rather than misapplying to a drifted Symfony file.
  4. 04Run the affected `PHPUnit (WebTestCase)` tests with `atlas bash bin/phpunit --filter 'Namespace\To\Affected\Test'` after each file modification, marking the todo completed only once they pass.
  5. 05Apply `PHP-CS-Fixer` over the diff of the changes using `atlas bash vendor/bin/php-cs-fixer fix --diff --dry-run --rules=@Symfony` to maintain code style consistency in your Symfony project.
  6. 06Review the unified diff for each change and approve it, leveraging Atlas's Git integration to stage and commit the migration steps.
  7. 07Finish by running `atlas grep <deprecated_symbol>` across your entire Symfony codebase to confirm zero remaining hits, then delete the old implementation.

Frequently asked questions

How does Atlas ensure it finds every deprecated API call in a Symfony project?
Atlas combines its `lsp` tool for precise, syntax-aware references from the language server with its `grep` tool for keyword-based searches. This dual approach catches both explicit code calls in `src/Controller/` and dynamic or string-based usages often found in Symfony's `config/services.yaml` or `config/routes.yaml`, ensuring no callsite is missed.
Can Atlas handle migrations across multiple Symfony bundles or complex service configurations?
Yes, Atlas's `lsp` and `grep` tools operate across your entire project, including all bundles and service definitions. It can read your `composer.json` and `config/services.yaml` to build a comprehensive index, ensuring that deprecated API calls within any part of your Symfony application, from `src/` to `vendor/`, are identified and tracked.
What happens if a file changes while Atlas is migrating a deprecated Symfony API?
Atlas's `apply_patch` tool uses context-anchored patches. If a file like `src/Entity/User.php` has drifted since the initial enumeration, `apply_patch` will detect that the expected 'old_lines' are no longer present. It will then explicitly fail with 'Failed to find expected lines' rather than misapplying the patch, protecting your Symfony codebase from unintended changes.
How does Atlas integrate with Symfony's testing framework, PHPUnit?
After each file modification, Atlas uses its `bash` tool to execute targeted `PHPUnit (WebTestCase)` commands, such as `bin/phpunit --filter 'Namespace\To\Affected\Test'`. This immediate feedback loop ensures that every change made during the deprecated API migration in your Symfony project is validated against your existing test suite before proceeding.
Does Atlas help maintain code style during a Symfony API migration?
Absolutely. Atlas can be configured to run `PHP-CS-Fixer` over the diff of the changes after each modification. Using commands like `vendor/bin/php-cs-fixer fix --diff --dry-run --rules=@Symfony`, Atlas ensures that all migrated code adheres to your project's coding standards, maintaining consistency across your Symfony application.
How does Atlas ensure safety and allow for review of changes in Symfony?
Atlas operates with a permission-gated system, requiring your approval for every tool call. It presents a unified diff for every proposed file edit, allowing you to review changes before they are written. Furthermore, Atlas integrates with Git, enabling it to stage and create commits on your behalf and snapshot changes as patches for easy rollback, providing full control over your Symfony codebase.

Try Atlas in your terminal

The terminal-native AI coding agent. Free core, single binary.

Install Atlas

Related guides

Migrate a Deprecated API Across Every Callsite with Atlas (2026 Workflow)

How to migrate a deprecated API across every callsite with Atlas in 2026: the lsp tool's findReferences enumerates callers, todowrite tracks them, apply_patch migrates each one.

Atlas for Symfony in 2026

Atlas is a terminal-native AI coding agent for Symfony in 2026. It reads autowired services and Doctrine mappings, and shows migration SQL before anything runs.

Onboard to an Unfamiliar Symfony Codebase with Atlas in 2026

Atlas helps Symfony developers quickly build a mental model of unfamiliar code. Semantic search, code navigation, and safe exploration reveal services, entities, and controllers.

Document a Module with a README in Symfony with Atlas in 2026

Learn how Atlas, the terminal-native AI agent, helps Symfony developers in 2026 generate accurate READMEs for modules. It uses lsp, read, and bash to document current code behavior, not outdated specs, ensuring

Plan a Multi-File Change Before Editing in Symfony with Atlas in 2026

Design and review complex, multi-file changes in your Symfony application with Atlas, the terminal-native AI coding agent. Get approval before modifying a single line of code.

Trace a runtime bug from a stack trace in Symfony with Atlas in 2026

Pinpoint runtime bugs in Symfony applications from production stack traces using Atlas. Go from error to fix, leveraging Symfony's toolchain like Composer and PHPUnit, without a debugger attached.

Review a Pull Request in Symfony with Atlas in 2026

In 2026, Atlas helps Symfony developers review pull requests by providing deep context beyond the diff. Catch subtle bugs in your bundles, services, and Doctrine entities with intelligent code analysis and real Symfony

Extract a Shared Helper from Duplicated Code in Symfony with Atlas in 2026

Streamline your Symfony codebase in 2026 by extracting duplicated logic into a single, tested helper using Atlas. Find semantic duplicates, create new services, and apply changes with confidence, all integrated with

Browse this resource hub