Problem/Motivation

We have a script that generates proxy classes at core/scripts/generate-proxy-class.php. The output from this does not follow coding standards and all files are prefixed with // @codingStandardsIgnoreFile.

Steps to reproduce

Proposed resolution

Alter the script to write coding standards compliant files.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

CommentFileSizeAuthor
#6 3208698.patch8.39 KBlongwave

Issue fork drupal-3208698

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

longwave created an issue. See original summary.

longwave’s picture

Issue tags: +Coding standards
spokje’s picture

Assigned: Unassigned » spokje
Status: Active » Needs work

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

spokje’s picture

Assigned: spokje » Unassigned
longwave’s picture

StatusFileSize
new8.39 KB

First stab at this, using core/lib/Drupal/Core/ProxyClass/Cron.php as a sample file for testing.

This leaves us with three issues:

  3 | ERROR | [x] Namespaced classes, interfaces and traits should not begin with a file doc comment
 14 | ERROR | [x] Namespaced classes/interfaces/traits should be referenced with use statements
 47 | ERROR | [x] Namespaced classes/interfaces/traits should be referenced with use statements

To fix the first we need to move the proxy class generator comment elsewhere.

To fix the other two we need to collect use statements and inject them in the correct place at the top of the file, and use short class names elsewhere.

However I've realised that 1. this lives in the Component namespace and 2. it effectively follows PSR-2, so maybe we should just leave it alone?

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

nikolay shapovalov’s picture

Having code that violates code standards so much is bad example.
I opened Drupal\Core\ProxyClass\Batch\BatchStorage and was thinking that some code styles at my IDE broke.
I was not expected to have php code in core, that use 4 spaces as indentation.
As mentioned at #6, current patch provide fix some code styles rules.
Let's implement changes and just ignore few code styles rules instead of all rules.

Adding related idea to implement Property promotion for generated class.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.