Skip to content

Commit

Permalink
Add support for psr/http-message 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
MAXakaWIZARD committed Dec 19, 2023
1 parent 6a18779 commit e07aa89
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 3 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/ci.yml
Expand Up @@ -29,6 +29,7 @@ jobs:
- php: '7.1'
- php: '7.2'
- php: '7.3'
deps: low
- php: '7.4'
coverage: yes
- php: '8.0'
Expand Down Expand Up @@ -61,9 +62,15 @@ jobs:
mkdir -p build/logs
- name: Install dependencies
if: "matrix.deps != 'low'"
run: |
composer install -o -q --no-suggest
- name: Install dependencies (low)
if: "matrix.deps == 'low'"
run: |
composer install -o -q --no-suggest --prefer-lowest
- name: Run phpcs and phpunit
if: "matrix.coverage != 'yes'"
run: |
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -3,3 +3,5 @@ composer.lock
*.phar
build
phpunit.xml
.phpunit.result.cache
tests/data/_*
4 changes: 4 additions & 0 deletions CHANGELOG.md
@@ -1,6 +1,10 @@
CHANGELOG
=========

## 1.10.0 (2023-12-19)
* Add test runs for PHP 8.3
* Add support for psr/http-message 2.0

## 1.9.1 (2023-07-07)
* Add test runs for PHP 8.2

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -15,7 +15,7 @@
"php": ">=7.1",

"salsify/json-streaming-parser": "^8.0.2",
"psr/http-message": "~1.0"
"psr/http-message": "~1.0|~2.0"
},
"require-dev": {
"phpunit/phpunit": ">6 <10",
Expand Down
10 changes: 8 additions & 2 deletions tests/DataStreamTest.php
Expand Up @@ -11,6 +11,7 @@
use ReflectionClass;
use ReflectionException;
use ReflectionMethod;
use ReflectionNamedType;
use stdClass;

class DataStreamTest extends TestCase
Expand Down Expand Up @@ -68,6 +69,12 @@ public function testFailsToParseInvalidResource()
*/
public function testFailsToParseObjectTypeWithInvalidStreamInterface()
{
$class = new ReflectionClass(MessageInterface::class);
$method = $class->getMethod('getBody');
if ($method->getReturnType() instanceof ReflectionNamedType) {
$this->markTestSkipped('psr/message 2.0 has strictly typed getBody method');
}

$objectMethod = self::getProtectedMethod('object');
$dataStream = new DataStream();

Expand All @@ -91,7 +98,6 @@ public function testFailsToParseObjectTypeWithInvalidStreamInterface()
*/
public function testFailsToParseUnreadableStreamType()
{

$objectMethod = self::getProtectedMethod('streamWrapper');
$dataStream = new DataStream();

Expand Down Expand Up @@ -139,7 +145,7 @@ public function testCantParseInvalidStream()
{
$this->expectException(StreamException::class);

$resource = DataStream::get(new stdClass());
DataStream::get(new stdClass());
}

public function testCanCloseStream()
Expand Down

0 comments on commit e07aa89

Please sign in to comment.