Skip to content

Class properties that have types should not require a DocBlock#406

Open
aligent-lturner wants to merge 7 commits into
magento:developfrom
aligent-lturner:feature/typed_class_properties
Open

Class properties that have types should not require a DocBlock#406
aligent-lturner wants to merge 7 commits into
magento:developfrom
aligent-lturner:feature/typed_class_properties

Conversation

@aligent-lturner

Copy link
Copy Markdown

Fixes #404

If a class property has a type, then there should not be a requirement for a DocBlock.
A DocBlock can still be added if desired - this change simply removes the warning for a missing comment block when the property has a defined type.

Note - this does not validate that the type is valid, only that it is not specifically invalid in the same way as https://github.com/magento/magento-coding-standard/blob/develop/Magento2/Sniffs/Annotation/MethodArgumentsSniff.php

Additional: This issue was originally raised against the documentation page (AdobeDocs/commerce-php#23), and was suggested to be raised directly here. The documentation would need to be updated to reflect that DocBlocks are only required for properties without a type.

@aligent-lturner

Copy link
Copy Markdown
Author

Failing tests do not appear to be related to this change, but a missing Symfony class:

Error: Class "Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator" not found

Comment thread Magento2/Tests/Commenting/ClassPropertyPHPDocFormattingUnitTest.inc
Co-authored-by: Ihor Sviziev <ihor-sviziev@users.noreply.github.com>
Comment thread Magento2/Tests/Commenting/ClassPropertyPHPDocFormattingUnitTest.inc
Co-authored-by: Ihor Sviziev <ihor-sviziev@users.noreply.github.com>
@torhoehn

torhoehn commented Sep 9, 2022

Copy link
Copy Markdown

@sivaschenko Would it be possible to merge this please?

@ihor-sviziev ihor-sviziev left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi @aligent-lturner,
Could you please resolve conflicts?

…s_properties

# Conflicts:
#	Magento2/Tests/Commenting/ClassPropertyPHPDocFormattingUnitTest.inc
@aligent-lturner

Copy link
Copy Markdown
Author

hi @aligent-lturner, Could you please resolve conflicts?

@ihor-sviziev conflict has been resolved

ihor-sviziev
ihor-sviziev previously approved these changes Apr 12, 2023
@sinhaparul

Copy link
Copy Markdown
Contributor

@magento import PR to magento-commerce/magento-coding-standard repository

@m2-github-services

Copy link
Copy Markdown
Contributor

@sinhaparul the Pull Request is successfully imported.

@fredden

fredden commented Dec 18, 2023

Copy link
Copy Markdown
Member

See also #476

@ihor-sviziev

Copy link
Copy Markdown
Collaborator

@sinhaparul @sidolov could you please merge it?

@aligent-lturner

Copy link
Copy Markdown
Author

@sidolov this has been approved for almost a year now. Any chance it can be merged soon?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Do not require DocBlock for typed class attributes

7 participants