Skip to content

Commit a221a29

Browse files
authored
chore: add cs check for return-type declaration (GoogleCloudPlatform#1202)
1 parent 3133564 commit a221a29

File tree

17 files changed

+30
-27
lines changed

17 files changed

+30
-27
lines changed

.php_cs.dist

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ return PhpCsFixer\Config::create()
1010
'method_argument_space' => [
1111
'keep_multiple_spaces_after_comma' => true
1212
],
13+
'return_type_declaration' => [
14+
'space_before' => 'none'
15+
],
1316
])
1417
->setFinder(
1518
PhpCsFixer\Finder::create()

appengine/php72/getting-started/test/CloudSqlTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class CloudSqlTest extends TestCase
2525
{
2626
use TestTrait;
2727

28-
public function setUp() : void
28+
public function setUp(): void
2929
{
3030
$connection = $this->requireEnv('CLOUDSQL_CONNECTION_NAME');
3131
$dbUser = $this->requireEnv('CLOUDSQL_USER');

cloud_sql/mysql/pdo/src/Votes.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function createTableIfNotExists()
6868
*
6969
* @return array
7070
*/
71-
public function listVotes() : array
71+
public function listVotes(): array
7272
{
7373
$sql = "SELECT vote_value, time_cast FROM votes ORDER BY time_cast DESC LIMIT 5";
7474
$statement = $this->connection->prepare($sql);
@@ -82,7 +82,7 @@ public function listVotes() : array
8282
* @param string $value
8383
* @param int
8484
*/
85-
public function getCountByValue(string $value) : int
85+
public function getCountByValue(string $value): int
8686
{
8787
$sql = "SELECT COUNT(vote_id) as voteCount FROM votes WHERE vote_value = ?";
8888

@@ -98,7 +98,7 @@ public function getCountByValue(string $value) : int
9898
* @param string $value The value to vote for.
9999
* @return boolean
100100
*/
101-
public function insertVote(string $value) : bool
101+
public function insertVote(string $value): bool
102102
{
103103
$conn = $this->connection;
104104
$res = false;

cloud_sql/mysql/pdo/src/app.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
/**
5555
* @param $conn_config array driver-specific options for PDO
5656
*/
57-
function init_tcp_database_connection(array $conn_config) : PDO
57+
function init_tcp_database_connection(array $conn_config): PDO
5858
{
5959
$username = getenv('DB_USER');
6060
$password = getenv('DB_PASS');
@@ -107,7 +107,7 @@ function init_tcp_database_connection(array $conn_config) : PDO
107107
/**
108108
* @param $conn_config array driver-specific options for PDO
109109
*/
110-
function init_unix_database_connection(array $conn_config) : PDO
110+
function init_unix_database_connection(array $conn_config): PDO
111111
{
112112
$username = getenv('DB_USER');
113113
$password = getenv('DB_PASS');

cloud_sql/mysql/pdo/tests/VotesTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class VotesTest extends TestCase
2929
{
3030
private $conn;
3131

32-
public function setUp() : void
32+
public function setUp(): void
3333
{
3434
$this->conn = $this->prophesize(PDO::class);
3535
}

cloud_sql/postgres/pdo/src/Votes.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function createTableIfNotExists()
6868
*
6969
* @return array
7070
*/
71-
public function listVotes() : array
71+
public function listVotes(): array
7272
{
7373
$sql = "SELECT vote_value, time_cast FROM votes ORDER BY time_cast DESC LIMIT 5";
7474
$statement = $this->connection->prepare($sql);
@@ -82,7 +82,7 @@ public function listVotes() : array
8282
* @param string $value
8383
* @param int
8484
*/
85-
public function getCountByValue(string $value) : int
85+
public function getCountByValue(string $value): int
8686
{
8787
$sql = "SELECT COUNT(vote_id) as voteCount FROM votes WHERE vote_value = ?";
8888

@@ -98,7 +98,7 @@ public function getCountByValue(string $value) : int
9898
* @param string $value The value to vote for.
9999
* @return boolean
100100
*/
101-
public function insertVote(string $value) : bool
101+
public function insertVote(string $value): bool
102102
{
103103
$conn = $this->connection;
104104
$res = false;

cloud_sql/postgres/pdo/src/app.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
/**
5555
* @param $conn_config array driver-specific options for PDO
5656
*/
57-
function init_tcp_database_connection(array $conn_config) : PDO
57+
function init_tcp_database_connection(array $conn_config): PDO
5858
{
5959
$username = getenv('DB_USER');
6060
$password = getenv('DB_PASS');

cloud_sql/postgres/pdo/tests/VotesTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class VotesTest extends TestCase
2929
{
3030
private $conn;
3131

32-
public function setUp() : void
32+
public function setUp(): void
3333
{
3434
$this->conn = $this->prophesize(PDO::class);
3535
}

cloud_sql/sqlserver/pdo/src/Votes.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public function createTableIfNotExists()
7474
*
7575
* @return array
7676
*/
77-
public function listVotes() : array
77+
public function listVotes(): array
7878
{
7979
$sql = "SELECT TOP 5 vote_value, time_cast FROM votes ORDER BY time_cast DESC";
8080
$statement = $this->connection->prepare($sql);
@@ -88,7 +88,7 @@ public function listVotes() : array
8888
* @param string $value
8989
* @param int
9090
*/
91-
public function getCountByValue(string $value) : int
91+
public function getCountByValue(string $value): int
9292
{
9393
$sql = "SELECT COUNT(vote_id) as voteCount FROM votes WHERE vote_value = ?";
9494

@@ -104,7 +104,7 @@ public function getCountByValue(string $value) : int
104104
* @param string $value The value to vote for.
105105
* @return boolean
106106
*/
107-
public function insertVote(string $value) : bool
107+
public function insertVote(string $value): bool
108108
{
109109
$conn = $this->connection;
110110
$res = false;

cloud_sql/sqlserver/pdo/tests/VotesTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class VotesTest extends TestCase
2929
{
3030
private $conn;
3131

32-
public function setUp() : void
32+
public function setUp(): void
3333
{
3434
$this->conn = $this->prophesize(PDO::class);
3535
}

0 commit comments

Comments
 (0)