Issues (224)

src/Compactor/PhpScoper.php (1 issue)

Labels
Severity
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\PhpScoper\Scoper;
18
use Throwable;
19
20
/**
21
 * @private
22
 */
23
final readonly class PhpScoper implements Compactor
0 ignored issues
show
A parse error occurred: Syntax error, unexpected T_READONLY, expecting T_CLASS on line 23 at column 6
Loading history...
24
{
25
    public function __construct(private Scoper $scoper)
26
    {
27
    }
28
29
    public function compact(string $file, string $contents): string
30
    {
31
        try {
32
            return $this->scoper->scope($file, $contents);
33
        } catch (Throwable) {
34
            return $contents;
35
        }
36
    }
37
38
    public function getScoper(): Scoper
39
    {
40
        return $this->scoper;
41
    }
42
}
43