Poser extends class not found

Asked

Viewed 245 times

2

How to use extends with the Poser autoloade? As it is returns me the following error:

Fatal error: Class 'App\Modulos\Mail\Mail' not found in ...Google.php on line 7

Composer:

"autoload": {
    "psr-4": {
        "App\\": "app/"
    }
}

Structure:

- Public
    app/
        Modulos/
                Mail/
                     Google.php
                     Mail.php
    vendor/
    bootstrap.php
    cli-config.php
    composer.json
    composer.lock
    index.php
    router.php

Public/index php.

<?php
require __DIR__.'/vendor/autoload.php';

$google = new \App\Modulos\Mail\Google;

var_dump($google);

app/Modulos/Mail/Google.php

<?php

namespace Google;

use \App\Modulos\Mail\Mail;

class Google extends Mail {

}

app/Modulos/Mail/Mail.php

<?php

namespace Mail;

abstract class Mail {

}
  • in the title @rray?

1 answer

2


I managed to solve by just changing the "namespace" in the archives:

app/Modulos/Mail/Google.php

<?php

namespace App\Modulos\Mail;

use \App\Modulos\Mail\Mail;

class Google extends Mail {

}

app/Modulos/Mail/Mail.php

<?php

namespace App\Modulos\Mail;

abstract class Mail {

}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.