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

linter: new rule for declare(strict_types) #1228

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

Hidanio
Copy link
Contributor

@Hidanio Hidanio commented Jul 25, 2024

  • added new linter rule: declareStrictTypes can not be "0"
  • added quickFix for declareStrictTypes
  • added new linter rule: lack of declare(strict_types=1) section
  • added quickFix for lack of declare(strict_types=1) section

@Hidanio Hidanio added the enhancement New feature or request label Jul 25, 2024
@Hidanio Hidanio requested a review from Danil42Russia July 25, 2024 15:17
@Hidanio Hidanio self-assigned this Jul 25, 2024
@Hidanio Hidanio force-pushed the linter_declare_strict branch from 64b7ffb to f83f419 Compare July 25, 2024 15:17
strictMixed bool
strictTypes bool
strictMixed bool
declareSection bool
Copy link
Contributor

Choose a reason for hiding this comment

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

I propose to do it differently. We have an ir.Root node that describes the entire file. Essentially, we can check if there is an ir.DeclareStmt at its level, and if there is, show an error.

see block.go

@@ -25,6 +25,24 @@ func addBuiltinCheckers(reg *CheckersRegistry) {
After: `$s = strip_tags($s, '<br>')`,
},

{
Name: "notStrictTypes",
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's split the checks into two different MRs, shall we?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants