diff --git a/.circleci/code-sniffer.sh b/.circleci/code-sniffer.sh index 97e0d8a7..80cce597 100644 --- a/.circleci/code-sniffer.sh +++ b/.circleci/code-sniffer.sh @@ -8,7 +8,7 @@ then fi # Install dependencies and configure phpcs -vendor/bin/phpcs --config-set installed_paths vendor/drupal/coder/coder_sniffer +vendor/bin/phpcs --config-set installed_paths vendor/drupal/coder/coder_sniffer,vendor/sirbrillig/phpcs-variable-analysis,vendor/slevomat/coding-standard vendor/bin/phpmd modules/$1/src html cleancode,codesize,design,unusedcode --ignore-violations-on-exit --reportfile artifacts/phpmd/index.html vendor/bin/phpmetrics --extensions=php,inc,module --report-html=artifacts/phpmetrics --git modules/$1 diff --git a/modules/apigee_edge_debug/src/HttpClientMiddleware/DevelKintApiClientProfiler.php b/modules/apigee_edge_debug/src/HttpClientMiddleware/DevelKintApiClientProfiler.php index 446311a7..4e6f4477 100644 --- a/modules/apigee_edge_debug/src/HttpClientMiddleware/DevelKintApiClientProfiler.php +++ b/modules/apigee_edge_debug/src/HttpClientMiddleware/DevelKintApiClientProfiler.php @@ -141,7 +141,7 @@ public function __invoke() { } $next($stats); $rest_call['Time Elapsed'] = $formatter->formatStats($stats); - $rest_call['Severity'] = isset($level) ? $level : ''; + $rest_call['Severity'] = $level ?? ''; ksm($rest_call); }; } diff --git a/modules/apigee_edge_teams/src/Entity/TeamAppRouteProvider.php b/modules/apigee_edge_teams/src/Entity/TeamAppRouteProvider.php index ade81e8f..1afef6a2 100644 --- a/modules/apigee_edge_teams/src/Entity/TeamAppRouteProvider.php +++ b/modules/apigee_edge_teams/src/Entity/TeamAppRouteProvider.php @@ -236,7 +236,7 @@ private function alterRoutesWithAppName(Route $route): void { // Default access check must be replaced. // @see \Drupal\apigee_edge\Access\AppAccessCheckByAppName $requirements = $route->getRequirements(); - list(, $operation) = explode('.', $requirements['_entity_access']); + [, $operation] = explode('.', $requirements['_entity_access']); $requirements['_app_access_check_by_app_name'] = $operation; unset($requirements['_entity_access']); $route->setRequirements($requirements); diff --git a/src/UserDeveloperConverter.php b/src/UserDeveloperConverter.php index a8fb6dab..eca85f60 100644 --- a/src/UserDeveloperConverter.php +++ b/src/UserDeveloperConverter.php @@ -109,7 +109,7 @@ public function convertUser(UserInterface $user): UserToDeveloperConversionResul // Default value for firstname lastname if null. if ($user->get($base_field)->value === NULL && ($base_field === "first_name" || $base_field === "last_name")) { - $base_field_value = $developer->{$getter}() !== NULL ? $developer->{$getter}() : ucfirst($developer_prop); + $base_field_value = $developer->{$getter}() ?? ucfirst($developer_prop); $user->set($base_field, $base_field_value); } diff --git a/tests/modules/apigee_mock_api_client/src/MockHandlerStack.php b/tests/modules/apigee_mock_api_client/src/MockHandlerStack.php index 4bac4f51..09e2efdb 100644 --- a/tests/modules/apigee_mock_api_client/src/MockHandlerStack.php +++ b/tests/modules/apigee_mock_api_client/src/MockHandlerStack.php @@ -103,13 +103,11 @@ public function queueMockResponse($response_ids) { $id = !is_array($item) ? $item : $index; // Body text can have elements replaced in it for certain values. $context = is_array($item) ? $item : []; - $context['org_name'] = isset($context['org_name']) ? $context['org_name'] : $org_name; + $context['org_name'] = $context['org_name'] ?? $org_name; // Add the default headers if headers aren't defined in the response // catalog. - $headers = isset($this->responses[$id]['headers']) ? $this->responses[$id]['headers'] : [ - 'content-type' => 'application/json;charset=utf-8', - ]; + $headers = $this->responses[$id]['headers'] ?? ['content-type' => 'application/json;charset=utf-8']; // Set the default status code. $status_code = !empty($this->responses[$id]['status_code']) ? $this->responses[$id]['status_code'] : 200; $status_code = !empty($context['status_code']) ? $context['status_code'] : $status_code; diff --git a/tests/src/Functional/ConfigurationPermissionTest.php b/tests/src/Functional/ConfigurationPermissionTest.php index 0f5dcd90..9b42b630 100644 --- a/tests/src/Functional/ConfigurationPermissionTest.php +++ b/tests/src/Functional/ConfigurationPermissionTest.php @@ -102,8 +102,8 @@ protected function assertPaths(bool $access) { $visit_path($data['path']); if ($route === 'apigee_edge.settings.developer.sync') { if ($access) { - list($schedule_path, $schedule_query) = $this->findLink('Background developer sync'); - list($run_path, $run_query) = $this->findLink('Run developer sync'); + [$schedule_path, $schedule_query] = $this->findLink('Background developer sync'); + [$run_path, $run_query] = $this->findLink('Run developer sync'); $visit_path($schedule_path, $schedule_query); $visit_path($run_path, $run_query); } diff --git a/tests/src/Kernel/EntityControllerCacheTest.php b/tests/src/Kernel/EntityControllerCacheTest.php index 8644589a..5a606af8 100644 --- a/tests/src/Kernel/EntityControllerCacheTest.php +++ b/tests/src/Kernel/EntityControllerCacheTest.php @@ -180,7 +180,7 @@ public function testDeveloperAppEntityControllerCache() { 'developerId' => $developer->getDeveloperId(), ]); } - list($developer_app_1, $developer_app_2) = array_values($developer_apps); + [$developer_app_1, $developer_app_2] = array_values($developer_apps); $cache_by_email = $developer_app_cache_factory->getAppCache($developer->getEmail()); $cache_by_id = $developer_app_cache_factory->getAppCache($developer->getDeveloperId()); diff --git a/tests/src/Traits/ApigeeEdgeFunctionalTestTrait.php b/tests/src/Traits/ApigeeEdgeFunctionalTestTrait.php index 4b45a917..33bbf569 100644 --- a/tests/src/Traits/ApigeeEdgeFunctionalTestTrait.php +++ b/tests/src/Traits/ApigeeEdgeFunctionalTestTrait.php @@ -244,7 +244,7 @@ protected function drupalGetNoMetaRefresh(string $path, array $options = [], arr * Name of the link. */ protected function clickLinkProperly(string $name) { - list($path, $query) = $this->findLink($name); + [$path, $query] = $this->findLink($name); $this->drupalGet(static::fixUrl($path), [ 'query' => $query, ]);