From 6496badc13e6c36d7545c93e02cf314b3f6a5a3e Mon Sep 17 00:00:00 2001 From: Adrian Suter Date: Mon, 11 May 2020 00:05:37 +0200 Subject: [PATCH] Fix use const and use function for php natives --- src/Config/Config.php | 2 ++ src/Config/ConfigResolver.php | 2 ++ src/Config/Parser/JSONConfigParser.php | 2 ++ tests/Config/ConfigResolverTest.php | 2 ++ tests/Config/Parser/JSONConfigParserTest.php | 2 ++ tests/Config/Parser/PHPConfigParserTest.php | 2 ++ tests/TestCase.php | 4 ++++ 7 files changed, 16 insertions(+) diff --git a/src/Config/Config.php b/src/Config/Config.php index 713355c..c52189f 100644 --- a/src/Config/Config.php +++ b/src/Config/Config.php @@ -17,6 +17,8 @@ use function getenv; use function is_string; +use const DIRECTORY_SEPARATOR; + class Config { public const SLIM_CONSOLE_BOOTSTRAP_DIR = 'SLIM_CONSOLE_BOOTSTRAP_DIR'; diff --git a/src/Config/ConfigResolver.php b/src/Config/ConfigResolver.php index acad6c3..31286e7 100644 --- a/src/Config/ConfigResolver.php +++ b/src/Config/ConfigResolver.php @@ -23,6 +23,8 @@ use function is_readable; use function is_string; +use const DIRECTORY_SEPARATOR; + class ConfigResolver { public const CONFIG_FILENAME = 'slim-console.config'; diff --git a/src/Config/Parser/JSONConfigParser.php b/src/Config/Parser/JSONConfigParser.php index beead09..8f602aa 100644 --- a/src/Config/Parser/JSONConfigParser.php +++ b/src/Config/Parser/JSONConfigParser.php @@ -19,6 +19,8 @@ use function json_last_error; use function json_last_error_msg; +use const JSON_ERROR_NONE; + class JSONConfigParser implements ConfigParserInterface { /** diff --git a/tests/Config/ConfigResolverTest.php b/tests/Config/ConfigResolverTest.php index a7a7537..25656a9 100644 --- a/tests/Config/ConfigResolverTest.php +++ b/tests/Config/ConfigResolverTest.php @@ -21,6 +21,8 @@ use function file_get_contents; use function json_decode; +use const DIRECTORY_SEPARATOR; + class ConfigResolverTest extends TestCase { public function supportedFormatsProvider(): array diff --git a/tests/Config/Parser/JSONConfigParserTest.php b/tests/Config/Parser/JSONConfigParserTest.php index bb16a8b..e08cf60 100644 --- a/tests/Config/Parser/JSONConfigParserTest.php +++ b/tests/Config/Parser/JSONConfigParserTest.php @@ -18,6 +18,8 @@ use function file_get_contents; use function json_decode; +use const DIRECTORY_SEPARATOR; + class JSONConfigParserTest extends TestCase { public function invalidConfigurationProvider(): array diff --git a/tests/Config/Parser/PHPConfigParserTest.php b/tests/Config/Parser/PHPConfigParserTest.php index 27e2bb6..393a993 100644 --- a/tests/Config/Parser/PHPConfigParserTest.php +++ b/tests/Config/Parser/PHPConfigParserTest.php @@ -15,6 +15,8 @@ use Slim\Console\Exception\CannotParseConfigException; use Slim\Tests\Console\TestCase; +use const DIRECTORY_SEPARATOR; + class PHPConfigParserTest extends TestCase { public function testParse(): void diff --git a/tests/TestCase.php b/tests/TestCase.php index ac97c02..b0d4f32 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -13,6 +13,10 @@ use PHPUnit\Framework\TestCase as PHPUnitTestCase; use Slim\Console\Config\Config; +use function putenv; + +use const DIRECTORY_SEPARATOR; + abstract class TestCase extends PhpUnitTestCase { public function setUp(): void