Skip to content

Commit 03cca7b

Browse files
committed
Turned return type annotations of private methods into php return types.
1 parent 9ab2dfd commit 03cca7b

File tree

8 files changed

+15
-47
lines changed

8 files changed

+15
-47
lines changed

Diff for: Application.php

+3-5
Original file line numberDiff line numberDiff line change
@@ -1030,10 +1030,8 @@ protected function getDefaultHelperSet()
10301030

10311031
/**
10321032
* Returns abbreviated suggestions in string format.
1033-
*
1034-
* @return string A formatted string of abbreviated suggestions
10351033
*/
1036-
private function getAbbreviationSuggestions(array $abbrevs)
1034+
private function getAbbreviationSuggestions(array $abbrevs): string
10371035
{
10381036
return ' '.implode("\n ", $abbrevs);
10391037
}
@@ -1062,7 +1060,7 @@ public function extractNamespace($name, $limit = null)
10621060
*
10631061
* @return string[] A sorted array of similar string
10641062
*/
1065-
private function findAlternatives(string $name, iterable $collection)
1063+
private function findAlternatives(string $name, iterable $collection): array
10661064
{
10671065
$threshold = 1e3;
10681066
$alternatives = [];
@@ -1175,7 +1173,7 @@ private function splitStringByWidth(string $string, int $width)
11751173
*
11761174
* @return string[] The namespaces of the command
11771175
*/
1178-
private function extractAllNamespaces(string $name)
1176+
private function extractAllNamespaces(string $name): array
11791177
{
11801178
// -1 as third argument is needed to skip the command short name when exploding
11811179
$parts = explode(':', $name, -1);

Diff for: Command/LockableTrait.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,8 @@ trait LockableTrait
2929

3030
/**
3131
* Locks a command.
32-
*
33-
* @return bool
3432
*/
35-
private function lock(string $name = null, bool $blocking = false)
33+
private function lock(string $name = null, bool $blocking = false): bool
3634
{
3735
if (!class_exists(SemaphoreStore::class)) {
3836
throw new LogicException('To enable the locking feature you must install the symfony/lock component.');

Diff for: Descriptor/JsonDescriptor.php

+4-16
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,7 @@ private function writeData(array $data, array $options)
100100
$this->write(json_encode($data, $flags));
101101
}
102102

103-
/**
104-
* @return array
105-
*/
106-
private function getInputArgumentData(InputArgument $argument)
103+
private function getInputArgumentData(InputArgument $argument): array
107104
{
108105
return [
109106
'name' => $argument->getName(),
@@ -114,10 +111,7 @@ private function getInputArgumentData(InputArgument $argument)
114111
];
115112
}
116113

117-
/**
118-
* @return array
119-
*/
120-
private function getInputOptionData(InputOption $option)
114+
private function getInputOptionData(InputOption $option): array
121115
{
122116
return [
123117
'name' => '--'.$option->getName(),
@@ -130,10 +124,7 @@ private function getInputOptionData(InputOption $option)
130124
];
131125
}
132126

133-
/**
134-
* @return array
135-
*/
136-
private function getInputDefinitionData(InputDefinition $definition)
127+
private function getInputDefinitionData(InputDefinition $definition): array
137128
{
138129
$inputArguments = [];
139130
foreach ($definition->getArguments() as $name => $argument) {
@@ -148,10 +139,7 @@ private function getInputDefinitionData(InputDefinition $definition)
148139
return ['arguments' => $inputArguments, 'options' => $inputOptions];
149140
}
150141

151-
/**
152-
* @return array
153-
*/
154-
private function getCommandData(Command $command)
142+
private function getCommandData(Command $command): array
155143
{
156144
$command->getSynopsis();
157145
$command->mergeApplicationDefinition(false);

Diff for: Helper/DebugFormatterHelper.php

+1-4
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,7 @@ public function stop($id, $message, $successful, $prefix = 'RES')
107107
return $message;
108108
}
109109

110-
/**
111-
* @return string
112-
*/
113-
private function getBorder(string $id)
110+
private function getBorder(string $id): string
114111
{
115112
return sprintf('<bg=%s> </>', $this->colors[$this->started[$id]['border']]);
116113
}

Diff for: Input/StringInput.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,9 @@ public function __construct(string $input)
4040
/**
4141
* Tokenizes a string.
4242
*
43-
* @return array An array of tokens
44-
*
4543
* @throws InvalidArgumentException When unable to parse input (should never happen)
4644
*/
47-
private function tokenize(string $input)
45+
private function tokenize(string $input): array
4846
{
4947
$tokens = [];
5048
$length = \strlen($input);

Diff for: Output/ConsoleOutput.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,8 @@ protected function hasStderrSupport()
125125
/**
126126
* Checks if current executing environment is IBM iSeries (OS400), which
127127
* doesn't properly convert character-encodings between ASCII to EBCDIC.
128-
*
129-
* @return bool
130128
*/
131-
private function isRunningOS400()
129+
private function isRunningOS400(): bool
132130
{
133131
$checks = [
134132
\function_exists('php_uname') ? php_uname('s') : '',

Diff for: Question/ConfirmationQuestion.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,8 @@ public function __construct(string $question, bool $default = true, string $true
3535

3636
/**
3737
* Returns the default answer normalizer.
38-
*
39-
* @return callable
4038
*/
41-
private function getDefaultNormalizer()
39+
private function getDefaultNormalizer(): callable
4240
{
4341
$default = $this->getDefault();
4442
$regex = $this->trueAnswerRegex;

Diff for: Terminal.php

+3-10
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ private static function initDimensions()
8585
*
8686
* @return int[]|null An array composed of the width and the height or null if it could not be parsed
8787
*/
88-
private static function getConsoleMode()
88+
private static function getConsoleMode(): ?array
8989
{
9090
$info = self::readFromProcess('mode CON');
9191

@@ -98,20 +98,13 @@ private static function getConsoleMode()
9898

9999
/**
100100
* Runs and parses stty -a if it's available, suppressing any error output.
101-
*
102-
* @return string|null
103101
*/
104-
private static function getSttyColumns()
102+
private static function getSttyColumns(): ?string
105103
{
106104
return self::readFromProcess('stty -a | grep columns');
107105
}
108106

109-
/**
110-
* @param string $command
111-
*
112-
* @return string|null
113-
*/
114-
private static function readFromProcess($command)
107+
private static function readFromProcess(string $command): ?string
115108
{
116109
if (!\function_exists('proc_open')) {
117110
return null;

0 commit comments

Comments
 (0)