Skip to content

Conversation

@staabm
Copy link
Contributor

@staabm staabm commented Nov 21, 2023

@mad-briller
Copy link
Contributor

does this ignore declare used for purposes other than strict_types?

@staabm
Copy link
Contributor Author

staabm commented Nov 21, 2023

good catch - fixed thanks

@ondrejmirtes
Copy link
Member

Please name this accordingly "DeclareStrictTypesRule" and also check nonsense in the directive, like 'foo' instead of 0/1.

Copy link
Member

Choose a reason for hiding this comment

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

Please don't use the type system for this, just the AST. I'm pretty sure some stuff is not allowed that would slip through this.

) {
return [
RuleErrorBuilder::message(sprintf(
'Declare strict_types must have 0 or 1 as its value.',
Copy link
Member

Choose a reason for hiding this comment

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

This message could be improved with 'Declare strict_types must have 0 or 1 as its value, %s given.'

@ondrejmirtes ondrejmirtes merged commit 37d0a83 into phpstan:1.10.x Nov 22, 2023
@ondrejmirtes
Copy link
Member

Thank you!

@ondrejmirtes
Copy link
Member

Hey @staabm this rule now causes a false positive: https://phpstan.org/r/adec71c6-2f0f-41b0-afc2-5df3f9110bce

Please look into it as it's currently blocking a release. Thank you.

@staabm
Copy link
Contributor Author

staabm commented Nov 25, 2023

I am on vacation and can have a look on sunday

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

Labels

None yet

3 participants