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

PHPDoc cleanup #587

Merged
merged 2 commits into from
Feb 3, 2022
Merged

PHPDoc cleanup #587

merged 2 commits into from
Feb 3, 2022

Conversation

AJenbo
Copy link
Collaborator

@AJenbo AJenbo commented Jan 30, 2022

Type: documentation update
Breaking change: no

Apply the same rules for code style in PHPDoc as for native code

  • Import classes instead of referencing them via FQN
  • Short names for scalar types
  • Consistent ordering of types
  • Consistent ordering of attributes
  • Grouping of attributes
  • Remove redundant attributes
  • Align values attributes

A large par of the changes where done using php-cs-fixer (see commit description for the settings that where used)

I have verified the changes with PHPStan at level 2

<?php
/*
 * This document has been generated with
*
https://mlocati.github.io/php-cs-fixer-configurator/#version:3.4.0|configurator
 * you can change this configuration by importing this file.
 */
$config = new PhpCsFixer\Config();
return $config
    ->setRules([
        'blank_line_after_namespace' => true,
        'fully_qualified_strict_types' => true,
        'global_namespace_import' => true,
        'no_empty_phpdoc' => true,
        'no_leading_import_slash' => true,
        'no_superfluous_phpdoc_tags' => true,
        'no_unused_imports' => true,
        'ordered_imports' => true,
        'phpdoc_align' => true,
        'phpdoc_indent' => true,
        'phpdoc_order' => true,
        'phpdoc_return_self_reference' => true,
        'phpdoc_scalar' => true,
        'phpdoc_separation' => true,
        'phpdoc_single_line_var_spacing' => true,
        'phpdoc_trim' => true,
        'phpdoc_trim_consecutive_blank_line_separation' => true,
        'phpdoc_types_order' => true,
        'phpdoc_var_annotation_correct_order' => true,
        'single_blank_line_before_namespace' => true,
        'single_import_per_statement' => true,
        'single_line_after_imports' => true,
    ])
    ->setFinder(PhpCsFixer\Finder::create()
        ->exclude('vendor')
        ->in(__DIR__)
    )
;
@AJenbo AJenbo changed the title Phpdoc PHPDoc cleanup Jan 30, 2022
@@ -117,49 +128,49 @@ class Engine
/**
* The used code node builder.
*
* @var PHPBuilder<\PDepend\Source\AST\ASTNamespace>|null
* @var null|PHPBuilder<ASTNamespace>
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* @var null|PHPBuilder<ASTNamespace>
* @var PHPBuilder<ASTNamespace>|null

I would keep the order with null always at the end.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ok, I can do that as a fullow up once this is merged.

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

Successfully merging this pull request may close these issues.

None yet

4 participants