Issues (632)

src/Traits/SelectableInputs.php (25 issues)

1
<?php
0 ignored issues
show
This file is missing a doc comment.
Loading history...
The PHP open tag does not have a corresponding PHP close tag
Loading history...
Filename "SelectableInputs.php" doesn't match the expected filename "selectableinputs.php"
Loading history...
2
namespace EddIriarte\Console\Traits;
0 ignored issues
show
Missing file doc comment
Loading history...
3
4
use EddIriarte\Console\Helpers\SelectionHelper;
5
use EddIriarte\Console\Inputs\CheckboxInput;
6
use EddIriarte\Console\Inputs\RadioInput;
7
use Symfony\Component\Console\Input\InputInterface;
8
use Symfony\Component\Console\Output\OutputInterface;
9
10
trait SelectableInputs
0 ignored issues
show
Missing class doc comment
Loading history...
11
{
0 ignored issues
show
Opening brace should be on the same line as the declaration for trait SelectableInputs
Loading history...
12 1
    public function enableSelectHelper(InputInterface $input, OutputInterface $output)
0 ignored issues
show
Expected 2 blank lines before function; 0 found
Loading history...
Missing function doc comment
Loading history...
13
    {
0 ignored issues
show
Opening brace should be on the same line as the declaration
Loading history...
14 1
        $this->getHelperSet()->set(
0 ignored issues
show
It seems like getHelperSet() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

14
        $this->/** @scrutinizer ignore-call */ 
15
               getHelperSet()->set(
Loading history...
15 1
            new SelectionHelper($input, $output)
16
        );
17 1
    }
0 ignored issues
show
Expected 2 blank lines after function; 1 found
Loading history...
Expected 1 blank line before closing function brace; 0 found
Loading history...
Expected //end enableSelectHelper()
Loading history...
18
19 2
    public function select(string $message, array $options, bool $allowMultiple = true)
0 ignored issues
show
Missing function doc comment
Loading history...
TRUE, FALSE and NULL should be uppercase as per the configured coding-style; instead of true please use TRUE.
Loading history...
20
    {
0 ignored issues
show
Opening brace should be on the same line as the declaration
Loading history...
21 2
        $helper = $this->getHelper('selection');
0 ignored issues
show
It seems like getHelper() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

21
        /** @scrutinizer ignore-call */ 
22
        $helper = $this->getHelper('selection');
Loading history...
Equals sign not aligned with surrounding assignments; expected 3 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
22 2
        $question = $allowMultiple ? new CheckboxInput($message, $options) : new RadioInput($message, $options);
0 ignored issues
show
The value of a comparison must not be assigned to a variable
Loading history...
Inline IF statements are not allowed
Loading history...
Inline shorthand IF statement requires brackets around comparison
Loading history...
23
24 2
        return $helper->select($question);
25
    }
0 ignored issues
show
Expected 2 blank lines after function; 0 found
Loading history...
Expected 1 blank line before closing function brace; 0 found
Loading history...
Expected //end select()
Loading history...
26
}
0 ignored issues
show
As per coding style, files should not end with a newline character.

This check marks files that end in a newline character, i.e. an empy line.

Loading history...
27