From 7e6837db20ebb360f2b97fa87411d11a4b500bf6 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Tue, 14 Jul 2020 20:26:07 +0100 Subject: [PATCH] Apply fixes from StyleCI (#451) --- src/Parser/EntryParser.php | 4 ++-- src/Parser/Lexer.php | 2 +- src/Repository/RepositoryBuilder.php | 2 +- src/Util/Str.php | 2 +- tests/Dotenv/DotenvTest.php | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Parser/EntryParser.php b/src/Parser/EntryParser.php index c236b086..64df9a02 100644 --- a/src/Parser/EntryParser.php +++ b/src/Parser/EntryParser.php @@ -92,8 +92,8 @@ private static function splitStringIntoParts(string $line) */ private static function parseName(string $name) { - if (Str::len($name) > 8 && Str::substr($name, 0, 6) === 'export' && ctype_space(Str::substr($name, 6, 1))) { - $name = ltrim(Str::substr($name, 6)); + if (Str::len($name) > 8 && Str::substr($name, 0, 6) === 'export' && \ctype_space(Str::substr($name, 6, 1))) { + $name = \ltrim(Str::substr($name, 6)); } if (self::isQuotedName($name)) { diff --git a/src/Parser/Lexer.php b/src/Parser/Lexer.php index 048b4e8f..c5eb64d3 100644 --- a/src/Parser/Lexer.php +++ b/src/Parser/Lexer.php @@ -51,7 +51,7 @@ public static function lex(string $content) while (isset($content[$offset])) { if (!\preg_match($regex, $content, $matches, 0, $offset)) { - throw new \Error(sprintf('Lexer encountered unexpected character [%s].', $content[$offset])); + throw new \Error(\sprintf('Lexer encountered unexpected character [%s].', $content[$offset])); } $offset += \strlen($matches[0]); diff --git a/src/Repository/RepositoryBuilder.php b/src/Repository/RepositoryBuilder.php index 299f90fb..f8a92644 100644 --- a/src/Repository/RepositoryBuilder.php +++ b/src/Repository/RepositoryBuilder.php @@ -6,12 +6,12 @@ use Dotenv\Repository\Adapter\AdapterInterface; use Dotenv\Repository\Adapter\EnvConstAdapter; +use Dotenv\Repository\Adapter\GuardedWriter; use Dotenv\Repository\Adapter\ImmutableWriter; use Dotenv\Repository\Adapter\MultiReader; use Dotenv\Repository\Adapter\MultiWriter; use Dotenv\Repository\Adapter\ReaderInterface; use Dotenv\Repository\Adapter\ServerConstAdapter; -use Dotenv\Repository\Adapter\GuardedWriter; use Dotenv\Repository\Adapter\WriterInterface; use InvalidArgumentException; use PhpOption\Some; diff --git a/src/Util/Str.php b/src/Util/Str.php index fc8d88a4..1a49a1e6 100644 --- a/src/Util/Str.php +++ b/src/Util/Str.php @@ -57,7 +57,7 @@ public static function utf8(string $input, string $encoding = null) */ public static function split(string $input) { - $result = mb_str_split($input, 1, 'UTF-8'); + $result = \mb_str_split($input, 1, 'UTF-8'); if ($result === false) { /** @var \GrahamCampbell\ResultType\Result */ diff --git a/tests/Dotenv/DotenvTest.php b/tests/Dotenv/DotenvTest.php index e9fe489f..b927d9ba 100644 --- a/tests/Dotenv/DotenvTest.php +++ b/tests/Dotenv/DotenvTest.php @@ -155,8 +155,8 @@ public function testLargeDotenvLoadsEnvironmentVars() { $dotenv = Dotenv::createMutable(self::$folder, 'large.env'); $dotenv->load(); - self::assertSame(2730, strlen($_SERVER['LARGE'])); - self::assertSame(8192, strlen($_SERVER['HUGE'])); + self::assertSame(2730, \strlen($_SERVER['LARGE'])); + self::assertSame(8192, \strlen($_SERVER['HUGE'])); } public function testDotenvLoadsMultibyteVars()