vimeo/psalm

Declaring stubs in directory

Open

#9.193 geöffnet am 27. Jan. 2023

Auf GitHub ansehen
 (6 Kommentare) (2 Reaktionen) (0 zugewiesene Personen)PHP (668 Forks)batch import
Help wantedeasy problemsenhancementgood first issue

Repository-Metriken

Stars
 (5.369 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 3T 12h) (5 gemergte PRs in 30 T)

Beschreibung

Right now, the <stubs> configuration node only supports the <file> node as a child.

This is problematic when:

  • there are multiple files
  • stubs files are generated dynamically

Having experienced both of the above, I think it would be nice if Psalm would support <directory> as <stubs>'s child node. Similar to how <projectFiles> already does.

Alternatively, the <file> node could support a pattern attribute to be used instead of <name>, so instead of

    <stubs>
        <file name="path/to/my/stubs/file1.php" />
        <file name="path/to/my/stubs/file2.php" />
        <file name="path/to/my/stubs/file3.php" />
        <file name="path/to/my/stubs/file4.php" />
    </stubs>

one could do either:

    <stubs>
        <directory name="path/to/my/stubs/" />
    </stubs>

or:

    <stubs>
        <file pattern="path/to/my/stubs/*.php" />
    </stubs>

Both approaches would solve this issue. The pattern attribute available for the StubsAttributeType XML type will enable it for any other usage of the <file> node in configuration.

Contributor Guide