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

Fix invalid class/method declaration in stub #6592

Merged
merged 1 commit into from
Oct 5, 2021

Conversation

sasezaki
Copy link
Contributor

@sasezaki sasezaki commented Oct 5, 2021

$ php -l stubs/SPL.phpstub
PHP Fatal error:  Abstract function SplHeap::compare() cannot contain body in stubs/SPL.phpstub on line 404
Errors parsing stubs/SPL.phpstub

This PR just fix above error in order to avoid confuse.

refs. PHP manual https://www.php.net/splheap

abstract class SplHeap

(Unexpectedly ? ) PHP-Parser can generate AST from uncompilable php code.

$ ./vendor/bin/php-parse -d '<?php abstract class A { protected abstract function compare() {}}'
====> Code <?php abstract class A { protected abstract function compare() {}}
==> Node dump:
array(
    0: Stmt_Class(
        attrGroups: array(
        )
        flags: MODIFIER_ABSTRACT (16)
        name: Identifier(
            name: A
        )
        extends: null
        implements: array(
        )
        stmts: array(
            0: Stmt_ClassMethod(
                attrGroups: array(
                )
                flags: MODIFIER_PROTECTED | MODIFIER_ABSTRACT (18)
                byRef: false
                name: Identifier(
                    name: compare
                )
                params: array(
                )
                returnType: null
                stmts: array(
                )
            )
        )
    )
)

@sasezaki sasezaki marked this pull request as ready for review October 5, 2021 12:54
@orklah orklah merged commit d0df1a6 into vimeo:master Oct 5, 2021
@orklah
Copy link
Collaborator

orklah commented Oct 5, 2021

Thanks!

@sasezaki sasezaki deleted the stub_spl_abstract_cannot_contain branch October 6, 2021 01:01
@weirdan weirdan added the release:fix The PR will be included in 'Fixes' section of the release notes label Oct 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release:fix The PR will be included in 'Fixes' section of the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants