Skip to content

PhpdocNoSuperfluousParamFixer removes useful callable info #1082

@Arkemlar

Description

@Arkemlar

When PhpdocNoSuperfluousParamFixer enabled:

    /**
     * @template TKey of array-key
     * @template TValue of mixed
     *
     * @param Collection<TKey, TValue>        $collection
-    * @param callable(TKey $a, TKey $b): int $comparator
     *
     * @return ArrayCollection<TKey, TValue>
     */
    public static function sortByKeys(Collection $collection, callable $comparator): ArrayCollection
    {
    }

It is proven that disabling PhpdocNoSuperfluousParamFixer stops removing callable param.

My config:

return (new PhpCsFixer\Config())
    ->setRiskyAllowed(true)
    ->registerCustomFixers(new PhpCsFixerCustomFixers\Fixers())
    ->setRules([
        // rule sets: https://cs.symfony.com/doc/ruleSets/index.html
        '@PSR12' => true,
        '@PSR12:risky' => true,
        '@Symfony' => true,
        // rules: https://cs.symfony.com/doc/rules/index.html
        'no_break_comment' => ['comment_text' => 'this is so bugged, but it works when this config is random text'],
        'strict_param' => true,
        'declare_strict_types' => true,
        'yoda_style' => true,
        'single_line_throw' => false,
        'trailing_comma_in_multiline' => ['elements' => ['arguments', 'arrays', 'match', 'parameters']],
        'global_namespace_import' => ['import_classes' => true],
        'phpdoc_to_comment' => false,
        'phpdoc_var_without_name' => false,
        'phpdoc_summary' => false,
        // rules: https://github.com/kubawerlos/php-cs-fixer-custom-fixers
        PhpCsFixerCustomFixers\Fixer\PhpdocSingleLineVarFixer::name() => true,
        PhpCsFixerCustomFixers\Fixer\DeclareAfterOpeningTagFixer::name() => true,
        PhpCsFixerCustomFixers\Fixer\CommentedOutFunctionFixer::name() => true,
        PhpCsFixerCustomFixers\Fixer\EmptyFunctionBodyFixer::name() => true,
        PhpCsFixerCustomFixers\Fixer\MultilinePromotedPropertiesFixer::name() => true,
        PhpCsFixerCustomFixers\Fixer\IssetToArrayKeyExistsFixer::name() => false,
        PhpCsFixerCustomFixers\Fixer\NoDuplicatedArrayKeyFixer::name() => true,
        PhpCsFixerCustomFixers\Fixer\NoUselessStrlenFixer::name() => true,
        PhpCsFixerCustomFixers\Fixer\NoPhpStormGeneratedCommentFixer::name() => true,
        PhpCsFixerCustomFixers\Fixer\PhpdocNoSuperfluousParamFixer::name() => false, // when enabled, removes useful callable info
        PhpCsFixerCustomFixers\Fixer\PhpdocNoIncorrectVarAnnotationFixer::name() => false,
        PhpCsFixerCustomFixers\Fixer\PhpdocParamTypeFixer::name() => true,
        PhpCsFixerCustomFixers\Fixer\PhpdocSelfAccessorFixer::name() => true,
        PhpCsFixerCustomFixers\Fixer\PhpdocSingleLineVarFixer::name() => true,
        PhpCsFixerCustomFixers\Fixer\NoUselessCommentFixer::name() => true,
        PhpCsFixerCustomFixers\Fixer\StringableInterfaceFixer::name() => true,
        PhpCsFixerCustomFixers\Fixer\NoDoctrineMigrationsGeneratedCommentFixer::name() => true,
    ])

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions