Skip to content

Add void return to tests #7748

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions tests/_support/Commands/AppInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ class AppInfo extends BaseCommand
protected $arguments = ['draft' => 'unused'];
protected $description = 'Displays basic application information.';

public function run(array $params)
public function run(array $params): void
{
CLI::write('CI Version: ' . CLI::color(CodeIgniter::CI_VERSION, 'red'));
}

public function bomb()
public function bomb(): void
{
try {
CLI::color('test', 'white', 'Background');
Expand All @@ -37,7 +37,7 @@ public function bomb()
}
}

public function helpme()
public function helpme(): void
{
$this->call('help');
}
Expand Down
2 changes: 1 addition & 1 deletion tests/_support/Commands/InvalidCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function __construct()
throw new ReflectionException();
}

public function run(array $params)
public function run(array $params): void
{
CLI::write('CI Version: ' . CLI::color(CodeIgniter::CI_VERSION, 'red'));
}
Expand Down
2 changes: 1 addition & 1 deletion tests/_support/Commands/LanguageCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class LanguageCommand extends BaseCommand
'--sort' => 'Turn on/off the sortImports flag.',
];

public function run(array $params)
public function run(array $params): void
{
$this->setHasClassName(false);
$params[0] = 'Foobar';
Expand Down
2 changes: 1 addition & 1 deletion tests/_support/Commands/ParamsReveal.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class ParamsReveal extends BaseCommand
protected $description = 'Reveal params';
public static $args;

public function run(array $params)
public function run(array $params): void
{
static::$args = $params;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/_support/Commands/Unsuffixable.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class Unsuffixable extends BaseCommand
/**
* Actually execute a command.
*/
public function run(array $params)
public function run(array $params): void
{
$this->component = 'Command';
$this->directory = 'Commands';
Expand Down
6 changes: 3 additions & 3 deletions tests/_support/Controllers/Popcorn.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function pop()
return $this->respond('Oops', 567, 'Surprise');
}

public function popper()
public function popper(): void
{
throw new RuntimeException('Surprise', 500);
}
Expand Down Expand Up @@ -61,12 +61,12 @@ public function index3()
return $this->response->setJSON(['lang' => $this->request->getLocale()]);
}

public function canyon()
public function canyon(): void
{
echo 'Hello-o-o ' . $this->request->getGet('foo');
}

public function cat()
public function cat(): void
{
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

class Migration_Create_test_tables extends Migration
{
public function up()
public function up(): void
{
// User Table
$this->forge->addField([
Expand Down Expand Up @@ -160,7 +160,7 @@ public function up()
}
}

public function down()
public function down(): void
{
$this->forge->dropTable('user', true);
$this->forge->dropTable('job', true);
Expand Down
2 changes: 1 addition & 1 deletion tests/_support/Database/Seeds/AnotherSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

class AnotherSeeder extends Seeder
{
public function run()
public function run(): void
{
$row = [
'name' => 'Jerome Lohan',
Expand Down
2 changes: 1 addition & 1 deletion tests/_support/Database/Seeds/CITestSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

class CITestSeeder extends Seeder
{
public function run()
public function run(): void
{
// Job Data
$data = [
Expand Down
2 changes: 1 addition & 1 deletion tests/_support/Filters/Customfilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function before(RequestInterface $request, $arguments = null)
return $request;
}

public function after(RequestInterface $request, ResponseInterface $response, $arguments = null)
public function after(RequestInterface $request, ResponseInterface $response, $arguments = null): void
{
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

class Migration_some_migration extends \CodeIgniter\Database\Migration
{
public function up()
public function up(): void
{
$this->forge->addField([
'key' => [
Expand All @@ -28,7 +28,7 @@ public function up()
]);
}

public function down()
public function down(): void
{
$this->forge->dropTable('foo', true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

class Migration_another_migration extends \CodeIgniter\Database\Migration
{
public function up()
public function up(): void
{
$fields = [
'value' => [
Expand All @@ -29,7 +29,7 @@ public function up()
]);
}

public function down()
public function down(): void
{
if ($this->db->tableExists('foo')) {
$this->forge->dropColumn('foo', 'value');
Expand Down
2 changes: 1 addition & 1 deletion tests/_support/Publishers/TestPublisher.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ final class TestPublisher extends Publisher
/**
* Fakes an error on the given file.
*/
public static function setResult(bool $result)
public static function setResult(bool $result): void
{
self::$result = $result;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/_support/View/Cells/AdditionCell.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class AdditionCell extends Cell
{
public int $value = 2;

public function mount(?int $number = null, bool $skipAddition = false)
public function mount(?int $number = null, bool $skipAddition = false): void
{
$this->value = ! $skipAddition
? $this->value + (int) $number
Expand Down
2 changes: 1 addition & 1 deletion tests/_support/View/SampleClassWithInitController.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class SampleClassWithInitController
{
private ResponseInterface $response;

public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger): void
{
$this->response = $response;
}
Expand Down
Loading