Skip to content

Undetected incompatible declaration error #198

Description

@Disservin

PHPantom version

phpantom_lsp 0.8.0-86-gefdc9ae4

Installation method

Built from source

Operating system

macOS aarch64 (Apple Silicon)

Editor

VS Code

Bug description

The following code generates a compile error, which isn't detected and not warned about.

Fatal error: Declaration of Bar::foo(): ?Bar must be compatible with Foo::foo(): ?static in php-wasm run script on line 11

Steps to reproduce

<?php

class Foo {
    public static function foo(): ?static
    {
        return new static();
    }
}

class Bar extends Foo {
    public static function foo(): ?self // wrong should be ?static but phpantom doesn't detect this
    {
        return new self();
    }
}

Error output or panic trace


.phpantom.toml

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions