magento / magento/magento-coding-standard
Do not require DocBlock for typed class attributes
@aligent-lturner is already working on this.
Since Jun 24, 2022.
- Dominant language
- PHP
- Stars
- 375
- Forks
- 165
- PR merge metrics
- No merged PRs in 30d
Description
### Description
Do not require a DocBlock for typed class attributes
### Expected behavior
Class attributes that have specified types should not require a DocBlock. When an attribute already has a type, the DocBlock is providing no new information, and is instead just creating noise - e.g.:
```
/** @var ProductRepositoryInterface */
private ProductRepositoryInterface $productRepository;
```
We already have the type information - we don't need the DocBlock to tell us the type.
I propose that the rule regarding class attributes requiring a `@var` annotation with a type be changed so that it only applies to attributes without a specified type.
### Benefits
Removes the need for redundant comments
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.