Thanks to visit codestin.com
Credit goes to github.com

Skip to content

hasFlag - Wrong documentation or implementation? #29

@obstschale

Description

@obstschale

The docs have the following snippet for flags:

<?php
    public function handle()
    {       
        $message = "Hello World";
        if ($this->hasFlag('shout')) {
            $message = strtoupper($message);
        }

        $this->getPrinter()->display($message);
    }

However then I try to use hasFlag I receive the following output.

    public function handle()
    {       
       var_dump($this->hasFlag('verbose')); // bool(false)
    }
    public function handle()
    {       
       var_dump($this->hasFlag('--verbose')); // bool(true)
    }

My question is: Are the docs wrong in this case or is the implementation wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions