Skip to content

Conversation

@shakaran
Copy link

Improves the robustness of the testValidateSchema method in XMLSchemaTest.php by adding null checks before importing XML nodes. This prevents potential errors when the expected XML elements are not present.

Test robustness improvements:

  • Added checks to ensure that dbal and orm elements are not null before attempting to import them with importNode, preventing possible exceptions if these elements are missing.
 vendor/bin/phpstan analyze --level=8 tests/DependencyInjection/XMLSchemaTest.php
 ------ ------------------------------------------------------------------------------------------------ 
  Line   tests/DependencyInjection/XMLSchemaTest.php                                                     
 ------ ------------------------------------------------------------------------------------------------ 
  :45    Parameter #1 $node of method DOMDocument::importNode() expects DOMNode, DOMElement|null given.  
         🪪  argument.type                                                                               
  :58    Parameter #1 $node of method DOMDocument::importNode() expects DOMNode, DOMElement|null given.  
         🪪  argument.type                                                                               
 ------ ------------------------------------------------------------------------------------------------ 

@ostrolucky
Copy link
Member

We are not going with PR by file approach. It's going to be a PR by raised phpstan level.

@ostrolucky ostrolucky closed this Dec 13, 2025
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