Skip to content

Commit 90cd5be

Browse files
Merge branch '4.4' into 5.1
* 4.4: Enable "native_constant_invocation" CS rule Make AbstractPhpFileCacheWarmer public
2 parents 178b8bd + 26ddd81 commit 90cd5be

File tree

6 files changed

+18
-18
lines changed

6 files changed

+18
-18
lines changed

Store/FlockStore.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ private function lock(Key $key, bool $blocking)
9595

9696
// On Windows, even if PHP doc says the contrary, LOCK_NB works, see
9797
// https://bugs.php.net/54129
98-
if (!flock($handle, LOCK_EX | ($blocking ? 0 : LOCK_NB))) {
98+
if (!flock($handle, \LOCK_EX | ($blocking ? 0 : \LOCK_NB))) {
9999
fclose($handle);
100100
throw new LockConflictedException();
101101
}
@@ -123,7 +123,7 @@ public function delete(Key $key)
123123

124124
$handle = $key->getState(__CLASS__);
125125

126-
flock($handle, LOCK_UN | LOCK_NB);
126+
flock($handle, \LOCK_UN | \LOCK_NB);
127127
fclose($handle);
128128

129129
$key->removeState(__CLASS__);

Store/MongoDbStore.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ public function save(Key $key)
217217
throw new LockAcquiringException('Failed to acquire lock.', 0, $e);
218218
}
219219

220-
if ($this->options['gcProbablity'] > 0.0 && (1.0 === $this->options['gcProbablity'] || (random_int(0, PHP_INT_MAX) / PHP_INT_MAX) <= $this->options['gcProbablity'])) {
220+
if ($this->options['gcProbablity'] > 0.0 && (1.0 === $this->options['gcProbablity'] || (random_int(0, \PHP_INT_MAX) / \PHP_INT_MAX) <= $this->options['gcProbablity'])) {
221221
$this->createTtlIndex();
222222
}
223223

Store/PdoStore.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ public function save(Key $key)
134134
$this->putOffExpiration($key, $this->initialTtl);
135135
}
136136

137-
if ($this->gcProbability > 0 && (1.0 === $this->gcProbability || (random_int(0, PHP_INT_MAX) / PHP_INT_MAX) <= $this->gcProbability)) {
137+
if ($this->gcProbability > 0 && (1.0 === $this->gcProbability || (random_int(0, \PHP_INT_MAX) / \PHP_INT_MAX) <= $this->gcProbability)) {
138138
$this->prune();
139139
}
140140

Store/RetryTillSaveStore.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class RetryTillSaveStore implements BlockingStoreInterface, LoggerAwareInterface
3737
* @param int $retrySleep Duration in ms between 2 retry
3838
* @param int $retryCount Maximum amount of retry
3939
*/
40-
public function __construct(PersistingStoreInterface $decorated, int $retrySleep = 100, int $retryCount = PHP_INT_MAX)
40+
public function __construct(PersistingStoreInterface $decorated, int $retrySleep = 100, int $retryCount = \PHP_INT_MAX)
4141
{
4242
$this->decorated = $decorated;
4343
$this->retrySleep = $retrySleep;

Tests/Store/BlockingStoreTestTrait.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ public function testBlockingLocks()
5050
$parentPID = posix_getpid();
5151

5252
// Block SIGHUP signal
53-
pcntl_sigprocmask(SIG_BLOCK, [SIGHUP]);
53+
pcntl_sigprocmask(\SIG_BLOCK, [\SIGHUP]);
5454

5555
if ($childPID = pcntl_fork()) {
5656
// Wait the start of the child
57-
pcntl_sigwaitinfo([SIGHUP], $info);
57+
pcntl_sigwaitinfo([\SIGHUP], $info);
5858

5959
$store = $this->getStore();
6060
try {
@@ -66,7 +66,7 @@ public function testBlockingLocks()
6666
}
6767

6868
// send the ready signal to the child
69-
posix_kill($childPID, SIGHUP);
69+
posix_kill($childPID, \SIGHUP);
7070

7171
// This call should be blocked by the child #1
7272
try {
@@ -82,23 +82,23 @@ public function testBlockingLocks()
8282
}
8383
} else {
8484
// Block SIGHUP signal
85-
pcntl_sigprocmask(SIG_BLOCK, [SIGHUP]);
85+
pcntl_sigprocmask(\SIG_BLOCK, [\SIGHUP]);
8686

8787
try {
8888
$store = $this->getStore();
8989
$store->save($key);
9090
// send the ready signal to the parent
91-
posix_kill($parentPID, SIGHUP);
91+
posix_kill($parentPID, \SIGHUP);
9292

9393
// Wait for the parent to be ready
94-
pcntl_sigwaitinfo([SIGHUP], $info);
94+
pcntl_sigwaitinfo([\SIGHUP], $info);
9595

9696
// Wait ClockDelay to let parent assert to finish
9797
usleep($clockDelay);
9898
$store->delete($key);
9999
exit(0);
100100
} catch (\Throwable $e) {
101-
posix_kill($parentPID, SIGHUP);
101+
posix_kill($parentPID, \SIGHUP);
102102
exit(1);
103103
}
104104
}

Tests/Store/SemaphoreStoreTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,22 +47,22 @@ public function testResourceRemoval()
4747

4848
private function getOpenedSemaphores()
4949
{
50-
if ('Darwin' === PHP_OS) {
51-
$lines = explode(PHP_EOL, trim(shell_exec('ipcs -s')));
50+
if ('Darwin' === \PHP_OS) {
51+
$lines = explode(\PHP_EOL, trim(shell_exec('ipcs -s')));
5252
if (-1 === $start = array_search('Semaphores:', $lines)) {
53-
throw new \Exception('Failed to extract list of opened semaphores. Expected a Semaphore list, got '.implode(PHP_EOL, $lines));
53+
throw new \Exception('Failed to extract list of opened semaphores. Expected a Semaphore list, got '.implode(\PHP_EOL, $lines));
5454
}
5555

5656
return \count(\array_slice($lines, ++$start));
5757
}
5858

59-
$lines = explode(PHP_EOL, trim(shell_exec('LC_ALL=C ipcs -su')));
59+
$lines = explode(\PHP_EOL, trim(shell_exec('LC_ALL=C ipcs -su')));
6060
if ('------ Semaphore Status --------' !== $lines[0]) {
61-
throw new \Exception('Failed to extract list of opened semaphores. Expected a Semaphore status, got '.implode(PHP_EOL, $lines));
61+
throw new \Exception('Failed to extract list of opened semaphores. Expected a Semaphore status, got '.implode(\PHP_EOL, $lines));
6262
}
6363
list($key, $value) = explode(' = ', $lines[1]);
6464
if ('used arrays' !== $key) {
65-
throw new \Exception('Failed to extract list of opened semaphores. Expected a "used arrays" key, got '.implode(PHP_EOL, $lines));
65+
throw new \Exception('Failed to extract list of opened semaphores. Expected a "used arrays" key, got '.implode(\PHP_EOL, $lines));
6666
}
6767

6868
return (int) $value;

0 commit comments

Comments
 (0)