Page MenuHomePhabricator

Move all ContentTranslation PHP files under a namespace
Open, MediumPublic

Description

Current status and recommendations:

  • includes: ok
  • api: Should be moved to includes/ActionApi (my preference) or includes/Api (widely used).
  • specials: Can be moved directly under includes for now.
  • scripts: Currently mixed use of namespaces. Could try moving the actual code to includes/MaintenanceScript and leave the scripts as simple entry point wrappers. Alternatively add prefix ContentTranslation\Maintenance(Script) to autoloader.
  • tests/phpunit: Consistently use ContentTranslation\Tests namespace prefix mirroring the main namespace structure.

Benefits:

  • No longer need to register each individual php file in extension.json.
  • Consistent use of namespace in all code files, makes copy-pasting code easier and avoids accidentally introducing issues.
  • Less top level directories, making it easier to navigate the repository.

Notes:

  • This would break backwards compatibility if someone would reference our classes externally. To my knowledge this is not happening.
  • This could introduce regressions if mistakes in the migration were made. Suggest using an IDE to do the changes that allows checking for such things.