Skip to content

Commit 6bc88fa

Browse files
anzinandrewbess
authored andcommitted
AC-2428: Fixed code, to avoid deprecation notices
1 parent f039f91 commit 6bc88fa

File tree

3 files changed

+154
-63
lines changed

3 files changed

+154
-63
lines changed

dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Profiler/OutputBambooTestFilter.php

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
67

78
/**
89
* Stream filter that collect the data that is going through the stream
@@ -11,23 +12,28 @@
1112
*/
1213
namespace Magento\Test\Profiler;
1314

15+
use PHPUnit\Framework\Assert;
16+
1417
class OutputBambooTestFilter extends \php_user_filter
1518
{
19+
/**
20+
* @var string
21+
*/
1622
private static $_collectedData = '';
1723

1824
/**
19-
* Collect intercepted data
25+
* Collect intercepted data.
2026
*
2127
* @param resource $in
2228
* @param resource $out
2329
* @param int $consumed
2430
* @param bool $closing
25-
* @return int
2631
*
32+
* @return int
2733
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
2834
* @SuppressWarnings(PHPMD.ShortVariable)
2935
*/
30-
public function filter($in, $out, &$consumed, $closing)
36+
public function filter($in, $out, &$consumed, $closing): int
3137
{
3238
while ($bucket = stream_bucket_make_writeable($in)) {
3339
self::$_collectedData .= $bucket->data;
@@ -37,19 +43,26 @@ public function filter($in, $out, &$consumed, $closing)
3743
return PSFS_PASS_ON;
3844
}
3945

40-
public static function resetCollectedData()
46+
/**
47+
* This method to reset collection data.
48+
*
49+
* @return void
50+
*/
51+
public static function resetCollectedData(): void
4152
{
4253
self::$_collectedData = '';
4354
}
4455

4556
/**
46-
* Assert that collected data matches expected format
57+
* Assert that collected data matches expected format.
4758
*
4859
* @param string $expectedData
60+
*
61+
* @return void
4962
*/
50-
public static function assertCollectedData($expectedData)
63+
public static function assertCollectedData(string $expectedData): void
5164
{
52-
\PHPUnit\Framework\Assert::assertStringMatchesFormat(
65+
Assert::assertStringMatchesFormat(
5366
$expectedData,
5467
self::$_collectedData,
5568
'Expected data went through the stream.'

0 commit comments

Comments
 (0)