Skip to content

[FIX] SimpleXmlElement construct can throw exceptions #427

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

Closed
wants to merge 1 commit into from

Conversation

VincentLanglet
Copy link
Contributor

See https://www.php.net/manual/fr/simplexmlelement.construct.php

Example: new SimpleXmlElement('foo')

@ondrejmirtes
Copy link
Member

Hi, it'd be much more effective to submit @throws annotation to https://github.com/jetbrains/phpstorm-stubs. PHPStan will pick it up from there. Ping me there once you do.

@VincentLanglet
Copy link
Contributor Author

Ok the PR is opened JetBrains/phpstorm-stubs#1020

But there will be nothing to do on this repository ?
Isn't weird to keep the line 'SimpleXMLElement::__construct' => ['hasSideEffects' => false], ?

@ondrejmirtes
Copy link
Member

That's correct. See this commit 9c39e0f

@VincentLanglet
Copy link
Contributor Author

it's merged @ondrejmirtes JetBrains/phpstorm-stubs#1020

@VincentLanglet VincentLanglet deleted the sideEffect branch January 19, 2021 17:31
@VincentLanglet
Copy link
Contributor Author

I'm still getting an error here: pepakriz/phpstan-exception-rules#143

What is needed for this to be fixed ? A new phpstan release even if the PR was made on phpstorm stubs ?

@ondrejmirtes
Copy link
Member

That's expected, the stubs are baked right into the PHAR. There's some incompatibility with the latest version that I need to look into. One test is failing and I don't know why:

1) PHPStan\Rules\Methods\MissingMethodParameterTypehintRuleTest::testRule
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
     💡 You can turn this off by setting <fg=cyan>checkGenericClassInNonGenericObjectType: false</> in your <fg=cyan>%configurationFile%</>.
 119: Method MissingMethodParameterTypehint\CollectionIterableAndGeneric::acceptsCollection2() has parameter $collection with generic interface DoctrineIntersectionTypeIsSupertypeOf\Collection but does not specify its types: TKey, T
     💡 You can turn this off by setting <fg=cyan>checkGenericClassInNonGenericObjectType: false</> in your <fg=cyan>%configurationFile%</>.
+170: Method MissingMethodParameterTypehint\SerializableImpl::unserialize() has parameter $serialized with no typehint specified.
 180: Method MissingMethodParameterTypehint\CallableSignature::doFoo() has parameter $cb with no signature specified for callable.
+194: Method MissingMethodParameterTypehint\SerializableImpl2::unserialize() has parameter $data with no typehint specified.

@ondrejmirtes
Copy link
Member

Updated: 6bbd629

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