Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 784788e035 |
14
psalm.xml
Normal file
14
psalm.xml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<psalm
|
||||||
|
errorLevel="1"
|
||||||
|
resolveFromConfigFile="true"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xmlns="https://getpsalm.org/schema/config"
|
||||||
|
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
|
||||||
|
>
|
||||||
|
<projectFiles>
|
||||||
|
<directory name="src" />
|
||||||
|
<ignoreFiles>
|
||||||
|
</ignoreFiles>
|
||||||
|
</projectFiles>
|
||||||
|
</psalm>
|
||||||
@@ -15,16 +15,13 @@
|
|||||||
*
|
*
|
||||||
* @param string $path Folder to file, default is __DIR__
|
* @param string $path Folder to file, default is __DIR__
|
||||||
* @param string $env_file What file to load, default is .env
|
* @param string $env_file What file to load, default is .env
|
||||||
* @return int -1 other error
|
* @return int 0 for success full load
|
||||||
* 0 for success full load
|
|
||||||
* 1 for file loadable, but no data inside
|
* 1 for file loadable, but no data inside
|
||||||
* 2 for file not readable
|
* 2 for file not readable
|
||||||
* 3 for file not found
|
* 3 for file not found
|
||||||
*/
|
*/
|
||||||
function readEnvFile(string $path = __DIR__, string $env_file = '.env'): int
|
function readEnvFile(string $path = __DIR__, string $env_file = '.env'): int
|
||||||
{
|
{
|
||||||
// default -1;
|
|
||||||
$status = -1;
|
|
||||||
$env_file_target = $path . DIRECTORY_SEPARATOR . $env_file;
|
$env_file_target = $path . DIRECTORY_SEPARATOR . $env_file;
|
||||||
// this is not a file -> abort
|
// this is not a file -> abort
|
||||||
if (!is_file($env_file_target)) {
|
if (!is_file($env_file_target)) {
|
||||||
@@ -74,6 +71,7 @@ function readEnvFile(string $path = __DIR__, string $env_file = '.env'): int
|
|||||||
$line = $matches[1];
|
$line = $matches[1];
|
||||||
}
|
}
|
||||||
// strip line of slashes
|
// strip line of slashes
|
||||||
|
/** @psalm-suppress MixedOperand */
|
||||||
$_ENV[$var] .= stripslashes($line);
|
$_ENV[$var] .= stripslashes($line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user