Skip to content

Undefined array key "comment_closer" #1300

@joachim-n

Description

@joachim-n

Describe the bug

I use PHPCS as part of the unit tests for https://github.com/drupal-code-builder/drupal-code-builder. The code that runs PHPCS is within a custom PHPUnit constraint class: https://github.com/drupal-code-builder/drupal-code-builder/blob/4.5.x/Test/Constraint/CodeAdheresToCodingStandards.php

I've tried updating PHPCS to 4.0.0, and now when I run my tests I get this error:

1) /Users/joachim/Sites/dcb-repos-9/vendor/slevomat/coding-standard/SlevomatCodingStandard/Helpers/DocCommentHelper.php:70
Undefined array key "comment_closer"


Triggered by:

* DrupalCodeBuilder\Test\Unit\ComponentContentEntityType10Test::testContentEntityTypeFunctionalityOptions#owner
  /Users/joachim/Sites/dcb-repos-9/repos/drupal-code-builder/Test/Unit/ComponentContentEntityType10Test.php:179

I get this by running the tests in the one test class:

 vendor/bin/phpunit repos/drupal-code-builder/Test/Unit/ComponentContentEntityType10Test.php  --stop-on-defect 

What's really weird is that if I run JUST the test that is causing the error, it passes:

vendor/bin/phpunit repos/drupal-code-builder/Test/Unit/ComponentContentEntityType10Test.php  --stop-on-defect --filter=testEntityTypeWithTranslation

Versions (please complete the following information)

Operating System MacOS 13.7.8
PHP version 8.3.8
PHP_CodeSniffer version 4.0.0
Standard custom
Install type Composer local

Additional context

Add any other context about the problem here.

Please confirm

  • I have searched the issue list and am not opening a duplicate issue.
  • I have read the Contribution Guidelines and this is not a support question.
  • I confirm that this bug is a bug in PHP_CodeSniffer and not in one of the external standards.
  • I have verified the issue still exists in the 4.x branch of PHP_CodeSniffer.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions