Skip to content
This repository has been archived by the owner on Mar 1, 2023. It is now read-only.

Commit

Permalink
fix: fixed unstable memory test
Browse files Browse the repository at this point in the history
  • Loading branch information
prisis committed Mar 15, 2021
1 parent 70b9667 commit e1643d9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
parameters:
ignoreErrors:
-
message: "#^Add regex101\\.com link to that shows the regex in practise, so it will be easier to maintain in case of bug/extension in the future$#"
count: 1
path: src/SapiStreamEmitter.php

-
message: "#^Post operation are forbidden, as they make 2 values at the same line\\. Use pre instead$#"
count: 1
Expand Down
4 changes: 2 additions & 2 deletions src/SapiStreamEmitter.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*/
final class SapiStreamEmitter extends AbstractSapiEmitter
{
private const CONTENT_PATTERN = '/(?P<unit>[\w]+)\s+(?P<first>\d+)-(?P<last>\d+)\/(?P<length>\d+|\*)/';
private const CONTENT_PATTERN_REGEX = '/(?P<unit>[\w]+)\s+(?P<first>\d+)-(?P<last>\d+)\/(?P<length>\d+|\*)/';

/**
* Maximum output buffering size for each iteration.
Expand Down Expand Up @@ -74,7 +74,7 @@ public function emit(ResponseInterface $response): void
*/
private function parseContentRange(string $header): ?array
{
if (preg_match(self::CONTENT_PATTERN, $header, $matches) === 1) {
if (preg_match(self::CONTENT_PATTERN_REGEX, $header, $matches) === 1) {
return [
(string) $matches['unit'],
(int) $matches['first'],
Expand Down
1 change: 1 addition & 0 deletions tests/SapiStreamEmitterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ public function testEmitRangeStreamResponse(
* @psalm-param null|array{0: int, 1: int} $rangeBlocks
*
* @dataProvider provideEmitMemoryUsageCases
* @runInSeparateProcess
*/
public function testEmitMemoryUsage(
bool $seekable,
Expand Down

0 comments on commit e1643d9

Please sign in to comment.