Problem/Motivation

We have a couple of compatibility breaks we want to do, so we need to make a new major version: Coder 9.x

Proposed resolution

Create a new 9.x git branch and start the work there.

Items we want to do:
* #3548073: Update php_codesniffer to 4.0
* #3553265: Remove empty VariableAnalysis sniff and all deprecated functionality
* #3556778: Fix spelling in sniff error codes
* Go through all sniffs and try to replace them with upstream sniffs from PHPS or Slevomat or others.

Remaining tasks

All TODOs seem to be done and we are aiming to release 9.0 in January 2026.

API changes

Requirements

  • Minimum PHP version requirement is now 7.4

Dependency

  • PHPCS updated to 4.x

Changes to sniffs

Replaced

  1. Drupal.Arrays.DisallowLongArraySyntax ===> Generic.Arrays.DisallowLongArraySyntax
  2. Drupal.Classes.ClassCreateInstance ===> SlevomatCodingStandard.ControlStructures.NewWithParentheses
  3. Drupal.Classes.ClassFileName ===> Squiz.Classes.ClassFileName
  4. Drupal.Classes.InterfaceName ===> Generic.NamingConventions.InterfaceNameSuffix
  5. Drupal.Classes.UnusedUseStatement ===> SlevomatCodingStandard.Namespaces.UnusedUses and SlevomatCodingStandard.Namespaces.UseFromSameNamespace
  6. Drupal.Classes.UseLeadingBackslash ===> SlevomatCodingStandard.Namespaces.UseDoesNotStartWithBackslash
  7. Drupal.ControlStructures.CaseSemicolon ===> PSR2.ControlStructures.SwitchDeclaration (but PSR2.ControlStructures.SwitchDeclaration.BodyOnNextLineCASE and PSR2.ControlStructures.SwitchDeclaration.BreakIndent disabled)
  8. Drupal.ControlStructures.ElseIf is ===> PSR2.ControlStructures.ElseIfDeclaration
  9. Drupal.ControlStructures.InlineControlStructure is ===> Generic.ControlStructures.InlineControlStructure
  10. Drupal.Methods.MethodDeclaration ===> PSR2.Methods.MethodDeclaration
  11. Drupal.WhiteSpace.Namespace ===> Generic.WhiteSpace.LanguageConstructSpacing
  12. DrupalPractice.CodeAnalysis.VariableAnalysis ===> VariableAnalysis.CodeAnalysis.VariableAnalysis

Removed

  1. Drupal.Commenting.DataTypeNamespace
  2. Drupal.Functions.FunctionDeclaration

Renamed

  1. Drupal.Commenting.FileComment.TeamplateSpacingAfterComment ===> Drupal.Commenting.FileComment.TemplateSpacingAfterComment
  2. Drupal.Commenting.FunctionComment.TrhowsCommentIndentation ===> Drupal.Commenting.FunctionComment.ThrowsCommentIndentation
  3. Drupal.InfoFiles.ClassFiles.UnecessaryFileDeclaration ===> Drupal.InfoFiles.ClassFiles.UnnecessaryFileDeclaration
  4. DrupalPractice.General.OptionsTSniff.TforValue ===> DrupalPractice.General.OptionsTSniff.OptionsValue

Issue fork coder-3552621

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

klausi created an issue. See original summary.

arkener’s picture

With this new major version, should we also consider dropping support for Drupal 7 in Coder?

klausi’s picture

Issue tags: +Vienna2025

I would like to keep Drupal 7 support as I'm still running lots of Drupal 7 sites and use Coder as part of the dev process :)

klausi’s picture

Version: 8.3.x-dev » 9.x-dev
klausi’s picture

Issue summary: View changes

The biggest chunk of work was done in #3548073: Update php_codesniffer to 4.0.

I started to replace some sniffs with sniffs from Slevomat, which is nice to reduce the code to maintain in Coder.

klausi’s picture

Issue summary: View changes
klausi’s picture

Issue summary: View changes
klausi’s picture

Issue summary: View changes
klausi’s picture

Issue summary: View changes
klausi’s picture

Coder 9.0.0-alpha1 released, but I plan to check some more sniffs we could remove by upstream sniffs. https://www.drupal.org/project/coder/releases/9.0.0-alpha1

thejimbirch’s picture

Issue summary: View changes

Typo fix. Thanks for the great documentation.

klausi’s picture

Issue summary: View changes
klausi’s picture

Issue summary: View changes
klausi’s picture

Issue summary: View changes
klausi’s picture

