Skip to content

Commit e372c44

Browse files
Merge pull request #19 from netlogix/feature/flow-8
feat: Require Flow 8.3
2 parents b8991d3 + 9501a56 commit e372c44

15 files changed

Lines changed: 92 additions & 67 deletions

.github/workflows/functionaltests.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,10 @@ jobs:
1010
strategy:
1111
fail-fast: false
1212
matrix:
13-
php-version: [ 7.4 ]
14-
flow-version: [ 5.3 ]
13+
php-version: [ 8.1, 8.2 ]
14+
flow-version: [ 8.3 ]
1515
mysql-version: [5.7]
1616

17-
exclude: []
18-
1917
env:
2018
APP_ENV: true
2119
FLOW_CONTEXT: Testing/Functional

.github/workflows/unittests.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,8 @@ jobs:
1010
strategy:
1111
fail-fast: false
1212
matrix:
13-
php-version: [ 7.4 ]
14-
flow-version: [ 5.3 ]
15-
16-
exclude: []
13+
php-version: [ 8.1, 8.2 ]
14+
flow-version: [ 8.3 ]
1715

1816
env:
1917
FLOW_CONTEXT: Testing/Unit

Classes/Domain/Model/ResourceProxy.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
* source code.
1111
*/
1212

13+
use GuzzleHttp\Psr7\Uri;
1314
use Neos\Flow\Annotations as Flow;
14-
use Neos\Flow\Http\Uri;
1515
use Netlogix\JsonApiOrg\Consumer\Service\ConsumerBackendInterface;
1616

1717
class ResourceProxy implements \ArrayAccess

Classes/Domain/Model/ResourceProxyIterator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
use Neos\Cache\Frontend\VariableFrontend;
77
use Neos\Flow\Cache\CacheManager;
8-
use Neos\Flow\Http\Uri;
98
use Neos\Flow\Utility\Now;
9+
use Psr\Http\Message\UriInterface;
1010

1111
class ResourceProxyIterator implements \IteratorAggregate, \Countable
1212
{
@@ -45,7 +45,7 @@ protected function __construct(string $uri = '')
4545
$this->uri = $uri;
4646
}
4747

48-
public static function fromUri(Uri $uri): self
48+
public static function fromUri(UriInterface $uri): self
4949
{
5050
return new static((string)$uri);
5151
}

Classes/Domain/Model/Type.php

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
*/
1212

1313
use Neos\Flow\Annotations as Flow;
14-
use Neos\Flow\Http\Uri;
1514
use Neos\Flow\ObjectManagement\ObjectManagerInterface;
15+
use Psr\Http\Message\UriInterface;
1616

1717
class Type
1818
{
@@ -57,7 +57,7 @@ class Type
5757
protected $properties = [];
5858

5959
/**
60-
* @var Uri
60+
* @var UriInterface
6161
*/
6262
protected $uri;
6363

@@ -76,14 +76,14 @@ class Type
7676
* @param string $typeName
7777
* @param string $resourceClassName
7878
* @param array $properties
79-
* @param Uri $uri
79+
* @param UriInterface $uri
8080
* @param array $defaultIncludes
8181
*/
8282
public function __construct(
8383
$typeName,
8484
$resourceClassName = ResourceProxy::class,
8585
array $properties = [],
86-
Uri $uri = null,
86+
UriInterface $uri = null,
8787
array $defaultIncludes = []
8888
) {
8989
$this->typeName = (string)$typeName;
@@ -95,19 +95,12 @@ public function __construct(
9595
$this->defaultIncludes = $defaultIncludes;
9696
}
9797

98-
/**
99-
* @return Uri
100-
*/
101-
public function getUri()
98+
public function getUri(): UriInterface
10299
{
103100
return $this->uri;
104101
}
105102

106-
/**
107-
* @param Uri $uri
108-
* @return void
109-
*/
110-
public function setUri(Uri $uri)
103+
public function setUri(UriInterface $uri): void
111104
{
112105
$this->uri = $uri;
113106
}

Classes/Guzzle/Middleware/EndpointCacheMiddleware.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function __invoke(callable $handler)
3131
return $handler($request, $options);
3232
}
3333

34-
$requestPath = $request->getUri()->getPath() ?? '';
34+
$requestPath = $request->getUri()->getPath() ?: '';
3535
if (!self::str_ends_with(rtrim($requestPath, '/'), '/.well-known/endpoint-discovery')) {
3636
return $handler($request, $options);
3737
}

Classes/Service/ConsumerBackend.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,18 @@
1111
*/
1212

1313
use GuzzleHttp\Client;
14+
use GuzzleHttp\Psr7\Uri;
1415
use Neos\Cache\Exception\InvalidDataException;
1516
use Neos\Cache\Frontend\StringFrontend;
1617
use Neos\Flow\Annotations as Flow;
1718
use Neos\Flow\Http\Helper\UriHelper;
18-
use Neos\Flow\Http\Uri;
1919
use Netlogix\JsonApiOrg\Consumer\Domain\Model\Arguments\PageInterface;
2020
use Netlogix\JsonApiOrg\Consumer\Domain\Model\Arguments\SortInterface;
2121
use Netlogix\JsonApiOrg\Consumer\Domain\Model\ResourceProxy;
2222
use Netlogix\JsonApiOrg\Consumer\Domain\Model\ResourceProxyIterator;
2323
use Netlogix\JsonApiOrg\Consumer\Domain\Model\Type;
2424
use Netlogix\JsonApiOrg\Consumer\Guzzle\ClientProvider;
25+
use Psr\Http\Message\UriInterface;
2526

2627
/**
2728
* @Flow\Scope("singleton")
@@ -83,11 +84,11 @@ public function getType($typeName)
8384
}
8485

8586
/**
86-
* @param Uri $endpointDiscovery
87+
* @param UriInterface $endpointDiscovery
8788
* @throws InvalidDataException
8889
* @throws \Neos\Cache\Exception
8990
*/
90-
public function registerEndpointsByEndpointDiscovery(Uri $endpointDiscovery)
91+
public function registerEndpointsByEndpointDiscovery(UriInterface $endpointDiscovery)
9192
{
9293
$result = $this->requestJson($endpointDiscovery);
9394
foreach ($result['links'] as $link) {
@@ -180,12 +181,12 @@ public function getQueryUriForFindByTypeAndFilter(
180181
}
181182

182183
/**
183-
* @param Uri $queryUri
184+
* @param UriInterface $queryUri
184185
* @return ResourceProxyIterator
185186
* @throws InvalidDataException
186187
* @throws \Neos\Cache\Exception
187188
*/
188-
public function fetchFromUri(Uri $queryUri)
189+
public function fetchFromUri(UriInterface $queryUri)
189190
{
190191
$resourceProxy = ResourceProxyIterator::fromUri($queryUri);
191192
$resourceProxy = $resourceProxy->loadFromCache();

Classes/Service/ConsumerBackendInterface.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010
* source code.
1111
*/
1212

13-
use Neos\Flow\Http\Uri;
1413
use Netlogix\JsonApiOrg\Consumer\Domain\Model\Arguments\PageInterface;
1514
use Netlogix\JsonApiOrg\Consumer\Domain\Model\Arguments\SortInterface;
1615
use Netlogix\JsonApiOrg\Consumer\Domain\Model\ResourceProxy;
1716
use Netlogix\JsonApiOrg\Consumer\Domain\Model\ResourceProxyIterator;
1817
use Netlogix\JsonApiOrg\Consumer\Domain\Model\Type;
18+
use Psr\Http\Message\UriInterface;
1919

2020
interface ConsumerBackendInterface
2121
{
@@ -31,9 +31,9 @@ public function addType(Type $type);
3131
public function getType($typeName);
3232

3333
/**
34-
* @param Uri $endpointDiscovery
34+
* @param UriInterface $endpointDiscovery
3535
*/
36-
public function registerEndpointsByEndpointDiscovery(Uri $endpointDiscovery);
36+
public function registerEndpointsByEndpointDiscovery(UriInterface $endpointDiscovery);
3737

3838
/**
3939
* @param string $type
@@ -46,10 +46,10 @@ public function registerEndpointsByEndpointDiscovery(Uri $endpointDiscovery);
4646
public function findByTypeAndFilter($type, $filter = [], $include = [], PageInterface $page = null, SortInterface $sort = null);
4747

4848
/**
49-
* @param Uri $queryUri
49+
* @param UriInterface $queryUri
5050
* @return ResourceProxyIterator
5151
*/
52-
public function fetchFromUri(Uri $queryUri);
52+
public function fetchFromUri(UriInterface $queryUri);
5353

5454
/**
5555
* @param mixed $type
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Netlogix\JsonApiOrg\Consumer\Tests\Common\Guzzle;
6+
7+
class NoResponseQueued extends \RuntimeException
8+
{
9+
}

Tests/Common/Guzzle/TestingClientProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function createClient(): Client
5757
}
5858

5959
if (strpos($uri, 'resource://') === 0
60-
|| strpos($uri, 'data://') === 0) {
60+
|| strpos($uri, 'data:') === 0) {
6161
$uri = (string) $requestUri
6262
->withQuery('')
6363
->withFragment('');
@@ -72,7 +72,7 @@ public function createClient(): Client
7272
);
7373
}
7474

75-
throw new \RuntimeException(sprintf('No Response queued for URI "%s"', $uri), 1624304664);
75+
throw new NoResponseQueued(sprintf('No Response queued for URI "%s"', $uri), 1624304664);
7676
};
7777

7878
$handlerStack = HandlerStack::create($requestHandler);

0 commit comments

Comments
 (0)