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

Commit c2d0a69

Browse files
committed
feat : added space to http header line
feat : upgraded php to 7.4.2
1 parent 9873f63 commit c2d0a69

10 files changed

+30
-18
lines changed

.github/workflows/code-coverage.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- name: "Setup PHP"
2323
uses: shivammathur/[email protected]
2424
with:
25-
php-version: "7.4"
25+
php-version: "7.4.2"
2626
extensions: mbstring, xml, ctype, iconv, zip, dom, fileinfo, intl, sodium, curl, pdo, pdo_sqlite, inotify, pcntl, posix, xdebug
2727
ini-values: pcov.directory=api, date.timezone=Europe/Berlin, opcache.enable_cli=1, serialize_precision=14
2828
coverage: none

.github/workflows/coding-standard.yml

+6-3
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,17 @@ jobs:
2222
- name: Setup PHP
2323
uses: shivammathur/[email protected]
2424
with:
25-
php-version: 7.4
25+
php-version: "7.4.2"
2626
extensions: mbstring, xml, ctype, iconv, zip, dom, fileinfo
2727
tools: composer, composer-prefetcher, cs2pr
2828

2929
- name: "Install Narrowspark coding standard"
30-
run: composer global require narrowspark/coding-standard:3.4.0 --no-interaction --no-progress --profile --no-suggest --optimize-autoloader
30+
run: |
31+
composer global require narrowspark/coding-standard:3.4.0 --no-interaction --no-progress --profile --no-suggest --optimize-autoloader
32+
# can be removed if bug with ClassAttributesSeparationFixer is fixed in newer version
33+
composer global require friendsofphp/php-cs-fixer:2.16.x-dev
3134
3235
- name: "lint php code"
3336
run: |
3437
cd $GITHUB_WORKSPACE
35-
/home/runner/.composer/vendor/bin/php-cs-fixer fix --config=$GITHUB_WORKSPACE/.php_cs -v --dry-run --stop-on-violation --format=checkstyle | cs2pr
38+
/home/runner/.composer/vendor/bin/php-cs-fixer fix --config=$GITHUB_WORKSPACE/.php_cs -v --dry-run --format=checkstyle | cs2pr

.github/workflows/continuous-integration-linux.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
fail-fast: false
1717
matrix:
1818
operating-system: [ubuntu-latest]
19-
php-versions: ["7.4"]
19+
php-versions: ["7.4.2"]
2020
dependencies: ["highest", "lowest"]
2121

2222
name: "PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }} OS and with ${{ matrix.dependencies }} dependencies"

.github/workflows/continuous-integration-windows.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
fail-fast: false
1717
matrix:
1818
operating-system: [windows-latest]
19-
php-versions: ["7.4"]
19+
php-versions: ["7.4.2"]
2020
dependencies: ["highest", "lowest"]
2121

2222
name: "PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }} OS and with ${{ matrix.dependencies }} dependencies"

.github/workflows/php-audit.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
max-parallel: 2
1818
matrix:
1919
operating-system: [ubuntu-latest]
20-
php-versions: ["7.4"]
20+
php-versions: ["7.4.2"]
2121
dependencies: ["highest", "lowest"]
2222

2323
name: "Audit on PHP ${{ matrix.php-versions }} and ${{ matrix.operating-system }} OS"

.github/workflows/static-analyze.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ jobs:
6767
- name: "Setup PHP"
6868
uses: shivammathur/[email protected]
6969
with:
70-
php-version: 7.4
70+
php-version: "7.4.2"
7171
extensions: mbstring, xml, ctype, iconv, zip, dom, fileinfo, intl, inotify, pcntl, posix
7272
pecl: true
7373
tools: composer, composer-prefetcher, cs2pr

src/Viserio/Component/Http/AbstractMessage.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ public function getHeaderLine($name): string
165165
return '';
166166
}
167167

168-
return \implode(',', $value);
168+
return \implode(', ', $value);
169169
}
170170

171171
/**

src/Viserio/Component/Http/Tests/AbstractMessageTest.php

+13-4
Original file line numberDiff line numberDiff line change
@@ -275,9 +275,9 @@ public static function provideValidHeaderCases(): iterable
275275
// Description => [header name, header value, getHeader(), getHeaderLine()],
276276
'Basic: value' => ['Basic', 'value', ['value'], 'value'],
277277
'array value' => ['Basic', ['value'], ['value'], 'value'],
278-
'two value' => ['Basic', ['value1', 'value2'], ['value1', 'value2'], 'value1,value2'],
278+
'two value' => ['Basic', ['value1', 'value2'], ['value1', 'value2'], 'value1, value2'],
279279
'empty header value' => ['Bar', '', [''], ''],
280-
'array value with key' => ['foo', ['foo' => 'text/plain', 'bar' => 'application/json'], ['text/plain', 'application/json'], 'text/plain,application/json'],
280+
'array value with key' => ['foo', ['foo' => 'text/plain', 'bar' => 'application/json'], ['text/plain', 'application/json'], 'text/plain, application/json'],
281281
'Header with int' => ['HTTP__1', 'test', ['test'], 'test'],
282282
'Int header' => [1, 'test', ['test'], 'test'],
283283
['key', 'allowed key', ['allowed key'], 'allowed key'],
@@ -326,9 +326,18 @@ public function testContainsNotAllowedCharsOnHeaderField($header): void
326326
$this->expectException(InvalidArgumentException::class);
327327
$this->expectExceptionMessage(\sprintf('[%s] is not a valid HTTP header field name.', $header));
328328

329-
$request = $this->classToTest;
329+
$message = $this->classToTest;
330+
331+
$message->withHeader($header, 'value');
332+
}
333+
334+
public function testWithAddedHeaderArrayValueAndKeys(): void
335+
{
336+
$message = $this->classToTest->withAddedHeader('list', ['foo' => 'one']);
337+
$message = $message->withAddedHeader('list', ['foo' => 'two', 'bar' => 'three']);
330338

331-
$request->withHeader($header, 'value');
339+
$headerLine = $message->getHeaderLine('list');
340+
self::assertSame('one, two, three', $headerLine);
332341
}
333342

334343
public static function provideContainsNotAllowedCharsOnHeaderFieldCases(): iterable

src/Viserio/Component/Http/Tests/RequestTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ public function testCanGetHeaderAsCsv(): void
557557
'Foo' => ['a', 'b', 'c'],
558558
]);
559559

560-
self::assertEquals('a,b,c', $request->getHeaderLine('Foo'));
560+
self::assertEquals('a, b, c', $request->getHeaderLine('Foo'));
561561
self::assertEquals('', $request->getHeaderLine('Bar'));
562562
}
563563

src/Viserio/Component/Http/Tests/ResponseTest.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ public function testCanConstructWithHeadersAsArray(): void
209209
]);
210210

211211
self::assertSame(['Foo' => ['baz', 'bar']], $response->getHeaders());
212-
self::assertSame('baz,bar', $response->getHeaderLine('Foo'));
212+
self::assertSame('baz, bar', $response->getHeaderLine('Foo'));
213213
self::assertSame(['baz', 'bar'], $response->getHeader('Foo'));
214214
}
215215

@@ -315,7 +315,7 @@ public function testWithHeaderAsArray(): void
315315

316316
self::assertSame(['Foo' => ['Bar']], $response->getHeaders());
317317
self::assertSame(['Foo' => ['Bar'], 'baZ' => ['Bam', 'Bar']], $response2->getHeaders());
318-
self::assertSame('Bam,Bar', $response2->getHeaderLine('baz'));
318+
self::assertSame('Bam, Bar', $response2->getHeaderLine('baz'));
319319
self::assertSame(['Bam', 'Bar'], $response2->getHeader('baz'));
320320
}
321321

@@ -337,7 +337,7 @@ public function testWithAddedHeader(): void
337337

338338
self::assertSame(['Foo' => ['Bar']], $response->getHeaders());
339339
self::assertSame(['Foo' => ['Bar', 'Baz']], $response2->getHeaders());
340-
self::assertSame('Bar,Baz', $response2->getHeaderLine('foo'));
340+
self::assertSame('Bar, Baz', $response2->getHeaderLine('foo'));
341341
self::assertSame(['Bar', 'Baz'], $response2->getHeader('foo'));
342342
}
343343

@@ -348,7 +348,7 @@ public function testWithAddedHeaderAsArray(): void
348348

349349
self::assertSame(['Foo' => ['Bar']], $response->getHeaders());
350350
self::assertSame(['Foo' => ['Bar', 'Baz', 'Bam']], $response2->getHeaders());
351-
self::assertSame('Bar,Baz,Bam', $response2->getHeaderLine('foo'));
351+
self::assertSame('Bar, Baz, Bam', $response2->getHeaderLine('foo'));
352352
self::assertSame(['Bar', 'Baz', 'Bam'], $response2->getHeader('foo'));
353353
}
354354

0 commit comments

Comments
 (0)