Skip to content

Commit db5e758

Browse files
Enable "native_constant_invocation" CS rule
1 parent 7e4a535 commit db5e758

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
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, $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/RetryTillSaveStore.php

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

Tests/Store/BlockingStoreTestTrait.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ public function testBlockingLocks()
5555
$parentPID = posix_getpid();
5656

5757
// Block SIGHUP signal
58-
pcntl_sigprocmask(SIG_BLOCK, [SIGHUP]);
58+
pcntl_sigprocmask(\SIG_BLOCK, [\SIGHUP]);
5959

6060
if ($childPID = pcntl_fork()) {
6161
// Wait the start of the child
62-
pcntl_sigwaitinfo([SIGHUP], $info);
62+
pcntl_sigwaitinfo([\SIGHUP], $info);
6363

6464
try {
6565
// This call should failed given the lock should already by acquired by the child
@@ -69,7 +69,7 @@ public function testBlockingLocks()
6969
}
7070

7171
// send the ready signal to the child
72-
posix_kill($childPID, SIGHUP);
72+
posix_kill($childPID, \SIGHUP);
7373

7474
// This call should be blocked by the child #1
7575
$store->waitAndSave($key);
@@ -81,14 +81,14 @@ public function testBlockingLocks()
8181
$this->assertSame(0, pcntl_wexitstatus($status1), 'The child process couldn\'t lock the resource');
8282
} else {
8383
// Block SIGHUP signal
84-
pcntl_sigprocmask(SIG_BLOCK, [SIGHUP]);
84+
pcntl_sigprocmask(\SIG_BLOCK, [\SIGHUP]);
8585
try {
8686
$store->save($key);
8787
// send the ready signal to the parent
88-
posix_kill($parentPID, SIGHUP);
88+
posix_kill($parentPID, \SIGHUP);
8989

9090
// Wait for the parent to be ready
91-
pcntl_sigwaitinfo([SIGHUP], $info);
91+
pcntl_sigwaitinfo([\SIGHUP], $info);
9292

9393
// Wait ClockDelay to let parent assert to finish
9494
usleep($clockDelay);

Tests/Store/SemaphoreStoreTest.php

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

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

5959
return \count(\array_slice($lines, ++$start));
6060
}
6161

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

7171
return (int) $value;

0 commit comments

Comments
 (0)