composer / getcomposer.org

getcomposer.org sources

Home Page:http://getcomposer.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Classmap wildcards supported or not?

tbreuss opened this issue · comments

commented

The current documentation states that wildcards are supported:

Wildcards (*) are also supported in a classmap paths, and expand to match any directory name:

See: https://getcomposer.org/doc/04-schema.md#classmap

If I do so, composer quits with a runtime exception:

[RuntimeException]                                                                                   
Could not scan for classes inside "folder_with_classes/*" which does not appear to be a file nor a folder 

I use composer version 1.10.17 on macOS.

Can you show the output of find folder_with_classes ?

commented

Here is an excerpt of the output.

folder_with_classes
folder_with_classes/minify
folder_with_classes/minify/JSMin.php
folder_with_classes/minify/Minify_HTML.php
folder_with_classes/minify/Minify_CSS_Compressor.php
folder_with_classes/library
folder_with_classes/library/TcpdfList.php
folder_with_classes/library/global.php
folder_with_classes/library/FpdfList.php
folder_with_classes/library/KeyValueModel.php
etc.

The confusiong thing about this issue is

  • that the classmap autoloader seems to work recursive
  • the docu states that there is a wildcard like "folder/*"
  • which implicitly meens that this should be used for nested folders (?)

But if i do so, it ends with a runtime exception.

Ah sorry I missed your I use composer version 1.10.17 on macOS.. This feature is only available from Composer 2.0.0.

That said, just using folder_with_classes/ is enough as it will anyway be parsed recursively. The wildcard is only useful in the middle of the path IMO.

commented

👍 +1