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

Docblock indentation #2976

Closed
tomasnorre opened this issue Feb 29, 2020 · 13 comments
Closed

Docblock indentation #2976

tomasnorre opened this issue Feb 29, 2020 · 13 comments

Comments

@tomasnorre
Copy link
Contributor

Bug Report

Subject Details
Rector version v0.7.2
Installed as composer dependency

After updating to rector v.0.7.2, I get "funny" indentations suggestions for some, not all docblocks.

     /*****************************
-     *
-     * General Helper Functions
-     *
-     *****************************/
-
-    /**
-     * This method is used to add a message to the internal queue
-     *
-     * @param  string $message the message itself
-     * @param  int $severity message level (-1 = success (default), 0 = info, 1 = notice, 2 = warning, 3 = error)
-     */
-    protected function addMessage(string $message, int $severity = FlashMessage::OK): void
+				 *
+				 * General Helper Functions
+				 *
+				 *****************************/
+				/**
+				 * This method is used to add a message to the internal queue
+				 *
+				 * @param   string $message the message itself
+				 * @param   int $severity message level (-1 = success (default), 0 = info, 1 = notice, 2 = warning, 3 = error)
+				 */
+				protected function addMessage(string $message, int $severity = FlashMessage::OK): void
     {

I haven't found a pattern in the behaviour yet, but perhaps you can point me into the correct direction.

I'm honestly not sure if it's a problem with rector, or a misconfiguration on my site.

I only run the dead-code set.

Expected Behaviour

I would expect the docblock to be "left" align as usual.

@TomasVotruba
Copy link
Member

TomasVotruba commented Feb 29, 2020

Try adding smallest demo possible (~10 lines) in: https://getrector.org/demo

I'm honestly not sure if it's a problem with rector, or a misconfiguration on my site.

If it worked before and not it doesn't, there is 99 % chance it's a bug in Rector.

@tomasnorre
Copy link
Contributor Author

At demo site, it's working like expected.
https://getrector.org/demo/66cfe4f1-617b-4a1f-b180-a1b3b8996ad9#result

@tomasnorre
Copy link
Contributor Author

tomasnorre commented Feb 29, 2020

You can see it here as well in the Travis CI, there is a little more "context"
https://travis-ci.org/AOEpeople/crawler/jobs/656789015#L540

@tomasnorre
Copy link
Contributor Author

I've done a little testing to see if I could locate the problem.

Regardless of which of the following sets I use it gets indented

dead-code
php70
php71

So looks like it hasn't something to do with a specific set.

@tomasnorre
Copy link
Contributor Author

I've found the problem, but not the solution.

For some reasons the indentation is after the vendor/bin/rector process --config rector-ci.yaml is done with tabs instead of spaces.

The number of indentations are still correct but the character isn't.

@tomasnorre
Copy link
Contributor Author

tomasnorre commented Mar 1, 2020

I don't know yet if can be related to following commit 04c62b0

and especially this section 04c62b0#diff-560bcf8e3b306989b3cb6718d0403d0cR365

But it as least has something to do with indentations and tabs too.

@TomasVotruba
Copy link
Member

TomasVotruba commented Mar 1, 2020

Failing demo is needed, you might need to modify the input file

@tomasnorre
Copy link
Contributor Author

I'll see if I can make a failing demo.

@tomasnorre
Copy link
Contributor Author

I have an example code now.
https://getrector.org/demo/eea02846-e17f-4e44-a6eb-7f9596a19134#result

After the

final class DemoFile
{

I added a tab manually.. And that triggered the PHPDoc to indent with tabs instead of spaces, but only for the second PHPDoc Block.

@tomasnorre
Copy link
Contributor Author

If I clean my file for all tab characters regardless where they are positioned. It works.

@alexanderschnitzler
Copy link
Contributor

Hey guys, this looks like a duplicate of #2944 which has been solved a couple of days ago with #2947.

@TomasVotruba
Copy link
Member

@alexanderschnitzler Just released v0.7.3 with that fix

@tomasnorre
Copy link
Contributor Author

tomasnorre commented Mar 2, 2020

I can confirm that it fixed my issue.
Thanks for taking care.

TomasVotruba added a commit that referenced this issue Oct 5, 2022
rectorphp/rector-src@d2ff17e [Php81] Skip assigned after defined as constructor promotion on ReadOnlyPropertyRector (#2976)
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

No branches or pull requests

3 participants