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

Deptrac does not recognize type aliases #1355

Open
patrickkusebauch opened this issue Jan 26, 2024 · 4 comments
Open

Deptrac does not recognize type aliases #1355

patrickkusebauch opened this issue Jan 26, 2024 · 4 comments

Comments

@patrickkusebauch
Copy link
Collaborator

Both PhpStan and Psalm allow users to define type aliases:

However, Deptrac does not recognize them and assumes there exists a class with the name of the alias. This results in Deptrac complaining about an uncovered dependency on a class that does not exist.

@MetalArend
Copy link

What a coincidence, only encountered this just now as well :) Thanks for reporting it.

@MetalArend
Copy link

MetalArend commented Jan 27, 2024

I saw #849. Here is a fairly simple example to trigger the uncovered type found in a @phpstan-type annotation.

<?php

namespace App;

/**
 * @phpstan-type TestType array<mixed>
 */
final class Test
{
    /**
     * @param TestType $content
     */
    private function __construct(private readonly array $content)
    {
    }
}
parameters:
  paths:
    - ./src/App
  layers:
    - name: App
      collectors:
        - type: directory
          value: src/App/.*
  ruleset:
    App: ~

@ghost
Copy link

ghost commented Feb 6, 2024

I confirm this issue (and #849).

@mpifx
Copy link

mpifx commented Sep 16, 2024

ACK for this one. It makes PHPStan's and Psalm's type aliases unusable when working with deptrac.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants