10 Cleanup

This step helps review and clean up migration artifacts, commented code, and TODO markers left during the migration process.

When to do this step:

  • After completing all migration steps

  • Before final testing and validation

  • Before creating pull requests


1. Find and Review TODO Markers

Search for TODO comments left during migration:

# Search for TODO in PHP files
grep -rn "TODO" src/ --include="*.php"

# Search for TODO in config files
grep -rn "TODO" config/ --include="*.yaml" --include="*.xml"

For each TODO found:

  • Check if the migration step was completed

  • If completed β†’ remove the TODO

  • If not completed β†’ decide if it should be done now or tracked in an issue


2. Find and Review Commented Code

Search for large commented blocks that might be migration leftovers:

Common patterns to look for:

  • Commented sylius_ui configuration in Extension.php

  • Commented event subscribers

  • Commented old template code

  • Commented routing configuration

For each finding:

  1. Read the full context

  2. Determine if it's obsolete:

    • Was this migrated to Twig Hooks? β†’ Remove

    • Was this replaced by Live Component? β†’ Remove

    • Was this moved to assets/? β†’ Remove

    • Is this still needed for reference? β†’ Keep with explanation

  3. Remove if obsolete

Example - Removing obsolete sylius_ui configuration:

In src/DependencyInjection/Extension.php:

If Twig Hooks migration is complete and JavaScript was migrated β†’ remove this entire block.


3. Check for Orphaned Template Files

Look for old template files that should have been removed:

Common orphaned templates:

  • _javascripts.html.twig (replaced by assets or Live Components)

  • _form.html.twig (replaced by Twig Hooks)

  • _breadcrumb.html.twig (integrated into new structure)

For each orphaned template:

  1. Check if it's still referenced anywhere:

  2. If not used β†’ remove:


4. Validate After Cleanup

After removing code, validate everything still works:

All commands should complete without errors.


5. Final Verification

Run a final check for remaining migration markers:

Review the results:

  • Some TODOs are fine (unrelated to migration)

  • Some comments are documentation (keep those)

  • Migration-related items should be minimal or zero


Checklist

After completing this step:

  • βœ… All migration-related TODOs reviewed and resolved

  • βœ… Obsolete commented code removed

  • βœ… Orphaned template files removed

  • βœ… Container compiles without errors

  • βœ… Cache clears successfully

  • βœ… Routes and hooks validated


What NOT to Remove

Keep these items:

  • TODOs unrelated to migration

  • Comments explaining complex logic

  • Commented code showing "why" something was done differently

  • PHPDoc comments

  • Debug comments that might be useful

Remove these items:

  • TODOs about "Migrate to Twig Hooks" if migration is complete

  • Commented sylius_ui blocks if replaced with Twig Hooks

  • Old template includes if replaced by assets or Live Components

  • Commented event subscribers if logic moved elsewhere

  • Old routing configuration that was replaced


Tips

  • Review in small batches - Don't try to clean everything at once

  • Use version control - Commit cleanup changes separately from functional changes

  • Test after each removal - Make sure nothing breaks

  • When in doubt, keep it - Better to have extra comments than break something

Last updated

Was this helpful?