Skip to content

Commit

Permalink
Add dependency on slevomat/coding-standard in CircleCI test
Browse files Browse the repository at this point in the history
  • Loading branch information
phdhiren committed Feb 1, 2022
1 parent 74d9f57 commit e151ae7
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .circleci/code-sniffer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/UserDeveloperConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
6 changes: 2 additions & 4 deletions tests/modules/apigee_mock_api_client/src/MockHandlerStack.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions tests/src/Functional/ConfigurationPermissionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/src/Kernel/EntityControllerCacheTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
2 changes: 1 addition & 1 deletion tests/src/Traits/ApigeeEdgeFunctionalTestTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
]);
Expand Down

0 comments on commit e151ae7

Please sign in to comment.