[policy] Remove DI verbosity by removing unnecessary doc lines

Created on 3 March 2014, about 11 years ago
Updated 16 July 2024, 9 months ago

Spin off from #2134513-55: [policy, no patch] Trait strategy β†’ . Since that issue is only making traits for a small subset of controller dependencies, we'll still be left with constructor injection of some dependencies in many controllers. As pointed out in that comment, a separate PHPDoc for each protected variable plus each constructor parameter is both redundant, and also unnecessary entirely given proper type hints, variable names, and an IDE that's capable of autocompleting on static code analysis (e.g., PhpStorm).

Proposal: combine declaration of DI property variables, __construct(), and create() into a single section of code, with only a single, minimal, PHPDoc for the entire combination.

Goal: to reduce the verbosity of implementing DI within controllers, so that it's less intimidating, and distracts less from the actual logic of the controller.

πŸ“Œ Task
Status

Closed: duplicate

Component

Coding Standards

Created by

πŸ‡ΊπŸ‡ΈUnited States effulgentsia

Live updates comments and jobs are added and updated live.
  • Coding standards

    It involves compliance with, or the content of coding standards. Requires broad community agreement.

  • Needs issue summary update

    Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡³πŸ‡ΏNew Zealand quietone

    There are now other issues about removing unnecessary doc lines have been created to work on this is small increments. I've added those as related. For this issue, I think it best to close in deference to the others. I am closing this as a duplicate and transferring credit to 🌱 Allow constructor methods to omit docblocks Fixed which seems the closest fit.

Production build 0.71.5 2024