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

ImportFullyQualifiedNamesRector : add a failing test about modified annotations that shouldn't be #2096

Conversation

gnutix
Copy link
Contributor

@gnutix gnutix commented Oct 4, 2019

I've finally been able to add ImportFullyQualifiedNamesRector to our project thanks to the new "skip root namespace" option. And I've noticed 3 nasty bugs in there (losing @ORM\Table argument, de-doubling of @ORM\InheritanceType argument, removing @Route arguments).

So I've added a test case with all these annotations, which resulted in :

1) Rector\CodingStyle\Tests\Rector\Namespace_\ImportFullyQualifiedNamesRector\ImportFullyQualifiedNamesRectorTest::test with data set #22 ('/home/gnutix/dev/oss/rectorph...hp.inc')
Caused by /home/gnutix/dev/oss/rectorphp/rector/packages/CodingStyle/tests/Rector/Namespace_/ImportFullyQualifiedNamesRector/Fixture/should_keep_all_doc_blocks_annotations_parameters.php.inc
Failed asserting that string matches format description.
--- Expected
+++ Actual
@@ @@
 use Symfony\Component\Routing\Annotation\Route;
 
 /**
- * @ORM\Table("Table_Name")
- * @ORM\Entity()
- * @ORM\InheritanceType("SINGLE_TABLE")
+ * @ORM\Table
+ * @ORM\Entity
+ * @ORM\InheritanceType("SINGLE_TABLE")("SINGLE_TABLE")
  */
 class ShouldKeepAllDocBlocksAnnotationsParameters
 {
     /**
-     * @Route(
-     *     "/{arg1}/{arg2}",
-     *     defaults={"arg1"=null, "arg2"=""},
-     *     requirements={"arg1"="\d+", "arg2"=".*"}
-     * )
+     * @Route    (     path="/{arg1}/{arg2}" )
      */
     public function nothing(): void
     {

/home/gnutix/dev/oss/rectorphp/rector/src/Testing/PHPUnit/AbstractRectorTestCase.php:182
/home/gnutix/dev/oss/rectorphp/rector/src/Testing/PHPUnit/AbstractRectorTestCase.php:136
/home/gnutix/dev/oss/rectorphp/rector/packages/CodingStyle/tests/Rector/Namespace_/ImportFullyQualifiedNamesRector/ImportFullyQualifiedNamesRectorTest.php:17

@gnutix
Copy link
Contributor Author

gnutix commented Oct 4, 2019

Seems like there's still a Travis build that works :

PHP: 7.1
COMPOSER_FLAGS="--prefer-lowest"

So probably that this has something to do with Rector's composer dependencies version.

@TomasVotruba
Copy link
Member

TomasVotruba commented Oct 4, 2019

I recommend checking different versions of:

  • doctrine/annotations
  • phpstan/phpdoc-parser

@TomasVotruba
Copy link
Member

TomasVotruba commented Oct 5, 2019

It seems tests are skipped on PHP 7.1 for some reason

Now it fails thanks to --testsuite main option

image

@TomasVotruba TomasVotruba merged commit 299ad87 into rectorphp:master Oct 5, 2019
@TomasVotruba TomasVotruba deleted the ImportFullyQualifiedNamesRector/fix-docblocks branch October 5, 2019 09:10
@TomasVotruba TomasVotruba mentioned this pull request Oct 5, 2019
TomasVotruba added a commit that referenced this pull request Apr 19, 2022
rectorphp/rector-src@b4efb43 [Fix][InlineSimplePropertyAnnotationRector] Add test case and minor fix (#2096)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants