Skip to content

Bug: defining new namespace under app/ causes Cannot declare class ..., because the name is already in use #5818

@datamweb

Description

@datamweb

PHP Version

8.0

CodeIgniter4 Version

v4.1.9

CodeIgniter4 Installation Method

Composer (using codeigniter4/appstarter)

Which operating systems have you tested for this bug?

Windows

Which server did you use?

apache

Database

--

What happened?

Problem in command php spark make:command --namespace MyNameSpace

Steps to Reproduce

composer create-project codeigniter4/appstarter project-root

    public $psr4 = [
        'MyNameSpace' 	        => APPPATH . 'ThirdParty\MyFolder',
    ];

php spark make:command --namespace MyNameSpace

Command class name : TeseCommand
File created: APPPATH\ThirdParty\MyFolder\Commands\TeseCommand.php

Everything is done well.
The corresponding file is created.
But now typing command php spark displays the following error!

PHP Fatal error:  Cannot declare class MyNameSpace\Commands\TeseCommand, because the name is already in use in P:\Program\xampp8010\htdocs\cimc\app\ThirdParty\MyFolder\Commands\TeseCommand.php on line 8

[ErrorException]

Cannot declare class MyNameSpace\Commands\TeseCommand, because the name is already in use

at APPPATH\ThirdParty\MyFolder\Commands\TeseCommand.php:8

Expected Output

@paulbalandan , @kenjis need to check to fix the problem. Please check.

Anything else?

This problem only exists in the installation method through composer .
This problem does not exist in the manual installation method.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugVerified issues on the current code behavior or pull requests that will fix them

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions