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

Improve DOM extension types #1965

Merged
merged 2 commits into from
Jul 24, 2019
Merged

Improve DOM extension types #1965

merged 2 commits into from
Jul 24, 2019

Conversation

shira-374
Copy link

@shira-374 shira-374 commented Jul 23, 2019

#1951

  • DOMNode::insertBefore() accepts null in place of $refnode
  • DOMXPath::evaluate() and DOMXPath::query() accept null in place of $contextnode
  • DOMDocument::$ownerDocument is always null
  • DOMNode::$attributes is null unless the node is instance of DOMElement
  • DOMNode::$parentNode is null for root nodes
  • DOMNode::$firstChild, $lastChild, $previousSibling, $nextSibling can be null if there is no such node
  • DOMNode::$namespaceURI, $baseURI can be null if they aren't defined for the document
  • DOMNode::$prefix seems to always be a string contrary to what the PHP docs say

@shira-374 shira-374 changed the title Improve DOM extension types Improve DOM extension types #1951 Jul 23, 2019
@shira-374 shira-374 changed the title Improve DOM extension types #1951 Improve DOM extension types Jul 23, 2019
@shira-374
Copy link
Author

I guess it might be better to assume that parentNode won't be null (unless Psalm knows that it's a DOMDocument instance).

@muglug
Copy link
Collaborator

muglug commented Jul 24, 2019

I guess it might be better to assume that parentNode won't be null (unless Psalm knows that it's a DOMDocument instance).

I think it's fine - if there are complaints I can allow Psalm to not care about null there.

@muglug muglug merged commit 90d020d into vimeo:master Jul 24, 2019
@shira-374 shira-374 deleted the improve-dom-types branch July 24, 2019 07:54
@shira-374 shira-374 mentioned this pull request Jul 24, 2019
@shira-374
Copy link
Author

I think it's fine - if there are complaints I can allow Psalm to not care about null there.

I've already reverted it via fixup before the merge 🙈 Should I send another PR or will you change it? test-with-real-projects will not pass though.

jinyongyoo pushed a commit to jinyongyoo/psalm that referenced this pull request Jul 24, 2019
* Improve DOM extension types

* fixup! Improve DOM extension types
voku added a commit to voku/psalm that referenced this pull request Jul 25, 2019
* upstream/master: (609 commits)
  Register so it doesn’t get removed
  Add support for compact
  Allow suppression of unused variable issues
  Fix tests
  Fix unused ref in assign op
  Issue 1926 unused variable (vimeo#1967)
  Fix ignoreExceptions tags (vimeo#1966)
  Improve DOM extension types (vimeo#1965)
  Fix infinite recursion on property types
  Analyse binary ops always
  Mark private properties unused when referenced only in constructor (vimeo#1962)
  Prefix constant
  Add slash
  Normalise plugin path
  Also convert \\ to / when scanning windows configs on macs
  Fix file path weirdness when scanning config files
  Reduce with / before converting back
  Improve behaviour of templated template assertions
  Break out templated assertion tests
  Restore gitignore for .*.swp in sub-directories (vimeo#1958)
  ...

# Conflicts:
#	src/Psalm/Config.php
#	src/Psalm/Context.php
#	src/Psalm/Internal/Analyzer/ClassAnalyzer.php
#	src/Psalm/Internal/Analyzer/CommentAnalyzer.php
#	src/Psalm/Internal/Analyzer/FileAnalyzer.php
#	src/Psalm/Internal/Analyzer/FunctionAnalyzer.php
#	src/Psalm/Internal/Analyzer/FunctionLike/ReturnTypeAnalyzer.php
#	src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php
#	src/Psalm/Internal/Analyzer/MethodAnalyzer.php
#	src/Psalm/Internal/Analyzer/Statements/Block/ForeachAnalyzer.php
#	src/Psalm/Internal/Analyzer/Statements/Block/LoopAnalyzer.php
#	src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOpAnalyzer.php
#	src/Psalm/Internal/Analyzer/Statements/Expression/Call/NewAnalyzer.php
#	src/Psalm/Internal/Analyzer/Statements/Expression/CallAnalyzer.php
#	src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/ConstFetchAnalyzer.php
#	src/Psalm/Internal/Analyzer/Statements/ReturnAnalyzer.php
#	src/Psalm/Internal/Analyzer/StatementsAnalyzer.php
#	src/Psalm/Internal/Analyzer/TypeAnalyzer.php
#	src/Psalm/Internal/Codebase/Analyzer.php
#	src/Psalm/Internal/Codebase/ClassLikes.php
#	src/Psalm/Internal/Codebase/Populator.php
#	src/Psalm/Internal/Codebase/Properties.php
#	src/Psalm/Internal/Codebase/Scanner.php
#	src/Psalm/Internal/LanguageServer/LanguageServer.php
#	src/Psalm/Internal/LanguageServer/Server/TextDocument.php
#	src/Psalm/Internal/Provider/FunctionExistenceProvider.php
#	src/Psalm/Internal/Provider/FunctionParamsProvider.php
#	src/Psalm/Internal/Provider/FunctionReturnTypeProvider.php
#	src/Psalm/Internal/Provider/MethodExistenceProvider.php
#	src/Psalm/Internal/Provider/MethodParamsProvider.php
#	src/Psalm/Internal/Provider/MethodReturnTypeProvider.php
#	src/Psalm/Internal/Provider/MethodVisibilityProvider.php
#	src/Psalm/Internal/Provider/PropertyExistenceProvider.php
#	src/Psalm/Internal/Provider/PropertyTypeProvider.php
#	src/Psalm/Internal/Provider/PropertyVisibilityProvider.php
#	src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayMapReturnTypeProvider.php
#	src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayReduceReturnTypeProvider.php
#	src/Psalm/Internal/Type/ParseTree.php
#	src/Psalm/Internal/Type/TypeCombination.php
#	src/Psalm/Internal/Visitor/ReflectorVisitor.php
#	src/Psalm/Type.php
#	src/Psalm/Type/Atomic/TNamedObject.php
#	src/Psalm/Type/Reconciler.php
#	src/command_functions.php
2e3s pushed a commit to 2e3s/psalm that referenced this pull request Sep 29, 2019
* Improve DOM extension types

* fixup! Improve DOM extension types
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