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

Add phpstan analysis #4458

Merged
merged 1 commit into from
Nov 20, 2024
Merged

Add phpstan analysis #4458

merged 1 commit into from
Nov 20, 2024

Conversation

VincentLanglet
Copy link
Contributor

@VincentLanglet VincentLanglet commented Nov 20, 2024

As suggested by @ruudk here: #4456 (comment)
I think it could be useful to add phpstan analysis on twig.

This is an example of all the things reported when checking level 3 PHPStan (more will get more errors to fix).

src/ExpressionParser.php Show resolved Hide resolved
src/ExpressionParser.php Show resolved Hide resolved
src/ExpressionParser.php Show resolved Hide resolved
src/ExtensionSet.php Show resolved Hide resolved
@@ -186,17 +186,11 @@ public function removeAttribute(string $name): void
unset($this->attributes[$name]);
}

/**
* @param string|int $name
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Int is not accepted

Copy link
Contributor

Choose a reason for hiding this comment

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

It is accepted explicitly in Twig 4.0 (same for all similar methods).

src/OperatorPrecedenceChange.php Show resolved Hide resolved
@VincentLanglet
Copy link
Contributor Author

Tests were already failing and fabbot error is unrelated
https://fabbot.io/report/twigphp/Twig/4458/93ca91b81d9be93d0a21441c03ef24ed7c274ab0

@VincentLanglet VincentLanglet marked this pull request as ready for review November 20, 2024 12:31
src/Node/ImportNode.php Outdated Show resolved Hide resolved
src/Node/MacroNode.php Outdated Show resolved Hide resolved
src/OperatorPrecedenceChange.php Show resolved Hide resolved
@fabpot
Copy link
Contributor

fabpot commented Nov 20, 2024

@VincentLanglet Can you also rebase to see (as stof fixed a bunch of test issues)

@VincentLanglet
Copy link
Contributor Author

VincentLanglet commented Nov 20, 2024

@VincentLanglet Can you also rebase to see (as stof fixed a bunch of test issues)

I rebased and added back the int|string phpdoc @fabpot

In the next PR I'll try to bump level 4

@fabpot
Copy link
Contributor

fabpot commented Nov 20, 2024

Thank you @VincentLanglet.

@fabpot fabpot merged commit 679e413 into twigphp:3.x Nov 20, 2024
5 of 6 checks passed
@VincentLanglet
Copy link
Contributor Author

There is some fixes in this PR, would it be enough for a 3.15.1 version ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants