Skip to content

Commit 7893207

Browse files
committed
Upgraded php version & dev tools
2 parents e0ba48a + 8b4f66a commit 7893207

4 files changed

Lines changed: 31 additions & 26 deletions

File tree

.github/workflows/build.yml

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ on: [push, pull_request]
33

44
jobs:
55
full-build:
6+
name: "Coding standards & coverage tests"
67
runs-on: ${{ matrix.operating-system }}
78
strategy:
89
matrix:
9-
operating-system: [ubuntu-latest]
10-
php-versions: ["7.4"]
10+
operating-system: ['ubuntu-latest']
11+
php-versions: ['7.4']
1112
env:
1213
extensions: pcov, dom, json, libxml, mbstring, pdo_sqlite, soap, xml, xmlwriter
1314
key: cache-v2
@@ -36,15 +37,12 @@ jobs:
3637
ini-values: assert.exception=1, zend.assertions=1
3738
- name: "Validate composer.json"
3839
run: composer validate
39-
- name: "Set composer cache directory"
40-
id: composer-cache-full-build
41-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
4240
- name: "Setup composer cache"
4341
uses: actions/cache@v2
4442
with:
45-
path: ${{ steps.composer-cache-full-build.outputs.dir }}
46-
key: ${{ runner.os }}-composer-full-${{ hashFiles('**/composer.json') }}
47-
restore-keys: ${{ runner.os }}-composer-full-
43+
path: ~/.composer/cache
44+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
45+
restore-keys: ${{ runner.os }}-composer-
4846
- name: "Install highest dependencies"
4947
run: composer update --no-interaction --no-ansi --no-progress --no-suggest --prefer-stable
5048
- name: "Coding standard Php-CS-Fixer checks"
@@ -63,16 +61,19 @@ jobs:
6361
COVERALLS_RUN_LOCALLY: 1
6462
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
6563

66-
lowest-build:
64+
php-os-builds:
65+
name: "PHP 8 tests"
6766
runs-on: ${{ matrix.operating-system }}
6867
strategy:
6968
matrix:
70-
operating-system: [ubuntu-latest]
71-
php-versions: ["7.4"]
69+
operating-system: ['ubuntu-latest', 'windows-latest', 'macos-latest']
70+
php-versions: ['8.0', '8.1']
7271
env:
7372
extensions: dom, json, libxml, mbstring, pdo_sqlite, soap, xml, xmlwriter
7473
key: cache-v2
7574
steps:
75+
- name: "Turn off git EOL conversion"
76+
run: git config --global core.autocrlf false
7677
- name: "Checkout"
7778
uses: actions/checkout@v2
7879
- name: "Setup PHP extensions cache environment"
@@ -95,16 +96,13 @@ jobs:
9596
coverage: none
9697
extensions: ${{ env.extensions }}
9798
ini-values: assert.exception=1, zend.assertions=1
98-
- name: "Set composer cache directory"
99-
id: composer-cache-lowest-build
100-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
10199
- name: "Setup composer cache"
102100
uses: actions/cache@v2
103101
with:
104-
path: ${{ steps.composer-cache-lowest-build.outputs.dir }}
105-
key: ${{ runner.os }}-composer-low-${{ hashFiles('**/composer.json') }}
106-
restore-keys: ${{ runner.os }}-composer-low-
107-
- name: "Install lowest dependencies"
108-
run: composer update --no-interaction --no-ansi --no-progress --no-suggest --prefer-stable --prefer-lowest
102+
path: ~/.composer/cache
103+
key: ${{ runner.os }}-php${{ matrix.php-versions }}-composer-${{ hashFiles('**/composer.json') }}
104+
restore-keys: ${{ runner.os }}-php${{ matrix.php-versions }}-composer-
105+
- name: "Install highest dependencies"
106+
run: composer update --no-interaction --no-ansi --no-progress --no-suggest --prefer-stable
109107
- name: "Run PhpUnit tests (no coverage)"
110108
run: vendor/bin/phpunit --no-coverage

