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

Error with version 4.13.0 using DOMNodeList::count introduced only from PHP 7.2 #6980

Closed
AlessandroMinoccheri opened this issue Nov 23, 2021 · 2 comments · Fixed by #6981
Closed

Comments

@AlessandroMinoccheri
Copy link
Contributor

AlessandroMinoccheri commented Nov 23, 2021

I, I have a problem in our project with the new version 4.13.0

This is the config file used without problems since some days ago.

<?xml version="1.0"?>
<psalm
    errorLevel="3"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="https://getpsalm.org/schema/config"
    xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
>
    <projectFiles>
        <directory name="src" />
        <ignoreFiles>
            <directory name="vendor" />
        </ignoreFiles>
    </projectFiles>
</psalm>

I have some problems with PHP 7.1 and the error is:

Uncaught Error: Call to undefined method DOMNodeList::count() in /home/runner/work/arkitect/arkitect/vendor/vimeo/psalm/src/Psalm/Config.php:814

The problem is: The count() method (aka the Countable interface) on DOMNodeLists has been implemented since PHP 7.2.
You can see the Stack Trace here into our Github actions:

https://github.com/phparkitect/arkitect/runs/4304237741?check_suite_focus=true

@AlessandroMinoccheri AlessandroMinoccheri changed the title Error with version 4.13.0 about: Call to undefined method DOMNodeList::count Error with version 4.13.0 using DOMNodeList::count introduced only from PHP 7.2 Nov 23, 2021
@orklah
Copy link
Collaborator

orklah commented Nov 23, 2021

related to https://github.com/vimeo/psalm/pull/6913/files#diff-8d07f6a86af4900069be3c80774a29e2e7e2ffaffe434c781ba95de859cf874dR814

I'd have expected Psalm to pick this up, the callmap is correct, however, DOMNodeList is flagged as implementing Countable: https://github.com/vimeo/psalm/blob/master/stubs/DOM.phpstub#L40

so count is inherited, independently from callmap

@weirdan
Copy link
Collaborator

weirdan commented Nov 23, 2021

Fixed in #6981

@weirdan weirdan closed this as completed Nov 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants