Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Member variables and methods should not require DocBlock when properly typed #476

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from

Commits on Aug 16, 2023

  1. Member variables and methods should not require DocBlock when properl…

    …y typed
    
    https://developer.adobe.com/commerce/php/coding-standards/docblock/
    > Include all necessary information without duplication.
    
    Example 1:
    
    ```
    private ?ObjectManagerInterface $objectManager;
    ```
    should not require a comment
    ```
    /** @var ObjectManagerInterface|null $objectManager */
    ```
    because all of that information is duplicated.  (Though the nullable is actually harder to read in DocBlock standard.)
    
    Example 2:
    ```
        public function getWeakMap() : WeakMap
        {
            return $this->weakMap;
        }
    ```
    This method is expressive. It is obvious what it does. It is strictly typed. There is no reason that it should need a DocBlock.
    
    This change no longer requires DocBlock in these cases:
    
    1: member variables that have defined types
    2: methods where all parameters have defined types AND method has defined return type (__construct and __destruct won't require return type, since it isn't allowed)
    JacobBrownAustin committed Aug 16, 2023
    Configuration menu
    Copy the full SHA
    ee3ddb3 View commit details
    Browse the repository at this point in the history

Commits on Oct 4, 2023

  1. API class/interfaces should still require DocBlocks for methods

    Adding in code to check the namespace of the class/interfaces to see if it is API.
    Magento's API code requires method Doc Blocks because it doesn't use Reflection for types.
    
    https://developer.adobe.com/commerce/php/development/components/web-api/services/
    JacobBrownAustin committed Oct 4, 2023
    Configuration menu
    Copy the full SHA
    83c8668 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    b442f9a View commit details
    Browse the repository at this point in the history

Commits on Dec 18, 2023

  1. API class/interfaces should still require DocBlocks for methods

    * Updated unit tests to cover new functionality reguarding when we can safely skip requiring DockBlocks
    * Fix MethodArgumentsSniff to work on PHP files without namespaces
    JacobBrownAustin committed Dec 18, 2023
    Configuration menu
    Copy the full SHA
    38f565c View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    59b5d46 View commit details
    Browse the repository at this point in the history

Commits on Dec 22, 2023

  1. Configuration menu
    Copy the full SHA
    17e120f View commit details
    Browse the repository at this point in the history

Commits on Oct 17, 2024

  1. Merge branch 'develop' of https://github.com/magento/magento-coding-s…

    …tandard into parameters-defined-needs-no-docblock-except-complex
    JacobBrownAustin committed Oct 17, 2024
    Configuration menu
    Copy the full SHA
    b5c1496 View commit details
    Browse the repository at this point in the history