src/Process/Http/ResponseBodyEncoder.php

Summary

Maintainability
A
45 mins
Test Coverage

Method __invoke has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

        ServerRequestInterface $request, 
        ResponseInterface $response, 
        StreamFactoryInterface $streamFactory, 
        LoggerInterface $logger,
        ObjectMapper $objectMapperJson,
Severity: Minor
Found in src/Process/Http/ResponseBodyEncoder.php - About 45 mins to fix

    Avoid unused local variables such as '$message'.
    Open

            $message = $t->getMessage();

    UnusedLocalVariable

    Since: 0.2

    Detects when a local variable is declared and/or assigned, but not used.

    Example

    class Foo {
        public function doSomething()
        {
            $i = 5; // Unused
        }
    }

    Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

    Avoid unused parameters such as '$request'.
    Open

            ServerRequestInterface $request, 

    UnusedFormalParameter

    Since: 0.2

    Avoid passing parameters to methods or constructors and then not using those parameters.

    Example

    class Foo
    {
        private function bar($howdy)
        {
            // $howdy is not used
        }
    }

    Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

    Avoid unused parameters such as '$logger'.
    Open

            LoggerInterface $logger,

    UnusedFormalParameter

    Since: 0.2

    Avoid passing parameters to methods or constructors and then not using those parameters.

    Example

    class Foo
    {
        private function bar($howdy)
        {
            // $howdy is not used
        }
    }

    Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

    syntax error, unexpected ':', expecting ',' or ')'
    Open

                status: 500,
    Severity: Critical
    Found in src/Process/Http/ResponseBodyEncoder.php by phan

    Avoid variables with short names like $t. Configured minimum length is 3.
    Open

        public function convertToSerializable(Throwable $t){

    ShortVariable

    Since: 0.2

    Detects when a field, local, or parameter has a very short name.

    Example

    class Something {
        private $q = 15; // VIOLATION - Field
        public static function main( array $as ) { // VIOLATION - Formal
            $r = 20 + $this->q; // VIOLATION - Local
            for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                $r += $this->q;
            }
        }
    }

    Source https://phpmd.org/rules/naming.html#shortvariable

    Expected 1 blank line at end of file; 2 found
    Open

    }

    The closing parenthesis of a multi-line function declaration must be on a new line
    Open

            UnitTrackerInterface $unitTracker)

    The closing parenthesis and the opening brace of a multi-line function declaration must be on the same line
    Open

        {

    Expected 1 space after IF keyword; 0 found
    Open

            if($t instanceof \Pluf\Orm\Exception){

    Usage of ELSE IF is discouraged; use ELSEIF instead
    Open

            } else if($t instanceof \atk4\core\Exception){

    Opening brace should be on a new line
    Open

        public function convertToSerializable(Throwable $t){

    Closing parenthesis of a multi-line function call must be on a line by itself
    Open

                solutions: $solutions);

    Multi-line function call not indented correctly; expected 8 spaces but found 12
    Open

                solutions: $solutions);

    Whitespace found at end of line
    Open

            ServerRequestInterface $request, 

    Whitespace found at end of line
    Open

            StreamFactoryInterface $streamFactory, 

    Expected 1 space after closing parenthesis; found 0
    Open

            if($t instanceof \Pluf\Orm\Exception){

    Expected 1 space after IF keyword; 0 found
    Open

            } else if($t instanceof \atk4\core\Exception){

    Whitespace found at end of line
    Open

            ResponseInterface $response, 

    Expected 1 space after closing parenthesis; found 0
    Open

            } else if($t instanceof \atk4\core\Exception){

    There are no issues that match your filters.

    Category
    Status