Answer the question
In order to leave comments, you need to log in
Why isn't one package class within another being generated when using composer to generate package autoload?
At the root of composer.json:
{
"autoload": {
"psr-4": {
"VendorName\\test\\": "vendor\\VendorName\\test"
}
}
}
<?php
namespace VendorName\test;
Class A
{
public function __construct()
{
}
}
<?php
namespace VendorName\test;
use VendorName\test A as A;
Class B
{
public function __construct()
{
return new A;
}
}
{
"name": "VendorName/test",
"description": "описание",
"version": "версия",
"license": "лицензия",
"autoload": {
"psr-4": {
"VendorName\\test\\": ""
}
},
}
var_dump(New VendorName\test\B);
Uncaught Error: Class 'VendorName\test\A' not found in C:\dev\testApp\vendor\VendorName\test\B.php
Answer the question
In order to leave comments, you need to log in
use VendorName\test A as A;
What are you trying to do here?
And what do the full paths to the A.php and B.php files look like?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question