Issues (177)

Standalone/StandaloneLaruploadCallables.php (2 issues)

1
<?php
2
3
namespace Mostafaznv\Larupload\Concerns\Standalone;
4
5
use Mostafaznv\Larupload\Larupload;
6
7
trait StandaloneLaruploadCallables
8
{
9
    /**
10
     * @internal
11
     */
12
    public function url(string $style = Larupload::ORIGINAL_FOLDER): ?string
13
    {
14
        if ($this->internalFunctionIsCallable) {
15
            return parent::url($style);
16
        }
17
18
        $this->internalException();
0 ignored issues
show
It seems like internalException() 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

18
        $this->/** @scrutinizer ignore-call */ 
19
               internalException();
Loading history...
19
    }
20
21
    /**
22
     * @internal
23
     */
24
    public function meta(string $key = null): object|int|string|null
25
    {
26
        if ($this->internalFunctionIsCallable) {
27
            return parent::meta($key);
28
        }
29
30
        $this->internalException();
31
    }
32
33
    /**
34
     * @internal
35
     */
36
    public function urls(): object
37
    {
38
        if ($this->internalFunctionIsCallable) {
39
            return parent::urls();
40
        }
41
42
        $this->internalException();
0 ignored issues
show
Bug Best Practice introduced by
In this branch, the function will implicitly return null which is incompatible with the type-hinted return object. Consider adding a return statement or allowing null as return value.

For hinted functions/methods where all return statements with the correct type are only reachable via conditions, ?null? gets implicitly returned which may be incompatible with the hinted type. Let?s take a look at an example:

interface ReturnsInt {
    public function returnsIntHinted(): int;
}

class MyClass implements ReturnsInt {
    public function returnsIntHinted(): int
    {
        if (foo()) {
            return 123;
        }
        // here: null is implicitly returned
    }
}
Loading history...
43
    }
44
45
    /**
46
     * @internal
47
     */
48
    public function handleFFMpegQueue(bool $isLastOne = false, bool $standalone = false): void
49
    {
50
        if ($this->internalFunctionIsCallable) {
51
            parent::handleFFMpegQueue($isLastOne, $standalone);
52
        }
53
        else {
54
            $this->internalException();
55
        }
56
    }
57
}
58