Skip to content

Rector\TypeDeclaration\Rector\ClassMethod\AddArrayReturnDocTypeRector changes the order of params but shouldn't #2699

@Aerendir

Description

@Aerendir
Subject Details
Rector version 0.6.10
PHP version PHP 7.2

Current Behaviour

1) src/Uri/Bridge/Doctrine/UriType.php

    ---------- begin diff ----------
--- Original
+++ New
@@ -59,7 +59,7 @@
      * @throws StringsException
      * @throws \Laminas\Uri\Exception\InvalidArgumentException
      *
-     * @return string|Uri|null
+     * @return Uri|string|null
      */
     public function convertToPHPValue($value, AbstractPlatform $platform)
     {
    ----------- end diff -----------

Applied rules:

 * Rector\CodingStyle\Rector\Namespace_\ImportFullyQualifiedNamesRector
 * Rector\TypeDeclaration\Rector\ClassMethod\AddArrayReturnDocTypeRector

Expected Behaviour

The problem is that the order of params is managed by PHP CS Fixer.

I have two shell scripts:

  1. fix
  2. validate

I first run fix command that runs first Rector and then PHP CS Fixer.
Then I run validate that runs Rector and then PHP CS Fixer.

This means that when I run validate, the last command run is PHP CS Fixer that changes on its own the order of params. When then is run Rector, this last one stops the entire script as for it there is an error in the order of params.

I'm going to submit a failing test case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions