Skip to content
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

XMLWriter::*Ns() accepts null in $prefix #383

Merged
merged 1 commit into from Nov 26, 2020
Merged

XMLWriter::*Ns() accepts null in $prefix #383

merged 1 commit into from Nov 26, 2020

Conversation

spaze
Copy link
Contributor

@spaze spaze commented Nov 26, 2020

@ondrejmirtes ondrejmirtes merged commit 741ede0 into phpstan:master Nov 26, 2020
@ondrejmirtes
Copy link
Member

Thank you! :)

@spaze
Copy link
Contributor Author

spaze commented Nov 26, 2020

That was quick, thanks :-) Just realized that similar change needs to be applied to functionMap_php80delta.php (which I didn't notice before, sorry!) came here to make and... :-)

@spaze spaze deleted the patch-1 branch November 26, 2020 18:11
@ondrejmirtes
Copy link
Member

It might not need to be, check out what phpstan.org does, there's more complicated logic. If the signature is correct in https://github.com/phpstan/php-8-stubs, there's a high chance the analysis will be already correct too :)

@spaze
Copy link
Contributor Author

spaze commented Nov 26, 2020

Aha, thanks. Currently (without this patch applied), analyzing startElementNs(null, ...) fails on PHP 7.4 (which is how I found this) but doesn't on PHP 8. I guess different PHP 8 signatures would explain this, am I right?

And yes, https://github.com/phpstan/php-8-stubs/blob/main/stubs/ext/xmlwriter/xmlwriter_write_element_ns.php et al. seems correct with ?string $prefix.

@ondrejmirtes
Copy link
Member

Yes, my plan is to sync PHP 8 stubs with 7.4 functionMap (in an automated way) for things that actually haven't changed in PHP 8 :)

@spaze
Copy link
Contributor Author

spaze commented Nov 26, 2020

I see, thanks! Looking forward to a new release so I don't need to do some magic to make analysis pass on both PHP 7.4 & 8.0! Got a bit confused when I've ignored the error message on 7.x and then analyzing on PHP 8.0 said "no error" so thanks for showing me php-8-stubs. (Yeah, I know I could somehow use different config files but nah I'll happily wait :-)

@@ -13110,19 +13110,19 @@
'XMLWriter::startDTDElement' => ['bool', 'qualifiedname'=>'string'],
'XMLWriter::startDTDEntity' => ['bool', 'name'=>'string', 'isparam'=>'bool'],
'XMLWriter::startElement' => ['bool', 'name'=>'string'],
'XMLWriter::startElementNS' => ['bool', 'prefix'=>'string', 'name'=>'string', 'uri'=>'string'],
'XMLWriter::startElementNS' => ['bool', 'prefix|null'=>'string', 'name'=>'string', 'uri'=>'string'],
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The null should be in the 'string' part. Sorry for that, remedied in #388

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants