Skip to content

Commit fb9043c

Browse files
committed
./vendor/bin/php-cs-fixer fix
1 parent 65a02f5 commit fb9043c

File tree

11 files changed

+34
-49
lines changed

11 files changed

+34
-49
lines changed

ci/src/CommandLine.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ class CommandLine
1414
*/
1515
protected function checkoutBranch($branch)
1616
{
17-
Travis::fold("start", "git.checkout.".get_called_class());
17+
Travis::fold('start', 'git.checkout.'.get_called_class());
1818
$this->call("git checkout $branch 2>&1");
1919
$this->call('git fetch origin main:main 2>&1');
20-
Travis::fold("end", "git.checkout.".get_called_class());
20+
Travis::fold('end', 'git.checkout.'.get_called_class());
2121
}
2222

2323
/**

ci/src/Travis.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88
class Travis
99
{
10-
const ANSI_CLEAR = "\033[0K";
10+
public const ANSI_CLEAR = "\033[0K";
1111

1212
protected static $timerID;
1313
protected static $timerStart;
@@ -19,7 +19,7 @@ public static function fold($action, $foldName)
1919

2020
public static function foldCall($foldName, $cmd, $includeTimer = true)
2121
{
22-
self::fold("start", $foldName);
22+
self::fold('start', $foldName);
2323

2424
if ($includeTimer) {
2525
self::timeStart();
@@ -31,7 +31,7 @@ public static function foldCall($foldName, $cmd, $includeTimer = true)
3131
self::timeFinish();
3232
}
3333

34-
self::fold("end", $foldName);
34+
self::fold('end', $foldName);
3535

3636
if ($retVal !== 0) {
3737
exit($retVal);
@@ -40,17 +40,17 @@ public static function foldCall($foldName, $cmd, $includeTimer = true)
4040

4141
public static function timeStart()
4242
{
43-
self::$timerID = sprintf("%08x", rand() * rand());
43+
self::$timerID = sprintf('%08x', rand() * rand());
4444
self::$timerStart = self::getNanosecondsTime();
45-
echo "travis_time:start:".self::$timerID."\r".self::ANSI_CLEAR;
45+
echo 'travis_time:start:'.self::$timerID."\r".self::ANSI_CLEAR;
4646
}
4747

4848
public static function timeFinish()
4949
{
5050
$start = self::$timerStart;
5151
$end = self::getNanosecondsTime();
5252
$duration = bcsub($end, $start);
53-
echo "travis_time:end:".self::$timerID.":start=$start,finish=$end,duration=$duration\r".self::ANSI_CLEAR;
53+
echo 'travis_time:end:'.self::$timerID.":start=$start,finish=$end,duration=$duration\r".self::ANSI_CLEAR;
5454
}
5555

5656
public static function getNanosecondsTime()

sample/SampleWorker.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* Sample BedrockWorkerManager worker class.
45
*/

src/Cache.php

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ class Cache extends Plugin
2626
public function read($name, $version = null)
2727
{
2828
$fullName = ($version ? "$name/$version" : "$name/*");
29-
$this->client->getLogger()->info("BedrockCache read", [
29+
$this->client->getLogger()->info('BedrockCache read', [
3030
'key' => $name,
3131
'version' => $version,
3232
]);
33-
$response = $this->call("ReadCache", ["name" => $fullName]);
33+
$response = $this->call('ReadCache', ['name' => $fullName]);
3434
if ($response['code'] === 404) {
3535
throw new NotFound('The cache entry could not be found', 666);
3636
}
@@ -41,10 +41,7 @@ public function read($name, $version = null)
4141
* Reads from the cache, but if it does not find the entry, it returns the passed default.
4242
*
4343
* @param string $name
44-
* @param mixed $default
4544
* @param string $version
46-
*
47-
* @return mixed
4845
*/
4946
public function readWithDefault($name, $default, $version = null)
5047
{
@@ -58,10 +55,6 @@ public function readWithDefault($name, $default, $version = null)
5855
/**
5956
* Gets data from a cache, if it is not present, it computes it by calling $computeFunction and saves the result in the cache.
6057
*
61-
* @param string $name
62-
* @param null|string $version
63-
* @param callable $computeFunction
64-
*
6558
* @return array
6659
*/
6760
public function get(string $name, ?string $version, callable $computeFunction)
@@ -96,14 +89,14 @@ public function write($name, $value, $version = null, array $headers = [])
9689
// If we have a version, invalidate previous versions
9790
if ($version) {
9891
// Invalidate all other versions of this name before setting
99-
$headers["invalidateName"] = "$name/*";
100-
$headers["name"] = "$name/$version";
92+
$headers['invalidateName'] = "$name/*";
93+
$headers['name'] = "$name/$version";
10194
} else {
10295
// Just set this name
103-
$headers["name"] = "$name/";
96+
$headers['name'] = "$name/";
10497
}
10598

106-
$this->call("WriteCache", $headers, json_encode($value));
99+
$this->call('WriteCache', $headers, json_encode($value));
107100
}
108101

109102
/**

src/DB.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ class DB extends Plugin
1717
*
1818
* @var int
1919
*/
20-
const CODE_OK = 200;
20+
public const CODE_OK = 200;
2121

2222
/**
2323
* Failed query response code.
2424
*
2525
* @var int
2626
*/
27-
const CODE_QUERY_FAILED = 502;
27+
public const CODE_QUERY_FAILED = 502;
2828

2929
/**
3030
* Executes a single SQL query.
@@ -52,7 +52,7 @@ public function query($sql): Response
5252
*/
5353
public function run(string $sql, bool $idempotent, int $timeout = 60000): Response
5454
{
55-
$sql = substr($sql, -1) === ";" ? $sql : $sql.";";
55+
$sql = substr($sql, -1) === ';' ? $sql : $sql.';';
5656
$matches = [];
5757
preg_match('/\s*(select|insert|delete|update).*/i', $sql, $matches);
5858
$operation = isset($matches[1]) && in_array(strtolower($matches[1]), ['insert', 'update', 'delete', 'select']) ? strtolower($matches[1]) : 'unknown';
@@ -61,15 +61,15 @@ public function run(string $sql, bool $idempotent, int $timeout = 60000): Respon
6161
'Query',
6262
[
6363
'query' => $sql,
64-
'format' => "json",
64+
'format' => 'json',
6565
'idempotent' => $idempotent,
6666
'timeout' => $timeout,
6767
]
6868
));
6969
});
7070

