Welcome Guest, Not a member yet? Register   Sign In
Custom CLI Return "Cannot declare class name in use"
#1

(This post was last modified: 03-31-2021, 08:46 AM by simonickalexs.)

I'm trying to test to make my own CLI command on my own library but it throw error cannot declare `someone\plugin\Commands` because the class name is already in use. Here's the source code.

PHP Code:
<?php
namespace someone\plugin\Commands;

use 
CodeIgniter\CLI\BaseCommand;
use 
CodeIgniter\CLI\CLI;

class 
PrintHelloWorld extends BaseCommand
{
    
/**
     * The Command's Group
     *
     * @var string
     */
    
protected $group 'Testing';

    
/**
     * The Command's Name
     *
     * @var string
     */
    
protected $name 'print:dummy';

    
/**
     * The Command's Description
     *
     * @var string
     */
    
protected $description 'Print Hello World';

    
/**
     * The Command's Usage
     *
     * @var string
     */
    
protected $usage 'print:dummy [options]';

    
/**
     * The path to someone\src directory.
     *
     * @var string
     */
    
protected $sourcePath;

    
/**
     * The command's options
     *
     * @var array
     */
    
protected $options = [];

    
/**
     * Actually execute the command.
     *
     * @param array $params
     *
     * @return void
     */
    
public function run(array $params)
    {
        
CLI::write('Hello world!.''green');
    }



Can someone explain why? Thank you.

Edit: I put it on the ThirdParty folder. Full path is on "ThirdParty\trydummy\src".
Reply


Messages In This Thread
Custom CLI Return "Cannot declare class name in use" - by simonickalexs - 03-31-2021, 08:28 AM



Theme © iAndrew 2016 - Forum software by © MyBB