Twig icon indicating copy to clipboard operation
Twig copied to clipboard

Documentation for types tag uses Twig types in examples instead of PHP

Open drjayvee opened this issue 1 year ago • 1 comments

Specifically, "bool" => "boolean" and "int" => "number".

This aligns the types documentation with templates.rst. See #4362

Thanks, @alexander-schranz!

drjayvee avatar Oct 21 '24 07:10 drjayvee

boolean is a valid PHPStan type, but number is not. See https://phpstan.org/writing-php-code/phpdoc-types

Can we maybe update the example, to not use a number instead?

TwigStan will only accept PHPStan types, as it's a PHPStan analyzer.

Making this types tag too strict up front, only limits its usage in the wild.

ruudk avatar Oct 21 '24 07:10 ruudk

The documentation is not up to date. PHPStan does properly understand number 🎉 I'll fix the docs.

See https://phpstan.org/r/24895f82-975a-4e08-b7b1-5da29d058ddd

ruudk avatar Oct 21 '24 09:10 ruudk

Done:

  • https://github.com/phpstan/phpstan/pull/11882

ruudk avatar Oct 21 '24 09:10 ruudk

Do you think it's worth it to update TypesTest.php and TypesTokenParser.php ?

smnandre avatar Oct 21 '24 15:10 smnandre

Thank you @drjayvee.

fabpot avatar Oct 23 '24 14:10 fabpot

Not sure why Github doesn't understand this one was merged 🤷

fabpot avatar Oct 23 '24 14:10 fabpot

@fabpot this happens when we squash commits but we are not allowed to push the squashed commits back to the branch from which the PR is submitted. There is no way to mark a PR as merged when performing a squash or rebase entirely locally.

stof avatar Oct 23 '24 15:10 stof