Closed MGatner closed 3 years ago
Hmm... since migrations are not really autoloaded via composer and we have our own system to auto-discover them by namespaces - I suppose it's not really an issue?
I haven't checked anything related to this, but there is something like exclude-from-classmap
option in the composer file. Maybe this would help?
That sounds exactly like what we need! Not urgent as this is just a warning, but good to look into.
Actually, it looks to me like migrations don't even need to be namespaced. The runner uses the base namespace and then forces the subdirectory Database/Migrations so I think it ignores the actual namespace of the file altogether. I'm not sure if that would fix the warning or not but I don't believe it would affect the framework.
I don't think Composer's deprecation notice is related to the namespace, but rather the clashing migration class name against the file name. The filename uses a date component prepended to the class name but the actual class name does not. Anyway, I fixed this in my current project by adding this to composer.json's autoload
key.
"exclude-from-classmap": [
"**/Database/Migrations/**"
]
@MGatner Is this still a concern?
I think Paul's solution is the appropriate way to handle it. We should probably get this into the User Guide and the default composer.json files before closing this issue.
name: Bug report about: Help us improve the framework by reporting bugs!
Direction I haven’t dug into this yet but PHPUnit tests are giving the following warning about Composer and PSR-4 compatibility:
Deprecation Notice: Class Myth\Auth\Database\Migrations\CreateAuthTables located in ./vendor/myth/auth/src/Database/Migrations/2017-11-20-223112_create_auth_tables.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar:///usr/bin/composer/src/Composer/Autoload/ClassMapGenerator.php:201
CodeIgniter 4 version develop branch
Affected module(s) Composer/PHPUnit
Context