Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Lint

on:
push:
branches: [ master ]
pull_request:

jobs:
staticanalysis:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'

- name: Run Script
run: |
composer global require phpstan/phpstan
for dir in $(find * -type d -name src -not -path 'appengine/*' -not -path '*/vendor/*' -exec dirname {} \;);
do
composer install --working-dir=$dir --ignore-platform-reqs
echo "<?php require_once 'testing/sample_helpers.php';require_once '$dir/vendor/autoload.php';" > autoload.php
~/.composer/vendor/bin/phpstan analyse $dir/src --autoload-file=autoload.php
done
2 changes: 1 addition & 1 deletion asset/src/list_assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* @param string|array $assetTypes (Optional) Asset types to list for.
* @param int $pageSize (Optional) Size of one result page.
*/
function list_assets(string $projectId, array $assetTypes = [], int $pageSize)
function list_assets(string $projectId, array $assetTypes = [], int $pageSize = null)
{
// Instantiate a client.
$client = new AssetServiceClient();
Expand Down
1 change: 1 addition & 0 deletions bigtable/src/create_production_instance.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
use Google\Cloud\Bigtable\Admin\V2\Instance;
use Google\Cloud\Bigtable\Admin\V2\Cluster;
use Google\ApiCore\ApiException;
use Exception;

/**
* Create a production Bigtable instance
Expand Down
1 change: 1 addition & 0 deletions cloud_sql/mysql/pdo/src/DBInitializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
use PDO;
use PDOException;
use RuntimeException;
use TypeError;

class DBInitializer
{
Expand Down
1 change: 1 addition & 0 deletions cloud_sql/postgres/pdo/src/DBInitializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
use PDO;
use PDOException;
use RuntimeException;
use TypeError;

class DBInitializer
{
Expand Down
1 change: 1 addition & 0 deletions cloud_sql/sqlserver/pdo/src/DBInitializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
use PDO;
use PDOException;
use RuntimeException;
use TypeError;

class DBInitializer
{
Expand Down
2 changes: 1 addition & 1 deletion datastore/api/src/functions/concepts.php
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,7 @@ function transactional_retry(
for ($i = 0; $i < $retries; $i++) {
try {
transfer_funds($datastore, $fromKey, $toKey, 10);
} catch (Google\Cloud\Exception\ConflictException $e) {
} catch (\Google\Cloud\Core\Exception\ConflictException $e) {
// if $i >= $retries, the failure is final
continue;
}
Expand Down
2 changes: 0 additions & 2 deletions iap/src/make_iap_request.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@
*
* @param string $url The Identity-Aware Proxy-protected URL to fetch.
* @param string $clientId The client ID used by Identity-Aware Proxy.
*
* @return The response body.
*/
function make_iap_request($url, $clientId)
{
Expand Down
5 changes: 2 additions & 3 deletions logging/src/log_entry_functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

namespace Google\Cloud\Samples\Logging;

use Google\Cloud\Core\Iterator\ItemIterator;
// [START logging_write_log_entry]
// [START logging_list_log_entries]
// [START logging_delete_log]
Expand Down Expand Up @@ -52,11 +51,11 @@ function write_log($projectId, $loggerName, $message)
// [END logging_write_log_entry]

// [START logging_list_log_entries]
/** Return an iterator for listing log entries.
/**
* Print the timestamp and entry for the project and logger.
*
* @param string $projectId The Google project ID.
* @param string $loggerName The name of the logger.
* @return ItemIterator<Google\Cloud\Logging\Entry>
*/
function list_entries($projectId, $loggerName)
{
Expand Down
2 changes: 0 additions & 2 deletions logging/src/sink_functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

namespace Google\Cloud\Samples\Logging;

use Google\Cloud\Core\Iterator\ItemIterator;
// [START logging_use]
use Google\Cloud\Logging\LoggingClient;

Expand Down Expand Up @@ -62,7 +61,6 @@ function delete_sink($projectId, $sinkName)
* List log sinks.
*
* @param string $projectId
* @return ItemIterator<Google\Cloud\Logging\Sink>
*/
function list_sinks($projectId)
{
Expand Down
2 changes: 1 addition & 1 deletion monitoring/src/update_uptime_check.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function update_uptime_checks($projectId, $configName, $newDisplayName = null, $
'projectId' => $projectId,
]);

$uptimeCheck = $uptimeCheckClient->getUptimeCheckConfig($displayName);
$uptimeCheck = $uptimeCheckClient->getUptimeCheckConfig($configName);
$fieldMask = new FieldMask();
if ($newDisplayName) {
$fieldMask->getPaths()[] = 'display_name';
Expand Down