Skip to content

Implemented interfaces don't inherit phpdoc-params #265

@Nadyita

Description

@Nadyita

🐞 Describe the Bug

When a class implements an interface, it should automatically inherit the @params defined in the interface. At least once {@inheritDoc} is added, but mago analyzer doesn't, which is very inconvenient and contrary to how psalm and phpstan do it

🔄 Steps to Reproduce

. Run mago anaylze` on my example code

⚙️ Configuration (mago.toml)

-

📜 Command Output

warning[mixed-assignment]: Assigning `mixed` type to a variable may lead to unexpected behavior.
   ┌─ test.php:11:28
   │
11 │     foreach ($x as $int => $string) {
   │                            ^^^^^^^ Assigning `mixed` type here.
   │
   = Using `mixed` can lead to runtime errors if the variable is used in a way that assumes a specific type.
   = Help: Consider using a more specific type to avoid potential issues.

warning: found 1 issues: 1 warning(s)

📂 PHP Code Sample (If Applicable)

<?php declare(strict_types=1);

interface testInterface {
  /** @param array<int,string> $x */
  public function test(array $x): void;
}

class testClass implements testInterface {
  /** {@inheritDoc} */
  public function test(array $x): void {
    foreach ($x as $int => $string) {
    }
  }
}

🖥️ Operating System

Linux

📦 How did you install Mago?

Built from Source

📝 Additional Context

No response

Metadata

Metadata

Assignees

Labels

Type: BugAn issue causing unintended or problematic behavior.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions