diff --git a/core/modules/ckeditor5/tests/src/FunctionalJavascript/MediaTestBase.php b/core/modules/ckeditor5/tests/src/FunctionalJavascript/MediaTestBase.php index 3384ec7fa483a06b2b41e0209a1775c72327963d..1ae146a70e593831a0b887f5914e6cb89e335c6d 100644 --- a/core/modules/ckeditor5/tests/src/FunctionalJavascript/MediaTestBase.php +++ b/core/modules/ckeditor5/tests/src/FunctionalJavascript/MediaTestBase.php @@ -255,7 +255,7 @@ protected function assertSourceAttributeSame(string $attribute, ?string $value): * @return int * The size of the bytes transferred. */ - protected function getLastPreviewRequestTransferSize() { + protected function getLastPreviewRequestTransferSize(): int { $javascript = <<<JS (function(){ return window.performance diff --git a/core/modules/contextual/tests/src/FunctionalJavascript/EditModeTest.php b/core/modules/contextual/tests/src/FunctionalJavascript/EditModeTest.php index ce88a5dbd0ec516209a790235ec6a68e8cf88b3f..f73e022a56d9026106514c88ec0e09097226fb3d 100644 --- a/core/modules/contextual/tests/src/FunctionalJavascript/EditModeTest.php +++ b/core/modules/contextual/tests/src/FunctionalJavascript/EditModeTest.php @@ -159,7 +159,7 @@ protected function assertAnnounceLeaveEditMode(): void { * @return int * The number of tabbable elements. */ - protected function getTabbableElementsCount() { + protected function getTabbableElementsCount(): int { // Mark all tabbable elements. $this->getSession()->executeScript("jQuery(window.tabbable.tabbable(document.body)).attr('data-marked', '');"); // Count all marked elements. diff --git a/core/modules/datetime/tests/src/Kernel/Views/DateTimeHandlerTestBase.php b/core/modules/datetime/tests/src/Kernel/Views/DateTimeHandlerTestBase.php index 2caaba3091fc4c74d0e9824cbaee8c03d4239ce5..55b97d8c854f8ebed2cc6bea14bbb5efad636e17 100644 --- a/core/modules/datetime/tests/src/Kernel/Views/DateTimeHandlerTestBase.php +++ b/core/modules/datetime/tests/src/Kernel/Views/DateTimeHandlerTestBase.php @@ -119,7 +119,7 @@ protected function setSiteTimezone($timezone) { * @return int * Unix timestamp. */ - protected function getUTCEquivalentOfUserNowAsTimestamp() { + protected function getUTCEquivalentOfUserNowAsTimestamp(): int { $user_now = new DateTimePlus('now', new \DateTimeZone(date_default_timezone_get())); $utc_equivalent = new DateTimePlus($user_now->format('Y-m-d H:i:s'), new \DateTimeZone(DateTimeItemInterface::STORAGE_TIMEZONE)); diff --git a/core/modules/dblog/tests/src/Kernel/DbLogTest.php b/core/modules/dblog/tests/src/Kernel/DbLogTest.php index 9bdc36cb98a9aa6363492f06fda3043778a96a53..6ff79f7aff465e4184ac78dd09e8629bca3556d1 100644 --- a/core/modules/dblog/tests/src/Kernel/DbLogTest.php +++ b/core/modules/dblog/tests/src/Kernel/DbLogTest.php @@ -83,7 +83,7 @@ public function testInvalidPlaceholders(): void { * @return int * Number of new watchdog entries. */ - private function runCron() { + private function runCron(): int { $connection = Database::getConnection(); // Get last ID to compare against; log entries get deleted, so we can't // reliably add the number of newly created log entries to the current count diff --git a/core/modules/file/tests/src/Functional/FileListingTest.php b/core/modules/file/tests/src/Functional/FileListingTest.php index acb919e1d75b00f15acc780602aec8d1e903ae01..cec109455b087781d3cfda6837d2b88a1cbc8909 100644 --- a/core/modules/file/tests/src/Functional/FileListingTest.php +++ b/core/modules/file/tests/src/Functional/FileListingTest.php @@ -62,7 +62,7 @@ protected function setUp(): void { * @return int * Total usage count. */ - protected function sumUsages($usage) { + protected function sumUsages($usage): int { $count = 0; foreach ($usage as $module) { foreach ($module as $entity_type) { diff --git a/core/modules/language/tests/src/Functional/LanguageConfigurationTest.php b/core/modules/language/tests/src/Functional/LanguageConfigurationTest.php index b99b0b29a69fdb9b29ff577604adf359294f5cf1..2a2aa42d25a564eb34fe5c7fc11f8e0f2c359e4e 100644 --- a/core/modules/language/tests/src/Functional/LanguageConfigurationTest.php +++ b/core/modules/language/tests/src/Functional/LanguageConfigurationTest.php @@ -214,7 +214,7 @@ protected function checkConfigurableLanguageWeight($state = 'by default') { * @return int * Maximum weight of configurable languages. */ - protected function getHighestConfigurableLanguageWeight() { + protected function getHighestConfigurableLanguageWeight(): int { $max_weight = 0; $storage = $this->container->get('entity_type.manager') diff --git a/core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderDisableInteractionsTest.php b/core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderDisableInteractionsTest.php index 014bbbf600d8feb8fb52f655f72e890f514238fa..0fd7fb464c3262c48f9b660037b34452a0a95f0f 100644 --- a/core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderDisableInteractionsTest.php +++ b/core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderDisableInteractionsTest.php @@ -315,7 +315,7 @@ protected function assertContextualLinkRetainsMouseup(): void { * @return int * The element position. */ - protected function getElementVerticalPosition($css_selector, $position_type) { + protected function getElementVerticalPosition($css_selector, $position_type): int { $this->assertContains($position_type, ['top', 'bottom'], 'Expected position type.'); return (int) $this->getSession()->evaluateScript("document.querySelector('$css_selector').getBoundingClientRect().$position_type + window.pageYOffset"); } diff --git a/core/modules/migrate_drupal/src/Tests/StubTestTrait.php b/core/modules/migrate_drupal/src/Tests/StubTestTrait.php index 4eca5aa4c65cc005d8e5322f867081017eaab1bc..e1c1e5c2c2ecba3b30c84f21440145b6fdf264e3 100644 --- a/core/modules/migrate_drupal/src/Tests/StubTestTrait.php +++ b/core/modules/migrate_drupal/src/Tests/StubTestTrait.php @@ -33,7 +33,7 @@ protected function performStubTest($entity_type_id) { * @return int * ID of the created entity. */ - protected function createEntityStub($entity_type_id) { + protected function createEntityStub($entity_type_id): int { // Create a dummy migration to pass to the destination plugin. $definition = [ 'migration_tags' => ['Stub test'], diff --git a/core/tests/Drupal/BuildTests/Framework/BuildTestBase.php b/core/tests/Drupal/BuildTests/Framework/BuildTestBase.php index 388680bf0ad48e62bd7f4b8357788fbdb3ce48ba..fa2981eb03f09ee15bbbc1c94e8c074b11edd66e 100644 --- a/core/tests/Drupal/BuildTests/Framework/BuildTestBase.php +++ b/core/tests/Drupal/BuildTests/Framework/BuildTestBase.php @@ -466,7 +466,7 @@ protected function stopServer() { * @throws \RuntimeException * Thrown when there are no available ports within the range. */ - protected function findAvailablePort() { + protected function findAvailablePort(): int { $store = new FlockStore(DrupalFilesystem::getOsTemporaryDirectory()); $lock_factory = new LockFactory($store); @@ -524,7 +524,7 @@ protected function checkPortIsAvailable($port): bool { * * @return int */ - protected function getPortNumber() { + protected function getPortNumber(): int { if (empty($this->hostPort)) { $this->hostPort = $this->findAvailablePort(); } diff --git a/core/tests/Drupal/KernelTests/Core/Cache/DatabaseBackendTest.php b/core/tests/Drupal/KernelTests/Core/Cache/DatabaseBackendTest.php index b0fa1e64de7c17ab8d3350edaaf94066f0b54dbe..04aa222706b995dcd085e7cddecba8fb1b3abc09 100644 --- a/core/tests/Drupal/KernelTests/Core/Cache/DatabaseBackendTest.php +++ b/core/tests/Drupal/KernelTests/Core/Cache/DatabaseBackendTest.php @@ -112,7 +112,7 @@ public function testGarbageCollection(): void { * @return int * The number of rows in the test cache bin database table. */ - protected function getNumRows() { + protected function getNumRows(): int { $table = 'cache_' . $this->testBin; $connection = $this->container->get('database'); $query = $connection->select($table); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityDecoupledTranslationRevisionsTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityDecoupledTranslationRevisionsTest.php index 0514af5a46c5b9be6d2563c41c8b3d3279a35214..362280b9e5f8d8a8e0d7a23df97d441a821ec689 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityDecoupledTranslationRevisionsTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityDecoupledTranslationRevisionsTest.php @@ -288,7 +288,7 @@ public function testUntranslatableFields($sequence, $default_translation_affecte * @return int * The latest saved revision id. */ - protected function doTestEditSequence($sequence) { + protected function doTestEditSequence($sequence): int { $revision_id = NULL; foreach ($sequence as $index => $step) { $this->stepIndex = $index; diff --git a/core/tests/Drupal/Tests/Core/Template/AttributeTest.php b/core/tests/Drupal/Tests/Core/Template/AttributeTest.php index 46ac4daf36dfea5e86614f1cd6561f0ce8a69d07..8cf07c7cffd9ab4af94b34cea917c54d037a7ae8 100644 --- a/core/tests/Drupal/Tests/Core/Template/AttributeTest.php +++ b/core/tests/Drupal/Tests/Core/Template/AttributeTest.php @@ -452,7 +452,7 @@ protected function assertNoID(string $id, string $html): void { * @return int * The number of results that are found. */ - protected function getXPathResultCount($query, $html) { + protected function getXPathResultCount($query, $html): int { $document = Html::load($html); $xpath = new \DOMXPath($document); diff --git a/core/tests/Drupal/Tests/TestFileCreationTrait.php b/core/tests/Drupal/Tests/TestFileCreationTrait.php index eaf25d07736f8a195027704feaed11217ce3f1ee..ef8437c2f89735757c67be7c52ae08fb2cc267fb 100644 --- a/core/tests/Drupal/Tests/TestFileCreationTrait.php +++ b/core/tests/Drupal/Tests/TestFileCreationTrait.php @@ -113,7 +113,7 @@ protected function getTestFiles($type, $size = NULL) { * * @return int */ - protected function compareFiles($file1, $file2) { + protected function compareFiles($file1, $file2): int { $compare_size = filesize($file1->uri) - filesize($file2->uri); if ($compare_size) { // Sort by file size.