Skip to content

Add phpstan analysis#4458

Merged
fabpot merged 1 commit into
twigphp:3.xfrom
VincentLanglet:phpstan
Nov 20, 2024
Merged

Add phpstan analysis#4458
fabpot merged 1 commit into
twigphp:3.xfrom
VincentLanglet:phpstan

Conversation

@VincentLanglet

@VincentLanglet VincentLanglet commented Nov 20, 2024

Copy link
Copy Markdown
Contributor

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).

Comment thread src/ExpressionParser.php
Comment thread src/ExpressionParser.php
Comment thread src/ExpressionParser.php
Comment thread src/ExtensionSet.php
Comment thread src/Node/Expression/BlockReferenceExpression.php
Comment thread src/Node/Node.php
}

/**
* @param string|int $name

Copy link
Copy Markdown
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
Copy Markdown
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).

Comment thread src/OperatorPrecedenceChange.php
@VincentLanglet

Copy link
Copy Markdown
Contributor Author

@VincentLanglet
VincentLanglet marked this pull request as ready for review November 20, 2024 12:31
Comment thread src/Node/ImportNode.php Outdated
Comment thread src/Node/MacroNode.php Outdated
Comment thread src/OperatorPrecedenceChange.php
Comment thread phpstan.neon.dist
@fabpot

fabpot commented Nov 20, 2024

Copy link
Copy Markdown
Contributor

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

@VincentLanglet

VincentLanglet commented Nov 20, 2024

Copy link
Copy Markdown
Contributor Author

@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

fabpot commented Nov 20, 2024

Copy link
Copy Markdown
Contributor

Thank you @VincentLanglet.

@fabpot
fabpot merged commit 679e413 into twigphp:3.x Nov 20, 2024
@VincentLanglet

Copy link
Copy Markdown
Contributor Author

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

fabpot added a commit that referenced this pull request Nov 19, 2025
…des)

This PR was merged into the 3.x branch.

Discussion
----------

Update .gitattributes to exclude phpstan configs

They where added in #4458

Versions >= 3.16.0 have the not needed files

Commits
-------

2e0c874 Update .gitattributes to exclude phpstan configs
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