src/Console/CommandTrait.php
public function getArguments(): array
    {
        // if user not define any arguments, get argument info from method parameters
        if ($this->arguments === null) {
            $this->arguments = [];

            $ro = new \ReflectionObject($this);
            if (!$ro->hasMethod('execute')) {
                throw new ExecuteMethodNotDefinedException($this);
            }

            $method = $ro->getMethod('execute');
            $parameters = $method->getParameters();

            foreach ($parameters as $param) {
                $a = $this->addArgument($param->getName());
                if ($param->isOptional()) {
                    $a->optional();

                    if ($param->isDefaultValueAvailable()) {
                        $a->setValue($param->getDefaultValue());
                    }
                }
            }
        }

        return $this->arguments;
    }
public function getArguments(): array
    {
        // if user not define any arguments, get argument info from method parameters
        if ($this->arguments === null) {
            $this->arguments = [];

            $ro = new \ReflectionObject($this);
            if (!$ro->hasMethod('execute')) {
                throw new ExecuteMethodNotDefinedException($this);
            }

            $method = $ro->getMethod('execute');
            $parameters = $method->getParameters();

            foreach ($parameters as $param) {
                $a = $this->addArgument($param->getName());
                if ($param->isOptional()) {
                    $a->optional();

                    if ($param->isDefaultValueAvailable()) {
                        $a->setValue($param->getDefaultValue());
                    }
                }
            }
        }

        return $this->arguments;
    }
public function getArguments ( ) : array { // if user not define any arguments, get argument info from method parameters if ( $ this -> arguments === null ) { $ this -> arguments = [ ] ; $ ro = new \ ReflectionObject ( $ this ) ; if ( ! $ ro -> hasMethod ( 'execute' ) ) { throw new ExecuteMethodNotDefinedException ( $ this ) ; } $ method = $ ro -> getMethod ( 'execute' ) ; $ parameters = $ method -> getParameters ( ) ; foreach ( $ parameters as $ param ) { $ a = $ this -> addArgument ( $ param -> getName ( ) ) ; if ( $ param -> isOptional ( ) ) { $ a -> optional ( ) ; if ( $ param -> isDefaultValueAvailable ( ) ) { $ a -> setValue ( $ param -> getDefaultValue ( ) ) ; } } } } return $ this -> arguments ; }
Return the defined argument info objects.

@return Argument[]
@throws ExecuteMethodNotDefinedException
Return the defined argument info objects .