Skip to content

Commit 5679b73

Browse files
committed
Fix type errors
1 parent d5c054b commit 5679b73

File tree

8 files changed

+24
-21
lines changed

8 files changed

+24
-21
lines changed

src/Illuminate/Console/Application.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Symfony\Component\Console\Exception\CommandNotFoundException;
1616
use Symfony\Component\Console\Input\ArgvInput;
1717
use Symfony\Component\Console\Input\ArrayInput;
18+
use Symfony\Component\Console\Input\InputDefinition;
1819
use Symfony\Component\Console\Input\InputInterface;
1920
use Symfony\Component\Console\Input\InputOption;
2021
use Symfony\Component\Console\Input\StringInput;
@@ -84,7 +85,7 @@ public function __construct(Container $laravel, Dispatcher $events, $version)
8485
/**
8586
* {@inheritdoc}
8687
*/
87-
public function run(InputInterface $input = null, OutputInterface $output = null)
88+
public function run(InputInterface $input = null, OutputInterface $output = null): int
8889
{
8990
$commandName = $this->getCommandName(
9091
$input = $input ?: new ArgvInput
@@ -309,7 +310,7 @@ public function setContainerCommandLoader()
309310
*
310311
* @return \Symfony\Component\Console\Input\InputDefinition
311312
*/
312-
protected function getDefaultInputDefinition()
313+
protected function getDefaultInputDefinition(): InputDefinition
313314
{
314315
return tap(parent::getDefaultInputDefinition(), function ($definition) {
315316
$definition->addOption($this->getEnvironmentOption());

src/Illuminate/Console/Command.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ protected function configureUsingFluentDefinition()
111111
* @param \Symfony\Component\Console\Output\OutputInterface $output
112112
* @return int
113113
*/
114-
public function run(InputInterface $input, OutputInterface $output)
114+
public function run(InputInterface $input, OutputInterface $output): int
115115
{
116116
$this->output = $this->laravel->make(
117117
OutputStyle::class, ['input' => $input, 'output' => $output]
@@ -164,7 +164,7 @@ protected function resolveCommand($command)
164164
/**
165165
* {@inheritdoc}
166166
*/
167-
public function isHidden()
167+
public function isHidden(): bool
168168
{
169169
return $this->hidden;
170170
}

src/Illuminate/Console/ContainerCommandLoader.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Illuminate\Console;
44

55
use Psr\Container\ContainerInterface;
6+
use Symfony\Component\Console\Command\Command;
67
use Symfony\Component\Console\CommandLoader\CommandLoaderInterface;
78
use Symfony\Component\Console\Exception\CommandNotFoundException;
89

@@ -43,7 +44,7 @@ public function __construct(ContainerInterface $container, array $commandMap)
4344
*
4445
* @throws \Symfony\Component\Console\Exception\CommandNotFoundException
4546
*/
46-
public function get(string $name)
47+
public function get(string $name): Command
4748
{
4849
if (! $this->has($name)) {
4950
throw new CommandNotFoundException(sprintf('Command "%s" does not exist.', $name));
@@ -58,7 +59,7 @@ public function get(string $name)
5859
* @param string $name
5960
* @return bool
6061
*/
61-
public function has(string $name)
62+
public function has(string $name): bool
6263
{
6364
return $name && isset($this->commandMap[$name]);
6465
}
@@ -68,7 +69,7 @@ public function has(string $name)
6869
*
6970
* @return string[]
7071
*/
71-
public function getNames()
72+
public function getNames(): array
7273
{
7374
return array_keys($this->commandMap);
7475
}

src/Illuminate/Console/OutputStyle.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function __construct(InputInterface $input, OutputInterface $output)
3434
*
3535
* @return bool
3636
*/
37-
public function isQuiet()
37+
public function isQuiet(): bool
3838
{
3939
return $this->output->isQuiet();
4040
}
@@ -44,7 +44,7 @@ public function isQuiet()
4444
*
4545
* @return bool
4646
*/
47-
public function isVerbose()
47+
public function isVerbose(): bool
4848
{
4949
return $this->output->isVerbose();
5050
}
@@ -54,7 +54,7 @@ public function isVerbose()
5454
*
5555
* @return bool
5656
*/
57-
public function isVeryVerbose()
57+
public function isVeryVerbose(): bool
5858
{
5959
return $this->output->isVeryVerbose();
6060
}
@@ -64,7 +64,7 @@ public function isVeryVerbose()
6464
*
6565
* @return bool
6666
*/
67-
public function isDebug()
67+
public function isDebug(): bool
6868
{
6969
return $this->output->isDebug();
7070
}

src/Illuminate/Http/JsonResponse.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function __construct($data = null, $status = 200, $headers = [], $options
3535
/**
3636
* {@inheritdoc}
3737
*/
38-
public static function fromJsonString(?string $data = null, int $status = 200, array $headers = [])
38+
public static function fromJsonString(?string $data = null, int $status = 200, array $headers = []): static
3939
{
4040
return new static($data, $status, $headers, 0, true);
4141
}
@@ -66,7 +66,7 @@ public function getData($assoc = false, $depth = 512)
6666
/**
6767
* {@inheritdoc}
6868
*/
69-
public function setData($data = [])
69+
public function setData($data = []): static
7070
{
7171
$this->original = $data;
7272

@@ -110,7 +110,7 @@ protected function hasValidJson($jsonError)
110110
/**
111111
* {@inheritdoc}
112112
*/
113-
public function setEncodingOptions($options)
113+
public function setEncodingOptions($options): static
114114
{
115115
$this->encodingOptions = (int) $options;
116116

src/Illuminate/Http/Request.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use RuntimeException;
1212
use Symfony\Component\HttpFoundation\ParameterBag;
1313
use Symfony\Component\HttpFoundation\Request as SymfonyRequest;
14+
use Symfony\Component\HttpFoundation\Session\SessionInterface;
1415

1516
/**
1617
* @method array validate(array $rules, ...$params)
@@ -336,7 +337,7 @@ public function replace(array $input)
336337
* @param mixed $default
337338
* @return mixed
338339
*/
339-
public function get(string $key, $default = null)
340+
public function get(string $key, mixed $default = null): mixed
340341
{
341342
return parent::get($key, $default);
342343
}
@@ -442,7 +443,7 @@ public static function createFromBase(SymfonyRequest $request)
442443
/**
443444
* {@inheritdoc}
444445
*/
445-
public function duplicate(array $query = null, array $request = null, array $attributes = null, array $cookies = null, array $files = null, array $server = null)
446+
public function duplicate(array $query = null, array $request = null, array $attributes = null, array $cookies = null, array $files = null, array $server = null): static
446447
{
447448
return parent::duplicate($query, $request, $attributes, $cookies, $this->filterFiles($files), $server);
448449
}
@@ -491,9 +492,9 @@ public function session()
491492
/**
492493
* Get the session associated with the request.
493494
*
494-
* @return \Illuminate\Session\Store|null
495+
* @return \Illuminate\Session\Store
495496
*/
496-
public function getSession()
497+
public function getSession(): SessionInterface
497498
{
498499
return $this->session;
499500
}
@@ -625,7 +626,7 @@ public function setRouteResolver(Closure $callback)
625626
*
626627
* @return array
627628
*/
628-
public function toArray()
629+
public function toArray(): array
629630
{
630631
return $this->all();
631632
}

src/Illuminate/Http/Response.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function __construct($content = '', $status = 200, array $headers = [])
4545
*
4646
* @throws \InvalidArgumentException
4747
*/
48-
public function setContent($content)
48+
public function setContent(mixed $content): static
4949
{
5050
$this->original = $content;
5151

src/Illuminate/Http/Testing/File.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public function mimeType($mimeType)
131131
*
132132
* @return string
133133
*/
134-
public function getMimeType()
134+
public function getMimeType(): string
135135
{
136136
return $this->mimeTypeToReport ?: MimeType::from($this->name);
137137
}

0 commit comments

Comments
 (0)