Skip to content

Commit

Permalink
support guzzle psr7 version 2
Browse files Browse the repository at this point in the history
  • Loading branch information
dbu committed May 24, 2021
1 parent fb0dbce commit 9b8d8f7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [1.11.1] - 2021-05-24

- Support GuzzleHttp/Psr7 version 2.0 in the (deprecated) GuzzleUriFactory.

## [1.11.0] - 2020-02-01

- Migrated from `zendframework/zend-diactoros` to `laminas/laminas-diactoros`.
Expand Down
9 changes: 7 additions & 2 deletions src/UriFactory/GuzzleUriFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

namespace Http\Message\UriFactory;

use GuzzleHttp\Psr7;
use function GuzzleHttp\Psr7\uri_for;
use GuzzleHttp\Psr7\Utils;
use Http\Message\UriFactory;

/**
Expand All @@ -19,6 +20,10 @@ final class GuzzleUriFactory implements UriFactory
*/
public function createUri($uri)
{
return Psr7\uri_for($uri);
if (class_exists(Utils::class)) {
return Utils::uriFor($uri);
}

return uri_for($uri);
}
}

0 comments on commit 9b8d8f7

Please sign in to comment.