Test Failed
Pull Request — master (#1200)
by
unknown
04:08
created

InvalidExtensionException   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 5
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 2
Metric Value
eloc 2
c 2
b 0
f 2
dl 0
loc 5
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
1
<?php
2
3
namespace UniSharp\LaravelFilemanager\Exceptions;
4
5
class InvalidExtensionException extends \Exception
6
{
7
    public function __construct()
8
    {
9
        $this->message = trans('laravel-filemanager::lfm.error-invalid');
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $this->message is correct as trans('laravel-filemanager::lfm.error-invalid') seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
Unused Code introduced by
The call to trans() has too many arguments starting with 'laravel-filemanager::lfm.error-invalid'. ( Ignorable by Annotation )

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

9
        $this->message = /** @scrutinizer ignore-call */ trans('laravel-filemanager::lfm.error-invalid');

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
10
    }
11
}
12