Skip to content

Conversation

staabm
Copy link
Contributor

@staabm staabm commented Oct 15, 2021

No description provided.

'chdb_create' => ['bool', 'pathname'=>'string', 'data'=>'array'],
'chdir' => ['bool', 'directory'=>'string'],
'checkdate' => ['bool', 'month'=>'int', 'day'=>'int', 'year'=>'int'],
'checkdate' => ['bool', 'month'=>'int<1, 12>', 'day'=>'int<1, 31>', 'year'=>'int<1, 32767>'],
Copy link
Contributor Author

@staabm staabm Oct 15, 2021

Choose a reason for hiding this comment

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

actually I am not 100% sure whether month and day upper-bounds are a good thing.

the function itself accepts values which are higher without a error, but always returns false then.
maybe the month/day interval should not have an upper bound?

see https://3v4l.org/f3GhG

in contrast the year interval is defined in the php-src manual as

The year is between 1 and 32767 inclusive.

see https://www.php.net/manual/en/function.checkdate.php


we could create a rule for checkdate' parameters but I don't think its worth it.

Copy link
Member

Choose a reason for hiding this comment

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

Hi, even a wrong year just returns false so this PR isn't a good fit for PHPStan: https://3v4l.org/AAtDi

Thanks anyway :)

@staabm staabm deleted the patch-3 branch November 3, 2021 16:04
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