composer.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"minimum-stability": "dev",
66
"prefer-stable": true,
77
"require": {
8-
"php": "^7.4",
8+
"php": "^7.4 || ^8.0",
99
"ext-json": "*",
1010
"psr/http-message": "^1.0",
1111
"psr/http-factory": "^1.0"
@@ -29,5 +29,12 @@
2929
"psr-4": {
3030
"Polymorphine\\Message\\Tests\\": "tests/"
3131
}
32+
},
33+
"scripts": {
34+
"test-cs": [
35+
"vendor/bin/php-cs-fixer --dry-run -v --config=cs-fixer.php.dist --path-mode=intersection fix src tests",
36+
"vendor/bin/phpcs --extensions=php --standard=vendor/polymorphine/dev/phpcs.xml src",
37+
"vendor/bin/phpcs --extensions=php --standard=vendor/polymorphine/dev/phpcs.xml --ignore=*/CodeSamples/* tests"
38+
]
3239
}
3340
}

tests/StreamTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function testInstantiateWithStreamName()
4545

4646
public function testInstantiateWithStreamResource()
4747
{
48-
$this->assertInstanceOf(StreamInterface::class, (new Stream(fopen('php://input', 'r+b'))));
48+
$this->assertInstanceOf(StreamInterface::class, new Stream(fopen('php://input', 'r+b')));
4949
}
5050

5151
public function testNonResourceConstructorArgument_ThrowsException()

tests/UriTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,10 @@ public function testDefaultSchemePortLogic()
126126

127127
$uri = $this->uri('http:foo.bar:500');
128128
$this->assertNull($uri->getPort(), 'This is relative path with scheme - port not specified');
129-
$uri = $uri->withPort(443); //SET Port
129+
$uri = $uri->withPort(443);
130130
$this->assertSame(443, $uri->getPort(), 'No host was given but port was set with modifier');
131131
$this->assertNull($this->uri((string) $uri)->getPort(), 'Without host port will not be part of uri string even if specified');
132-
$uri = $uri->withHost('example.com'); //SET Host
132+
$uri = $uri->withHost('example.com');
133133
$this->assertSame(443, $this->uri((string) $uri)->getPort(), 'Port included in uri string when host became present');
134134
$this->assertNull($this->uri((string) $uri->withScheme('https'))->getPort(), 'Changed scheme match its default port - not present in uri string');
135135
}
@@ -154,8 +154,8 @@ public function testBasicSegmentsConcatenationLogic()
154154
$this->assertSame('?foo=bar&baz=qux#foo', (string) $uri->withScheme('')->withHost('')->withPath(''));
155155
$this->assertSame('#foo', (string) $uri->withScheme('')->withHost('')->withPath('')->withQuery(''));
156156

157-
//Invalid links, but valid URIs
158-
//Browsers would ignore 'http' scheme (but not https) and resolve these into valid relative links
157+
// Invalid links, but valid URIs
158+
// Browsers would ignore 'http' scheme (but not https) and resolve these into valid relative links
159159
$this->assertSame('https:/foo/bar?foo=bar&baz=qux#foo', (string) $uri->withUserInfo('')->withHost(''));
160160
$this->assertSame('https:/foo/bar?foo=bar&baz=qux#foo', (string) $uri->withHost(''));
161161
$this->assertSame('https:#foo', (string) $uri->withHost('')->withPath('')->withQuery(''));
@@ -316,7 +316,7 @@ public function testEncodedStringParametersAreNotDoubleEncoded()
316316
$this->assertSame('fo%C3%B3%20bar.baz', $uri->withHost('foó%20bar.baz')->getHost());
317317
$this->assertSame('%E2%9E%A1/foo%20bar', $uri->withPath('%E2%9E%A1/foo bar')->getPath());
318318
$this->assertSame('%E2%9E%A1=foo%20bar&%E4%BE%8B%E5%AD%90=%E6%B5%8B%E8%AF%95', $uri->withQuery('%E2%9E%A1=foo%20bar&%E4%BE%8B%E5%AD%90=测试')->getQuery());
319-
$this->assertSame('%D9%85%D8%AB%D8%A7%D9%84', $uri->withFragment('مثا%D9%84')->getFragment()); //Right-to-left-literals
319+
$this->assertSame('%D9%85%D8%AB%D8%A7%D9%84', $uri->withFragment('مثا%D9%84')->getFragment()); // Right-to-left-literals
320320
}
321321

322322
public function testEncodedNormalizedToUppercase()

0 commit comments

Comments
 (0)