-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Add array|int and object-of-class|int types to stubs #6081
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
4186fd9
to
2f6722b
Compare
2f6722b
to
64d48f7
Compare
64d48f7
to
48e120b
Compare
Can we have a |
a4f2b03
to
87d1ae4
Compare
I've just rebased to current master since there was a conflict. Additionally, I synchronized the signature of |
87d1ae4
to
0064d12
Compare
ad28dd8
to
d507919
Compare
d507919
to
813885f
Compare
9853823
to
4281daa
Compare
a02d422
to
0cbe010
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nearly there...
ext/filter/filter.c
Outdated
zval *options = NULL; | ||
zval *option; | ||
char *charset = NULL; | ||
|
||
if (filter_args && Z_TYPE_P(filter_args) != IS_ARRAY) { | ||
zend_long lval = zval_get_long(filter_args); | ||
if (filter_args_long) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the check here rather the !filter_args_ht
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change would make 3 tests fail:
- in
ext/filter/tests/039.phpt
:var_dump(filter_var_array(array()));
would becomefalse
rather thanarray()
- in
ext/filter/tests/057.php
: a bunch of things would change, e.g.var_dump(filter_input_array(INPUT_POST, null));
would printfalse
, rather thannull
ext/filter/tests/filter_var_array_with_ref.phpt
would printfalse
in the first line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trying to figure this out now...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've pushed some changes to ext/filter that hopefully make sense. I've also added a warning for the "unknown filter" case, which should make the changes in 057.phpt more obvious.
Any concerns about adding that warning?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fixes! This was a more bumpy road for me than what I imagined ^^
At first, I was a bit surprised about the new warnings (I thought that I accidentally removed them previously), but I agree that we should have them :)
dace607
to
7c3ed6f
Compare
7c3ed6f
to
ebbf195
Compare
No behavior difference here, but let's be consistent.
b682b84
to
1318bbe
Compare
<?php | ||
|
||
try { | ||
$perid = new DatePeriod("R4"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$perid = new DatePeriod("R4"); | |
$period = new DatePeriod("R4"); |
Or drop the variable :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I don't even know why I added the variables in the first place... :) (I do know indeed: copy-pasted from date_interval_bad_format_leak.phpt)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You copied my typo :P
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed them during applying the changes in this PR :)
After this PR, there is only ~270 parameters remaining whose type can't be added as a proper type declaration, not counting out parameters, parameters containing
resource
, and parameters in ext/dba, but including aliases.Most of these are because of LSP violations (
offset*()
methods), but there are 70 funkyGMP|int|bool|string
param types in ext/gmp, so all in all, there is only a few cases where type validation is not exactly in line with the reported PHPDoc-based type. :)