Skip to content

Commit c11415a

Browse files
authored
Merge pull request #448 from php-http/support-cache-2.x
support cache plugin 2.x, bump to minimum 1.7 to always support psr17…
2 parents 22dae44 + 74064d1 commit c11415a

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

Diff for: composer.json

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
},
4444
"conflict": {
4545
"php-http/guzzle6-adapter": "<1.1",
46+
"php-http/cache-plugin": "<1.7.0",
4647
"php-http/curl-client": "<2.0",
4748
"php-http/socket-client": "<2.0"
4849
},

Diff for: src/DependencyInjection/Configuration.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
use Http\Client\Plugin\Vcr\Recorder\RecorderInterface;
1414
use Http\Message\CookieJar;
1515
use Http\Message\Formatter;
16-
use Http\Message\StreamFactory;
1716
use Psr\Cache\CacheItemPoolInterface;
17+
use Psr\Http\Message\StreamFactoryInterface;
1818
use Psr\Log\LoggerInterface;
1919
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
2020
use Symfony\Component\Config\Definition\Builder\NodeDefinition;
@@ -744,7 +744,7 @@ private function createCachePluginNode(): NodeDefinition
744744
// Cannot set both respect_cache_headers and respect_response_cache_directives
745745
return isset($config['respect_cache_headers'], $config['respect_response_cache_directives']);
746746
})
747-
->thenInvalid('You can\'t provide config option "respect_cache_headers" and "respect_response_cache_directives" simultaniously. Use "respect_response_cache_directives" instead.')
747+
->thenInvalid('You can\'t provide config option "respect_cache_headers" and "respect_response_cache_directives" simultaneously. Use "respect_response_cache_directives" instead.')
748748
->end()
749749
->children()
750750
->scalarNode('cache_key_generator')
@@ -856,8 +856,8 @@ private function createCachePluginNode(): NodeDefinition
856856
->cannotBeEmpty()
857857
->end()
858858
->scalarNode('stream_factory')
859-
->info('This must be a service id to a service implementing '.StreamFactory::class)
860-
->defaultValue('httplug.stream_factory')
859+
->info('This must be a service id to a service implementing '.StreamFactoryInterface::class)
860+
->defaultValue('httplug.psr17_stream_factory')
861861
->cannotBeEmpty()
862862
->end()
863863
->end()

Diff for: tests/Unit/DependencyInjection/ConfigurationTest.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class ConfigurationTest extends AbstractExtensionConfigurationTestCase
5959
'authentication' => [],
6060
'cache' => [
6161
'enabled' => false,
62-
'stream_factory' => 'httplug.stream_factory',
62+
'stream_factory' => 'httplug.psr17_stream_factory',
6363
'config' => [
6464
'methods' => ['GET', 'HEAD'],
6565
'blacklisted_paths' => [],
@@ -363,7 +363,7 @@ public function testInvalidCacheConfig(): void
363363
$file = __DIR__.'/../../Resources/Fixtures/config/invalid_cache_config.yml';
364364

365365
$this->expectException(InvalidConfigurationException::class);
366-
$this->expectExceptionMessage('Invalid configuration for path "httplug.plugins.cache.config": You can\'t provide config option "respect_cache_headers" and "respect_response_cache_directives" simultaniously. Use "respect_response_cache_directives" instead.');
366+
$this->expectExceptionMessage('Invalid configuration for path "httplug.plugins.cache.config": You can\'t provide config option "respect_cache_headers" and "respect_response_cache_directives" simultaneously. Use "respect_response_cache_directives" instead.');
367367
$this->assertProcessedConfigurationEquals([], [$file]);
368368
}
369369

@@ -492,7 +492,7 @@ public function testNullDefaultTtl(): void
492492
],
493493
'cache_pool' => 'my_custom_cache_pull',
494494
'enabled' => true,
495-
'stream_factory' => 'httplug.stream_factory',
495+
'stream_factory' => 'httplug.psr17_stream_factory',
496496
],
497497
],
498498
],

0 commit comments

Comments
 (0)