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

Match Rule Descriptions with Configuration Parameters in README.md #265

Merged
merged 2 commits into from
Mar 30, 2025

Conversation

OsitaDNU
Copy link
Contributor

Hi,

I watched your video on stricter rules in PHPStan and wanted to configure the rules I needed. However, I found it difficult to match the configuration parameters to their corresponding rule descriptions. I also checked the documentation but couldn’t find where these parameters were defined.

To improve clarity, I’ve put the rule descriptions into a table and tried to match them with their respective configuration parameters. This should make it easier to understand which settings control each rule.

However, I couldn’t match the following parameters to any rule descriptions:

  • uselessCast
  • disallowedImplicitArrayCreation
  • strictArrayFilter
  • illegalConstructorMethodCall

Additionally, I couldn’t match the following rule descriptions to a specific parameter:

  • "Correct case for referenced and called function names."
  • "Contravariance for parameter types and covariance for return types in inherited methods (Liskov substitution principle - LSP)."
  • "Check LSP even for static methods."

Could you review my matches to ensure they are correct? Also, any help in completing the missing mappings would be appreciated. Thanks!

README.md Outdated
| | Check LSP even for static methods. |
| `requireParentConstructorCall` | Require calling parent constructor. |
| `disallowedBacktick` | Disallow usage of backtick operator (`` $ls = `ls -la` ``). |
| `closureUsesThis` | Closure should use `$this` directly instead of using `$this` variable indirectly. |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice if the table was also formatted nicely in markdown.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated 3a4a228

@ondrejmirtes
Copy link
Member

Unfortunately it's still not very readable.

Screenshot 2025-03-18 at 10 36 41

@hrach
Copy link

hrach commented Mar 18, 2025

A note: use spaces instead of tabs and IntelliJ/PHPStorm/... can this format automatically.

@OsitaDNU
Copy link
Contributor Author

@ondrejmirtes Okay, I can fix it. Given the issues so far, I just want to confirm if everyone is happy with a table format. See screenshot below... there will be a horizontal scroll bar. Alternatively, I can list each rule description with the parameter as the header. Let me know your thoughts. Cc @hrach
image

@ondrejmirtes
Copy link
Member

Would be better if the text in the 2nd column wrapped instead of causing horizontal scrolling.

@OsitaDNU OsitaDNU requested a review from ondrejmirtes March 18, 2025 12:30
@ondrejmirtes
Copy link
Member

Please solve the conflict, there was a new parameter added meanwhile.

@OsitaDNU OsitaDNU closed this Mar 28, 2025
@OsitaDNU OsitaDNU force-pushed the improve-rule-descriptions branch from 67a405b to 3ecc310 Compare March 28, 2025 23:42
@OsitaDNU OsitaDNU reopened this Mar 28, 2025
@OsitaDNU
Copy link
Contributor Author

Hi, I've fixed the conflict. Should be good to go now. Thanks

@ondrejmirtes ondrejmirtes merged commit f203fec into phpstan:2.0.x Mar 30, 2025
31 checks passed
@ondrejmirtes
Copy link
Member

Thank you!

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.

3 participants