Skip to content

Calling static methods on an interface that has __callStatic is allowed #17718

Closed
@azjezz

Description

@azjezz

Description

Calling a static method on an interface should not be allowed as __callStatic is abstract.

This issue seems to have started with PHP 8.0

The following code:

<?php

interface Foo {
    public static function __callStatic($method, $args);
}

Foo::bar();

Resulted in this output:

But I expected this output instead:

Error: cannot call static methods on an interface

PHP Version

PHP >=8.0.0

Operating System

N/A

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions