Skip to content

Commit 220a4b5

Browse files
committed
prefer array_key_exists over isset for more robust code
1 parent 757753a commit 220a4b5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/CachePlugin.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public function __construct(CacheItemPoolInterface $pool, $streamFactory, array
7878
$this->pool = $pool;
7979
$this->streamFactory = $streamFactory;
8080

81-
if (isset($config['respect_cache_headers']) && isset($config['respect_response_cache_directives'])) {
81+
if (\array_key_exists('respect_cache_headers', $config) && \array_key_exists('respect_response_cache_directives', $config)) {
8282
throw new \InvalidArgumentException('You can\'t provide config option "respect_cache_headers" and "respect_response_cache_directives". Use "respect_response_cache_directives" instead.');
8383
}
8484

@@ -103,7 +103,7 @@ public function __construct(CacheItemPoolInterface $pool, $streamFactory, array
103103
public static function clientCache(CacheItemPoolInterface $pool, $streamFactory, array $config = [])
104104
{
105105
// Allow caching of private requests
106-
if (isset($config['respect_response_cache_directives'])) {
106+
if (\array_key_exists('respect_response_cache_directives', $config)) {
107107
$config['respect_response_cache_directives'][] = 'no-cache';
108108
$config['respect_response_cache_directives'][] = 'max-age';
109109
$config['respect_response_cache_directives'] = array_unique($config['respect_response_cache_directives']);

0 commit comments

Comments
 (0)