[Bug]: Cannot resolve the namespace
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 11.7k
- Forks
- 538
- Avg merge
- 4d 11h
- Merged PRs (30d)
- 8
Description
What Happened
Hello, I wrote this test in the namespace Application
arch('src')
->expect('Application\*\UseCases')
->toHaveMethod('execute');
and i have this following error :
Symfony\Component\Finder\Exception\DirectoryNotFoundException: The "/Users/npldev/dev/apiasddd/vendor/composer/../../app/lication/*/UseCases" directory does not exist.
at vendor/symfony/finder/Finder.php:646
at vendor/pestphp/pest-plugin-arch/src/Repositories/ObjectsRepository.php:106
at vendor/pestphp/pest-plugin-arch/src/Repositories/ObjectsRepository.php:104
at vendor/pestphp/pest-plugin-arch/src/Factories/LayerFactory.php:61
at vendor/pestphp/pest-plugin-arch/src/Blueprint.php:98
at vendor/pestphp/pest-plugin-arch/src/Expectations/Targeted.php:43
at vendor/pestphp/pest-plugin-arch/src/SingleArchExpectation.php:162
at vendor/pestphp/pest-plugin-arch/src/SingleArchExpectation.php:146
How to Reproduce
In my composer.json here is the autoload part :
{
"autoload": {
"psr-4": {
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/",
"Application\\": "src/Application/",
"Domain\\": "src/Domain/",
"Infrastructure\\": "src/Infrastructure/",
"App\\": "app/"
}
},
}
Sample Repository
No response
Pest Version
3.8.4
PHP Version
8.4
Operation System
macOS
Notes
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the provided arch expectation with the composer PSR-4 mappings, then inspect vendor/pestphp/pest-plugin-arch/src/Repositories/ObjectsRepository.php around line 106 and the LayerFactory call at line 61. Trace how the Application namespace becomes the Finder path. Done means the namespace resolves to the configured source directory without the DirectoryNotFoundException.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100