chore: code refactor via rector

This commit is contained in:
idevakk
2025-11-14 02:01:01 -08:00
parent 90ab79b3a2
commit ae795880ed
148 changed files with 1520 additions and 1486 deletions

View File

@@ -48,7 +48,7 @@ class ZEmailTest extends TestCase
}
/** @test */
public function it_returns_null_when_no_email_cookie_exists_and_generate_is_false()
public function it_returns_null_when_no_email_cookie_exists_and_generate_is_false(): void
{
$result = ZEmail::getEmail(false);
@@ -56,7 +56,7 @@ class ZEmailTest extends TestCase
}
/** @test */
public function it_generates_random_email_when_no_cookie_exists_and_generate_is_true()
public function it_generates_random_email_when_no_cookie_exists_and_generate_is_true(): void
{
$result = ZEmail::getEmail(true);
@@ -65,7 +65,7 @@ class ZEmailTest extends TestCase
}
/** @test */
public function it_creates_custom_email_with_valid_username_length()
public function it_creates_custom_email_with_valid_username_length(): void
{
$result = ZEmail::createCustomEmail('validuser', 'example.com');
@@ -73,7 +73,7 @@ class ZEmailTest extends TestCase
}
/** @test */
public function it_generates_random_username_when_custom_username_is_too_short()
public function it_generates_random_username_when_custom_username_is_too_short(): void
{
$result = ZEmail::createCustomEmail('ab', 'example.com'); // Less than min length 3
@@ -84,7 +84,7 @@ class ZEmailTest extends TestCase
}
/** @test */
public function it_generates_random_username_when_custom_username_is_too_long()
public function it_generates_random_username_when_custom_username_is_too_long(): void
{
$longUsername = str_repeat('a', 25); // More than max length 20
$result = ZEmail::createCustomEmail($longUsername, 'example.com');
@@ -96,7 +96,7 @@ class ZEmailTest extends TestCase
}
/** @test */
public function it_sanitizes_username_by_removing_special_characters()
public function it_sanitizes_username_by_removing_special_characters(): void
{
$result = ZEmail::createCustomEmail('user!@#$%', 'example.com');
@@ -104,7 +104,7 @@ class ZEmailTest extends TestCase
}
/** @test */
public function it_generates_random_email_when_forbidden_id_is_used()
public function it_generates_random_email_when_forbidden_id_is_used(): void
{
$result = ZEmail::createCustomEmail('admin', 'example.com');
@@ -113,7 +113,7 @@ class ZEmailTest extends TestCase
}
/** @test */
public function it_generates_random_gmail_when_empty_username_for_gmail_domain()
public function it_generates_random_gmail_when_empty_username_for_gmail_domain(): void
{
$result = ZEmail::createCustomEmail('', 'gmail.com');
@@ -122,7 +122,7 @@ class ZEmailTest extends TestCase
}
/** @test */
public function it_generates_random_outlook_when_empty_username_for_outlook_domain()
public function it_generates_random_outlook_when_empty_username_for_outlook_domain(): void
{
$result = ZEmail::createCustomEmail('', 'outlook.com');
@@ -131,7 +131,7 @@ class ZEmailTest extends TestCase
}
/** @test */
public function it_handles_gmail_plus_addressing_correctly()
public function it_handles_gmail_plus_addressing_correctly(): void
{
$result = ZEmail::createCustomEmail('john.doe+tag', 'gmail.com');
@@ -139,7 +139,7 @@ class ZEmailTest extends TestCase
}
/** @test */
public function it_handles_gmail_dot_addressing_correctly()
public function it_handles_gmail_dot_addressing_correctly(): void
{
$result = ZEmail::createCustomEmail('johndoe', 'gmail.com');
@@ -148,7 +148,7 @@ class ZEmailTest extends TestCase
}
/** @test */
public function it_handles_outlook_plus_addressing_correctly()
public function it_handles_outlook_plus_addressing_correctly(): void
{
$result = ZEmail::createCustomEmail('outlookuser+tag', 'outlook.com');
@@ -156,7 +156,7 @@ class ZEmailTest extends TestCase
}
/** @test */
public function it_generates_random_email_for_unknown_domain()
public function it_generates_random_email_for_unknown_domain(): void
{
$result = ZEmail::createCustomEmail('user', 'unknown.com');
@@ -165,7 +165,7 @@ class ZEmailTest extends TestCase
}
/** @test */
public function it_generates_random_email_with_store_option()
public function it_generates_random_email_with_store_option(): void
{
$result = ZEmail::generateRandomEmail(true);
@@ -174,7 +174,7 @@ class ZEmailTest extends TestCase
}
/** @test */
public function it_generates_random_email_without_store_option()
public function it_generates_random_email_without_store_option(): void
{
$result = ZEmail::generateRandomEmail(false);
@@ -183,7 +183,7 @@ class ZEmailTest extends TestCase
}
/** @test */
public function it_generates_gmail_email_with_dots()
public function it_generates_gmail_email_with_dots(): void
{
$result = ZEmail::generateRandomGmail(true);
@@ -192,7 +192,7 @@ class ZEmailTest extends TestCase
}
/** @test */
public function it_generates_outlook_email_with_plus_addressing()
public function it_generates_outlook_email_with_plus_addressing(): void
{
$result = ZEmail::generateRandomOutlook(true);
@@ -201,12 +201,11 @@ class ZEmailTest extends TestCase
}
/** @test */
public function it_generates_pronounceable_word()
public function it_generates_pronounceable_word(): void
{
$zemail = new ZEmail;
$reflection = new ReflectionClass($zemail);
$method = $reflection->getMethod('generatePronounceableWord');
$method->setAccessible(true);
$result = $method->invoke($zemail);
@@ -215,12 +214,11 @@ class ZEmailTest extends TestCase
}
/** @test */
public function it_generates_random_string_with_specified_length()
public function it_generates_random_string_with_specified_length(): void
{
$zemail = new ZEmail;
$reflection = new ReflectionClass($zemail);
$method = $reflection->getMethod('generateRandomString');
$method->setAccessible(true);
$result = $method->invoke($zemail, 10);
@@ -230,12 +228,11 @@ class ZEmailTest extends TestCase
}
/** @test */
public function it_gets_random_domain_from_configuration()
public function it_gets_random_domain_from_configuration(): void
{
$zemail = new ZEmail;
$reflection = new ReflectionClass($zemail);
$method = $reflection->getMethod('getRandomDomain');
$method->setAccessible(true);
$result = $method->invoke($zemail);
@@ -243,12 +240,11 @@ class ZEmailTest extends TestCase
}
/** @test */
public function it_gets_random_gmail_user_from_configuration()
public function it_gets_random_gmail_user_from_configuration(): void
{
$zemail = new ZEmail;
$reflection = new ReflectionClass($zemail);
$method = $reflection->getMethod('getRandomGmailUser');
$method->setAccessible(true);
$result = $method->invoke($zemail);
@@ -256,12 +252,11 @@ class ZEmailTest extends TestCase
}
/** @test */
public function it_gets_random_outlook_user_from_configuration()
public function it_gets_random_outlook_user_from_configuration(): void
{
$zemail = new ZEmail;
$reflection = new ReflectionClass($zemail);
$method = $reflection->getMethod('getRandomOutlookUser');
$method->setAccessible(true);
$result = $method->invoke($zemail);
@@ -269,7 +264,7 @@ class ZEmailTest extends TestCase
}
/** @test */
public function it_returns_messages_from_message_model_when_beta_feature_is_enabled()
public function it_returns_messages_from_message_model_when_beta_feature_is_enabled(): void
{
Config::set('app.beta_feature', true);
Config::set('app.settings.configuration_settings', json_encode([
@@ -279,7 +274,7 @@ class ZEmailTest extends TestCase
]));
// Create a test message that will be found by getMessages
$message = Message::factory()->create([
Message::factory()->create([
'to' => 'test@example.com',
'subject' => 'Test Subject',
'from' => 'Test Sender <sender@example.com>',
@@ -297,7 +292,7 @@ class ZEmailTest extends TestCase
}
/** @test */
public function it_returns_messages_from_email_model_when_force_db_mail_is_enabled()
public function it_returns_messages_from_email_model_when_force_db_mail_is_enabled(): void
{
Config::set('app.beta_feature', false);
Config::set('app.force_db_mail', true);
@@ -308,7 +303,7 @@ class ZEmailTest extends TestCase
]));
// Create a test email that will be found by parseEmail
$email = Email::factory()->create([
Email::factory()->create([
'to' => ['test@example.com'],
'is_seen' => false,
'message_id' => 'test-123',
@@ -328,7 +323,7 @@ class ZEmailTest extends TestCase
}
/** @test */
public function it_handles_empty_domain_configuration_gracefully()
public function it_handles_empty_domain_configuration_gracefully(): void
{
Config::set('app.settings.configuration_settings', json_encode([
'domains' => [],
@@ -337,7 +332,6 @@ class ZEmailTest extends TestCase
$zemail = new ZEmail;
$reflection = new ReflectionClass($zemail);
$method = $reflection->getMethod('getRandomDomain');
$method->setAccessible(true);
$result = $method->invoke($zemail);