Issue summary: View changes

  • klausi committed 822df190 on 9.x
    fix(phpcs): Require 4.0.1 to resolve some known issues (#3552621)
    
klausi’s picture

Issue summary: View changes

  • klausi authored e0a63c5f on 9.x
    style(phpcs): Adapt same code style as in PHPCS 4 (#3552621)
    
    
klausi’s picture

Issue summary: View changes
klausi’s picture

Issue summary: View changes
klausi’s picture

Issue summary: View changes

  • klausi authored 0ae707a2 on 9.x
    refactor(MethodScope): Update sniff implementation from upstream (#...

  • klausi authored 1e0bfdd0 on 9.x
    refactor(ValidFunctionName): Simplify method name checking, underscores...
klausi’s picture

Coder 9.0.0-alpha2 released 🚀

2 new features: now checking that trait names end with "Trait" and that there is a newline before the finally keyword.

Lots of other refactoring in the background to use upstream sniffs that already exist in PHPCS and Slevomat.

https://www.drupal.org/project/coder/releases/9.0.0-alpha2

TODO:
* Replace ValidClassName sniff with sniff from upstream
* Move CI from Github to drupal.org Gitlab
* Check all sniffs to find more that we can replace with upstream ones.

klausi’s picture

Issue summary: View changes

I checked ValidClassName sniff and I think we want to keep it for now, as it is a bit different than upstream.

I also did not find any upstream replacements for the remaining sniff and would keep them as is now.

From my point of view everything is ready for a 9.0 release. I'm aiming to do that in January 2026.

Let me know if you want any API breaking changes that we should get in before 9.0!

  • klausi committed fa94dd17 on 9.x
    refactor(composer): Bump dependencies to latest versions (#3552621)
    

  • klausi committed 2ccd5c9d on 9.x
    test(gitlab): Enable PHP 8.5 testing (#3552621)
    
klausi’s picture

Issue summary: View changes

Adapting API changes for Drupal.Commenting.DataTypeNamespace, we removed the Slevomat replacement again in #3360163: Stop using FQCN in @param @var @return annotations.

klausi’s picture

Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

quietone’s picture

Component: Coder Sniffer » Code

It was difficult for me to read through the list of sniffs so I did some re-formatting,

Requirements

  • Minimum PHP version requirement is now 7.4

Dependency

  • PHPCS updated to 4.x

Changes to sniffs

Replaced

  1. Drupal.Arrays.DisallowLongArraySyntax ===> Generic.Arrays.DisallowLongArraySyntax
  2. Drupal.Classes.ClassCreateInstance ===> SlevomatCodingStandard.ControlStructures.NewWithParentheses
  3. Drupal.Classes.ClassFileName ===> Squiz.Classes.ClassFileName
  4. Drupal.Classes.InterfaceName ===> Generic.NamingConventions.InterfaceNameSuffix
  5. Drupal.Classes.UnusedUseStatement ===> SlevomatCodingStandard.Namespaces.UnusedUses and SlevomatCodingStandard.Namespaces.UseFromSameNamespace
  6. Drupal.Classes.UseLeadingBackslash ===> SlevomatCodingStandard.Namespaces.UseDoesNotStartWithBackslash
  7. Drupal.ControlStructures.CaseSemicolon ===> PSR2.ControlStructures.SwitchDeclaration (but PSR2.ControlStructures.SwitchDeclaration.BodyOnNextLineCASE and PSR2.ControlStructures.SwitchDeclaration.BreakIndent disabled)
  8. Drupal.ControlStructures.ElseIf is ===> PSR2.ControlStructures.ElseIfDeclaration
  9. Drupal.ControlStructures.InlineControlStructure is ===> Generic.ControlStructures.InlineControlStructure
  10. Drupal.Methods.MethodDeclaration ===> PSR2.Methods.MethodDeclaration
  11. Drupal.WhiteSpace.Namespace ===> Generic.WhiteSpace.LanguageConstructSpacing
  12. DrupalPractice.CodeAnalysis.VariableAnalysis ===> VariableAnalysis.CodeAnalysis.VariableAnalysis

Removed

  1. Drupal.Commenting.DataTypeNamespace
  2. Drupal.Functions.FunctionDeclaration

Renamed

  1. Drupal.Commenting.FileComment.TeamplateSpacingAfterComment ===> Drupal.Commenting.FileComment.TemplateSpacingAfterComment
  2. Drupal.Commenting.FunctionComment.TrhowsCommentIndentation ===> Drupal.Commenting.FunctionComment.ThrowsCommentIndentation
  3. Drupal.InfoFiles.ClassFiles.UnecessaryFileDeclaration ===> Drupal.InfoFiles.ClassFiles.UnnecessaryFileDeclaration
  4. DrupalPractice.General.OptionsTSniff.TforValue ===> DrupalPractice.General.OptionsTSniff.OptionsValue
klausi’s picture

Issue summary: View changes

thanks, copied to the issue summary, will also copy to release notes.

klausi’s picture

Issue summary: View changes

fixed HTML

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.