Skip to content

Conversation

@carlos-granados
Copy link
Contributor

@carlos-granados carlos-granados commented Nov 27, 2025

The latest versions of the Symfony Config component improve the docs for some of the functions on the config objects and now use Template tags so that PHPStan is able to correctly guess the type returned. So some asserts are not needed any more. But they are still needed in older versions of Symfony which don't have these improved docs. The only solution I was able to find was to change these asserts into @var tags, this seems to work for both versions

Had to disable a PHP-CS-Fixer rule which was incorrectly trying to change these @var tag docblocks into normal comments

Copy link
Contributor

@acoulton acoulton left a comment

Choose a reason for hiding this comment

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

Thanks for figuring this out - I can't think of a better solution. Just a small comment on the cs-fixer config.

],
'single_line_throw' => false, //override Symfony
'yoda_style' => false, //override Symfony
'phpdoc_to_comment' => false, //incorrectly changes @var tags
Copy link
Contributor

Choose a reason for hiding this comment

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

It might be better to just exclude the specific tag we want to keep?

Suggested change
'phpdoc_to_comment' => false, //incorrectly changes @var tags
'phpdoc_to_comment' => [ // Keep as a phpdoc if it contains the `@var` annotation
'ignored_tags' => ['var'],
],

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, did not known about that option, updated!

@carlos-granados carlos-granados merged commit 30ec7c6 into Behat:3.x Nov 28, 2025
21 checks passed
@carlos-granados carlos-granados deleted the fix-static-analysis branch November 28, 2025 07:39
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