Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 13f0062

Browse filesBrowse files
committed
Especape namespace usage on function calls consistently
1 parent 728c6dc commit 13f0062
Copy full SHA for 13f0062

File tree

3 files changed

+20
-20
lines changed
Filter options

3 files changed

+20
-20
lines changed

‎src/Symfony/Component/Cache/Adapter/AbstractTagAwareAdapter.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Cache/Adapter/AbstractTagAwareAdapter.php
+6-6Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ static function ($key, $value, $isHit) use ($defaultLifetime) {
5050
$item->defaultLifetime = $defaultLifetime;
5151
//<diff:AbstractAdapter> extract Value and Tags from the cache value
5252
$item->isTaggable = true;
53-
$item->value = $v = $value['value'];
53+
$item->value = $value['value'];
5454
$item->metadata[CacheItem::METADATA_TAGS] = $value['tags'] ?? [];
5555
// Detect wrapped values that encode for their expiry and creation duration
5656
// For compactness, these values are packed
@@ -92,16 +92,16 @@ static function ($deferred, &$expiredIds) use ($getId, $tagPrefix) {
9292

9393
if ($metadata) {
9494
// For compactness, expiry and creation duration are packed, using magic numbers as separators
95-
$value['meta'] = pack('VN', (int) $metadata[CacheItem::METADATA_EXPIRY] - CacheItem::METADATA_EXPIRY_OFFSET, $metadata[CacheItem::METADATA_CTIME]);
95+
$value['meta'] = \pack('VN', (int) $metadata[CacheItem::METADATA_EXPIRY] - CacheItem::METADATA_EXPIRY_OFFSET, $metadata[CacheItem::METADATA_CTIME]);
9696
}
9797

9898
// Extract tag changes, these should be removed from values in doSave()
9999
$value['tag-operations'] = ['add' => [], 'remove' => []];
100100
$oldTags = $item->metadata[CacheItem::METADATA_TAGS] ?? [];
101-
foreach (array_diff($value['tags'], $oldTags) as $addedTag) {
101+
foreach (\array_diff($value['tags'], $oldTags) as $addedTag) {
102102
$value['tag-operations']['add'][] = $getId($tagPrefix.$addedTag);
103103
}
104-
foreach (array_diff($oldTags, $value['tags']) as $removedTag) {
104+
foreach (\array_diff($oldTags, $value['tags']) as $removedTag) {
105105
$value['tag-operations']['remove'][] = $getId($tagPrefix.$removedTag);
106106
}
107107

@@ -231,7 +231,7 @@ public function deleteItems(array $keys)
231231
}
232232

233233
try {
234-
if ($this->doDelete(array_values($ids), $tagData)) {
234+
if ($this->doDelete(\array_values($ids), $tagData)) {
235235
return true;
236236
}
237237
} catch (\Exception $e) {
@@ -265,7 +265,7 @@ public function invalidateTags(array $tags)
265265
}
266266

267267
$tagIds = [];
268-
foreach (array_unique($tags) as $tag) {
268+
foreach (\array_unique($tags) as $tag) {
269269
$tagIds[] = $this->getId(TagAwareAdapter::TAGS_PREFIX.$tag);
270270
}
271271

‎src/Symfony/Component/Cache/Adapter/FilesystemTagAwareAdapter.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Cache/Adapter/FilesystemTagAwareAdapter.php
+10-10Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -113,17 +113,17 @@ protected function doInvalidate(array $tagIds): bool
113113
{
114114
foreach ($tagIds as $tagId) {
115115
$tagsFolder = $this->getTagFolder($tagId);
116-
if (!is_dir($tagsFolder)) {
116+
if (!\is_dir($tagsFolder)) {
117117
continue;
118118
}
119119

120120
foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($tagsFolder, \FilesystemIterator::SKIP_DOTS)) as $itemLink) {
121121
if (!$itemLink->isLink()) {
122-
throw new LogicException('Tag link is not a link, however in cache tag folder it was expected to be: '.$itemLink);
122+
throw new LogicException('Expected a (sym)link when iterating over tag folder, non link found: '.$itemLink);
123123
}
124124

125125
$valueFile = $itemLink->getRealPath();
126-
if ($valueFile && file_exists($valueFile)) {
126+
if ($valueFile && \file_exists($valueFile)) {
127127
@unlink($valueFile);
128128
}
129129

@@ -142,23 +142,23 @@ private function getFilesystem(): Filesystem
142142
private function getTagFolder(string $tagId): string
143143
{
144144
// Use MD5 to favor speed over security, which is not an issue here
145-
$hash = str_replace('/', '-', \base64_encode(\hash('md5', static::class.$tagId, true)));
146-
$dir = $this->directory.self::TAG_FOLDER.\DIRECTORY_SEPARATOR.strtoupper($hash[0].\DIRECTORY_SEPARATOR.$hash[1].\DIRECTORY_SEPARATOR);
145+
$hash = \str_replace('/', '-', \base64_encode(\hash('md5', static::class.$tagId, true)));
146+
$dir = $this->directory.self::TAG_FOLDER.\DIRECTORY_SEPARATOR.\strtoupper($hash[0].\DIRECTORY_SEPARATOR.$hash[1].\DIRECTORY_SEPARATOR);
147147

148-
return $dir.substr($hash, 2, 20).\DIRECTORY_SEPARATOR;
148+
return $dir.\substr($hash, 2, 20).\DIRECTORY_SEPARATOR;
149149
}
150150

151151
private function getTagLink(string $tagId, string $id, bool $mkdir = false)
152152
{
153153
$tagFolder = $this->getTagFolder($tagId);
154154
// Use MD5 to favor speed over security, which is not an issue here
155-
$hash = str_replace('/', '-', base64_encode(hash('md5', static::class.$id, true)));
156-
$dir = $tagFolder.strtoupper($hash[0].\DIRECTORY_SEPARATOR.$hash[1].\DIRECTORY_SEPARATOR);
155+
$hash = \str_replace('/', '-', \base64_encode(\hash('md5', static::class.$id, true)));
156+
$dir = $tagFolder.\strtoupper($hash[0].\DIRECTORY_SEPARATOR.$hash[1].\DIRECTORY_SEPARATOR);
157157

158-
if ($mkdir && !file_exists($dir)) {
158+
if ($mkdir && !\file_exists($dir)) {
159159
@mkdir($dir, 0777, true);
160160
}
161161

162-
return $dir.substr($hash, 2, 20);
162+
return $dir.\substr($hash, 2, 20);
163163
}
164164
}

‎src/Symfony/Component/Cache/Adapter/RedisTagAwareAdapter.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Cache/Adapter/RedisTagAwareAdapter.php
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public function __construct($redisClient, string $namespace = '', int $defaultLi
7373
$this->init($redisClient, $namespace, $defaultLifetime, $marshaller);
7474

7575
// Make sure php-redis is 3.1.3 or higher configured for Redis classes
76-
if (!$this->redis instanceof Predis\Client && version_compare(phpversion('redis'), '3.1.3', '<')) {
76+
if (!$this->redis instanceof Predis\Client && \version_compare(\phpversion('redis'), '3.1.3', '<')) {
7777
throw new LogicException('RedisTagAwareAdapter requires php-redis 3.1.3 or higher, alternatively use predis/predis');
7878
}
7979
}
@@ -111,7 +111,7 @@ protected function doSave(array $values, ?int $lifetime, array $addTagData = [],
111111

112112
foreach ($results as $id => $result) {
113113
// Skip results of SADD/SREM operations, they'll be 1 or 0 depending on if set value already existed or not
114-
if (is_numeric($result)) {
114+
if (\is_numeric($result)) {
115115
continue;
116116
}
117117
// setEx results
@@ -143,7 +143,7 @@ protected function doDelete(array $ids, array $tagData = []): bool
143143
}
144144

145145
foreach ($tagData as $tagId => $idList) {
146-
yield 'sRem' => array_merge([$tagId], $idList);
146+
yield 'sRem' => \array_merge([$tagId], $idList);
147147
}
148148
})->rewind();
149149

@@ -165,7 +165,7 @@ protected function doInvalidate(array $tagIds): bool
165165
});
166166

167167
// Flatten generator result from pipeline, ignore keys (tag ids)
168-
$ids = array_unique(array_merge(...iterator_to_array($tagIdSets, false)));
168+
$ids = \array_unique(\array_merge(...\iterator_to_array($tagIdSets, false)));
169169

170170
// Delete cache in chunks to avoid overloading the connection
171171
foreach (\array_chunk($ids, self::BULK_DELETE_LIMIT) as $chunkIds) {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.