diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index cd21c9dde3..3e0dae0ef9 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -68,4 +68,5 @@ jobs:
- name: Run Static Analysis
run: |
+ rm -r public_html # remove once https://github.com/phpstan/phpstan/issues/10321 is fixed
vendor/bin/phpstan analyse
diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php
index 472fbd5e97..54dc0a2d05 100644
--- a/.php-cs-fixer.dist.php
+++ b/.php-cs-fixer.dist.php
@@ -113,7 +113,6 @@
'php_unit_data_provider_name' => false,
'php_unit_test_case_static_method_calls' => false,
'random_api_migration' => false,
- 'static_lambda' => false,
'strict_param' => false,
])
->setFinder($finder)
diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon
index 30e9b089e7..d50e5977f2 100644
--- a/phpstan-baseline.neon
+++ b/phpstan-baseline.neon
@@ -2544,568 +2544,6 @@ parameters:
count: 1
path: program/lib/Roundcube/spellchecker/googie.php
- -
- message: "#^Access to an undefined property rcube_output\\:\\:\\$ajax_call\\.$#"
- count: 1
- path: public_html/plugins/archive/archive.php
-
- -
- message: "#^Call to an undefined method rcube_output\\:\\:command\\(\\)\\.$#"
- count: 6
- path: public_html/plugins/archive/archive.php
-
- -
- message: "#^Call to an undefined method rcube_storage\\:\\:fetch_headers\\(\\)\\.$#"
- count: 1
- path: public_html/plugins/archive/archive.php
-
- -
- message: "#^Call to an undefined method rcube_storage\\:\\:get_vendor\\(\\)\\.$#"
- count: 1
- path: public_html/plugins/archive/archive.php
-
- -
- message: """
- #^Call to deprecated method get_uids\\(\\) of class rcmail\\:
- since 1\\.5\\-beta, use rcmail_action\\:\\:get_uids\\(\\)$#
- """
- count: 1
- path: public_html/plugins/archive/archive.php
-
- -
- message: "#^Access to an undefined property rcube\\:\\:\\$action\\.$#"
- count: 1
- path: public_html/plugins/attachment_reminder/attachment_reminder.php
-
- -
- message: "#^Access to an undefined property rcube\\:\\:\\$task\\.$#"
- count: 2
- path: public_html/plugins/attachment_reminder/attachment_reminder.php
-
- -
- message: "#^Call to an undefined method rcube_output\\:\\:add_label\\(\\)\\.$#"
- count: 1
- path: public_html/plugins/attachment_reminder/attachment_reminder.php
-
- -
- message: "#^Access to an undefined property rcube\\:\\:\\$task\\.$#"
- count: 1
- path: public_html/plugins/emoticons/emoticons.php
-
- -
- message: "#^Access to an undefined property rcube\\:\\:\\$action\\.$#"
- count: 6
- path: public_html/plugins/enigma/enigma.php
-
- -
- message: "#^Access to an undefined property rcube\\:\\:\\$task\\.$#"
- count: 3
- path: public_html/plugins/enigma/enigma.php
-
- -
- message: "#^Cannot call method getExpirationDateTime\\(\\) on class\\-string\\|object\\.$#"
- count: 1
- path: public_html/plugins/enigma/lib/enigma_driver_gnupg.php
-
- -
- message: "#^Method enigma_driver_gnupg\\:\\:init\\(\\) should return enigma_error\\|null but return statement is missing\\.$#"
- count: 1
- path: public_html/plugins/enigma/lib/enigma_driver_gnupg.php
-
- -
- message: "#^Cannot access property \\$mime_id on string\\.$#"
- count: 2
- path: public_html/plugins/enigma/lib/enigma_driver_phpssl.php
-
- -
- message: "#^Cannot access property \\$uid on string\\.$#"
- count: 1
- path: public_html/plugins/enigma/lib/enigma_driver_phpssl.php
-
- -
- message: "#^Cannot call method get_part_body\\(\\) on string\\.$#"
- count: 1
- path: public_html/plugins/enigma/lib/enigma_driver_phpssl.php
-
- -
- message: "#^Method enigma_driver_phpssl\\:\\:parse_key\\(\\) should return enigma_key but return statement is missing\\.$#"
- count: 1
- path: public_html/plugins/enigma/lib/enigma_driver_phpssl.php
-
- -
- message: "#^Method enigma_driver_phpssl\\:\\:signature_algorithm\\(\\) should return string but return statement is missing\\.$#"
- count: 1
- path: public_html/plugins/enigma/lib/enigma_driver_phpssl.php
-
- -
- message: "#^Access to an undefined property object\\:\\:\\$body\\.$#"
- count: 1
- path: public_html/plugins/enigma/lib/enigma_engine.php
-
- -
- message: "#^Access to an undefined property object\\:\\:\\$body_modified\\.$#"
- count: 1
- path: public_html/plugins/enigma/lib/enigma_engine.php
-
- -
- message: "#^Access to an undefined property object\\:\\:\\$mime_id\\.$#"
- count: 1
- path: public_html/plugins/enigma/lib/enigma_engine.php
-
- -
- message: "#^Access to an undefined property object\\:\\:\\$size\\.$#"
- count: 1
- path: public_html/plugins/enigma/lib/enigma_engine.php
-
- -
- message: "#^Cannot access property \\$mime_id on array\\.$#"
- count: 1
- path: public_html/plugins/enigma/lib/enigma_engine.php
-
- -
- message: "#^Cannot access property \\$mimetype on array\\.$#"
- count: 1
- path: public_html/plugins/enigma/lib/enigma_engine.php
-
- -
- message: "#^Cannot access property \\$parts on array\\.$#"
- count: 1
- path: public_html/plugins/enigma/lib/enigma_engine.php
-
- -
- message: "#^Method enigma_engine\\:\\:encrypt_message\\(\\) should return enigma_error but return statement is missing\\.$#"
- count: 1
- path: public_html/plugins/enigma/lib/enigma_engine.php
-
- -
- message: "#^Method enigma_engine\\:\\:sign_message\\(\\) should return enigma_error but return statement is missing\\.$#"
- count: 1
- path: public_html/plugins/enigma/lib/enigma_engine.php
-
- -
- message: "#^Variable \\$key in empty\\(\\) always exists and is not falsy\\.$#"
- count: 2
- path: public_html/plugins/enigma/lib/enigma_engine.php
-
- -
- message: "#^Variable \\$sign_key in empty\\(\\) always exists and is not falsy\\.$#"
- count: 1
- path: public_html/plugins/enigma/lib/enigma_engine.php
-
- -
- message: "#^Method enigma_key\\:\\:find_subkey\\(\\) should return enigma_subkey\\|null but return statement is missing\\.$#"
- count: 1
- path: public_html/plugins/enigma/lib/enigma_key.php
-
- -
- message: "#^Method Mail_mimePart\\:\\:encode\\(\\) invoked with 2 parameters, 0\\-1 required\\.$#"
- count: 1
- path: public_html/plugins/enigma/lib/enigma_mime_message.php
-
- -
- message: "#^Variable \\$headers might not be defined\\.$#"
- count: 1
- path: public_html/plugins/enigma/lib/enigma_mime_message.php
-
- -
- message: "#^Variable \\$message might not be defined\\.$#"
- count: 2
- path: public_html/plugins/enigma/lib/enigma_mime_message.php
-
- -
- message: "#^Method enigma_subkey\\:\\:get_algorithm\\(\\) should return string but return statement is missing\\.$#"
- count: 1
- path: public_html/plugins/enigma/lib/enigma_subkey.php
-
- -
- message: "#^Variable \\$keyid might not be defined\\.$#"
- count: 2
- path: public_html/plugins/enigma/lib/enigma_ui.php
-
- -
- message: "#^Default value of the parameter \\#3 \\$strict \\(false\\) of method example_addressbook_backend\\:\\:search\\(\\) is incompatible with type int\\.$#"
- count: 1
- path: public_html/plugins/example_addressbook/example_addressbook_backend.php
-
- -
- message: "#^Method example_addressbook_backend\\:\\:get_group\\(\\) should return array\\|null but return statement is missing\\.$#"
- count: 1
- path: public_html/plugins/example_addressbook/example_addressbook_backend.php
-
- -
- message: "#^Binary operation \"\\+\" between string and 1 results in an error\\.$#"
- count: 1
- path: public_html/plugins/filesystem_attachments/filesystem_attachments.php
-
- -
- message: "#^Call to an undefined method rcube\\:\\:get_uploaded_file\\(\\)\\.$#"
- count: 1
- path: public_html/plugins/filesystem_attachments/filesystem_attachments.php
-
- -
- message: "#^Call to an undefined method rcube\\:\\:list_uploaded_files\\(\\)\\.$#"
- count: 1
- path: public_html/plugins/filesystem_attachments/filesystem_attachments.php
-
- -
- message: "#^Access to an undefined property rcube_output\\:\\:\\$framed\\.$#"
- count: 1
- path: public_html/plugins/help/help.php
-
- -
- message: "#^Call to an undefined method rcube_output\\:\\:add_handlers\\(\\)\\.$#"
- count: 1
- path: public_html/plugins/help/help.php
-
- -
- message: "#^Call to an undefined method rcube_output\\:\\:button\\(\\)\\.$#"
- count: 1
- path: public_html/plugins/help/help.php
-
- -
- message: "#^Call to an undefined method rcube_output\\:\\:set_pagetitle\\(\\)\\.$#"
- count: 3
- path: public_html/plugins/help/help.php
-
- -
- message: "#^Method rcube_output\\:\\:send\\(\\) invoked with 1 parameter, 0 required\\.$#"
- count: 1
- path: public_html/plugins/help/help.php
-
- -
- message: "#^Method rcube_output\\:\\:set_env\\(\\) invoked with 3 parameters, 2 required\\.$#"
- count: 1
- path: public_html/plugins/help/help.php
-
- -
- message: "#^Access to an undefined property rcube_output\\:\\:\\$type\\.$#"
- count: 1
- path: public_html/plugins/jqueryui/jqueryui.php
-
- -
- message: "#^Access to protected property rcube_output\\:\\:\\$skins\\.$#"
- count: 2
- path: public_html/plugins/jqueryui/jqueryui.php
-
- -
- message: "#^Call to an undefined method rcube\\:\\:find_asset\\(\\)\\.$#"
- count: 1
- path: public_html/plugins/jqueryui/jqueryui.php
-
- -
- message: "#^Call to an undefined method rcube_output\\:\\:add_script\\(\\)\\.$#"
- count: 1
- path: public_html/plugins/jqueryui/jqueryui.php
-
- -
- message: "#^Call to an undefined method rcube_output\\:\\:include_css\\(\\)\\.$#"
- count: 2
- path: public_html/plugins/jqueryui/jqueryui.php
-
- -
- message: "#^Call to an undefined method rcube_output\\:\\:include_script\\(\\)\\.$#"
- count: 2
- path: public_html/plugins/jqueryui/jqueryui.php
-
- -
- message: "#^Call to method getMessage\\(\\) on an unknown class PEAR_Error\\.$#"
- count: 1
- path: public_html/plugins/managesieve/lib/Roundcube/rcube_sieve.php
-
- -
- message: "#^Default value of the parameter \\#4 \\$port \\(int\\) of method rcube_sieve\\:\\:__construct\\(\\) is incompatible with type string\\.$#"
- count: 1
- path: public_html/plugins/managesieve/lib/Roundcube/rcube_sieve.php
-
- -
- message: "#^Undefined variable\\: \\$list$#"
- count: 1
- path: public_html/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php
-
- -
- message: "#^Undefined variable\\: \\$msg$#"
- count: 1
- path: public_html/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php
-
- -
- message: "#^Variable \\$list in empty\\(\\) is never defined\\.$#"
- count: 1
- path: public_html/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php
-
- -
- message: "#^Variable \\$msg in empty\\(\\) is never defined\\.$#"
- count: 1
- path: public_html/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php
-
- -
- message: "#^Variable \\$parts in empty\\(\\) always exists and is not falsy\\.$#"
- count: 1
- path: public_html/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php
-
- -
- message: "#^Variable \\$forward_tests in empty\\(\\) is never defined\\.$#"
- count: 1
- path: public_html/plugins/managesieve/lib/Roundcube/rcube_sieve_forward.php
-
- -
- message: "#^Variable \\$parts in empty\\(\\) always exists and is not falsy\\.$#"
- count: 1
- path: public_html/plugins/managesieve/lib/Roundcube/rcube_sieve_forward.php
-
- -
- message: "#^Method rcube_sieve_script\\:\\:get_var\\(\\) should return string but return statement is missing\\.$#"
- count: 1
- path: public_html/plugins/managesieve/lib/Roundcube/rcube_sieve_script.php
-
- -
- message: "#^Variable \\$date_to might not be defined\\.$#"
- count: 1
- path: public_html/plugins/managesieve/lib/Roundcube/rcube_sieve_vacation.php
-
- -
- message: "#^Variable \\$parts in empty\\(\\) always exists and is not falsy\\.$#"
- count: 1
- path: public_html/plugins/managesieve/lib/Roundcube/rcube_sieve_vacation.php
-
- -
- message: "#^Access to an undefined property rcube\\:\\:\\$action\\.$#"
- count: 1
- path: public_html/plugins/managesieve/managesieve.php
-
- -
- message: "#^Access to an undefined property rcube\\:\\:\\$task\\.$#"
- count: 2
- path: public_html/plugins/managesieve/managesieve.php
-
- -
- message: """
- #^Call to deprecated method get_uids\\(\\) of class rcmail\\:
- since 1\\.5\\-beta, use rcmail_action\\:\\:get_uids\\(\\)$#
- """
- count: 1
- path: public_html/plugins/managesieve/managesieve.php
-
- -
- message: "#^Call to an undefined method rcube_storage\\:\\:registerFunction\\(\\)\\.$#"
- count: 1
- path: public_html/plugins/managesieve/tests/Engine.php
-
- -
- message: "#^Call to an undefined method rcube_output\\:\\:command\\(\\)\\.$#"
- count: 1
- path: public_html/plugins/markasjunk/drivers/edit_headers.php
-
- -
- message: "#^Call to an undefined method rcube\\:\\:user_date\\(\\)\\.$#"
- count: 2
- path: public_html/plugins/markasjunk/drivers/email_learn.php
-
- -
- message: "#^Access to an undefined property rcube_output\\:\\:\\$type\\.$#"
- count: 1
- path: public_html/plugins/markasjunk/drivers/jsevent.php
-
- -
- message: "#^Call to an undefined method rcube_output\\:\\:add_script\\(\\)\\.$#"
- count: 1
- path: public_html/plugins/markasjunk/drivers/jsevent.php
-
- -
- message: "#^Access to an undefined property object\\:\\:\\$mime_id\\.$#"
- count: 1
- path: public_html/plugins/markasjunk/drivers/sa_detach.php
-
- -
- message: "#^Call to an undefined method rcube_output\\:\\:command\\(\\)\\.$#"
- count: 1
- path: public_html/plugins/markasjunk/drivers/sa_detach.php
-
- -
- message: "#^Access to an undefined property rcube\\:\\:\\$action\\.$#"
- count: 2
- path: public_html/plugins/markasjunk/markasjunk.php
-
- -
- message: """
- #^Call to deprecated method get_uids\\(\\) of class rcmail\\:
- since 1\\.5\\-beta, use rcmail_action\\:\\:get_uids\\(\\)$#
- """
- count: 1
- path: public_html/plugins/markasjunk/markasjunk.php
-
- -
- message: "#^Call to an undefined method rcube_output\\:\\:add_footer\\(\\)\\.$#"
- count: 1
- path: public_html/plugins/new_user_dialog/new_user_dialog.php
-
- -
- message: "#^Call to an undefined method rcube_output\\:\\:add_script\\(\\)\\.$#"
- count: 1
- path: public_html/plugins/new_user_dialog/new_user_dialog.php
-
- -
- message: "#^Call to an undefined method rcube_output\\:\\:command\\(\\)\\.$#"
- count: 1
- path: public_html/plugins/new_user_dialog/new_user_dialog.php
-
- -
- message: "#^Access to an undefined property rcube_output\\:\\:\\$type\\.$#"
- count: 1
- path: public_html/plugins/newmail_notifier/newmail_notifier.php
-
- -
- message: "#^Call to an undefined method rcube_output\\:\\:add_label\\(\\)\\.$#"
- count: 1
- path: public_html/plugins/newmail_notifier/newmail_notifier.php
-
- -
- message: "#^Access to an undefined property COM\\:\\:\\$Domains\\.$#"
- count: 1
- path: public_html/plugins/password/drivers/hmail.php
-
- -
- message: "#^Call to an undefined method COM\\:\\:Authenticate\\(\\)\\.$#"
- count: 1
- path: public_html/plugins/password/drivers/hmail.php
-
- -
- message: "#^Undefined variable\\: \\$binddb$#"
- count: 1
- path: public_html/plugins/password/drivers/ldap_simple.php
-
- -
- message: "#^Variable \\$bindmech might not be defined\\.$#"
- count: 1
- path: public_html/plugins/password/drivers/ldap_simple.php
-
- -
- message: "#^Variable \\$bindrealm might not be defined\\.$#"
- count: 1
- path: public_html/plugins/password/drivers/ldap_simple.php
-
- -
- message: "#^Variable \\$result might not be defined\\.$#"
- count: 1
- path: public_html/plugins/password/drivers/miab.php
-
- -
- message: "#^Function pam_chpass invoked with 3 parameters, 4\\-5 required\\.$#"
- count: 1
- path: public_html/plugins/password/drivers/pam.php
-
- -
- message: "#^Comparison operation \"\\=\\=\" between \\(SimpleXMLElement\\|null\\) and 1017 results in an error\\.$#"
- count: 1
- path: public_html/plugins/password/drivers/plesk.php
-
- -
- message: "#^Call to method getMessage\\(\\) on an unknown class PEAR_Error\\.$#"
- count: 1
- path: public_html/plugins/password/drivers/poppassd.php
-
- -
- message: "#^Call to method Auth\\(\\) on an unknown class TinyCPConnector\\.$#"
- count: 1
- path: public_html/plugins/password/drivers/tinycp.php
-
- -
- message: "#^Call to method mail___mailserver___email_pass_change2\\(\\) on an unknown class TinyCPConnector\\.$#"
- count: 1
- path: public_html/plugins/password/drivers/tinycp.php
-
- -
- message: "#^Instantiated class TinyCPConnector not found\\.$#"
- count: 1
- path: public_html/plugins/password/drivers/tinycp.php
-
- -
- message: "#^Comparison operation \"\\<\" between Socket\\|false and 0 results in an error\\.$#"
- count: 1
- path: public_html/plugins/password/drivers/xmail.php
-
- -
- message: "#^Call to an undefined method rcube_output\\:\\:command\\(\\)\\.$#"
- count: 1
- path: public_html/plugins/password/password.php
-
- -
- message: "#^Call to an undefined method rcube_storage\\:\\:list_folders_direct\\(\\)\\.$#"
- count: 1
- path: public_html/plugins/subscriptions_option/subscriptions_option.php
-
- -
- message: "#^Access to an undefined property rcube_storage\\:\\:\\$methodCalls\\.$#"
- count: 3
- path: public_html/plugins/subscriptions_option/tests/SubscriptionsOption.php
-
- -
- message: "#^Call to an undefined method rcube_storage\\:\\:registerFunction\\(\\)\\.$#"
- count: 1
- path: public_html/plugins/subscriptions_option/tests/SubscriptionsOption.php
-
- -
- message: "#^Call to an undefined method rcube_output\\:\\:set_pagetitle\\(\\)\\.$#"
- count: 1
- path: public_html/plugins/userinfo/userinfo.php
-
- -
- message: "#^Method rcube_output\\:\\:send\\(\\) invoked with 1 parameter, 0 required\\.$#"
- count: 1
- path: public_html/plugins/userinfo/userinfo.php
-
- -
- message: "#^Access to an undefined property rcube_output\\:\\:\\$ajax_call\\.$#"
- count: 1
- path: public_html/plugins/vcard_attachments/vcard_attachments.php
-
- -
- message: "#^Access to an undefined property rcube_output\\:\\:\\$framed\\.$#"
- count: 2
- path: public_html/plugins/vcard_attachments/vcard_attachments.php
-
- -
- message: "#^Call to an undefined method rcube_output\\:\\:add_label\\(\\)\\.$#"
- count: 1
- path: public_html/plugins/vcard_attachments/vcard_attachments.php
-
- -
- message: "#^Call to an undefined method rcube_output\\:\\:command\\(\\)\\.$#"
- count: 2
- path: public_html/plugins/vcard_attachments/vcard_attachments.php
-
- -
- message: "#^Call to deprecated method get_part_content\\(\\) of class rcube_message\\.$#"
- count: 1
- path: public_html/plugins/vcard_attachments/vcard_attachments.php
-
- -
- message: "#^Call to an undefined method rcube_output\\:\\:add_footer\\(\\)\\.$#"
- count: 1
- path: public_html/plugins/zipdownload/zipdownload.php
-
- -
- message: "#^Call to an undefined method rcube_output\\:\\:button\\(\\)\\.$#"
- count: 1
- path: public_html/plugins/zipdownload/zipdownload.php
-
- -
- message: """
- #^Call to deprecated method get_uids\\(\\) of class rcmail\\:
- since 1\\.5\\-beta, use rcmail_action\\:\\:get_uids\\(\\)$#
- """
- count: 1
- path: public_html/plugins/zipdownload/zipdownload.php
-
- -
- message: "#^Method rcube_output\\:\\:send\\(\\) invoked with 1 parameter, 0 required\\.$#"
- count: 1
- path: public_html/plugins/zipdownload/zipdownload.php
-
- -
- message: "#^Method rcube_storage\\:\\:index\\(\\) invoked with 4 parameters, 0\\-3 required\\.$#"
- count: 1
- path: public_html/plugins/zipdownload/zipdownload.php
-
-
message: "#^Call to an undefined method rcube\\:\\:get_uploaded_file\\(\\)\\.$#"
count: 1
diff --git a/plugins/archive/tests/Browser/MailTest.php b/plugins/archive/tests/Browser/MailTest.php
index a93f5a7409..556a272c33 100644
--- a/plugins/archive/tests/Browser/MailTest.php
+++ b/plugins/archive/tests/Browser/MailTest.php
@@ -21,7 +21,7 @@ public static function setUpBeforeClass(): void
public function testMailUI()
{
- $this->browse(function ($browser) {
+ $this->browse(static function ($browser) {
$browser->go('mail');
if (!$browser->isDesktop()) {
@@ -29,7 +29,7 @@ public function testMailUI()
}
// Folders list
- $browser->whenAvailable('#mailboxlist', function ($browser) {
+ $browser->whenAvailable('#mailboxlist', static function ($browser) {
$browser->assertVisible('li.mailbox.archive')
->assertMissing('li.mailbox.archive .unreadcount');
});
@@ -41,7 +41,7 @@ public function testMailUI()
// Toolbar menu (Archive button inactive)
$browser->assertToolbarMenu([], ['archive']);
- $browser->whenAvailable('#messagelist tbody', function ($browser) {
+ $browser->whenAvailable('#messagelist tbody', static function ($browser) {
$browser->ctrlClick('tr:last-child');
});
@@ -54,7 +54,7 @@ public function testMailUI()
}
// Folders list
- $browser->whenAvailable('#mailboxlist', function ($browser) {
+ $browser->whenAvailable('#mailboxlist', static function ($browser) {
$browser->assertSeeIn('li.mailbox.archive .unreadcount', '1')
->click('li.mailbox.archive')
->waitUntilNotBusy();
@@ -69,10 +69,10 @@ public function testMailUI()
// Test archive class on folder in folder selector
$browser->ctrlClick('#messagelist tbody tr')
->clickToolbarMenuItem('more', null, false)
- ->with(new Popupmenu('message-menu'), function ($browser) {
+ ->with(new Popupmenu('message-menu'), static function ($browser) {
$browser->clickMenuItem('move');
})
- ->with(new Popupmenu('folder-selector'), function ($browser) {
+ ->with(new Popupmenu('folder-selector'), static function ($browser) {
$browser->assertVisible('li.archive')
->assertSeeIn('li.archive', 'Archive');
})
diff --git a/plugins/archive/tests/Browser/SettingsTest.php b/plugins/archive/tests/Browser/SettingsTest.php
index 6e5fa14d42..30f03a6a99 100644
--- a/plugins/archive/tests/Browser/SettingsTest.php
+++ b/plugins/archive/tests/Browser/SettingsTest.php
@@ -14,11 +14,11 @@ public static function setUpBeforeClass(): void
*/
public function testFolders()
{
- $this->browse(function ($browser) {
+ $this->browse(static function ($browser) {
$browser->go('settings', 'folders');
// Folders list
- $browser->with('#subscription-table', function ($browser) {
+ $browser->with('#subscription-table', static function ($browser) {
$browser->assertHasClass('li:nth-child(7)', 'archive')
->assertSeeIn('li:nth-child(7)', 'Archive')
->assertPresent('li:nth-child(7) [type=checkbox][disabled]');
@@ -31,7 +31,7 @@ public function testFolders()
*/
public function testPreferences()
{
- $this->browse(function ($browser) {
+ $this->browse(static function ($browser) {
$browser->go('settings');
if (!$browser->isDesktop()) {
@@ -45,13 +45,13 @@ public function testPreferences()
$browser->waitFor('#layout-content .footer a.button.submit:not(.disabled)');
}
- $browser->withinFrame('#preferences-frame', function ($browser) {
+ $browser->withinFrame('#preferences-frame', static function ($browser) {
if (!$browser->isPhone()) {
$browser->waitFor('.formbuttons button.submit');
}
// Main Options fieldset
- $browser->with('form.propform fieldset.main', function ($browser) {
+ $browser->with('form.propform fieldset.main', static function ($browser) {
$browser->assertSeeIn('legend', 'Main Options');
$browser->assertSeeIn('label[for=_archive_mbox]', 'Archive')
@@ -62,13 +62,13 @@ public function testPreferences()
});
// Archive fieldset
- $browser->with('form.propform fieldset.archive', function ($browser) {
+ $browser->with('form.propform fieldset.archive', static function ($browser) {
$browser->assertSeeIn('legend', 'Archive');
$browser->assertSeeIn('label[for=ff_archive_type]', 'Divide archive by')
->assertVisible('select[name=_archive_type]')
->assertSelected('select[name=_archive_type]', '')
- ->with('select[name=_archive_type]', function ($browser) {
+ ->with('select[name=_archive_type]', static function ($browser) {
$browser->assertValue('option:nth-child(1)', '')
->assertSeeIn('option:nth-child(1)', 'None')
->assertValue('option:nth-child(2)', 'year')
@@ -99,7 +99,7 @@ public function testPreferences()
$browser->waitForMessage('confirmation', 'Successfully saved');
// Verify if every option has been updated
- $browser->withinFrame('#preferences-frame', function ($browser) {
+ $browser->withinFrame('#preferences-frame', static function ($browser) {
$browser->assertSelected('_archive_mbox', 'Drafts');
$browser->assertSelected('_archive_type', 'year');
});
@@ -111,18 +111,18 @@ public function testPreferences()
*/
public function testServerSettings()
{
- $this->browse(function ($browser) {
+ $this->browse(static function ($browser) {
$browser->go('settings', 'preferences');
$browser->click('#sections-table tr.server');
- $browser->withinFrame('#preferences-frame', function ($browser) {
+ $browser->withinFrame('#preferences-frame', static function ($browser) {
if (!$browser->isPhone()) {
$browser->waitFor('.formbuttons button.submit');
}
// Main Options fieldset
- $browser->with('form.propform fieldset.main', function ($browser) {
+ $browser->with('form.propform fieldset.main', static function ($browser) {
$browser->assertSeeIn('label[for=ff_read_on_archive]', 'Mark the message as read on archive')
->assertCheckboxState('_read_on_archive', false)
->setCheckboxState('_read_on_archive', true);
@@ -141,7 +141,7 @@ public function testServerSettings()
$browser->waitForMessage('confirmation', 'Successfully saved');
// Verify if every option has been updated
- $browser->withinFrame('#preferences-frame', function ($browser) {
+ $browser->withinFrame('#preferences-frame', static function ($browser) {
$browser->assertCheckboxState('_read_on_archive', true);
});
});
diff --git a/plugins/attachment_reminder/tests/Browser/PluginTest.php b/plugins/attachment_reminder/tests/Browser/PluginTest.php
index 13c6901c44..ebe40385ee 100644
--- a/plugins/attachment_reminder/tests/Browser/PluginTest.php
+++ b/plugins/attachment_reminder/tests/Browser/PluginTest.php
@@ -16,18 +16,18 @@ public static function setUpBeforeClass(): void
*/
public function testPreferences()
{
- $this->browse(function ($browser) {
+ $this->browse(static function ($browser) {
$browser->go('settings', 'preferences');
$browser->click('#sections-table tr.compose');
- $browser->withinFrame('#preferences-frame', function ($browser) {
+ $browser->withinFrame('#preferences-frame', static function ($browser) {
if (!$browser->isPhone()) {
$browser->waitFor('.formbuttons button.submit');
}
// Main Options fieldset
- $browser->with('form.propform fieldset.main', function ($browser) {
+ $browser->with('form.propform fieldset.main', static function ($browser) {
$browser->assertSeeIn('label[for=rcmfd_attachment_reminder]', 'Remind about forgotten attachments')
->assertCheckboxState('_attachment_reminder', false)
->setCheckboxState('_attachment_reminder', true);
@@ -46,7 +46,7 @@ public function testPreferences()
$browser->waitForMessage('confirmation', 'Successfully saved');
// Verify if every option has been updated
- $browser->withinFrame('#preferences-frame', function ($browser) {
+ $browser->withinFrame('#preferences-frame', static function ($browser) {
$browser->assertCheckboxState('_attachment_reminder', true);
});
});
@@ -59,7 +59,7 @@ public function testPreferences()
*/
public function testMailCompose()
{
- $this->browse(function ($browser) {
+ $this->browse(static function ($browser) {
$send_btn = $browser->isPhone() ? '.buttons a.send' : '.formbuttons button.send';
$browser->go('mail', 'compose');
@@ -71,7 +71,7 @@ public function testMailCompose()
->click($send_btn);
// Expect a dialog, Click "Attach a file" button
- $browser->with(new Dialog(), function ($browser) {
+ $browser->with(new Dialog(), static function ($browser) {
$browser->assertDialogTitle('Missing attachment?')
->assertDialogContent('Did you forget to attach a file?')
->assertButton('mainaction.attach', 'Attach a file')
@@ -83,7 +83,7 @@ public function testMailCompose()
$browser->click($send_btn);
// Expect the dialog again, click Send button (in the dialog)
- $browser->with(new Dialog(), function ($browser) {
+ $browser->with(new Dialog(), static function ($browser) {
$browser->assertDialogTitle('Missing attachment?')
->clickButton('send');
});
diff --git a/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php b/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php
index a8c3fc384b..b516ff0c75 100644
--- a/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php
+++ b/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php
@@ -2488,7 +2488,7 @@ function action_div($fid, $id, $div = true)
$is_flag_action = preg_match('/^(set|add|remove)flag$/', (string) $action['type']);
if ($is_flag_action) {
- $custom_flags = array_filter($flags_target, function ($v) use ($flags) {
+ $custom_flags = array_filter($flags_target, static function ($v) use ($flags) {
return !in_array_nocase($v, $flags);
});
}
diff --git a/plugins/markasjunk/drivers/email_learn.php b/plugins/markasjunk/drivers/email_learn.php
index e4ad7c78b8..532f7fcc59 100644
--- a/plugins/markasjunk/drivers/email_learn.php
+++ b/plugins/markasjunk/drivers/email_learn.php
@@ -75,7 +75,7 @@ private function _do_emaillearn($uids, $spam)
'mailto' => $mailto,
'dsn_enabled' => false,
'charset' => 'UTF-8',
- 'error_handler' => function (...$args) use ($OUTPUT) {
+ 'error_handler' => static function (...$args) use ($OUTPUT) {
call_user_func_array([$OUTPUT, 'show_message'], $args);
$OUTPUT->send();
},
diff --git a/plugins/markasjunk/tests/Browser/MailTest.php b/plugins/markasjunk/tests/Browser/MailTest.php
index 0f7c053dd3..a80b331ec2 100644
--- a/plugins/markasjunk/tests/Browser/MailTest.php
+++ b/plugins/markasjunk/tests/Browser/MailTest.php
@@ -20,13 +20,13 @@ public static function setUpBeforeClass(): void
*/
public function testMailUI()
{
- $this->browse(function ($browser) {
+ $this->browse(static function ($browser) {
$browser->go('mail');
// Toolbar menu (Spam button inactive)
$browser->assertToolbarMenu([], ['junk']);
- $browser->whenAvailable('#messagelist tbody', function ($browser) {
+ $browser->whenAvailable('#messagelist tbody', static function ($browser) {
$browser->ctrlClick('tr:last-child');
});
@@ -42,7 +42,7 @@ public function testMailUI()
}
// Folders list
- $browser->whenAvailable('#mailboxlist', function ($browser) {
+ $browser->whenAvailable('#mailboxlist', static function ($browser) {
$browser->assertSeeIn('li.mailbox.junk .unreadcount', '1')
->assertMissing('li.mailbox.inbox .unreadcount')
->click('li.mailbox.junk')
@@ -53,7 +53,7 @@ public function testMailUI()
$browser->assertToolbarMenu([], ['notjunk']);
// Messages list contains the moved message
- $browser->whenAvailable('#messagelist tbody', function ($browser) {
+ $browser->whenAvailable('#messagelist tbody', static function ($browser) {
$browser->assertElementsCount('tr', 1)
->ctrlClick('tr:last-child');
});
@@ -70,7 +70,7 @@ public function testMailUI()
}
// Folders list, the message is back in INBOX
- $browser->whenAvailable('#mailboxlist', function ($browser) {
+ $browser->whenAvailable('#mailboxlist', static function ($browser) {
$browser->assertMissing('li.mailbox.junk .unreadcount')
->assertSeeIn('li.mailbox.inbox .unreadcount', '1')
->click('li.mailbox.inbox')
@@ -78,7 +78,7 @@ public function testMailUI()
});
// Messages list contains the moved message
- $browser->whenAvailable('#messagelist tbody', function ($browser) {
+ $browser->whenAvailable('#messagelist tbody', static function ($browser) {
$browser->assertElementsCount('tr', 1);
});
});
@@ -91,10 +91,10 @@ public function testMailUI()
*/
public function testMailView()
{
- $this->browse(function ($browser) {
+ $this->browse(static function ($browser) {
$browser->go('mail');
- $browser->whenAvailable('#messagelist tbody', function ($browser) {
+ $browser->whenAvailable('#messagelist tbody', static function ($browser) {
$browser->click('tr:last-child');
});
@@ -112,12 +112,12 @@ public function testMailView()
}
// Folders list
- $browser->whenAvailable('#mailboxlist', function ($browser) {
+ $browser->whenAvailable('#mailboxlist', static function ($browser) {
$browser->click('li.mailbox.junk')
->waitUntilNotBusy();
});
- $browser->whenAvailable('#messagelist tbody', function ($browser) {
+ $browser->whenAvailable('#messagelist tbody', static function ($browser) {
$browser->click('tr:last-child');
});
diff --git a/plugins/subscriptions_option/subscriptions_option.php b/plugins/subscriptions_option/subscriptions_option.php
index b3fb9f076d..5385047951 100644
--- a/plugins/subscriptions_option/subscriptions_option.php
+++ b/plugins/subscriptions_option/subscriptions_option.php
@@ -102,7 +102,7 @@ function mailboxes_list($args)
$storage = $rcmail->get_storage();
if ($folders = $storage->list_folders_direct($args['root'], $args['name'])) {
- $folders = array_filter($folders, function ($folder) use ($storage) {
+ $folders = array_filter($folders, static function ($folder) use ($storage) {
$attrs = $storage->folder_attributes($folder);
return !in_array_nocase('\\Noselect', $attrs);
});
diff --git a/plugins/zipdownload/tests/Browser/MailTest.php b/plugins/zipdownload/tests/Browser/MailTest.php
index 6e37ec189a..df217cdab3 100644
--- a/plugins/zipdownload/tests/Browser/MailTest.php
+++ b/plugins/zipdownload/tests/Browser/MailTest.php
@@ -22,13 +22,13 @@ public function testMailUI()
$this->browse(function ($browser) {
$browser->go('mail');
- $browser->whenAvailable('#messagelist tbody', function ($browser) {
+ $browser->whenAvailable('#messagelist tbody', static function ($browser) {
$browser->ctrlClick('tr:first-child');
});
// Test More > Download > Source (single message selected)
$browser->clickToolbarMenuItem('more', null, false)
- ->with(new Popupmenu('message-menu'), function ($browser) {
+ ->with(new Popupmenu('message-menu'), static function ($browser) {
$browser->clickMenuItem('download', null, false);
})
->with(new Popupmenu('zipdownload-menu'), function ($browser) {
@@ -49,7 +49,7 @@ public function testMailUI()
// Test More > Download > Mailbox format (two messages selected)
$browser->ctrlClick('#messagelist tbody tr:nth-of-type(2)')
->clickToolbarMenuItem('more', null, false)
- ->with(new Popupmenu('message-menu'), function ($browser) {
+ ->with(new Popupmenu('message-menu'), static function ($browser) {
$browser->clickMenuItem('download', null, false);
})
->with(new Popupmenu('zipdownload-menu'), function ($browser) {
@@ -67,7 +67,7 @@ public function testMailUI()
// Test More > Download > Maildir format (two messages selected)
$browser->clickToolbarMenuItem('more', null, false)
- ->with(new Popupmenu('message-menu'), function ($browser) {
+ ->with(new Popupmenu('message-menu'), static function ($browser) {
$browser->clickMenuItem('download', null, false);
})
->with(new Popupmenu('zipdownload-menu'), function ($browser) {
@@ -84,7 +84,7 @@ public function testMailUI()
->waitForMessage('loading', 'Loading...')
->waitFor('#messagecontframe')
->waitUntilMissing('#messagestack')
- ->withinFrame('#messagecontframe', function ($browser) {
+ ->withinFrame('#messagecontframe', static function ($browser) {
$browser->waitFor('.header-links a.zipdownload')
->click('.header-links a.zipdownload');
});
diff --git a/program/actions/contacts/index.php b/program/actions/contacts/index.php
index cbd235cb30..0d91b9db23 100644
--- a/program/actions/contacts/index.php
+++ b/program/actions/contacts/index.php
@@ -832,7 +832,7 @@ public static function contact_form($form, $record, $attrib = null)
if (!empty($prop['subtypes'])) {
// re-order subtypes, so 'work' is before 'home'
if ($business_mode) {
- $work_opts = array_filter($prop['subtypes'], function ($var) { return strpos($var, 'work') !== false; });
+ $work_opts = array_filter($prop['subtypes'], static function ($var) { return strpos($var, 'work') !== false; });
if (!empty($work_opts)) {
$coltypes[$col]['subtypes'] = $prop['subtypes'] = array_merge(
$work_opts,
diff --git a/program/actions/mail/bounce.php b/program/actions/mail/bounce.php
index ed0def245f..1bf4acbbc4 100644
--- a/program/actions/mail/bounce.php
+++ b/program/actions/mail/bounce.php
@@ -64,7 +64,7 @@ public function run($args = [])
['mode' => rcmail_sendmail::MODE_FORWARD],
[
'sendmail' => true,
- 'error_handler' => function (...$args) use ($rcmail) {
+ 'error_handler' => static function (...$args) use ($rcmail) {
call_user_func_array([$rcmail->output, 'show_message'], $args);
$rcmail->output->send('iframe');
},
diff --git a/program/actions/mail/search.php b/program/actions/mail/search.php
index 8515865660..629fac13d1 100644
--- a/program/actions/mail/search.php
+++ b/program/actions/mail/search.php
@@ -225,7 +225,7 @@ public static function search_input($str, $headers = '', $filter = 'ALL', $inter
$result .= ' ' . $search_interval;
}
- $value_function = function ($value) {
+ $value_function = static function ($value) {
$value = trim($value);
$value = preg_replace('/(^"|"$)/', '', $value);
$value = str_replace('\\"', '"', $value);
diff --git a/program/actions/mail/send.php b/program/actions/mail/send.php
index 45ffbeaf28..68167e6a91 100644
--- a/program/actions/mail/send.php
+++ b/program/actions/mail/send.php
@@ -56,7 +56,7 @@ public function run($args = [])
'sendmail' => true,
'saveonly' => $saveonly,
'savedraft' => $savedraft,
- 'error_handler' => function (...$args) use ($rcmail) {
+ 'error_handler' => static function (...$args) use ($rcmail) {
call_user_func_array([$rcmail->output, 'show_message'], $args);
$rcmail->output->send('iframe');
},
diff --git a/program/actions/settings/about.php b/program/actions/settings/about.php
index 5bec5e22da..85e137df87 100644
--- a/program/actions/settings/about.php
+++ b/program/actions/settings/about.php
@@ -36,10 +36,10 @@ public function run($args = [])
$rcmail->output->add_handlers([
'supportlink' => [$this, 'supportlink'],
'pluginlist' => [$this, 'plugins_list'],
- 'copyright' => function () {
+ 'copyright' => static function () {
return 'Copyright © 2005-2023, The Roundcube Dev Team';
},
- 'license' => function () {
+ 'license' => static function () {
return 'This program is free software; you can redistribute it and/or modify it under the terms '
. 'of the GNU General Public License '
. 'as published by the Free Software Foundation, either version 3 of the License, '
diff --git a/program/include/rcmail.php b/program/include/rcmail.php
index ce898252c8..7984011029 100644
--- a/program/include/rcmail.php
+++ b/program/include/rcmail.php
@@ -1031,7 +1031,7 @@ public function logout_actions()
$trash_mbox = $this->config->get('trash_mbox');
if ($logout_purge && !empty($trash_mbox)) {
- $getMessages = function ($folder) use ($logout_purge, $storage) {
+ $getMessages = static function ($folder) use ($logout_purge, $storage) {
if (is_numeric($logout_purge)) {
$now = new DateTime('now');
$interval = new DateInterval('P' . intval($logout_purge) . 'D');
diff --git a/program/include/rcmail_output_html.php b/program/include/rcmail_output_html.php
index 4d1fbe2b8c..8c7daa5f3d 100644
--- a/program/include/rcmail_output_html.php
+++ b/program/include/rcmail_output_html.php
@@ -2024,11 +2024,11 @@ protected function _write($output = '')
$is_empty = true;
}
- $merge_script_files = function ($output, $script) {
+ $merge_script_files = static function ($output, $script) {
return $output . html::script($script);
};
- $merge_scripts = function ($output, $script) {
+ $merge_scripts = static function ($output, $script) {
return $output . html::script([], $script);
};
diff --git a/program/include/rcmail_sendmail.php b/program/include/rcmail_sendmail.php
index 1be5e7a2b8..4b134bb9ce 100644
--- a/program/include/rcmail_sendmail.php
+++ b/program/include/rcmail_sendmail.php
@@ -62,7 +62,7 @@ public function __construct($data = [], $options = [])
$this->options['sendmail_delay'] = (int) $this->rcmail->config->get('sendmail_delay');
if (empty($options['error_handler'])) {
- $this->options['error_handler'] = function () { return false; };
+ $this->options['error_handler'] = static function () { return false; };
}
if (empty($this->data['mode'])) {
diff --git a/program/lib/Roundcube/bootstrap.php b/program/lib/Roundcube/bootstrap.php
index b1238d7691..60a580f913 100644
--- a/program/lib/Roundcube/bootstrap.php
+++ b/program/lib/Roundcube/bootstrap.php
@@ -106,7 +106,7 @@
// set PEAR error handling (will also load the PEAR main class)
if (class_exists('PEAR')) {
- PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, function ($err) { rcube::raise_error($err, true); });
+ PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, static function ($err) { rcube::raise_error($err, true); });
}
/**
diff --git a/program/lib/Roundcube/cache/memcache.php b/program/lib/Roundcube/cache/memcache.php
index 2980c80bd4..1c353d78ee 100644
--- a/program/lib/Roundcube/cache/memcache.php
+++ b/program/lib/Roundcube/cache/memcache.php
@@ -75,7 +75,7 @@ public static function engine()
$available = 0;
// Callback for memcache failure
- $error_callback = function ($host, $port) use ($seen, $available) {
+ $error_callback = static function ($host, $port) use ($seen, $available) {
// only report once
if (!$seen["$host:$port"]++) {
$available--;
diff --git a/program/lib/Roundcube/db/mysql.php b/program/lib/Roundcube/db/mysql.php
index 56ceba03af..a1e409c8f2 100644
--- a/program/lib/Roundcube/db/mysql.php
+++ b/program/lib/Roundcube/db/mysql.php
@@ -232,12 +232,12 @@ public function get_variable($varname, $default = null)
*/
public function insert_or_update($table, $keys, $columns, $values)
{
- $columns = array_map(function ($i) { return "`$i`"; }, $columns);
- $cols = implode(', ', array_map(function ($i) { return "`$i`"; }, array_keys($keys)));
+ $columns = array_map(static function ($i) { return "`$i`"; }, $columns);
+ $cols = implode(', ', array_map(static function ($i) { return "`$i`"; }, array_keys($keys)));
$cols .= ', ' . implode(', ', $columns);
$vals = implode(', ', array_map(function ($i) { return $this->quote($i); }, $keys));
$vals .= ', ' . rtrim(str_repeat('?, ', count($columns)), ', ');
- $update = implode(', ', array_map(function ($i) { return "$i = VALUES($i)"; }, $columns));
+ $update = implode(', ', array_map(static function ($i) { return "$i = VALUES($i)"; }, $columns));
return $this->query("INSERT INTO $table ($cols) VALUES ($vals)"
. " ON DUPLICATE KEY UPDATE $update", $values);
diff --git a/program/lib/Roundcube/db/pgsql.php b/program/lib/Roundcube/db/pgsql.php
index 2a3ba9fcee..8705f9c895 100644
--- a/program/lib/Roundcube/db/pgsql.php
+++ b/program/lib/Roundcube/db/pgsql.php
@@ -208,7 +208,7 @@ public function insert_or_update($table, $keys, $columns, $values)
$cols = $target . ', ' . implode(', ', $columns);
$vals = implode(', ', array_map(function ($i) { return $this->quote($i); }, $keys));
$vals .= ', ' . rtrim(str_repeat('?, ', count($columns)), ', ');
- $update = implode(', ', array_map(function ($i) { return "$i = EXCLUDED.$i"; }, $columns));
+ $update = implode(', ', array_map(static function ($i) { return "$i = EXCLUDED.$i"; }, $columns));
return $this->query("INSERT INTO $table ($cols) VALUES ($vals)"
. " ON CONFLICT ($target) DO UPDATE SET $update", $values);
diff --git a/program/lib/Roundcube/rcube.php b/program/lib/Roundcube/rcube.php
index 9d2a846b3b..bff14bcf3a 100644
--- a/program/lib/Roundcube/rcube.php
+++ b/program/lib/Roundcube/rcube.php
@@ -221,7 +221,7 @@ public function get_cache($name, $type = 'db', $ttl = 0, $packed = true, $indexe
$this->caches[$name] = rcube_cache::factory($type, $userid, $name, $ttl, $packed, $indexed);
}
- return $this->caches[$name];
+ return $this->caches[$name] ?? null;
}
/**
diff --git a/program/lib/Roundcube/rcube_addressbook.php b/program/lib/Roundcube/rcube_addressbook.php
index de487dec0d..b5f5cf27be 100644
--- a/program/lib/Roundcube/rcube_addressbook.php
+++ b/program/lib/Roundcube/rcube_addressbook.php
@@ -689,7 +689,7 @@ public static function compose_list_name($contact)
$compose_mode = (int) rcube::get_instance()->config->get('addressbook_name_listing', 0);
}
- $get_names = function ($contact, $fields) {
+ $get_names = static function ($contact, $fields) {
$result = [];
foreach ($fields as $field) {
if (!empty($contact[$field])) {
diff --git a/program/lib/Roundcube/rcube_cache.php b/program/lib/Roundcube/rcube_cache.php
index d8d325b2d0..8b6ae7843c 100644
--- a/program/lib/Roundcube/rcube_cache.php
+++ b/program/lib/Roundcube/rcube_cache.php
@@ -201,7 +201,7 @@ public static function key_name($prefix, $params = [])
$cache_key = $prefix;
if (!empty($params)) {
- $func = function ($v) {
+ $func = static function ($v) {
if (is_array($v)) {
sort($v);
}
diff --git a/program/lib/Roundcube/rcube_charset.php b/program/lib/Roundcube/rcube_charset.php
index a388eb6444..a7c7f4ee46 100644
--- a/program/lib/Roundcube/rcube_charset.php
+++ b/program/lib/Roundcube/rcube_charset.php
@@ -291,7 +291,7 @@ public static function convert($str, $from, $to = null)
}
$out = false;
- $error_handler = function () { throw new \Exception(); };
+ $error_handler = static function () { throw new \Exception(); };
// Ignore invalid characters
$mbstring_sc = mb_substitute_character();
diff --git a/program/lib/Roundcube/rcube_db.php b/program/lib/Roundcube/rcube_db.php
index 6cd24db2b7..64f0fdd2c2 100644
--- a/program/lib/Roundcube/rcube_db.php
+++ b/program/lib/Roundcube/rcube_db.php
@@ -588,8 +588,8 @@ protected function handle_error($query)
*/
public function insert_or_update($table, $keys, $columns, $values)
{
- $columns = array_map(function ($i) { return "`$i`"; }, $columns);
- $sets = array_map(function ($i) { return "$i = ?"; }, $columns);
+ $columns = array_map(static function ($i) { return "`$i`"; }, $columns);
+ $sets = array_map(static function ($i) { return "$i = ?"; }, $columns);
$where = $keys;
array_walk($where, function (&$val, $key) {
@@ -602,7 +602,7 @@ public function insert_or_update($table, $keys, $columns, $values)
// if UPDATE fails use INSERT
if ($result && !$this->affected_rows($result)) {
- $cols = implode(', ', array_map(function ($i) { return "`$i`"; }, array_keys($keys)));
+ $cols = implode(', ', array_map(static function ($i) { return "`$i`"; }, array_keys($keys)));
$cols .= ', ' . implode(', ', $columns);
$vals = implode(', ', array_map(function ($i) { return $this->quote($i); }, $keys));
$vals .= ', ' . rtrim(str_repeat('?, ', count($columns)), ', ');
diff --git a/program/lib/Roundcube/rcube_imap.php b/program/lib/Roundcube/rcube_imap.php
index 76d614ac0b..979941a880 100644
--- a/program/lib/Roundcube/rcube_imap.php
+++ b/program/lib/Roundcube/rcube_imap.php
@@ -1140,7 +1140,7 @@ protected function list_search_messages($folder, $page, $slice = 0)
}
// Re-sort the result according to the original search set order
- usort($a_msg_headers, function ($a, $b) use ($index) {
+ usort($a_msg_headers, static function ($a, $b) use ($index) {
return array_search($a->uid . '-' . $a->folder, $index) - array_search($b->uid . '-' . $b->folder, $index);
});
}
@@ -3142,7 +3142,7 @@ protected function list_folders_filter(&$result, $root, $update_type = null)
// Remove hidden folders
if ($config->get('imap_skip_hidden_folders')) {
- $result = array_filter($result, function ($v) { return $v[0] != '.'; });
+ $result = array_filter($result, static function ($v) { return $v[0] != '.'; });
}
// Remove folders in shared namespaces (if configured, see self::set_env())
@@ -3498,7 +3498,7 @@ public function get_special_folders($forced = false)
return $result;
}
- $types = array_map(function ($value) { return "\\" . ucfirst($value); }, rcube_storage::$folder_types);
+ $types = array_map(static function ($value) { return '\\' . ucfirst($value); }, rcube_storage::$folder_types);
$special = [];
// request \Subscribed flag in LIST response as performance improvement for folder_exists()
diff --git a/program/lib/Roundcube/rcube_imap_generic.php b/program/lib/Roundcube/rcube_imap_generic.php
index 8d2e04ee0c..5af9b46517 100644
--- a/program/lib/Roundcube/rcube_imap_generic.php
+++ b/program/lib/Roundcube/rcube_imap_generic.php
@@ -583,7 +583,7 @@ protected function authenticate($user, $pass, $type = 'PLAIN')
// RFC2195: CRAM-MD5
$ipad = '';
$opad = '';
- $xor = function ($str1, $str2) {
+ $xor = static function ($str1, $str2) {
$result = '';
$size = strlen($str1);
for ($i = 0; $i < $size; $i++) {
@@ -3367,7 +3367,7 @@ public function getQuota($mailbox = null)
*/
public function setQuota($root, $quota)
{
- $fn = function ($key, $value) {
+ $fn = static function ($key, $value) {
return strtoupper($key) . ' ' . $value;
};
diff --git a/program/lib/Roundcube/rcube_result_multifolder.php b/program/lib/Roundcube/rcube_result_multifolder.php
index 8eebcb48bd..da13f94f41 100644
--- a/program/lib/Roundcube/rcube_result_multifolder.php
+++ b/program/lib/Roundcube/rcube_result_multifolder.php
@@ -76,7 +76,7 @@ protected function append_result($result)
// append UIDs to global index
$folder = $result->get_parameters('MAILBOX');
- $index = array_map(function ($uid) use ($folder) { return $uid . '-' . $folder; }, $result->get());
+ $index = array_map(static function ($uid) use ($folder) { return $uid . '-' . $folder; }, $result->get());
$this->index = array_merge($this->index, $index);
}
diff --git a/program/lib/Roundcube/rcube_spellchecker.php b/program/lib/Roundcube/rcube_spellchecker.php
index c70e8a3fb1..0c58fcce61 100644
--- a/program/lib/Roundcube/rcube_spellchecker.php
+++ b/program/lib/Roundcube/rcube_spellchecker.php
@@ -139,7 +139,7 @@ function check($text, $is_html = false)
}
// ignore links (#8527)
- $callback = function ($matches) {
+ $callback = static function ($matches) {
// replace the link with a dummy string that has the same length
// we can't just remove the link
return str_repeat(' ', strlen($matches[0]));
diff --git a/program/lib/Roundcube/rcube_uploads.php b/program/lib/Roundcube/rcube_uploads.php
index bbb0aedc75..342814d04c 100644
--- a/program/lib/Roundcube/rcube_uploads.php
+++ b/program/lib/Roundcube/rcube_uploads.php
@@ -272,7 +272,7 @@ protected function prepare_upload_metadata($data)
$data = array_diff_key($data, array_fill_keys(['id', 'group', 'status', 'abort', 'error', 'data', 'created'], 1));
// Remove null values
- $data = array_filter($data, function ($v) { return $v !== null; });
+ $data = array_filter($data, static function ($v) { return $v !== null; });
// Convert to string
$data = json_encode($data, \JSON_INVALID_UTF8_IGNORE);
diff --git a/program/lib/Roundcube/rcube_utils.php b/program/lib/Roundcube/rcube_utils.php
index 055b420827..15cb18a1bf 100644
--- a/program/lib/Roundcube/rcube_utils.php
+++ b/program/lib/Roundcube/rcube_utils.php
@@ -480,7 +480,7 @@ public static function mod_css_styles($source, $container_id, $allow_remote = fa
// for cases like @media { body { position: fixed; } } (#5811)
$excl = '(?!' . substr($replacements->pattern, 1, -1) . ')';
$regexp = '/(^\s*|,\s*|\}\s*|\{\s*)(' . $excl . ':?[a-z0-9\._#\*\[][a-z0-9\._:\(\)#=~ \[\]"\|\>\+\$\^-]*)/im';
- $callback = function ($matches) use ($container_id, $prefix) {
+ $callback = static function ($matches) use ($container_id, $prefix) {
$replace = $matches[2];
if (stripos($replace, ':root') === 0) {
@@ -628,7 +628,7 @@ public static function file2class($mimetype, $filename)
*/
public static function xss_entity_decode($content)
{
- $callback = function ($matches) { return chr(hexdec($matches[1])); };
+ $callback = static function ($matches) { return chr(hexdec($matches[1])); };
$out = html_entity_decode(html_entity_decode($content));
$out = trim(preg_replace('/(^$)/', '', trim($out)));
@@ -1681,7 +1681,7 @@ public static function remove_subject_prefix($subject, $mode = 'both')
}
// replace Re:, Re[x]:, Re-x (#1490497)
- $pieces = array_map(function ($prefix) {
+ $pieces = array_map(static function ($prefix) {
$prefix = strtolower(str_replace(':', '', $prefix));
return "$prefix:|$prefix\[\d\]:|$prefix-\d:";
}, $prefixes);
diff --git a/tests/ActionTestCase.php b/tests/ActionTestCase.php
index 1e7fae8231..f35ff9bbba 100644
--- a/tests/ActionTestCase.php
+++ b/tests/ActionTestCase.php
@@ -185,7 +185,7 @@ protected function fakeUpload($name = '_file', $is_array = true, $error = 0)
// Attachments handling plugins use move_uploaded_file() which does not work
// here. We'll add a fake hook handler for our purposes.
$rcmail = rcmail::get_instance();
- $rcmail->plugins->register_hook('attachment_upload', function ($att) use ($file) {
+ $rcmail->plugins->register_hook('attachment_upload', static function ($att) use ($file) {
$att['status'] = true;
$att['id'] = $file['id'];
return $att;
@@ -227,7 +227,7 @@ protected function fileUpload($group)
// Attachments handling plugins use move_uploaded_file() which does not work
// here. We'll add a fake hook handler for our purposes.
$rcmail = rcmail::get_instance();
- $rcmail->plugins->register_hook('attachment_upload', function ($att) use ($file) {
+ $rcmail->plugins->register_hook('attachment_upload', static function ($att) use ($file) {
$att['status'] = true;
$att['id'] = $file['id'];
return $att;
diff --git a/tests/Actions/Mail/AttachmentDelete.php b/tests/Actions/Mail/AttachmentDelete.php
index 2fdcf53124..bfd790f523 100644
--- a/tests/Actions/Mail/AttachmentDelete.php
+++ b/tests/Actions/Mail/AttachmentDelete.php
@@ -28,7 +28,7 @@ function test_run()
// This is needed so upload deletion works
$rcmail = rcmail::get_instance();
unset($rcmail->plugins->handlers['attachment_delete']);
- $rcmail->plugins->register_hook('attachment_delete', function ($att) {
+ $rcmail->plugins->register_hook('attachment_delete', static function ($att) {
$att['status'] = true;
$att['break'] = true;
return $att;
diff --git a/tests/Browser/Browser.php b/tests/Browser/Browser.php
index d007bb2603..1e568d2a8e 100644
--- a/tests/Browser/Browser.php
+++ b/tests/Browser/Browser.php
@@ -75,7 +75,7 @@ public function assertHasClass($selector, $class_name)
*/
public function assertTaskMenu($selected)
{
- $this->with(new Components\Taskmenu(), function ($browser) use ($selected) {
+ $this->with(new Components\Taskmenu(), static function ($browser) use ($selected) {
$browser->assertMenuState($selected);
});
@@ -87,7 +87,7 @@ public function assertTaskMenu($selected)
*/
public function assertToolbarMenu($active, $disabled = [], $missing = [])
{
- $this->with(new Components\Toolbarmenu(), function ($browser) use ($active, $disabled, $missing) {
+ $this->with(new Components\Toolbarmenu(), static function ($browser) use ($active, $disabled, $missing) {
$browser->assertMenuState($active, $disabled, $missing);
});
@@ -99,7 +99,7 @@ public function assertToolbarMenu($active, $disabled = [], $missing = [])
*/
public function closeToolbarMenu()
{
- $this->with(new Components\Toolbarmenu(), function ($browser) {
+ $this->with(new Components\Toolbarmenu(), static function ($browser) {
$browser->closeMenu();
});
@@ -111,7 +111,7 @@ public function closeToolbarMenu()
*/
public function clickTaskMenuItem($name)
{
- $this->with(new Components\Taskmenu(), function ($browser) use ($name) {
+ $this->with(new Components\Taskmenu(), static function ($browser) use ($name) {
$browser->clickMenuItem($name);
});
@@ -123,7 +123,7 @@ public function clickTaskMenuItem($name)
*/
public function clickToolbarMenuItem($name, $dropdown_action = null, $close = true)
{
- $this->with(new Components\Toolbarmenu(), function ($browser) use ($name, $dropdown_action, $close) {
+ $this->with(new Components\Toolbarmenu(), static function ($browser) use ($name, $dropdown_action, $close) {
$browser->clickMenuItem($name, $dropdown_action, $close);
});
@@ -147,7 +147,7 @@ public function ctrlClick($selector)
*/
public function go($task = 'mail', $action = null, $login = true)
{
- $this->with(new Components\App(), function ($browser) use ($task, $action, $login) {
+ $this->with(new Components\App(), static function ($browser) use ($task, $action, $login) {
$browser->gotoAction($task, $action, $login);
});
diff --git a/tests/Browser/Components/Dialog.php b/tests/Browser/Components/Dialog.php
index cc91f8ab1c..ff6f508b38 100644
--- a/tests/Browser/Components/Dialog.php
+++ b/tests/Browser/Components/Dialog.php
@@ -116,8 +116,8 @@ public function pressESC($browser)
*/
public function withinDialogFrame($browser, $callback)
{
- $browser->withinFrame('@content iframe', function ($browser) use ($callback) {
- $browser->withinBody(function ($browser) use ($callback) {
+ $browser->withinFrame('@content iframe', static function ($browser) use ($callback) {
+ $browser->withinBody(static function ($browser) use ($callback) {
$callback($browser);
});
});
diff --git a/tests/Browser/Components/Popupmenu.php b/tests/Browser/Components/Popupmenu.php
index f86d2f9679..088c86d043 100644
--- a/tests/Browser/Components/Popupmenu.php
+++ b/tests/Browser/Components/Popupmenu.php
@@ -106,7 +106,7 @@ public function clickMenuItem($browser, $name, $dropdown_action = null)
if ($dropdown_action) {
$popup_id = $browser->attribute($selector, 'data-popup');
- $browser->withinBody(function ($browser) use ($popup_id, $dropdown_action) {
+ $browser->withinBody(static function ($browser) use ($popup_id, $dropdown_action) {
$browser->click("#{$popup_id} li a.{$dropdown_action}");
});
}
diff --git a/tests/Browser/Components/Taskmenu.php b/tests/Browser/Components/Taskmenu.php
index ca19f64c1e..1cb338a10a 100644
--- a/tests/Browser/Components/Taskmenu.php
+++ b/tests/Browser/Components/Taskmenu.php
@@ -79,7 +79,7 @@ public function assertMenuState(Browser $browser, $selected)
public function clickMenuItem(Browser $browser, $name)
{
if ($browser->isPhone()) {
- $browser->withinBody(function ($browser) {
+ $browser->withinBody(static function ($browser) {
$browser->click('.task-menu-button');
});
}
diff --git a/tests/Browser/Components/Toolbarmenu.php b/tests/Browser/Components/Toolbarmenu.php
index 09562ac275..7186d47a81 100644
--- a/tests/Browser/Components/Toolbarmenu.php
+++ b/tests/Browser/Components/Toolbarmenu.php
@@ -110,7 +110,7 @@ public function clickMenuItem($browser, $name, $dropdown_action = null, $close =
if ($dropdown_action) {
$popup_id = $browser->attribute($selector, 'data-popup');
- $browser->withinBody(function ($browser) use ($popup_id, $dropdown_action) {
+ $browser->withinBody(static function ($browser) use ($popup_id, $dropdown_action) {
$browser->click("#{$popup_id} li a.{$dropdown_action}");
});
}
diff --git a/tests/Browser/Contacts/ContactsTest.php b/tests/Browser/Contacts/ContactsTest.php
index 089e49bbb7..7628af379c 100644
--- a/tests/Browser/Contacts/ContactsTest.php
+++ b/tests/Browser/Contacts/ContactsTest.php
@@ -16,10 +16,10 @@ public static function setUpBeforeClass(): void
*/
public function testContactsUI()
{
- $this->browse(function ($browser) {
+ $this->browse(static function ($browser) {
$browser->go('addressbook');
- $browser->with(new App(), function ($browser) {
+ $browser->with(new App(), static function ($browser) {
// check task
$browser->assertEnv('task', 'addressbook');
diff --git a/tests/Browser/Contacts/GroupsTest.php b/tests/Browser/Contacts/GroupsTest.php
index f47f47448e..5ca960ca6c 100644
--- a/tests/Browser/Contacts/GroupsTest.php
+++ b/tests/Browser/Contacts/GroupsTest.php
@@ -17,7 +17,7 @@ public static function setUpBeforeClass(): void
*/
public function testGroups()
{
- $this->browse(function ($browser) {
+ $this->browse(static function ($browser) {
$browser->go('addressbook');
if (!$browser->isDesktop()) {
@@ -33,7 +33,7 @@ public function testGroups()
$browser->click('#layout-sidebar .header .sidebar-menu');
- $browser->with(new Popupmenu('groupoptions-menu'), function ($browser) {
+ $browser->with(new Popupmenu('groupoptions-menu'), static function ($browser) {
// Note: These are button class names, not action names
$active = ['create'];
$disabled = ['group.rename', 'group.delete', 'search', 'search.delete'];
@@ -49,7 +49,7 @@ public function testGroups()
*/
public function testGroupCreate()
{
- $this->browse(function ($browser) {
+ $this->browse(static function ($browser) {
$browser->go('addressbook');
if (!$browser->isDesktop()) {
@@ -58,11 +58,11 @@ public function testGroupCreate()
$browser->click('#layout-sidebar .header .sidebar-menu');
- $browser->with(new Popupmenu('groupoptions-menu'), function ($browser) {
+ $browser->with(new Popupmenu('groupoptions-menu'), static function ($browser) {
$browser->clickMenuItem('create');
});
- $browser->with(new Dialog(), function ($browser) {
+ $browser->with(new Dialog(), static function ($browser) {
$browser->assertDialogTitle('Create new group')
->assertButton('save.mainaction', 'Save')
->assertButton('cancel', 'Cancel')
@@ -71,7 +71,7 @@ public function testGroupCreate()
->clickButton('save');
});
- $browser->with('#directorylist', function ($browser) {
+ $browser->with('#directorylist', static function ($browser) {
$browser->waitFor('li:first-child ul.groups')
->assertVisible('.treetoggle.expanded')
->assertElementsCount('ul.groups > li.contactgroup', 1)
@@ -93,7 +93,7 @@ public function testGroupCreate()
*/
public function testGroupRename()
{
- $this->browse(function ($browser) {
+ $this->browse(static function ($browser) {
$browser->go('addressbook');
if (!$browser->isDesktop()) {
@@ -108,11 +108,11 @@ public function testGroupRename()
$browser->click('#layout-sidebar .header .sidebar-menu');
- $browser->with(new Popupmenu('groupoptions-menu'), function ($browser) {
+ $browser->with(new Popupmenu('groupoptions-menu'), static function ($browser) {
$browser->clickMenuItem('group.rename');
});
- $browser->with(new Dialog(), function ($browser) {
+ $browser->with(new Dialog(), static function ($browser) {
$browser
->assertDialogTitle('Rename group')
->assertButton('save.mainaction', 'Save')
@@ -123,7 +123,7 @@ public function testGroupRename()
->clickButton('save');
});
- $browser->with('#directorylist', function ($browser) {
+ $browser->with('#directorylist', static function ($browser) {
$browser->waitFor('li:first-child ul.groups')
->assertVisible('.treetoggle.expanded')
->assertElementsCount('ul.groups > li.contactgroup', 1)
@@ -145,7 +145,7 @@ public function testGroupRename()
*/
public function testGroupDelete()
{
- $this->browse(function ($browser) {
+ $this->browse(static function ($browser) {
$browser->go('addressbook');
if (!$browser->isDesktop()) {
@@ -160,11 +160,11 @@ public function testGroupDelete()
$browser->click('#layout-sidebar .header .sidebar-menu');
- $browser->with(new Popupmenu('groupoptions-menu'), function ($browser) {
+ $browser->with(new Popupmenu('groupoptions-menu'), static function ($browser) {
$browser->clickMenuItem('group.delete');
});
- $browser->with(new Dialog(), function ($browser) {
+ $browser->with(new Dialog(), static function ($browser) {
$browser
->assertDialogTitle('Are you sure...')
->assertDialogContent('Do you really want to delete selected group?')
@@ -173,7 +173,7 @@ public function testGroupDelete()
->clickButton('delete');
});
- $browser->with('#directorylist', function ($browser) {
+ $browser->with('#directorylist', static function ($browser) {
$browser->assertMissing('.treetoggle.expanded')
->assertMissing('ul.groups');
});
diff --git a/tests/Browser/Contacts/ImportTest.php b/tests/Browser/Contacts/ImportTest.php
index 6a553e2df1..7d48764522 100644
--- a/tests/Browser/Contacts/ImportTest.php
+++ b/tests/Browser/Contacts/ImportTest.php
@@ -17,20 +17,20 @@ public static function setUpBeforeClass(): void
*/
public function testImportUI()
{
- $this->browse(function ($browser) {
+ $this->browse(static function ($browser) {
$browser->go('addressbook');
$browser->clickToolbarMenuItem('import');
- $browser->with(new Dialog(), function ($browser) {
+ $browser->with(new Dialog(), static function ($browser) {
$browser->assertDialogTitle('Import contacts')
->assertButton('mainaction.import', 'Import')
->assertButton('cancel', 'Cancel');
});
- $browser->withinFrame('.ui-dialog iframe', function ($browser) {
+ $browser->withinFrame('.ui-dialog iframe', static function ($browser) {
// check task and action
- $browser->with(new App(), function ($browser) {
+ $browser->with(new App(), static function ($browser) {
$browser->assertEnv('task', 'addressbook');
$browser->assertEnv('action', 'import');
// these objects should be there always
@@ -47,7 +47,7 @@ public function testImportUI()
});
// Close the dialog
- $browser->with(new Dialog(), function ($browser) {
+ $browser->with(new Dialog(), static function ($browser) {
$browser->clickButton('cancel');
});
});
@@ -60,29 +60,29 @@ public function testImportUI()
*/
public function testImportProcess()
{
- $this->browse(function ($browser) {
+ $this->browse(static function ($browser) {
// Open the dialog again
$browser->clickToolbarMenuItem('import');
- $browser->with(new Dialog(), function ($browser) {
+ $browser->with(new Dialog(), static function ($browser) {
$browser->assertDialogTitle('Import contacts')
->clickButton('import');
});
// Submit the form with no file attached
- $browser->with(new Dialog(2), function ($browser) {
+ $browser->with(new Dialog(2), static function ($browser) {
$browser->assertDialogTitle('Attention')
->assertDialogContent('Please select a file')
->assertButton('save.mainaction', 'OK')
->pressESC();
});
- $browser->with(new Dialog(), function ($browser) {
- $browser->withinDialogFrame(function ($browser) {
+ $browser->with(new Dialog(), static function ($browser) {
+ $browser->withinDialogFrame(static function ($browser) {
$browser->attach('.custom-file input', TESTS_DIR . 'data/contacts.vcf');
})
->clickButton('import')
- ->withinDialogFrame(function ($browser) {
+ ->withinDialogFrame(static function ($browser) {
$browser->waitForText('Successfully imported 2 contacts:');
})
->closeDialog();
@@ -102,11 +102,11 @@ public function testImportProcess()
*/
public function testImportResult()
{
- $this->browse(function ($browser) {
+ $this->browse(static function ($browser) {
// Open the dialog again
$browser->click('#contacts-table tr:last-child');
- $browser->withinFrame('#contact-frame', function ($browser) {
+ $browser->withinFrame('#contact-frame', static function ($browser) {
$browser->waitFor('a.email'); // wait for iframe to load
$browser->assertSeeIn('.names', 'Sylvester Stalone');
$browser->assertSeeIn('a.email', 's.stalone@rambo.tv');
diff --git a/tests/Browser/Contacts/PrintTest.php b/tests/Browser/Contacts/PrintTest.php
index bf612654eb..74b35bfdc7 100644
--- a/tests/Browser/Contacts/PrintTest.php
+++ b/tests/Browser/Contacts/PrintTest.php
@@ -32,7 +32,7 @@ public function testPrint()
$browser->driver->switchTo()->window($new_window);
- $browser->with(new App(), function ($browser) {
+ $browser->with(new App(), static function ($browser) {
$browser->assertEnv([
'task' => 'addressbook',
'action' => 'print',
diff --git a/tests/Browser/Logon/LoginTest.php b/tests/Browser/Logon/LoginTest.php
index e7446394fd..b6328e27f9 100644
--- a/tests/Browser/Logon/LoginTest.php
+++ b/tests/Browser/Logon/LoginTest.php
@@ -23,7 +23,7 @@ public function testLogin()
$browser->assertTitleContains($this->app->config->get('product_name'));
// task should be set to 'login'
- $browser->with(new App(), function ($browser) {
+ $browser->with(new App(), static function ($browser) {
$browser->assertEnv('task', 'login');
});
@@ -45,7 +45,7 @@ public function testLogin()
$browser->go('mail');
// task should be set to 'mail' now
- $browser->with(new App(), function ($browser) {
+ $browser->with(new App(), static function ($browser) {
$browser->assertEnv('task', 'mail');
});
});
diff --git a/tests/Browser/Logon/LogoutTest.php b/tests/Browser/Logon/LogoutTest.php
index ec2b811fd0..60003e1b78 100644
--- a/tests/Browser/Logon/LogoutTest.php
+++ b/tests/Browser/Logon/LogoutTest.php
@@ -8,14 +8,14 @@ class LogoutTest extends TestCase
{
public function testLogout()
{
- $this->browse(function ($browser) {
+ $this->browse(static function ($browser) {
$browser->go('settings');
// click the Logout button in taskmenu
$browser->clickTaskMenuItem('logout');
// task should be set to 'login'
- $browser->with(new App(), function ($browser) {
+ $browser->with(new App(), static function ($browser) {
$browser->assertEnv('task', 'login');
});
diff --git a/tests/Browser/Mail/ComposeTest.php b/tests/Browser/Mail/ComposeTest.php
index 7e8ba4f4b4..1d47bb71d6 100644
--- a/tests/Browser/Mail/ComposeTest.php
+++ b/tests/Browser/Mail/ComposeTest.php
@@ -16,13 +16,13 @@ public static function setUpBeforeClass(): void
public function testCompose()
{
- $this->browse(function ($browser) {
+ $this->browse(static function ($browser) {
$browser->go('mail');
$browser->clickTaskMenuItem('compose');
// check task and action
- $browser->with(new App(), function ($browser) {
+ $browser->with(new App(), static function ($browser) {
$browser->assertEnv('task', 'mail');
$browser->assertEnv('action', 'compose');
@@ -85,8 +85,8 @@ function testPlainEditor()
{
// Test for #7230: Shift+PageUp text selection
// and copy-pasting with keyboard
- $this->browse(function ($browser) {
- $browser->with(new HtmlEditor('composebodycontainer'), function ($browser) {
+ $this->browse(static function ($browser) {
+ $browser->with(new HtmlEditor('composebodycontainer'), static function ($browser) {
$browser->assertMode(HtmlEditor::MODE_PLAIN)
->type('@plain-body', "line1\nline2\n")
->keys('@plain-body', [WebDriverKeys::SHIFT, WebDriverKeys::PAGE_UP])
@@ -99,8 +99,8 @@ function testPlainEditor()
});
// Test switching to HTML and back
- $this->browse(function ($browser) {
- $browser->with(new HtmlEditor('composebodycontainer'), function ($browser) {
+ $this->browse(static function ($browser) {
+ $browser->with(new HtmlEditor('composebodycontainer'), static function ($browser) {
$browser->switchMode(HtmlEditor::MODE_HTML, true)
->switchMode(HtmlEditor::MODE_PLAIN)
->assertValue('@plain-body', "line1\nline2\nline1\nline2")
@@ -116,11 +116,11 @@ function testRecipientInput()
{
// Test for #7231: Recipient input bug when using click
// to select a contact from autocomplete list
- $this->browse(function ($browser) {
- $browser->with(new RecipientInput('#compose_to'), function ($browser) {
+ $this->browse(static function ($browser) {
+ $browser->with(new RecipientInput('#compose_to'), static function ($browser) {
$browser->type('@input', 'johndoe@e')
- ->withinBody(function ($browser) {
- $browser->whenAvailable('#rcmKSearchpane', function ($browser) {
+ ->withinBody(static function ($browser) {
+ $browser->whenAvailable('#rcmKSearchpane', static function ($browser) {
$browser->click('li:first-child');
});
})
diff --git a/tests/Browser/Mail/ListTest.php b/tests/Browser/Mail/ListTest.php
index d07dd49dfe..177ab75f1e 100644
--- a/tests/Browser/Mail/ListTest.php
+++ b/tests/Browser/Mail/ListTest.php
@@ -41,7 +41,7 @@ public function testList()
$browser->assertVisible('#layout-list .header a.toolbar-button.refresh:not(.disabled)');
if ($browser->isDesktop()) {
- $browser->with('#toolbar-list-menu', function ($browser) {
+ $browser->with('#toolbar-list-menu', static function ($browser) {
$browser->assertVisible('a.select:not(.disabled)');
$browser->assertVisible('a.options:not(.disabled)');
@@ -58,7 +58,7 @@ public function testList()
$browser->click('.toolbar-list-button')
->waitFor('#toolbar-list-menu');
- $browser->with('#toolbar-list-menu', function ($browser) {
+ $browser->with('#toolbar-list-menu', static function ($browser) {
$browser->assertVisible('a.select:not(.disabled)');
$browser->assertVisible('a.options:not(.disabled)');
@@ -75,7 +75,7 @@ public function testList()
}
else { // phone
// On phones list options are in the toolbar menu
- $browser->with(new Toolbarmenu(), function ($browser) {
+ $browser->with(new Toolbarmenu(), static function ($browser) {
$active = ['select', 'options'];
$missing = [];
$imap = \bootstrap::get_storage();
@@ -98,9 +98,9 @@ public function testList()
*/
public function testListSelection()
{
- $this->browse(function ($browser) {
+ $this->browse(static function ($browser) {
if ($browser->isPhone()) {
- $browser->with(new Toolbarmenu(), function ($browser) {
+ $browser->with(new Toolbarmenu(), static function ($browser) {
$browser->clickMenuItem('select', null, false);
});
}
@@ -115,7 +115,7 @@ public function testListSelection()
// Popup menu content
$browser->waitFor('#listselect-menu');
- $browser->with('#listselect-menu', function ($browser) {
+ $browser->with('#listselect-menu', static function ($browser) {
$browser->assertVisible('a.selection:not(.disabled)');
$browser->assertVisible('a.select.all:not(.disabled)');
$browser->assertVisible('a.select.page:not(.disabled)');
diff --git a/tests/Browser/Mail/MailTest.php b/tests/Browser/Mail/MailTest.php
index 3605c31989..7a9c0bab5b 100644
--- a/tests/Browser/Mail/MailTest.php
+++ b/tests/Browser/Mail/MailTest.php
@@ -9,11 +9,11 @@ class MailTest extends \Tests\Browser\TestCase
{
public function testMailUI()
{
- $this->browse(function ($browser) {
+ $this->browse(static function ($browser) {
$browser->go('mail');
// check task
- $browser->with(new App(), function ($browser) {
+ $browser->with(new App(), static function ($browser) {
$browser->assertEnv('task', 'mail');
// these objects should be there always
$browser->assertObjects([
@@ -60,12 +60,12 @@ public function testMailUI()
*/
public function testMessageMenu()
{
- $this->browse(function ($browser) {
+ $this->browse(static function ($browser) {
$browser->go('mail');
$browser->clickToolbarMenuItem('more', null, false);
- $browser->with(new Popupmenu('message-menu'), function ($browser) {
+ $browser->with(new Popupmenu('message-menu'), static function ($browser) {
// Note: These are button class names, not action names
$active = ['import'];
$disabled = ['print', 'download', 'edit.asnew', 'source', 'move', 'copy', 'extwin'];
diff --git a/tests/Browser/Mail/OpenTest.php b/tests/Browser/Mail/OpenTest.php
index 7312b4deef..2f1c6baed6 100644
--- a/tests/Browser/Mail/OpenTest.php
+++ b/tests/Browser/Mail/OpenTest.php
@@ -43,13 +43,13 @@ public function testOpenInNewWindow()
$uid = $uids[0];
- [$current_window, $new_window] = $browser->openWindow(function ($browser) {
+ [$current_window, $new_window] = $browser->openWindow(static function ($browser) {
$browser->clickMenuItem('extwin');
});
$browser->driver->switchTo()->window($new_window);
- $browser->with(new App(), function ($browser) use ($uid) {
+ $browser->with(new App(), static function ($browser) use ($uid) {
$browser->assertEnv([
'task' => 'mail',
'action' => 'show',
diff --git a/tests/Browser/Mail/PreviewTest.php b/tests/Browser/Mail/PreviewTest.php
index 2234e3b9e1..1366846ca0 100644
--- a/tests/Browser/Mail/PreviewTest.php
+++ b/tests/Browser/Mail/PreviewTest.php
@@ -33,7 +33,7 @@ public function testPreview()
// On phone check frame controls
if ($browser->isPhone()) {
- $browser->with('#layout-content .footer', function ($browser) {
+ $browser->with('#layout-content .footer', static function ($browser) {
$browser->assertVisible('a.button.prev.disabled')
->assertVisible('a.button.next:not(.disabled)')
->assertVisible('a.button.reply:not(.disabled)')
@@ -71,19 +71,19 @@ public function testPreview()
// On phone check frame controls
if ($browser->isPhone()) {
- $browser->with('#layout-content .footer', function ($browser) {
+ $browser->with('#layout-content .footer', static function ($browser) {
$browser->assertVisible('a.button.prev:not(.disabled)')
->assertVisible('a.button.next.disabled')
->assertVisible('a.button.reply:not(.disabled)');
});
}
- $browser->withinFrame('#messagecontframe', function ($browser) {
+ $browser->withinFrame('#messagecontframe', static function ($browser) {
$browser->waitFor('img.contactphoto')
->assertMissing('#remote-objects-message');
// Attachments list
- $browser->with('#attachment-list', function ($browser) {
+ $browser->with('#attachment-list', static function ($browser) {
$browser->assertVisible('li:nth-child(1).text.plain')
->assertSeeIn('li:nth-child(1) .attachment-name', 'lines.txt')
->assertSeeIn('li:nth-child(1) .attachment-size', '(~13 B)')
@@ -95,7 +95,7 @@ public function testPreview()
if (!$browser->isPhone()) {
$browser->waitFor('#attachmentmenu')
- ->with('#attachmentmenu', function ($browser) {
+ ->with('#attachmentmenu', static function ($browser) {
$browser->assertVisible('a.extwin:not(.disabled)')
->assertVisible('a.download:not(.disabled)')
->click('a.download');
@@ -105,7 +105,7 @@ public function testPreview()
if ($browser->isPhone()) {
$browser->waitFor('#attachmentmenu-clone')
- ->with('#attachmentmenu-clone', function ($browser) {
+ ->with('#attachmentmenu-clone', static function ($browser) {
$browser->assertVisible('a.extwin:not(.disabled)')
->assertVisible('a.download:not(.disabled)')
->click('a.download');
@@ -134,7 +134,7 @@ public function testPreview()
*/
public function testPreviewMorelink()
{
- $this->browse(function ($browser) {
+ $this->browse(static function ($browser) {
$browser->go('mail');
$browser->waitFor('#messagelist tbody tr:last-child')
@@ -143,7 +143,7 @@ public function testPreviewMorelink()
->waitFor('#messagecontframe')
->waitUntilMissing('#messagestack');
- $browser->withinFrame('#messagecontframe', function ($browser) {
+ $browser->withinFrame('#messagecontframe', static function ($browser) {
$browser->waitFor('img.contactphoto');
$browser->assertSeeIn('.subject', 'Lines')
@@ -160,7 +160,7 @@ public function testPreviewMorelink()
->click('.header.cc a.morelink');
});
- $browser->with(new Dialog(), function ($browser) {
+ $browser->with(new Dialog(), static function ($browser) {
$browser->assertDialogTitle('Cc')
->assertDialogContent('test1@domain.tld')
->assertDialogContent('test12@domain.tld')
diff --git a/tests/Browser/Mail/PrintTest.php b/tests/Browser/Mail/PrintTest.php
index d84bd9efc5..863146f0f2 100644
--- a/tests/Browser/Mail/PrintTest.php
+++ b/tests/Browser/Mail/PrintTest.php
@@ -37,14 +37,14 @@ public function testPrint()
$this->markTestSkipped();
}
- [$current_window, $new_window] = $browser->openWindow(function ($browser) {
+ [$current_window, $new_window] = $browser->openWindow(static function ($browser) {
$browser->clickMenuItem('print');
});
});
$browser->driver->switchTo()->window($new_window);
- $browser->with(new App(), function ($browser) {
+ $browser->with(new App(), static function ($browser) {
$browser->assertEnv([
'task' => 'mail',
'action' => 'print',
@@ -56,7 +56,7 @@ public function testPrint()
->assertSeeIn('.message-part div.pre', 'Plain text message body.')
->assertVisible('.message-part div.pre .sig')
// Tests "more recipients" link
- ->with('.header-headers .header.cc', function ($browser) {
+ ->with('.header-headers .header.cc', static function ($browser) {
$browser->assertSee('test10@domain.tld')
->assertDontSee('test11@domain.tld')
->assertSeeIn('a.morelink', '2 more...')
diff --git a/tests/Browser/Settings/AboutTest.php b/tests/Browser/Settings/AboutTest.php
index 00c3eb561a..a15be3b5d9 100644
--- a/tests/Browser/Settings/AboutTest.php
+++ b/tests/Browser/Settings/AboutTest.php
@@ -14,7 +14,7 @@ public function testAbout()
$browser->clickTaskMenuItem('about');
- $browser->with(new Dialog(), function ($browser) {
+ $browser->with(new Dialog(), static function ($browser) {
$browser->assertDialogTitle('About')
->assertButton('cancel', 'Close')
->assertVisible('@content #aboutframe');
@@ -26,7 +26,7 @@ public function testAbout()
$browser->withinFrame('#aboutframe', function ($browser) {
// check task and action
- $browser->with(new App(), function ($browser) {
+ $browser->with(new App(), static function ($browser) {
$browser->assertEnv('task', 'settings');
$browser->assertEnv('action', 'about');
});
@@ -35,7 +35,7 @@ public function testAbout()
$browser->assertVisible('#pluginlist');
});
- $browser->with(new Dialog(), function ($browser) {
+ $browser->with(new Dialog(), static function ($browser) {
$browser->closeDialog();
});
});
diff --git a/tests/Browser/Settings/FoldersTest.php b/tests/Browser/Settings/FoldersTest.php
index af34aa290b..7ac1455c6e 100644
--- a/tests/Browser/Settings/FoldersTest.php
+++ b/tests/Browser/Settings/FoldersTest.php
@@ -17,11 +17,11 @@ public static function setUpBeforeClass(): void
*/
public function testFolders()
{
- $this->browse(function ($browser) {
+ $this->browse(static function ($browser) {
$browser->go('settings', 'folders');
// task should be set to 'settings' and action to 'folders'
- $browser->with(new App(), function ($browser) {
+ $browser->with(new App(), static function ($browser) {
$browser->assertEnv('task', 'settings');
$browser->assertEnv('action', 'folders');
@@ -44,7 +44,7 @@ public function testFolders()
$browser->assertToolbarMenu(['create'], ['delete', 'purge']);
// Folders list
- $browser->with('#subscription-table', function ($browser) {
+ $browser->with('#subscription-table', static function ($browser) {
// Note: first li element is root which is hidden in Elastic
$browser->assertHasClass('li:nth-child(2)', 'inbox')
->assertSeeIn('li:nth-child(2)', 'Inbox')
@@ -73,7 +73,7 @@ public function testFolders()
*/
public function testFolderCreate()
{
- $this->browse(function ($browser) {
+ $this->browse(static function ($browser) {
$browser->go('settings', 'folders');
$num = count($browser->elements('#subscription-table li'));
@@ -87,9 +87,9 @@ public function testFolderCreate()
$browser->clickToolbarMenuItem('create');
}
- $browser->withinFrame('#preferences-frame', function ($browser) {
+ $browser->withinFrame('#preferences-frame', static function ($browser) {
$browser->waitFor('form')
- ->with('form fieldset', function ($browser) {
+ ->with('form fieldset', static function ($browser) {
$browser->assertVisible('input[name=_name]')
->assertValue('input[name=_name]', '')
->assertVisible('select[name=_parent]')
@@ -124,7 +124,7 @@ public function testFolderCreate()
$num++;
// Folders list
- $browser->with('#subscription-table', function ($browser) use ($num) {
+ $browser->with('#subscription-table', static function ($browser) use ($num) {
// Note: li.root is hidden in Elastic
$browser->waitFor("li.mailbox:nth-child({$num})")
->assertElementsCount('li', $num - 1)
@@ -136,7 +136,7 @@ public function testFolderCreate()
$browser->waitFor('#preferences-frame');
}
- $browser->withinFrame('#preferences-frame', function ($browser) {
+ $browser->withinFrame('#preferences-frame', static function ($browser) {
$browser->waitFor('form');
// TODO
});
diff --git a/tests/Browser/Settings/IdentitiesTest.php b/tests/Browser/Settings/IdentitiesTest.php
index a0c0b95ac5..dfa975f64d 100644
--- a/tests/Browser/Settings/IdentitiesTest.php
+++ b/tests/Browser/Settings/IdentitiesTest.php
@@ -14,11 +14,11 @@ public static function setUpBeforeClass(): void
public function testIdentities()
{
- $this->browse(function ($browser) {
+ $this->browse(static function ($browser) {
$browser->go('settings', 'identities');
// check task and action
- $browser->with(new App(), function ($browser) {
+ $browser->with(new App(), static function ($browser) {
$browser->assertEnv('task', 'settings');
$browser->assertEnv('action', 'identities');
@@ -47,7 +47,7 @@ public function testIdentities()
*/
public function testIdentityCreate()
{
- $this->browse(function ($browser) {
+ $this->browse(static function ($browser) {
$browser->go('settings', 'identities');
if ($browser->isPhone()) {
@@ -59,9 +59,9 @@ public function testIdentityCreate()
$browser->clickToolbarMenuItem('create');
}
- $browser->withinFrame('#preferences-frame', function ($browser) {
+ $browser->withinFrame('#preferences-frame', static function ($browser) {
$browser->waitFor('form')
- ->with('form fieldset:nth-of-type(1)', function ($browser) {
+ ->with('form fieldset:nth-of-type(1)', static function ($browser) {
$browser->assertSeeIn('legend', 'Settings')
->assertVisible('input[name=_name]')
->assertValue('input[name=_name]', '')
@@ -81,7 +81,7 @@ public function testIdentityCreate()
->assertCheckboxState('input[name=_standard]', false)
->assertSeeIn('label[for=rcmfd_standard]', 'Set default');
})
- ->with('form fieldset:nth-of-type(2)', function ($browser) {
+ ->with('form fieldset:nth-of-type(2)', static function ($browser) {
$browser->assertSeeIn('legend', 'Signature')
->assertVisible('textarea[name=_signature]')
->assertValue('textarea[name=_signature]', '');
@@ -101,7 +101,7 @@ public function testIdentityCreate()
if ($browser->isPhone()) {
$browser->assertVisible('#layout-content .header a.back-list-button')
- ->whenAvailable('#layout-content .footer .buttons', function ($browser) {
+ ->whenAvailable('#layout-content .footer .buttons', static function ($browser) {
$browser->click('a.button.submit');
});
}
@@ -110,8 +110,8 @@ public function testIdentityCreate()
->closeMessage('confirmation')
->waitFor('#preferences-frame');
- $browser->withinFrame('#preferences-frame', function ($browser) {
- $browser->whenAvailable('form', function ($browser) {
+ $browser->withinFrame('#preferences-frame', static function ($browser) {
+ $browser->whenAvailable('form', static function ($browser) {
$browser->assertValue('input[name=_name]', 'My Test')
->assertValue('input[name=_email]', 'mynew@identity.com')
->assertValue('input[name=_organization]', 'My Organization')
@@ -131,7 +131,7 @@ public function testIdentityCreate()
}
// Identities list
- $browser->with('#identities-table', function ($browser) {
+ $browser->with('#identities-table', static function ($browser) {
$browser->assertElementsCount('tbody tr', 2)
->assertSeeIn('tbody tr:nth-child(2)', 'My Test');
});
@@ -148,12 +148,12 @@ public function testIdentityCreate()
*/
public function testIdentityDelete()
{
- $this->browse(function ($browser) {
+ $this->browse(static function ($browser) {
$browser->click('#identities-table tbody tr:first-child')
->waitFor('#preferences-frame')
->clickToolbarMenuItem('delete');
- $browser->with(new Dialog(), function ($browser) {
+ $browser->with(new Dialog(), static function ($browser) {
$browser->assertDialogTitle('Are you sure...')
->assertDialogContent('Do you really want to delete this identity?')
->assertButton('mainaction.delete', 'Delete')
@@ -165,7 +165,7 @@ public function testIdentityDelete()
->closeMessage('confirmation');
// Preview frame should reset to the watermark page
- $browser->withinFrame('#preferences-frame', function ($browser) {
+ $browser->withinFrame('#preferences-frame', static function ($browser) {
$browser->waitUntilMissing('> div');
});
@@ -187,13 +187,13 @@ public function testIdentityDelete()
*/
public function testIdentityUpdate()
{
- $this->browse(function ($browser) {
+ $this->browse(static function ($browser) {
$browser->click('#identities-table tbody tr:last-child')
->waitFor('#preferences-frame')
->waitUntilMissing('#messagestack div.loading');
- $browser->withinFrame('#preferences-frame', function ($browser) {
- $browser->whenAvailable('form', function ($browser) {
+ $browser->withinFrame('#preferences-frame', static function ($browser) {
+ $browser->whenAvailable('form', static function ($browser) {
$browser->type('[name=_name]', 'Default')
->type('[name=_organization]', 'Default Org');
});
@@ -204,7 +204,7 @@ public function testIdentityUpdate()
});
if ($browser->isPhone()) {
- $browser->whenAvailable('#layout-content .footer', function ($browser) {
+ $browser->whenAvailable('#layout-content .footer', static function ($browser) {
$browser->assertVisible('a.button.prev.disabled')
->assertVisible('a.button.next.disabled')
->click('a.button.submit');
@@ -219,7 +219,7 @@ public function testIdentityUpdate()
$browser->click('#layout-content .header a.back-list-button');
}
- $browser->whenAvailable('#identities-table', function ($browser) {
+ $browser->whenAvailable('#identities-table', static function ($browser) {
$browser->assertSeeIn('tbody tr:last-child', 'Default ');
});
});
@@ -260,7 +260,7 @@ public function testIdentitiesInComposer()
// Test "unsaved changes" dialog
$browser->type('#compose-subject', 'subject')
->click('#compose_from a.edit')
- ->with(new Dialog(), function ($browser) {
+ ->with(new Dialog(), static function ($browser) {
$browser->assertDialogTitle('Are you sure...')
->assertDialogContent('The message has not been sent and has unsaved changes. Do you want to discard your changes?')
->assertButton('mainaction.discard', 'Discard')
diff --git a/tests/Browser/Settings/Preferences/GeneralTest.php b/tests/Browser/Settings/Preferences/GeneralTest.php
index 9e01ca25fc..dff0ffcfb2 100644
--- a/tests/Browser/Settings/Preferences/GeneralTest.php
+++ b/tests/Browser/Settings/Preferences/GeneralTest.php
@@ -39,7 +39,7 @@ public function testGeneral()
}
// check task and action
- $browser->with(new App(), function ($browser) {
+ $browser->with(new App(), static function ($browser) {
$browser->assertEnv('task', 'settings');
$browser->assertEnv('action', 'edit-prefs');
});
diff --git a/tests/Browser/Settings/Preferences/ServerTest.php b/tests/Browser/Settings/Preferences/ServerTest.php
index 94eac04f63..d865c996f1 100644
--- a/tests/Browser/Settings/Preferences/ServerTest.php
+++ b/tests/Browser/Settings/Preferences/ServerTest.php
@@ -30,7 +30,7 @@ public function testServer()
$browser->click('#sections-table tr.server');
if ($browser->isPhone()) {
- $browser->whenAvailable('#layout-content .footer', function ($browser) {
+ $browser->whenAvailable('#layout-content .footer', static function ($browser) {
$browser->assertVisible('a.button.submit:not(.disabled)')
->assertVisible('a.button.prev:not(.disabled)')
->assertVisible('a.button.next');
@@ -43,7 +43,7 @@ public function testServer()
}
// check task and action
- $browser->with(new App(), function ($browser) {
+ $browser->with(new App(), static function ($browser) {
$browser->assertEnv('task', 'settings');
$browser->assertEnv('action', 'edit-prefs');
});
diff --git a/tests/Browser/Settings/PreferencesTest.php b/tests/Browser/Settings/PreferencesTest.php
index 424e911bf6..cb9a1272ce 100644
--- a/tests/Browser/Settings/PreferencesTest.php
+++ b/tests/Browser/Settings/PreferencesTest.php
@@ -8,10 +8,10 @@ class PreferencesTest extends \Tests\Browser\TestCase
{
public function testPreferences()
{
- $this->browse(function ($browser) {
+ $this->browse(static function ($browser) {
$browser->go('settings');
- $browser->with(new App(), function ($browser) {
+ $browser->with(new App(), static function ($browser) {
$browser->assertObjects(['sectionslist']);
});
@@ -24,7 +24,7 @@ public function testPreferences()
->waitFor('#sections-table');
}
// Preferences actions
- $browser->with('#sections-table', function ($browser) {
+ $browser->with('#sections-table', static function ($browser) {
$browser->assertSeeIn('tr.general', 'User Interface')
->assertSeeIn('tr.mailbox', 'Mailbox View')
->assertSeeIn('tr.mailview', 'Displaying Messages')
diff --git a/tests/Browser/Settings/ResponsesTest.php b/tests/Browser/Settings/ResponsesTest.php
index 15c4600591..8f4b896dc5 100644
--- a/tests/Browser/Settings/ResponsesTest.php
+++ b/tests/Browser/Settings/ResponsesTest.php
@@ -15,10 +15,10 @@ public static function setUpBeforeClass(): void
public function testResponses()
{
- $this->browse(function ($browser) {
+ $this->browse(static function ($browser) {
$browser->go('settings', 'responses');
- $browser->with(new App(), function ($browser) {
+ $browser->with(new App(), static function ($browser) {
// check task and action
$browser->assertEnv('task', 'settings');
$browser->assertEnv('action', 'responses');
@@ -54,7 +54,7 @@ public function testResponseCreate()
INSERT INTO responses (user_id, name, data, is_html) VALUES (1, 'response 2', 'test response 2
', '1');
");
- $this->browse(function ($browser) {
+ $this->browse(static function ($browser) {
$browser->go('settings', 'responses');
if ($browser->isPhone()) {
@@ -66,9 +66,9 @@ public function testResponseCreate()
$browser->clickToolbarMenuItem('create');
}
- $browser->withinFrame('#preferences-frame', function ($browser) {
+ $browser->withinFrame('#preferences-frame', static function ($browser) {
$browser->waitFor('form')
- ->with('form', function ($browser) {
+ ->with('form', static function ($browser) {
$browser->assertVisible('input[name=_name]')
->assertValue('input[name=_name]', '')
->assertSeeIn('label[for=ffname]', 'Name')
@@ -93,9 +93,9 @@ public function testResponseCreate()
->closeMessage('confirmation')
->waitFor('#preferences-frame');
- $browser->withinFrame('#preferences-frame', function ($browser) {
+ $browser->withinFrame('#preferences-frame', static function ($browser) {
$browser->waitFor('form')
- ->with('form', function ($browser) {
+ ->with('form', static function ($browser) {
$browser->assertVisible('input[name=_name]')
->assertValue('input[name=_name]', 'Test')
->assertValue('textarea[name=_text]', 'Response Body');
@@ -108,7 +108,7 @@ public function testResponseCreate()
}
// Responses list
- $browser->with('#responses-table', function ($browser) {
+ $browser->with('#responses-table', static function ($browser) {
$browser->assertElementsCount('tbody tr', 3)
->assertSeeIn('tbody tr:nth-child(3)', 'Test');
});
@@ -133,10 +133,10 @@ public function testResponseCreate()
*/
public function testResponseDelete()
{
- $this->browse(function ($browser) {
+ $this->browse(static function ($browser) {
$browser->clickToolbarMenuItem('delete');
- $browser->with(new Dialog(), function ($browser) {
+ $browser->with(new Dialog(), static function ($browser) {
$browser->assertDialogTitle('Are you sure...')
->assertDialogContent('Do you really want to delete this response text?')
->assertButton('mainaction.delete', 'Delete')
@@ -148,7 +148,7 @@ public function testResponseDelete()
->closeMessage('confirmation');
// Preview frame should reset to the watermark page
- $browser->withinFrame('#preferences-frame', function ($browser) {
+ $browser->withinFrame('#preferences-frame', static function ($browser) {
$browser->waitUntilMissing('> div');
});
@@ -170,7 +170,7 @@ public function testResponseDelete()
*/
public function testResponsesInComposer()
{
- $this->browse(function ($browser) {
+ $this->browse(static function ($browser) {
if ($browser->isPhone()) {
$browser->click('a.back-sidebar-button');
}
@@ -179,9 +179,9 @@ public function testResponsesInComposer()
$browser->clickTaskMenuItem('compose')
->waitFor('#compose-content')
->clickToolbarMenuItem('responses', null, false)
- ->with(new Popupmenu('responses-menu'), function ($browser) {
+ ->with(new Popupmenu('responses-menu'), static function ($browser) {
$browser->assertMenuState(['edit.responses'])
- ->with('#responseslist', function ($browser) {
+ ->with('#responseslist', static function ($browser) {
$browser->assertElementsCount('li', 2)
->assertSeeIn('li:nth-child(1) a.insertresponse', 'response 1')
->assertSeeIn('li:nth-child(2) a.insertresponse', 'response 2');
@@ -216,12 +216,12 @@ public function testResponsesInComposer()
*/
public function testResponseUpdate()
{
- $this->browse(function ($browser) {
+ $this->browse(static function ($browser) {
// We're in mail compose, use responses menu to goto Settings > Responses
$browser->clickToolbarMenuItem('responses', null, false)
->waitFor('#responses-menu')
->click('#responses-menu a.edit.responses')
- ->with(new Dialog(), function ($browser) {
+ ->with(new Dialog(), static function ($browser) {
$browser->assertDialogTitle('Are you sure...')
->assertDialogContent('The message has not been sent and has unsaved changes. Do you want to discard your changes?')
->assertButton('mainaction.discard', 'Discard')
@@ -234,9 +234,9 @@ public function testResponseUpdate()
->click('#responses-table tbody tr:first-child')
->waitFor('#preferences-frame');
- $browser->withinFrame('#preferences-frame', function ($browser) {
+ $browser->withinFrame('#preferences-frame', static function ($browser) {
$browser->waitFor('form')
- ->with('form', function ($browser) {
+ ->with('form', static function ($browser) {
$browser->assertValue('[name=_name]', 'response 1')
->assertValue('[name=_text]', 'test response 1')
->type('[name=_name]', 'Test 11')
@@ -250,7 +250,7 @@ public function testResponseUpdate()
if ($browser->isPhone()) {
$browser->waitFor('#layout-content .footer')
- ->with('#layout-content .footer', function ($browser) {
+ ->with('#layout-content .footer', static function ($browser) {
$browser->assertVisible('a.button.prev.disabled')
->assertVisible('a.button.next:not(.disabled)')
->click('a.button.submit');
@@ -266,7 +266,7 @@ public function testResponseUpdate()
}
// Responses list
- $browser->with('#responses-table', function ($browser) {
+ $browser->with('#responses-table', static function ($browser) {
$browser->assertSeeIn('tbody tr:nth-child(1)', 'Test 11');
});
});
diff --git a/tests/Browser/Settings/SettingsTest.php b/tests/Browser/Settings/SettingsTest.php
index 2353894481..718e43e4e2 100644
--- a/tests/Browser/Settings/SettingsTest.php
+++ b/tests/Browser/Settings/SettingsTest.php
@@ -8,18 +8,18 @@ class SettingsTest extends \Tests\Browser\TestCase
{
public function testSettings()
{
- $this->browse(function ($browser) {
+ $this->browse(static function ($browser) {
$browser->go('settings');
// task should be set to 'settings'
- $browser->with(new App(), function ($browser) {
+ $browser->with(new App(), static function ($browser) {
$browser->assertEnv('task', 'settings');
});
$browser->assertSeeIn('#layout-sidebar .header', 'Settings');
// Sidebar menu
- $browser->with('#settings-menu', function ($browser) {
+ $browser->with('#settings-menu', static function ($browser) {
$browser->assertSeeIn('li.preferences', 'Preferences');
$browser->assertSeeIn('li.folders', 'Folders');
$browser->assertSeeIn('li.identities', 'Identities');
diff --git a/tests/Browser/TestCase.php b/tests/Browser/TestCase.php
index 608c960dc5..b12ca6a600 100644
--- a/tests/Browser/TestCase.php
+++ b/tests/Browser/TestCase.php
@@ -164,7 +164,7 @@ protected static function startWebServer()
static::$phpProcess->setWorkingDirectory($path);
static::$phpProcess->start();
- static::afterClass(function () {
+ static::afterClass(static function () {
static::$phpProcess->stop();
});
}
diff --git a/tests/Framework/PluginApi.php b/tests/Framework/PluginApi.php
index 78603c55db..5170e7e810 100644
--- a/tests/Framework/PluginApi.php
+++ b/tests/Framework/PluginApi.php
@@ -28,7 +28,7 @@ function test_hooks()
$api = rcube_plugin_api::get_instance();
$var = 0;
- $hook_handler = function ($args) use (&$var) { $var++; };
+ $hook_handler = static function ($args) use (&$var) { $var++; };
$api->register_hook('test', $hook_handler);