Adjust the function argument spacing in DocParserTest.php

Created on 11 January 2023, almost 2 years ago
Updated 14 March 2023, almost 2 years ago

Problem/Motivation

Adjust the function argument spacing in DocParserTest.php

core/tests/Drupal/Tests/Component/Annotation/Doctrine/DocParserTest.php

There are 29 instances, some of them are stated below.

        $parser->setTarget(Target::TARGET_CLASS);
        $this->assertNotNull($parser->parse($docComment,$context));


        $property   = $class->getProperty('foo');
        $docComment = $property->getDocComment();
        $context    = 'property ' . $class->getName() . "::\$" . $property->getName();

        $parser->setTarget(Target::TARGET_PROPERTY);
        $this->assertNotNull($parser->parse($docComment,$context));



        $method     = $class->getMethod('someFunction');
        $docComment = $property->getDocComment();
        $context    = 'method ' . $class->getName() . '::' . $method->getName() . '()';

        $parser->setTarget(Target::TARGET_METHOD);
        $this->assertNotNull($parser->parse($docComment,$context));
    /**
     * @dataProvider getAnnotationVarTypeProviderValid
     */
    public function testAnnotationWithVarType($attribute, $value)
    {
        $parser     = $this->createTestParser();
        $context    = 'property SomeClassName::$invalidProperty.';
        $docblock   = sprintf('@Drupal\Tests\Component\Annotation\Doctrine\Fixtures\AnnotationWithVarType(%s = %s)',$attribute, $value);
        $parser->setTarget(Target::TARGET_PROPERTY);

        $result = $parser->parse($docblock, $context);

    /**
     * @dataProvider getAnnotationVarTypeProviderInvalid
     */
    public function testAnnotationWithVarTypeError($attribute,$type,$value,$given)
    {
        $parser     = $this->createTestParser();
        $context    = 'property SomeClassName::invalidProperty.';

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

๐Ÿ“Œ Task
Status

Closed: won't fix

Version

10.1 โœจ

Component
Otherย  โ†’

Last updated about 3 hours ago

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia anmolgoyal74

Live updates comments and jobs are added and updated live.
  • Novice

    It would make a good project for someone who is new to the Drupal contribution process. It's preferred over Newbie.

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.

  • The Needs Review Queue Bot โ†’ tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

    Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.

    Consult the Drupal Contributor Guide โ†’ to find step-by-step guides for working with issues.

  • Issue was unassigned.
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia PrabuEla chennai
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia kkalashnikov Ghaziabad, India
  • Status changed to Needs review almost 2 years ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia kkalashnikov Ghaziabad, India
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia nayana_mvr

    Reviewed the patch #46 and tested it on Drupal version 10.1.x. The patch applied cleanly and the spacing issues mentioned in the ticket are fixed. I can see that some coding standard issue are also fixed along with this patch but now there are some other coding standard issues. Please see the attached files for reference.

  • Status changed to Needs work almost 2 years ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Should instances like

    /**
    * @SomeAnnotationClassNameWithoutConstructor(data = "Some data")
    */
    DOCBLOCK;

    Also be adjusted?

    How come this wasn't caught by phpstan rules?

  • Kaushik1216 โ†’ made their first commit to this issueโ€™s fork.

  • @kaushik1216 opened merge request.
  • First commit to issue fork.
  • First commit to issue fork.
  • Status changed to Needs review almost 2 years ago
  • Status changed to Closed: won't fix almost 2 years ago
  • ๐Ÿ‡ณ๐Ÿ‡ฟNew Zealand quietone

    Thanks for the interest in working on Drupal coding standards โ†’ !

    Unfortunately, what has been missed here is that ./core/tests/Drupal/Tests/Component/Annotation/Doctrine/ is specifically excluded from Coding standards. In phpcs.xml.dist there is this block:

     <!-- Exclude third-party code maintained within core that does not follow our standards. -->
      <!-- @todo This rule may be removed when https://www.drupal.org/node/1848264 is resolved. -->
      <exclude-pattern>./core/lib/Drupal/Component/Diff/</exclude-pattern>
      <exclude-pattern>./core/tests/Drupal/Tests/Component/Annotation/Doctrine/</exclude-pattern>
    

    were we see the comment tells use that this is "third-party code" and it does not meet our standards.

    Another thing to know is that in order to fix core coding standards in a maintainable way, all our coding standards issues should be done on a per-rule basis across all of core, rather than fixing standards in individual modules or files. The meta issue for coding standards is ๐Ÿ“Œ [Meta] Fix coding standards in core Active . From there you can find the child issues for PHP, which is a Meta listing many child issues. If you wish to continue working to get Drupal to comply with our Coding Standards, I suggest selecting one of the existing child issues that needs work to complete.

    There is also a Drupal Slack channel, #coding-standards, where you can join others interested in the Coding Standards process in Drupal core.

    Cheers!

Production build 0.71.5 2024