7171
if ($response->getCode() === self::CODE_QUERY_FAILED) {
72-
throw new BedrockError($response->getCodeLine()." - ".$response->getError(), $response->getCode());
72+
throw new BedrockError($response->getCodeLine().' - '.$response->getError(), $response->getCode());
7373
}
7474

7575
if ($response->getCode() !== self::CODE_OK) {

src/DB/Response.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*/
1111
class Response implements JsonSerializable, Countable
1212
{
13-
protected $container = null;
13+
protected $container;
1414

1515
public function __construct(array $leValue)
1616
{
@@ -47,9 +47,6 @@ public function jsonSerialize(): array
4747
* Shortcut method to access the value inside the container.
4848
*
4949
* @param string|array $index
50-
* @param mixed $default
51-
*
52-
* @return mixed
5350
*/
5451
protected function getFromContainer($index, $default = null)
5552
{
@@ -80,9 +77,6 @@ protected function getFromContainer($index, $default = null)
8077
* Shortcut function to set data inside the container.
8178
*
8279
* @param string|int|array $index
83-
* @param mixed $value
84-
*
85-
* @return mixed
8680
*/
8781
protected function setContainerValue($index, $value)
8882
{

src/Exceptions/BedrockError.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
class BedrockError extends Exception
88
{
9-
public function __construct($message, $code = 666, Exception $previous = null)
9+
public function __construct($message, $code = 666, ?Exception $previous = null)
1010
{
1111
parent::__construct($message, $code, $previous);
1212
}

src/Exceptions/Jobs/RetryableException.php

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,15 @@ class RetryableException extends BedrockError
3434
/**
3535
* RetryableException constructor.
3636
*
37-
* @param string $message Message of the exception
38-
* @param int $delay Time to delay the retry (in seconds; maximum value is currently 999)
39-
* @param ?int $code Code of the exception
40-
* @param ?Exception $previous
41-
* @param string $name New name for the job
42-
* @param string $nextRun When to retry the job (takes precedence over delay; expects format Y-m-d H:i:s)
43-
* @param bool $ignoreRepeat When calculating when to retry the job, should we ignore the repeat parameter and
44-
* use $delay or $nextRun instead
37+
* @param string $message Message of the exception
38+
* @param int $delay Time to delay the retry (in seconds; maximum value is currently 999)
39+
* @param ?int $code Code of the exception
40+
* @param string $name New name for the job
41+
* @param string $nextRun When to retry the job (takes precedence over delay; expects format Y-m-d H:i:s)
42+
* @param bool $ignoreRepeat When calculating when to retry the job, should we ignore the repeat parameter and
43+
* use $delay or $nextRun instead
4544
*/
46-
public function __construct(string $message, int $delay = 0, int $code = null, Exception $previous = null, string $name = '', string $nextRun = '', bool $ignoreRepeat = false)
45+
public function __construct(string $message, int $delay = 0, ?int $code = null, ?Exception $previous = null, string $name = '', string $nextRun = '', bool $ignoreRepeat = false)
4746
{
4847
$code = $code ?? 666;
4948
$this->delay = $delay;

src/Jobs.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,13 @@ class Jobs extends Plugin
122122
* @param array $headers Headers to send
123123
* @param string $body Body of the request
124124
*
125+
* @return array
126+
*
125127
* @throws DoesNotExist
126128
* @throws IllegalAction
127129
* @throws MalformedAttribute
128130
* @throws SqlFailed
129131
* @throws GenericError
130-
*
131-
* @return array
132132
*/
133133
public function call($method, $headers = [], $body = '')
134134
{
@@ -390,7 +390,7 @@ public function failJob($jobID)
390390
/**
391391
* Retry a job. Job must be in a RUNNING state to be able to be retried.
392392
*/
393-
public function retryJob(int $jobID, int $delay = 0, array $data = null, string $name = '', string $nextRun = '', ?int $priority = null, bool $ignoreRepeat = false): array
393+
public function retryJob(int $jobID, int $delay = 0, ?array $data = null, string $name = '', string $nextRun = '', ?int $priority = null, bool $ignoreRepeat = false): array
394394
{
395395
return $this->call(
396396
'RetryJob',

src/Plugin.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ class Plugin
1616

1717
/**
1818
* Constructor.
19-
*
20-
* @param Client $client
2119
*/
2220
public function __construct(Client $client)
2321
{

0 commit comments

Comments
 (0)