Completed
Pull Request — master (#31)
by Théo
100:14 queued 97:52
created

PhpScoper::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the box project.
7
 *
8
 * (c) Kevin Herrera <[email protected]>
9
 *     Théo Fidry <[email protected]>
10
 *
11
 * This source file is subject to the MIT license that is bundled
12
 * with this source code in the file LICENSE.
13
 */
14
15
namespace KevinGH\Box\Compactor;
16
17
use KevinGH\Box\Compactor;
18
use Humbug\PhpScoper\Scoper;
19
20
final class PhpScoper implements Compactor
21
{
22
    private $scoper;
23
24
    public function __construct(Scoper $scoper)
25
    {
26
        $this->scoper = $scoper;
27
    }
28
    
29
    /**
30
     * @inheritdoc
31
     */
32
    public function compact(string $file, string $contents): string
33
    {
34
        return $this->scoper->scope($file, $contents, '', [], []);
0 ignored issues
show
Bug introduced by
The call to Humbug\PhpScoper\Scoper::scope() has too few arguments starting with globalWhitelister. ( Ignorable by Annotation )

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

34
        return $this->scoper->/** @scrutinizer ignore-call */ scope($file, $contents, '', [], []);

This check compares calls to functions or methods with their respective definitions. If the call has less 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...
35
    }
36
}
37