Skip to content

Commit e612f0d

Browse files
committed
Use consistent return types from console commands
1 parent 664ef28 commit e612f0d

File tree

2 files changed

+12
-38
lines changed

2 files changed

+12
-38
lines changed

src/Console/Clear.php

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,29 +22,16 @@ class Clear extends Command
2222
*/
2323
protected $description = 'Clear GeoIP cached locations.';
2424

25-
/**
26-
* Execute the console command for Laravel 5.5 and newer.
27-
*
28-
* @return void
29-
*/
30-
public function handle()
31-
{
32-
$this->fire();
33-
}
34-
35-
/**
36-
* Execute the console command.
37-
* @deprecated Use {@see self::handle()} instead.
38-
*
39-
* @return void
40-
*/
41-
public function fire()
25+
public function handle(): int
4226
{
4327
if ($this->isSupported() === false) {
44-
return $this->output->error('Default cache system does not support tags');
28+
$this->output->error('Default cache system does not support tags');
29+
return self::FAILURE;
4530
}
4631

4732
$this->performFlush();
33+
34+
return self::SUCCESS;
4835
}
4936

5037
/**

src/Console/Update.php

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -23,38 +23,22 @@ class Update extends Command
2323
*/
2424
protected $description = 'Update GeoIP database files to the latest version';
2525

26-
/**
27-
* Execute the console command for Laravel 5.5 and newer.
28-
*
29-
* @return void
30-
*/
31-
public function handle()
32-
{
33-
$this->fire();
34-
}
35-
36-
/**
37-
* Execute the console command.
38-
* @deprecated Use {@see self::handle()} instead.
39-
*
40-
* @return void
41-
*/
42-
public function fire()
26+
public function handle(): int
4327
{
4428
// Get default service
4529
try {
4630
$service = app('geoip')->getService();
47-
} catch(MissingConfigurationException $e) {
31+
} catch (MissingConfigurationException $e) {
4832
$this->components->error($e->getMessage()) ;
4933

50-
return static::FAILURE ;
34+
return static::FAILURE;
5135
}
5236

5337
// Ensure the selected service supports updating
5438
if (method_exists($service, 'update') === false) {
5539
$this->info('The current service "' . get_class($service) . '" does not support updating.');
5640

57-
return;
41+
return static::SUCCESS;
5842
}
5943

6044
$this->comment('Updating...');
@@ -64,6 +48,9 @@ public function fire()
6448
$this->info($result);
6549
} else {
6650
$this->error('Update failed!');
51+
return static::FAILURE;
6752
}
53+
54+
return static::SUCCESS;
6855
}
6956
}

0 commit comments

Comments
 (0)