Issues (2)

src/Traits/PackageEnvLoader.php (2 issues)

Labels
Severity
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SolumDeSignum\PackageEnvLoader\Traits;
6
7
use Dotenv\Dotenv;
8
use Dotenv\Exception\InvalidFileException;
9
use Illuminate\Support\Env;
0 ignored issues
show
The type Illuminate\Support\Env was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
10
11
trait PackageEnvLoader
12
{
13
    /**
14
     * @param string $environmentFile
15
     *
16
     * @return null[]|string|string[]
17
     */
18
    final public function createPackageDotenv(string $environmentFile = '.env')
19
    {
20
        try {
21
            $response = Dotenv::create(
22
                Env::getRepository(),
23
                $this->packageEnvRootPath(),
0 ignored issues
show
It seems like packageEnvRootPath() 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

23
                $this->/** @scrutinizer ignore-call */ 
24
                       packageEnvRootPath(),
Loading history...
24
                $environmentFile
25
            )
26
                ->load();
27
        } catch (InvalidFileException $e) {
28
            $response = $e->getMessage();
29
        }
30
31
        return $response;
32
    }
33
}
34