diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 7e9b516115..2d4e12f10e 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -17,10 +17,5 @@ jobs: - 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 " autoload.php - ~/.composer/vendor/bin/phpstan analyse $dir/src --autoload-file=autoload.php - done + composer install -d testing/ + bash testing/run_staticanalysis_check.sh diff --git a/appengine/flexible/datastore/app.php b/appengine/flexible/datastore/app.php index 4eb850a2f9..ad9e4e0acd 100644 --- a/appengine/flexible/datastore/app.php +++ b/appengine/flexible/datastore/app.php @@ -80,7 +80,7 @@ ->withHeader('Content-Type', 'text/plain'); }); -function get_user_ip(Request $request) +function get_user_ip(Request $request): void { $ip = $request->getAttribute('ip_address'); // Keep only the first two octets of the IP address. diff --git a/appengine/flexible/metadata/app.php b/appengine/flexible/metadata/app.php index bc355f73c1..8938db407d 100644 --- a/appengine/flexible/metadata/app.php +++ b/appengine/flexible/metadata/app.php @@ -19,7 +19,7 @@ use Slim\Factory\AppFactory; # [START gae_flex_metadata] -function get_external_ip_using_google_cloud() +function get_external_ip_using_google_cloud(): void { $metadata = new Google\Cloud\Core\Compute\Metadata(); $externalIp = $metadata->get( @@ -28,7 +28,7 @@ function get_external_ip_using_google_cloud() return $externalIp; } -function get_external_ip_using_curl() +function get_external_ip_using_curl(): void { $url = 'http://metadata.google.internal/computeMetadata/v1/' . 'instance/network-interfaces/0/access-configs/0/external-ip'; diff --git a/appengine/flexible/tasks/src/create_task.php b/appengine/flexible/tasks/src/create_task.php index f06bc6d33f..840eb872b0 100644 --- a/appengine/flexible/tasks/src/create_task.php +++ b/appengine/flexible/tasks/src/create_task.php @@ -42,7 +42,7 @@ * @param integer $inSeconds The number of seconds from now to schedule task attempt. * */ -function create_task($projectId, $queueId, $location, $payload = 'helloworld', $inSeconds = null) +function create_task($projectId, $queueId, $location, $payload = 'helloworld', $inSeconds = null): void { // Instantiate the client, authenticate, and add scopes. $client = new Google_Client(); diff --git a/appengine/standard/auth/src/auth_api.php b/appengine/standard/auth/src/auth_api.php index 09578f2c74..8be907a014 100644 --- a/appengine/standard/auth/src/auth_api.php +++ b/appengine/standard/auth/src/auth_api.php @@ -27,7 +27,7 @@ use Google_Client; use Google_Service_Storage; -function auth_api($projectId) +function auth_api($projectId): void { $client = new Google_Client(); $client->useApplicationDefaultCredentials(); diff --git a/appengine/standard/auth/src/auth_cloud.php b/appengine/standard/auth/src/auth_cloud.php index 1ca0f8eb03..5446ca901f 100644 --- a/appengine/standard/auth/src/auth_cloud.php +++ b/appengine/standard/auth/src/auth_cloud.php @@ -26,7 +26,7 @@ // Imports the Cloud Storage client library. use Google\Cloud\Storage\StorageClient; -function auth_cloud($projectId) +function auth_cloud($projectId): void { # If you don't specify credentials when constructing the client, the # client library will look for credentials in the environment. diff --git a/appengine/standard/metadata/index.php b/appengine/standard/metadata/index.php index 77734f8a79..6ef92d1656 100644 --- a/appengine/standard/metadata/index.php +++ b/appengine/standard/metadata/index.php @@ -34,7 +34,7 @@ * * @param $metadataKey the key for the metadata server */ -function request_metadata_using_google_cloud($metadataKey) +function request_metadata_using_google_cloud($metadataKey): void { $metadata = new Google\Cloud\Core\Compute\Metadata(); $metadataValue = $metadata->get($metadataKey); @@ -47,7 +47,7 @@ function request_metadata_using_google_cloud($metadataKey) * * @param $metadataKey the key for the metadata server */ -function request_metadata_using_curl(http://github.com/$metadataKey) +function request_metadata_using_curl(http://github.com/$metadataKey): void { $url = 'http://metadata/computeMetadata/v1/' . $metadataKey; @@ -60,7 +60,7 @@ function request_metadata_using_curl(http://github.com/$metadataKey) } # [END gae_metadata] -function print_metadata_paths($root = '') +function print_metadata_paths($root = ''): void { $keys = request_metadata_using_google_cloud($root); $html = '