Skip to content

Commit f34ea19

Browse files
authored
Add dependency on slevomat/coding-standard in CircleCI test (#659)
1 parent 74d9f57 commit f34ea19

File tree

8 files changed

+10
-12
lines changed

8 files changed

+10
-12
lines changed

.circleci/code-sniffer.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ then
88
fi
99

1010
# Install dependencies and configure phpcs
11-
vendor/bin/phpcs --config-set installed_paths vendor/drupal/coder/coder_sniffer
11+
vendor/bin/phpcs --config-set installed_paths vendor/drupal/coder/coder_sniffer,vendor/sirbrillig/phpcs-variable-analysis,vendor/slevomat/coding-standard
1212

1313
vendor/bin/phpmd modules/$1/src html cleancode,codesize,design,unusedcode --ignore-violations-on-exit --reportfile artifacts/phpmd/index.html
1414
vendor/bin/phpmetrics --extensions=php,inc,module --report-html=artifacts/phpmetrics --git modules/$1

modules/apigee_edge_debug/src/HttpClientMiddleware/DevelKintApiClientProfiler.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ public function __invoke() {
141141
}
142142
$next($stats);
143143
$rest_call['Time Elapsed'] = $formatter->formatStats($stats);
144-
$rest_call['Severity'] = isset($level) ? $level : '';
144+
$rest_call['Severity'] = $level ?? '';
145145
ksm($rest_call);
146146
};
147147
}

modules/apigee_edge_teams/src/Entity/TeamAppRouteProvider.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ private function alterRoutesWithAppName(Route $route): void {
236236
// Default access check must be replaced.
237237
// @see \Drupal\apigee_edge\Access\AppAccessCheckByAppName
238238
$requirements = $route->getRequirements();
239-
list(, $operation) = explode('.', $requirements['_entity_access']);
239+
[, $operation] = explode('.', $requirements['_entity_access']);
240240
$requirements['_app_access_check_by_app_name'] = $operation;
241241
unset($requirements['_entity_access']);
242242
$route->setRequirements($requirements);

src/UserDeveloperConverter.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public function convertUser(UserInterface $user): UserToDeveloperConversionResul
109109

110110
// Default value for firstname lastname if null.
111111
if ($user->get($base_field)->value === NULL && ($base_field === "first_name" || $base_field === "last_name")) {
112-
$base_field_value = $developer->{$getter}() !== NULL ? $developer->{$getter}() : ucfirst($developer_prop);
112+
$base_field_value = $developer->{$getter}() ?? ucfirst($developer_prop);
113113
$user->set($base_field, $base_field_value);
114114
}
115115

tests/modules/apigee_mock_api_client/src/MockHandlerStack.php

+2-4
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,11 @@ public function queueMockResponse($response_ids) {
103103
$id = !is_array($item) ? $item : $index;
104104
// Body text can have elements replaced in it for certain values.
105105
$context = is_array($item) ? $item : [];
106-
$context['org_name'] = isset($context['org_name']) ? $context['org_name'] : $org_name;
106+
$context['org_name'] = $context['org_name'] ?? $org_name;
107107

108108
// Add the default headers if headers aren't defined in the response
109109
// catalog.
110-
$headers = isset($this->responses[$id]['headers']) ? $this->responses[$id]['headers'] : [
111-
'content-type' => 'application/json;charset=utf-8',
112-
];
110+
$headers = $this->responses[$id]['headers'] ?? ['content-type' => 'application/json;charset=utf-8'];
113111
// Set the default status code.
114112
$status_code = !empty($this->responses[$id]['status_code']) ? $this->responses[$id]['status_code'] : 200;
115113
$status_code = !empty($context['status_code']) ? $context['status_code'] : $status_code;

tests/src/Functional/ConfigurationPermissionTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ protected function assertPaths(bool $access) {
102102
$visit_path($data['path']);
103103
if ($route === 'apigee_edge.settings.developer.sync') {
104104
if ($access) {
105-
list($schedule_path, $schedule_query) = $this->findLink('Background developer sync');
106-
list($run_path, $run_query) = $this->findLink('Run developer sync');
105+
[$schedule_path, $schedule_query] = $this->findLink('Background developer sync');
106+
[$run_path, $run_query] = $this->findLink('Run developer sync');
107107
$visit_path($schedule_path, $schedule_query);
108108
$visit_path($run_path, $run_query);
109109
}

tests/src/Kernel/EntityControllerCacheTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ public function testDeveloperAppEntityControllerCache() {
180180
'developerId' => $developer->getDeveloperId(),
181181
]);
182182
}
183-
list($developer_app_1, $developer_app_2) = array_values($developer_apps);
183+
[$developer_app_1, $developer_app_2] = array_values($developer_apps);
184184

185185
$cache_by_email = $developer_app_cache_factory->getAppCache($developer->getEmail());
186186
$cache_by_id = $developer_app_cache_factory->getAppCache($developer->getDeveloperId());

tests/src/Traits/ApigeeEdgeFunctionalTestTrait.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ protected function drupalGetNoMetaRefresh(string $path, array $options = [], arr
244244
* Name of the link.
245245
*/
246246
protected function clickLinkProperly(string $name) {
247-
list($path, $query) = $this->findLink($name);
247+
[$path, $query] = $this->findLink($name);
248248
$this->drupalGet(static::fixUrl($path), [
249249
'query' => $query,
250250
]);

0 commit comments

Comments
 (0)