Skip to content

[Example Config] Use class reference instead of self:: on code example config to ease copy paste config #6037

Merged
samsonasik merged 2 commits intomainfrom
use-class-self
Jun 26, 2024
Merged

[Example Config] Use class reference instead of self:: on code example config to ease copy paste config #6037
samsonasik merged 2 commits intomainfrom
use-class-self

Conversation

@samsonasik
Copy link
Copy Markdown
Member

@samsonasik samsonasik commented Jun 26, 2024

Ref #6035 (review) as they are public constant to copy on configure rector, something like:

    $rectorConfig
        ->ruleWithConfiguration(BooleanInTernaryOperatorRuleFixerRector::class, [
-            self::TREAT_AS_NON_EMPTY => false,
+            BooleanInTernaryOperatorRuleFixerRector::TREAT_AS_NON_EMPTY => false,
        ]);

self just pointed to invalid target class on rector config.

@samsonasik
Copy link
Copy Markdown
Member Author

All checks have passed 🎉 @TomasVotruba I am merging it ;)

@samsonasik samsonasik merged commit 421f74a into main Jun 26, 2024
@samsonasik samsonasik deleted the use-class-self branch June 26, 2024 04:06
@TomasVotruba
Copy link
Copy Markdown
Member

We'll have to fix this in the tool, not enforce it here:)
Could you revert and fix it?

@samsonasik
Copy link
Copy Markdown
Member Author

samsonasik commented Jun 26, 2024

I don't understand, what tool? There is no example in generarted documentation now, in the past, we have example config in generated documentation, and that feature removed on symplify doc generator, so currently, user only can see example by read the config in the rules, so copy paste from there is needed to symplify DX

@samsonasik
Copy link
Copy Markdown
Member Author

Reverting at #6038 btw, but I need explanation for this, as this was used for DX

@TomasVotruba
Copy link
Copy Markdown
Member

Thanks 👍

I think we should solve this in the documentation, as other projects do. I rarely copy-paste any code from other projects internals. It's either documented or never used.

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