From a0f76b17854bf730a418218dd420ee1bb804f0b2 Mon Sep 17 00:00:00 2001 From: Gregor Date: Fri, 20 Oct 2023 14:49:31 +0200 Subject: [PATCH] fix spacing according to PSR-12 #18 --- src/SapRfc.php | 1 + src/Traits/ApiTrait.php | 1 + src/Traits/ConfigTrait.php | 1 + src/Traits/ParamTrait.php | 4 +++- tests/OutputTableTest.php | 3 ++- tests/SapRfcIntegrationTest.php | 12 ++++++++---- 6 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/SapRfc.php b/src/SapRfc.php index 430c6e1..1eb0460 100644 --- a/src/SapRfc.php +++ b/src/SapRfc.php @@ -20,6 +20,7 @@ use SAPNWRFC\ConnectionException as ModuleConnectionException; use SAPNWRFC\FunctionCallException as ModuleFunctionCallException; use SAPNWRFC\RemoteFunction; + use function array_merge; use function get_object_vars; use function method_exists; diff --git a/src/Traits/ApiTrait.php b/src/Traits/ApiTrait.php index 9ccc39a..9cd5cea 100644 --- a/src/Traits/ApiTrait.php +++ b/src/Traits/ApiTrait.php @@ -13,6 +13,7 @@ use phpsap\interfaces\Api\IStruct; use phpsap\interfaces\Api\ITable; use phpsap\interfaces\Api\IValue; + use function array_key_exists; use function is_array; use function sprintf; diff --git a/src/Traits/ConfigTrait.php b/src/Traits/ConfigTrait.php index 2208a05..52949f6 100644 --- a/src/Traits/ConfigTrait.php +++ b/src/Traits/ConfigTrait.php @@ -9,6 +9,7 @@ use phpsap\interfaces\Config\IConfigTypeB; use phpsap\interfaces\Config\IConfiguration; use phpsap\interfaces\exceptions\IIncompleteConfigException; + use function array_merge; /** diff --git a/src/Traits/ParamTrait.php b/src/Traits/ParamTrait.php index 7a7f637..ca7576b 100644 --- a/src/Traits/ParamTrait.php +++ b/src/Traits/ParamTrait.php @@ -10,6 +10,7 @@ use phpsap\interfaces\Api\ITable; use phpsap\interfaces\Api\IValue; use phpsap\interfaces\exceptions\IInvalidArgumentException; + use function array_key_exists; use function count; use function is_array; @@ -62,7 +63,8 @@ private function getTableParams(array $tables, array $params): array $result = []; foreach ($tables as $table) { $key = $table->getName(); - if (array_key_exists($key, $params) + if ( + array_key_exists($key, $params) && is_array($params[$key]) && count($params[$key]) > 0 ) { diff --git a/tests/OutputTableTest.php b/tests/OutputTableTest.php index c29684d..daf1fdf 100644 --- a/tests/OutputTableTest.php +++ b/tests/OutputTableTest.php @@ -354,7 +354,8 @@ public function mockRfcOutputTable() $flags->response = self::$responseRaw; $expectedConfig = static::getSampleSapConfig(); static::mock('\SAPNWRFC\Connection::__construct', static function (array $config, array $options) use ($flags, $expectedConfig) { - if (!is_array($config) + if ( + !is_array($config) || !array_key_exists('ashost', $config) || !array_key_exists('sysnr', $config) || !array_key_exists('client', $config) diff --git a/tests/SapRfcIntegrationTest.php b/tests/SapRfcIntegrationTest.php index 1a47fcf..9967191 100644 --- a/tests/SapRfcIntegrationTest.php +++ b/tests/SapRfcIntegrationTest.php @@ -530,7 +530,8 @@ protected function mockSuccessfulRfcPing() $flags->func = null; $expectedConfig = static::getSampleSapConfig(); static::mock('\SAPNWRFC\Connection::__construct', static function (array $config, array $options) use ($flags, $expectedConfig) { - if (!is_array($config) + if ( + !is_array($config) || !array_key_exists('ashost', $config) || !array_key_exists('sysnr', $config) || !array_key_exists('client', $config) @@ -596,7 +597,8 @@ protected function mockUnknownFunctionException() $flags->conn = false; $expectedConfig = static::getSampleSapConfig(); static::mock('\SAPNWRFC\Connection::__construct', static function (array $config, array $options) use ($flags, $expectedConfig) { - if (!is_array($config) + if ( + !is_array($config) || !array_key_exists('ashost', $config) || !array_key_exists('sysnr', $config) || !array_key_exists('client', $config) @@ -638,7 +640,8 @@ protected function mockRemoteFunctionCallWithParametersAndResults() $flags->api = static::$rfcWalkThruTestApi; $expectedConfig = static::getSampleSapConfig(); static::mock('\SAPNWRFC\Connection::__construct', static function (array $config, array $options) use ($flags, $expectedConfig) { - if (!is_array($config) + if ( + !is_array($config) || !array_key_exists('ashost', $config) || !array_key_exists('sysnr', $config) || !array_key_exists('client', $config) @@ -733,7 +736,8 @@ protected function mockFailedRemoteFunctionCallWithParameters() $flags->api = static::$rfcReadTableApi; $expectedConfig = static::getSampleSapConfig(); static::mock('\SAPNWRFC\Connection::__construct', static function (array $config, array $options) use ($flags, $expectedConfig) { - if (!is_array($config) + if ( + !is_array($config) || !array_key_exists('ashost', $config) || !array_key_exists('sysnr', $config) || !array_key_exists('client', $config)