Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit 62eff1d

Browse files
committed
Remove type hints and @api annotation
- Remove scalar type and return hints - Inline mapHostData method & get rid of SupressWarning - Remove @api on new interface & implementation
1 parent c638fd7 commit 62eff1d

File tree

4 files changed

+20
-28
lines changed

4 files changed

+20
-28
lines changed

lib/internal/Magento/Framework/Config/Data/ConfigDataFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function __construct(ObjectManagerInterface $objectManager)
3636
* @param string $fileKey
3737
* @return ConfigData
3838
*/
39-
public function create(string $fileKey) : ConfigData
39+
public function create($fileKey)
4040
{
4141
return $this->objectManager->create(ConfigData::class, ['fileKey' => $fileKey]);
4242
}

setup/src/Magento/Setup/Model/ConfigGenerator.php

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -242,33 +242,27 @@ public function createCacheHostsConfig(array $data)
242242

243243
if (isset($data[ConfigOptionsListConstants::INPUT_KEY_CACHE_HOSTS])) {
244244
$hosts = explode(',', $data[ConfigOptionsListConstants::INPUT_KEY_CACHE_HOSTS]);
245-
$hosts = array_map([$this, 'mapHostData'], $hosts);
246-
$configData->set(ConfigOptionsListConstants::CONFIG_PATH_CACHE_HOSTS, $hosts);
247-
}
248245

249-
$configData->setOverrideWhenSave(true);
250-
return $configData;
251-
}
246+
$hosts = array_map(
247+
function ($hostData) {
248+
$hostDataParts = explode(':', trim($hostData));
252249

253-
/**
254-
* Splits host data to host and port and returns them as an assoc. array.
255-
*
256-
* @param string $hostData
257-
*
258-
* @return array
259-
*
260-
* @SuppressWarnings(PHPMD.UnusedPrivateMethod)
261-
*/
262-
private function mapHostData(string $hostData) : array
263-
{
264-
$hostDataParts = explode(':', trim($hostData));
250+
$tmp = ['host' => $hostDataParts[0]];
265251

266-
$tmp = ['host' => $hostDataParts[0]];
252+
if (isset($hostDataParts[1])) {
253+
$tmp['port'] = $hostDataParts[1];
254+
}
255+
256+
return $tmp;
257+
},
258+
$hosts
259+
);
267260

268-
if (isset($hostDataParts[1])) {
269-
$tmp['port'] = $hostDataParts[1];
261+
$configData->set(ConfigOptionsListConstants::CONFIG_PATH_CACHE_HOSTS, $hosts);
270262
}
271263

272-
return $tmp;
264+
$configData->setOverrideWhenSave(true);
265+
return $configData;
273266
}
267+
274268
}

setup/src/Magento/Setup/Model/CryptKeyGenerator.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
/**
1313
* Generates a crypt
14-
* @api
1514
*/
1615
class CryptKeyGenerator implements CryptKeyGeneratorInterface
1716
{
@@ -39,7 +38,7 @@ public function __construct(Random $random)
3938
*
4039
* @throws \Magento\Framework\Exception\LocalizedException
4140
*/
42-
public function generate() : string
41+
public function generate()
4342
{
4443
return md5($this->getRandomString());
4544
}
@@ -49,7 +48,7 @@ public function generate() : string
4948
*
5049
* @return string
5150
*/
52-
private function getRandomString() : string
51+
private function getRandomString()
5352
{
5453
return $this->random->getRandomString(ConfigOptionsListConstants::STORE_KEY_RANDOM_STRING_SIZE);
5554
}

setup/src/Magento/Setup/Model/CryptKeyGeneratorInterface.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
/**
1010
* Interface for crypt key generators.
11-
* @api
1211
*/
1312
interface CryptKeyGeneratorInterface
1413
{
@@ -19,5 +18,5 @@ interface CryptKeyGeneratorInterface
1918
*
2019
* @return string
2120
*/
22-
public function generate() : string;
21+
public function generate();
2322
}

0 commit comments

Comments
 (0)