Skip to content

test: ensure all test methods have native return types #9565

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
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
3 changes: 2 additions & 1 deletion .php-cs-fixer.tests.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
->notName('#Foobar.php$#');

$overrides = [
'void_return' => true,
'phpdoc_to_return_type' => true,
'void_return' => true,
];

return $config
Expand Down
2 changes: 1 addition & 1 deletion tests/_support/Autoloader/FatalLocator.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class FatalLocator extends FileLocator
*
* @return false|string The path to the file, or false if not found.
*/
public function locateFile(string $file, ?string $folder = null, string $ext = 'php')
public function locateFile(string $file, ?string $folder = null, string $ext = 'php'): false|string
{
$folder ??= 'null';

Expand Down
4 changes: 1 addition & 3 deletions tests/_support/Config/Services.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,8 @@ class Services extends BaseServices
* The URI class provides a way to model and manipulate URIs.
*
* @param string|null $uri The URI string
*
* @return URI
*/
public static function uri(?string $uri = null, bool $getShared = true)
public static function uri(?string $uri = null, bool $getShared = true): URI
{
// Intercept our test case
if ($uri === 'testCanReplaceFrameworkServices') {
Expand Down
4 changes: 1 addition & 3 deletions tests/_support/Entity/Cast/CastPassParameters.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@ class CastPassParameters extends BaseCast
*
* @param mixed $value Data
* @param array $params Additional param
*
* @return mixed
*/
public static function set($value, array $params = [])
public static function set($value, array $params = []): string
{
return $value . ':' . json_encode($params);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/system/Files/FileTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public function testGetDestination(): void
/**
* @return array<string, array<int, FileSizeUnit>>
*/
public static function provideGetSizeData()
public static function provideGetSizeData(): array
{
return [
'returns KB binary' => [
Expand Down
4 changes: 2 additions & 2 deletions tests/system/Models/TimestampModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ protected function tearDown(): void
/**
* @return int|string Insert ID
*/
private function allowDatesPrepareOneRecord(array $data)
private function allowDatesPrepareOneRecord(array $data): int|string
{
$this->createModel(UserTimestampModel::class);
$this->db->table('user')->truncate();
Expand All @@ -60,7 +60,7 @@ private function allowDatesPrepareOneRecord(array $data)
/**
* @return int|string Insert ID
*/
private function doNotAllowDatesPrepareOneRecord(array $data)
private function doNotAllowDatesPrepareOneRecord(array $data): int|string
{
$this->createModel(UserTimestampModel::class);
$this->db->table('user')->truncate();
Expand Down
5 changes: 1 addition & 4 deletions tests/system/Test/BootstrapFCPATHTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,7 @@ private function fileContents(): string
return $fileContents . 'echo FCPATH;' . PHP_EOL;
}

/**
* @return false|string
*/
private function readOutput(string $file)
private function readOutput(string $file): false|string
{
ob_start();
system('php -f ' . $file);
Expand Down
Loading