diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 9cd55d4f13..2d52acd496 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -15,6 +15,7 @@ $config = new PhpCsFixer\Config(); return $config->setRules([ '@PSR2' => true, + '@PHP81Migration' => true, 'method_argument_space' => ['on_multiline' => 'ignore'], 'no_unused_imports' => true, ]) diff --git a/app/Console/Commands/MigrateConfig.php b/app/Console/Commands/MigrateConfig.php index 8ab950d473..42e9bf62dd 100644 --- a/app/Console/Commands/MigrateConfig.php +++ b/app/Console/Commands/MigrateConfig.php @@ -67,7 +67,7 @@ public function handle() if (strpos($line, '=') === false) { continue; } - list($key, $value) = explode('=', $line); + [$key, $value] = explode('=', $line); $config[$key] = $value; } fclose($handle); diff --git a/app/Http/Controllers/AdminController.php b/app/Http/Controllers/AdminController.php index 2dcfb3af5a..265a84fab2 100644 --- a/app/Http/Controllers/AdminController.php +++ b/app/Http/Controllers/AdminController.php @@ -99,10 +99,10 @@ public function removeBuilds(): View|RedirectResponse $dayTo, $yearFrom, $monthFrom, - $dayFrom + $dayFrom, ]); - $builds = array(); + $builds = []; foreach ($build as $build_array) { $builds[] = (int) $build_array->id; } @@ -238,7 +238,7 @@ public function upgrade() // Add new multi-column index to build table. // This improves the rendering speed of overview.php. - $multi_index = array('projectid', 'parentid', 'starttime'); + $multi_index = ['projectid', 'parentid', 'starttime']; AddTableIndex('build', $multi_index); // Support for dynamic BuildGroups. diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index 8106464d7f..e741813b7b 100755 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -79,7 +79,7 @@ protected function sendFailedLoginResponse(Request $request): Response ->response = response() ->view('auth.login', [ 'errors' => $e->validator->getMessageBag(), - 'title' => 'Login' + 'title' => 'Login', ], 401 ); diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index be9c0398dd..22712d8f6b 100755 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -99,7 +99,7 @@ public function create(array $data) : User|null 'lastname' => $data['lname'], 'email' => $data['email'], 'password' => Hash::make($data['password']), - 'institution' => $data['institution'] + 'institution' => $data['institution'], ]); } diff --git a/app/Http/Controllers/AuthTokenController.php b/app/Http/Controllers/AuthTokenController.php index 86f296a27d..8668102874 100644 --- a/app/Http/Controllers/AuthTokenController.php +++ b/app/Http/Controllers/AuthTokenController.php @@ -32,7 +32,7 @@ public function fetchAll(): JsonResponse } return response()->json([ - 'tokens' => $token_map + 'tokens' => $token_map, ]); } diff --git a/app/Http/Controllers/BuildController.php b/app/Http/Controllers/BuildController.php index 7c79813889..7bd6a652b0 100644 --- a/app/Http/Controllers/BuildController.php +++ b/app/Http/Controllers/BuildController.php @@ -687,16 +687,16 @@ public function viewUpdatePageContent(): JsonResponse $update_groups = [ [ 'description' => "{$this->project->Name} Updated Files ($num_updated_files)", - 'directories' => $updated_files + 'directories' => $updated_files, ], [ 'description' => "Modified Files ($num_modified_files)", - 'directories' => $modified_files + 'directories' => $modified_files, ], [ 'description' => "Conflicting Files ($num_conflicting_files)", - 'directories' => $conflicting_files - ] + 'directories' => $conflicting_files, + ], ]; $response['updategroups'] = $update_groups; @@ -850,7 +850,7 @@ public function apiViewBuildError(): JsonResponse // Site $extra_build_fields = [ - 'site' => $this->build->GetSite()->name + 'site' => $this->build->GetSite()->name, ]; // Update @@ -910,12 +910,12 @@ public function apiViewBuildError(): JsonResponse ', [intval($resolvedBuildFailure['id'])], $marshaledResolvedBuildFailure); } - $marshaledResolvedBuildFailure = array_merge($marshaledResolvedBuildFailure, array( + $marshaledResolvedBuildFailure = array_merge($marshaledResolvedBuildFailure, [ 'stderr' => $resolvedBuildFailure['stderror'], 'stderrorrows' => min(10, substr_count($resolvedBuildFailure['stderror'], "\n") + 1), 'stdoutput' => $resolvedBuildFailure['stdoutput'], 'stdoutputrows' => min(10, substr_count($resolvedBuildFailure['stdoutput'], "\n") + 1), - )); + ]); $this->addErrorResponse($marshaledResolvedBuildFailure, $response); } @@ -1177,7 +1177,7 @@ public function apiBuildExpected(): JsonResponse $this->setBuildById(intval($_GET['buildid'] ?? -1)); $rule = new BuildGroupRule($this->build); return response()->json([ - 'expected' => $rule->GetExpected() + 'expected' => $rule->GetExpected(), ]); } } diff --git a/app/Http/Controllers/BuildPropertiesController.php b/app/Http/Controllers/BuildPropertiesController.php index f643711e96..84ca15c239 100644 --- a/app/Http/Controllers/BuildPropertiesController.php +++ b/app/Http/Controllers/BuildPropertiesController.php @@ -46,8 +46,8 @@ public function apiBuildProperties(): JsonResponse if (isset($_GET['begin']) && isset($_GET['end'])) { $beginning_date = $_GET['begin']; $end_date = $_GET['end']; - list($unused, $beginning_timestamp) = get_dates($beginning_date, $this->project->NightlyTime); - list($unused, $end_timestamp) = get_dates($end_date, $this->project->NightlyTime); + [$unused, $beginning_timestamp] = get_dates($beginning_date, $this->project->NightlyTime); + [$unused, $end_timestamp] = get_dates($end_date, $this->project->NightlyTime); $datetime = new DateTime(); $datetime->setTimestamp($end_timestamp); $datetime->add(new DateInterval('P1D')); @@ -62,7 +62,7 @@ public function apiBuildProperties(): JsonResponse $date = date(FMT_DATE); } if (is_null($beginning_timestamp)) { - list($unused, $beginning_timestamp) = get_dates($date, $this->project->NightlyTime); + [$unused, $beginning_timestamp] = get_dates($date, $this->project->NightlyTime); $datetime = new DateTime(); $datetime->setTimestamp($beginning_timestamp); $datetime->add(new DateInterval('P1D')); @@ -81,18 +81,18 @@ public function apiBuildProperties(): JsonResponse [ 'name' => 'builderrors', 'prettyname' => 'Errors', - 'selected' => false + 'selected' => false, ], [ 'name' => 'buildwarnings', 'prettyname' => 'Warnings', - 'selected' => false + 'selected' => false, ], [ 'name' => 'testfailed', 'prettyname' => 'Test Failures', - 'selected' => false - ] + 'selected' => false, + ], ]; // Mark specified types of defects as selected. @@ -289,7 +289,7 @@ private function gather_defects(PDOStatement $stmt, string $prettyname, array &$ $defects_response[] = [ 'descr' => $descr, 'type' => $prettyname, - 'builds' => [] + 'builds' => [], ]; $idx = count($defects_response) - 1; } diff --git a/app/Http/Controllers/CoverageController.php b/app/Http/Controllers/CoverageController.php index bd803b033b..2e0eb2ce28 100644 --- a/app/Http/Controllers/CoverageController.php +++ b/app/Http/Controllers/CoverageController.php @@ -50,7 +50,7 @@ public function manageCoverage(): View|RedirectResponse if (!isset($userid) || !is_numeric($userid)) { return view('cdash', [ 'xsl' => true, - 'xsl_content' => 'Not a valid userid!' + 'xsl_content' => 'Not a valid userid!', ]); } @@ -84,7 +84,7 @@ public function manageCoverage(): View|RedirectResponse if (!Gate::allows('edit-project', $Project)) { return view('cdash', [ 'xsl' => true, - 'xsl_content' => "You don't have the permissions to access this page" + 'xsl_content' => "You don't have the permissions to access this page", ]); } @@ -178,7 +178,7 @@ public function manageCoverage(): View|RedirectResponse $line = substr($contents, $pos, $pos2 - $pos); $file = ''; - $authors = array(); + $authors = []; // first is the svnuser $posfile = strpos($line, ':'); @@ -374,7 +374,7 @@ public function manageCoverage(): View|RedirectResponse 'xsl' => true, 'xsl_content' => generate_XSLT($xml, base_path() . '/app/cdash/public/manageCoverage', true), 'project' => $Project, - 'title' => 'Manage Coverage' + 'title' => 'Manage Coverage', ]); } @@ -506,7 +506,7 @@ public function viewCoverage(): View|RedirectResponse if ($this->project->DisplayLabels) { // Get the set of labels involved: // - $labels = array(); + $labels = []; $covlabels = $db->executePrepared(' SELECT DISTINCT id, text @@ -596,8 +596,8 @@ public function viewCoverage(): View|RedirectResponse AND c.fileid=cf.id ', [intval($this->build->Id)]); - $directories = array(); - $covfile_array = array(); + $directories = []; + $covfile_array = []; foreach ($coveragefile as $coveragefile_array) { $covfile['covered'] = 1; @@ -675,7 +675,7 @@ public function viewCoverage(): View|RedirectResponse $covfile_array[] = $covfile; } - $ncoveragefiles = array(); + $ncoveragefiles = []; $ncoveragefiles[0] = count($directories); $ncoveragefiles[1] = 0; $ncoveragefiles[2] = 0; @@ -730,7 +730,7 @@ public function viewCoverage(): View|RedirectResponse 'xsl' => true, 'xsl_content' => generate_XSLT($xml, 'viewCoverage', true), 'project' => $this->project, - 'title' => 'Coverage' + 'title' => 'Coverage', ]); } @@ -1080,12 +1080,12 @@ public function ajaxGetViewCoverage(): JsonResponse // Contruct the directory view if ($status === -1) { - $directory_array = array(); + $directory_array = []; foreach ($covfile_array as $covfile) { $fullpath = $covfile['fullpath']; $fullpath = dirname($fullpath); if (!isset($directory_array[$fullpath])) { - $directory_array[$fullpath] = array(); + $directory_array[$fullpath] = []; $directory_array[$fullpath]['priority'] = 0; $directory_array[$fullpath]['directory'] = 1; $directory_array[$fullpath]['covered'] = 1; @@ -1756,7 +1756,7 @@ public function apiCompareCoverage(): JsonResponse $date = isset($_GET['date']) ? htmlspecialchars($_GET['date']) : null; - list($previousdate, $currentstarttime, $nextdate) = get_dates($date, $this->project->NightlyTime); + [$previousdate, $currentstarttime, $nextdate] = get_dates($date, $this->project->NightlyTime); $response = begin_JSON_response(); $response['title'] = $this->project->Name . ' - Compare Coverage'; diff --git a/app/Http/Controllers/FilterController.php b/app/Http/Controllers/FilterController.php index 65261de48b..4ad1489aa3 100644 --- a/app/Http/Controllers/FilterController.php +++ b/app/Http/Controllers/FilterController.php @@ -17,7 +17,7 @@ public function getFilterDataArray(): JsonResponse 'limit', 'othercombine', 'showfilters', - 'showlimit' + 'showlimit', ]; foreach ($filterdata as $key => $value) { if (!in_array($key, $fields_to_preserve)) { diff --git a/app/Http/Controllers/ManageProjectRolesController.php b/app/Http/Controllers/ManageProjectRolesController.php index a5a3b3a5b6..95a0974a65 100644 --- a/app/Http/Controllers/ManageProjectRolesController.php +++ b/app/Http/Controllers/ManageProjectRolesController.php @@ -49,7 +49,7 @@ public function viewPage(): View|RedirectResponse if (!$current_user->IsAdmin() && $role <= 1) { return view('cdash', [ 'xsl' => true, - 'xsl_content' => "You don't have the permissions to access this page!" + 'xsl_content' => "You don't have the permissions to access this page!", ]); } @@ -385,7 +385,7 @@ public function viewPage(): View|RedirectResponse intval($project_array['id']), intval($project_array['id']), intval($project_array['id']), - $date + $date, ]); add_last_sql_error('ManageProjectRole'); @@ -409,7 +409,7 @@ public function viewPage(): View|RedirectResponse 'xsl' => true, 'xsl_content' => generate_XSLT($xml, base_path() . '/app/cdash/public/manageProjectRoles', true), 'project' => $project, - 'title' => 'Project Roles' + 'title' => 'Project Roles', ]); } diff --git a/app/Http/Controllers/MapController.php b/app/Http/Controllers/MapController.php index d9a60d6605..0fce0770b1 100644 --- a/app/Http/Controllers/MapController.php +++ b/app/Http/Controllers/MapController.php @@ -35,7 +35,7 @@ public function viewMap(): View|RedirectResponse $db = Database::getInstance(); - list($previousdate, $currenttime, $nextdate) = get_dates($date, $this->project->NightlyTime); + [$previousdate, $currenttime, $nextdate] = get_dates($date, $this->project->NightlyTime); $nightlytime = strtotime($this->project->NightlyTime); diff --git a/app/Http/Controllers/ProjectController.php b/app/Http/Controllers/ProjectController.php index a5761287e3..46cf75a360 100644 --- a/app/Http/Controllers/ProjectController.php +++ b/app/Http/Controllers/ProjectController.php @@ -85,7 +85,7 @@ public function apiCreateProject(): JsonResponse $repositories = $this->project->GetRepositories(); foreach ($repositories as $repository) { - $repository_response = array(); + $repository_response = []; $repository_response['url'] = $repository['url']; $repository_response['username'] = $repository['username']; $repository_response['password'] = $repository['password']; diff --git a/app/Http/Controllers/ProjectOverviewController.php b/app/Http/Controllers/ProjectOverviewController.php index 9657f6cc84..108731c4c4 100644 --- a/app/Http/Controllers/ProjectOverviewController.php +++ b/app/Http/Controllers/ProjectOverviewController.php @@ -27,7 +27,7 @@ public function apiOverview(): JsonResponse // Handle optional date argument. $date = htmlspecialchars($_GET['date'] ?? date(FMT_DATE)); - list($previousdate, $currentstarttime, $nextdate) = get_dates($date, $this->project->NightlyTime); + [$previousdate, $currentstarttime, $nextdate] = get_dates($date, $this->project->NightlyTime); // Date range is currently hardcoded to two weeks in the past. // This could become a configurable value instead. @@ -55,23 +55,23 @@ public function apiOverview(): JsonResponse ]; // sanitized versions of these measurements. - $clean_measurements = array( + $clean_measurements = [ 'configure warnings' => 'configure_warnings', 'configure errors' => 'configure_errors', 'build warnings' => 'build_warnings', 'build errors' => 'build_errors', - 'failing tests' => 'failing_tests'); + 'failing tests' => 'failing_tests']; // for static analysis, we only care about errors & warnings. - $static_measurements = array('errors', 'warnings'); + $static_measurements = ['errors', 'warnings']; // information on how to sort by the various build measurements - $sort = array( + $sort = [ 'configure warnings' => '-configure.warning', 'configure errors' => '-configure.error', 'build warnings' => '-compilation.warning', 'build errors' => '-compilation.error', - 'failing tests' => '-test.fail'); + 'failing tests' => '-test.fail']; // get the build groups that are included in this project's overview, // split up by type (currently only static analysis and general builds). @@ -83,8 +83,8 @@ public function apiOverview(): JsonResponse ORDER BY obg.position ', [$this->project->Id]); - $build_groups = array(); - $static_groups = array(); + $build_groups = []; + $static_groups = []; foreach ($query as $group_row) { if ($group_row->type === 'build') { @@ -101,9 +101,9 @@ public function apiOverview(): JsonResponse } $has_subproject_groups = false; - $subproject_groups = array(); - $coverage_categories = array(); - $coverage_build_group_names = array(); + $subproject_groups = []; + $coverage_categories = []; + $coverage_build_group_names = []; if ($has_subprojects) { // Detect if the subprojects are split up into groups. $groups = $this->project->GetSubProjectGroups(); @@ -117,7 +117,7 @@ public function apiOverview(): JsonResponse // for this group. $group_name = $group->GetName(); $threshold = $group->GetCoverageThreshold(); - $coverage_category = array(); + $coverage_category = []; $coverage_category['name'] = $group_name; $coverage_category['position'] = $group->GetPosition(); $coverage_category['low'] = 0.7 * $threshold; @@ -126,7 +126,7 @@ public function apiOverview(): JsonResponse $coverage_categories[] = $coverage_category; } // Also save a 'Total' category to summarize across groups. - $coverage_category = array(); + $coverage_category = []; $coverage_category['name'] = 'Total'; $coverage_category['position'] = 0; $threshold = intval($this->project->CoverageThreshold); @@ -139,7 +139,7 @@ public function apiOverview(): JsonResponse $threshold = $this->project->CoverageThreshold; if (!$has_subproject_groups) { - $coverage_category = array(); + $coverage_category = []; $coverage_category['name'] = 'coverage'; $coverage_category['position'] = 1; $coverage_category['low'] = 0.7 * $threshold; @@ -165,27 +165,27 @@ public function apiOverview(): JsonResponse // are defined: // coverage_data[day][build group][coverage group] = percent_coverage // dynamic_analysis_data[day][group][checker] = num_defects - $overview_data = array(); - $coverage_data = array(); - $dynamic_analysis_data = array(); + $overview_data = []; + $coverage_data = []; + $dynamic_analysis_data = []; for ($i = 0; $i < $date_range; $i++) { - $overview_data[$i] = array(); + $overview_data[$i] = []; foreach ($build_groups as $build_group) { $build_group_name = $build_group['name']; // overview - $overview_data[$i][$build_group_name] = array(); + $overview_data[$i][$build_group_name] = []; // dynamic analysis - $dynamic_analysis_data[$i][$build_group_name] = array(); + $dynamic_analysis_data[$i][$build_group_name] = []; } // coverage foreach ($coverage_build_group_names as $build_group_name) { foreach ($coverage_categories as $coverage_category) { $category_name = $coverage_category['name']; - $coverage_data[$i][$build_group_name][$category_name] = array(); + $coverage_data[$i][$build_group_name][$category_name] = []; $coverage_array = &$coverage_data[$i][$build_group_name][$category_name]; $coverage_array['loctested'] = 0; @@ -197,7 +197,7 @@ public function apiOverview(): JsonResponse // static analysis foreach ($static_groups as $static_group) { $static_group_name = $static_group['name']; - $overview_data[$i][$static_group_name] = array(); + $overview_data[$i][$static_group_name] = []; } } @@ -237,12 +237,12 @@ public function apiOverview(): JsonResponse // If we have multiple coverage builds in a single day we will also // show the aggregate. - $aggregate_tracker = array(); + $aggregate_tracker = []; $show_aggregate = false; // Keep track of the different types of dynamic analysis that are being // performed on our build groups of interest. - $dynamic_analysis_types = array(); + $dynamic_analysis_types = []; // TODO: (williamjallen) Much of this can be done in SQL for efficiency and better readability foreach ($builds_array as $build_row) { @@ -394,23 +394,23 @@ public function apiOverview(): JsonResponse // Now that the data has been collected we can generate the XML. // Start with the general build groups. - $groups = array(); + $groups = []; foreach ($build_groups as $build_group) { - $groups[] = array('name' => $build_group['name']); + $groups[] = ['name' => $build_group['name']]; } $response['groups'] = $groups; - $measurements_response = array(); + $measurements_response = []; foreach ($build_measurements as $measurement) { $clean_measurement = $clean_measurements[$measurement]; - $measurement_response = array(); + $measurement_response = []; $measurement_response['name'] = $measurement; $measurement_response['name_clean'] = $clean_measurement; $measurement_response['sort'] = $sort[$measurement]; - $groups_response = array(); + $groups_response = []; foreach ($build_groups as $build_group) { - $group_response = array(); + $group_response = []; $group_response['name'] = $build_group['name']; $group_response['name_clean'] = self::sanitize_string($build_group['name']); $value = self::get_current_value($build_group['name'], $measurement, $date_range, $overview_data); @@ -426,16 +426,16 @@ public function apiOverview(): JsonResponse $response['measurements'] = $measurements_response; // coverage - $coverages_response = array(); - $coverage_buildgroups = array(); + $coverages_response = []; + $coverage_buildgroups = []; foreach ($coverage_categories as $coverage_category) { $category_name = $coverage_category['name']; - $coverage_category_response = array(); + $coverage_category_response = []; $coverage_category_response['name_clean'] = self::sanitize_string($category_name); $coverage_category_response['name'] = $category_name; $coverage_category_response['position'] = $coverage_category['position']; - $coverage_category_response['groups'] = array(); + $coverage_category_response['groups'] = []; foreach ($coverage_build_group_names as $build_group_name) { // Skip groups that don't have any coverage. @@ -452,7 +452,7 @@ public function apiOverview(): JsonResponse continue; } - $coverage_response = array(); + $coverage_response = []; $coverage_response['name'] = $build_group_name; if (!in_array($build_group_name, $coverage_buildgroups)) { @@ -463,7 +463,7 @@ public function apiOverview(): JsonResponse $coverage_response['medium'] = $coverage_category['medium']; $coverage_response['satisfactory'] = $coverage_category['satisfactory']; - list($current_value, $previous_value) = + [$current_value, $previous_value] = self::get_recent_coverage_values($build_group_name, $category_name, $date_range, $coverage_data); $coverage_response['current'] = $current_value; $coverage_response['previous'] = $previous_value; @@ -482,13 +482,13 @@ public function apiOverview(): JsonResponse $response['coverage_buildgroups'] = $coverage_buildgroups; // dynamic analysis - $dynamic_analyses_response = array(); + $dynamic_analyses_response = []; foreach ($dynamic_analysis_types as $checker) { - $DA_response = array(); + $DA_response = []; $DA_response['name_clean'] = self::sanitize_string($checker); $DA_response['name'] = $checker; - $groups_response = array(); + $groups_response = []; foreach ($build_groups as $build_group) { // Skip groups that don't have any data for this tool. $found = false; @@ -503,7 +503,7 @@ public function apiOverview(): JsonResponse continue; } - $group_response = array(); + $group_response = []; $group_response['name'] = $build_group['name']; $group_response['name_clean'] = self::sanitize_string($build_group['name']); @@ -520,7 +520,7 @@ public function apiOverview(): JsonResponse $response['dynamicanalyses'] = $dynamic_analyses_response; // static analysis - $static_analyses_response = array(); + $static_analyses_response = []; foreach ($static_groups as $static_group) { // Skip this group if no data was found for it. $found = false; @@ -540,12 +540,12 @@ public function apiOverview(): JsonResponse continue; } - $SA_response = array(); + $SA_response = []; $SA_response['group_name'] = $static_group['name']; $SA_response['group_name_clean'] = self::sanitize_string($static_group['name']); - $measurements_response = array(); + $measurements_response = []; foreach ($static_measurements as $measurement) { - $measurement_response = array(); + $measurement_response = []; $measurement_response['name'] = $measurement; $measurement_response['name_clean'] = self::sanitize_string($measurement); $measurement_response['sort'] = $sort["build $measurement"]; @@ -661,14 +661,14 @@ private static function get_date_from_index($i, $beginning_timestamp): string */ private static function get_chart_data($group_name, $measurement, $date_range, $overview_data, $beginning_timestamp): string { - $chart_data = array(); + $chart_data = []; for ($i = 0; $i < $date_range; $i++) { if (!array_key_exists($measurement, $overview_data[$i][$group_name])) { continue; } $chart_date = self::get_date_from_index($i, $beginning_timestamp); - $chart_data[] = array($chart_date, $overview_data[$i][$group_name][$measurement]); + $chart_data[] = [$chart_date, $overview_data[$i][$group_name][$measurement]]; } // JSON encode the chart data to make it easier to use on the client side. @@ -680,7 +680,7 @@ private static function get_chart_data($group_name, $measurement, $date_range, $ */ private static function get_coverage_chart_data($build_group_name, $coverage_category, $date_range, $coverage_data, $beginning_timestamp): string { - $chart_data = array(); + $chart_data = []; for ($i = 0; $i < $date_range; $i++) { $coverage_array = @@ -691,7 +691,7 @@ private static function get_coverage_chart_data($build_group_name, $coverage_cat } $chart_date = self::get_date_from_index($i, $beginning_timestamp); - $chart_data[] = array($chart_date, $coverage_array['percent']); + $chart_data[] = [$chart_date, $coverage_array['percent']]; } return json_encode($chart_data); } @@ -717,7 +717,7 @@ private static function get_recent_coverage_values($build_group_name, $coverage_ $current_value_found = true; } else { $previous_value = $coverage_array['percent']; - return array($current_value, $previous_value); + return [$current_value, $previous_value]; } } @@ -725,7 +725,7 @@ private static function get_recent_coverage_values($build_group_name, $coverage_ // of coverage for these groups. In this case, we make previous & current // hold the same value. We do this because nvd3's bullet chart implementation // does not support leaving the "marker" off of the chart. - return array($current_value, $current_value); + return [$current_value, $current_value]; } /** @@ -733,7 +733,7 @@ private static function get_recent_coverage_values($build_group_name, $coverage_ */ private static function get_DA_chart_data($group_name, $checker, $date_range, $dynamic_analysis_data, $beginning_timestamp): string { - $chart_data = array(); + $chart_data = []; for ($i = 0; $i < $date_range; $i++) { $dynamic_analysis_array = &$dynamic_analysis_data[$i][$group_name]; @@ -742,7 +742,7 @@ private static function get_DA_chart_data($group_name, $checker, $date_range, $d } $chart_date = self::get_date_from_index($i, $beginning_timestamp); - $chart_data[] = array($chart_date, $dynamic_analysis_data[$i][$group_name][$checker]); + $chart_data[] = [$chart_date, $dynamic_analysis_data[$i][$group_name][$checker]]; } return json_encode($chart_data); } diff --git a/app/Http/Controllers/SiteController.php b/app/Http/Controllers/SiteController.php index 29a4bdba3e..4a939764a6 100644 --- a/app/Http/Controllers/SiteController.php +++ b/app/Http/Controllers/SiteController.php @@ -266,7 +266,7 @@ public function editSite(): View|RedirectResponse $xml .= ''; $site_array = $db->executePreparedSingleRow('SELECT * FROM site WHERE id=?', [intval($siteid)]); - $siteinformation_array = array(); + $siteinformation_array = []; $siteinformation_array['description'] = 'NA'; $siteinformation_array['processoris64bits'] = 'NA'; $siteinformation_array['processorvendor'] = 'NA'; @@ -394,7 +394,7 @@ public function viewSite(): View $currenttime = pdo_real_escape_numeric($currenttime); } - $siteinformation_array = array(); + $siteinformation_array = []; $siteinformation_array['description'] = 'NA'; $siteinformation_array['processoris64bits'] = 'NA'; $siteinformation_array['processorvendor'] = 'NA'; @@ -542,7 +542,7 @@ public function viewSite(): View // Select projects that belong to this site $displayPage = 0; - $projects = array(); + $projects = []; $site2project = $db->executePrepared(' SELECT projectid, max(submittime) AS maxtime FROM build @@ -744,12 +744,12 @@ private static function update_site( 'ip' => $ip, 'latitude' => $latitude, 'longitude' => $longitude, - 'outoforder' => $outoforder + 'outoforder' => $outoforder, ]); add_last_sql_error('update_site'); - $names = array(); + $names = []; $names[] = 'processoris64bits'; $names[] = 'processorvendor'; $names[] = 'processorvendorid'; diff --git a/app/Http/Controllers/SubProjectController.php b/app/Http/Controllers/SubProjectController.php index 8b09cadb52..a008cfee46 100644 --- a/app/Http/Controllers/SubProjectController.php +++ b/app/Http/Controllers/SubProjectController.php @@ -144,7 +144,7 @@ public function apiViewSubProjects(): JsonResponse $response['title'] = $this->project->Name; $response['showcalendar'] = 1; - $banners = array(); + $banners = []; $global_banner = Banner::find(0); if ($global_banner !== null && strlen($global_banner->text) > 0) { $banners[] = $global_banner->text; @@ -159,7 +159,7 @@ public function apiViewSubProjects(): JsonResponse $response['showlastsubmission'] = 1; } - list($previousdate, $currentstarttime, $nextdate) = get_dates($date, $this->project->NightlyTime); + [$previousdate, $currentstarttime, $nextdate] = get_dates($date, $this->project->NightlyTime); // Main dashboard section get_dashboard_JSON($this->project->GetName(), $date, $response); @@ -175,7 +175,7 @@ public function apiViewSubProjects(): JsonResponse $response['linkparams'] = $linkparams; // Menu definition - $menu_response = array(); + $menu_response = []; $menu_response['subprojects'] = 1; $menu_response['previous'] = "viewSubProjects.php?project=$projectname_encoded&date=$previousdate"; $menu_response['current'] = "viewSubProjects.php?project=$projectname_encoded"; @@ -190,7 +190,7 @@ public function apiViewSubProjects(): JsonResponse $end_UTCDate = gmdate(FMT_DATETIME, $currentstarttime + 3600 * 24); // Get some information about the project - $project_response = array(); + $project_response = []; $project_response['nbuilderror'] = $this->project->GetNumberOfErrorBuilds($beginning_UTCDate, $end_UTCDate); $project_response['nbuildwarning'] = $this->project->GetNumberOfWarningBuilds($beginning_UTCDate, $end_UTCDate); $project_response['nbuildpass'] = $this->project->GetNumberOfPassingBuilds($beginning_UTCDate, $end_UTCDate); @@ -210,11 +210,11 @@ public function apiViewSubProjects(): JsonResponse // Look for the subproject $subprojectids = $this->project->GetSubProjects(); - $subprojProp = array(); + $subprojProp = []; foreach ($subprojectids as $subprojectid) { $SubProject = new SubProject(); $SubProject->SetId($subprojectid); - $subprojProp[$subprojectid] = array('name' => $SubProject->GetName()); + $subprojProp[$subprojectid] = ['name' => $SubProject->GetName()]; } // If all of the dates are the same, we can get the results in bulk. Otherwise, we must query every @@ -238,15 +238,15 @@ public function apiViewSubProjects(): JsonResponse } } - $reportArray = array('nbuilderror', 'nbuildwarning', 'nbuildpass', + $reportArray = ['nbuilderror', 'nbuildwarning', 'nbuildpass', 'nconfigureerror', 'nconfigurewarning', 'nconfigurepass', - 'ntestpass', 'ntestfail', 'ntestnotrun'); - $subprojects_response = array(); + 'ntestpass', 'ntestfail', 'ntestnotrun']; + $subprojects_response = []; foreach ($subprojectids as $subprojectid) { $SubProject = new SubProject(); $SubProject->SetId($subprojectid); - $subproject_response = array(); + $subproject_response = []; $subproject_response['name'] = $SubProject->GetName(); $subproject_response['name_encoded'] = urlencode($SubProject->GetName()); diff --git a/app/Http/Controllers/SubscribeProjectController.php b/app/Http/Controllers/SubscribeProjectController.php index eb7e2c5a64..03272cfb9a 100644 --- a/app/Http/Controllers/SubscribeProjectController.php +++ b/app/Http/Controllers/SubscribeProjectController.php @@ -140,7 +140,7 @@ public function subscribeProject(): View|RedirectResponse $EmailMissingSites, $EmailSuccess, $user->id, - $this->project->Id + $this->project->Id, ]); // Update the repository credential @@ -203,7 +203,7 @@ public function subscribeProject(): View|RedirectResponse $EmailMissingSites, $EmailSuccess, $user->id, - $this->project->Id + $this->project->Id, ]); // Update the repository credential @@ -248,7 +248,7 @@ public function subscribeProject(): View|RedirectResponse $EmailType, $EmailCategory, $EmailSuccess, - $EmailMissingSites + $EmailMissingSites, ]); $UserProject = new UserProject(); diff --git a/app/Http/Controllers/TestController.php b/app/Http/Controllers/TestController.php index 76fa31b563..c351417515 100644 --- a/app/Http/Controllers/TestController.php +++ b/app/Http/Controllers/TestController.php @@ -120,7 +120,7 @@ public function apiTestSummary(): JsonResponse|StreamedResponse get_dashboard_JSON_by_name($this->project->Name, $date, $response); $response['testName'] = $testName; - list($previousdate, $currentstarttime, $nextdate, $today) = get_dates($date, $this->project->NightlyTime); + [$previousdate, $currentstarttime, $nextdate, $today] = get_dates($date, $this->project->NightlyTime); $menu = [ 'back' => 'index.php?project=' . urlencode($this->project->Name) . "&date=$date", 'previous' => "testSummary.php?project={$this->project->Id}&name=$testName&date=$previousdate", diff --git a/app/Http/Controllers/UserStatisticsController.php b/app/Http/Controllers/UserStatisticsController.php index 85f86e1a69..1f4838e68c 100644 --- a/app/Http/Controllers/UserStatisticsController.php +++ b/app/Http/Controllers/UserStatisticsController.php @@ -42,7 +42,7 @@ public function api(): JsonResponse $response['range'] = $range; // Set up links from this page. - $menu = array(); + $menu = []; $menu['back'] = "index.php?project={$this->project->Name}&date=$date"; $nextdate = $response['nextdate']; $menu['next'] = "userStatistics.php?project={$this->project->Name}&date=$nextdate&range=$range"; @@ -68,12 +68,12 @@ public function api(): JsonResponse $stmt->bindParam(':projectid', $this->project->Id); pdo_execute($stmt); - $users = array(); + $users = []; while ($row = $stmt->fetch()) { if (array_key_exists($row['userid'], $users)) { $user = $users[$row['userid']]; } else { - $user = array(); + $user = []; $user['nfailedwarnings'] = 0; $user['nfixedwarnings'] = 0; $user['nfailederrors'] = 0; @@ -95,9 +95,9 @@ public function api(): JsonResponse } // Generate the response used to render the main table of this page. - $users_response = array(); + $users_response = []; foreach ($users as $key => $user) { - $user_response = array(); + $user_response = []; $user_obj = User::where('id', $key)->first(); $user_response['name'] = $user_obj->full_name; $user_response['id'] = $key; diff --git a/app/Http/Controllers/ViewTestController.php b/app/Http/Controllers/ViewTestController.php index 2ecba5c58a..783bfd32ac 100644 --- a/app/Http/Controllers/ViewTestController.php +++ b/app/Http/Controllers/ViewTestController.php @@ -53,7 +53,7 @@ public function fetchPageContent(): JsonResponse|StreamedResponse return response()->json(cast_data_for_JSON($response)); } else { $headers = [ - 'Content-Type' => 'text/csv' + 'Content-Type' => 'text/csv', ]; return response()->streamDownload(function () use ($response) { echo $response; diff --git a/app/Http/Middleware/VerifyCsrfToken.php b/app/Http/Middleware/VerifyCsrfToken.php index 482b38a507..26bcb76eac 100755 --- a/app/Http/Middleware/VerifyCsrfToken.php +++ b/app/Http/Middleware/VerifyCsrfToken.php @@ -19,6 +19,6 @@ class VerifyCsrfToken extends Middleware * @var array */ protected $except = [ - '*.php' + '*.php', ]; } diff --git a/app/Jobs/ProcessSubmission.php b/app/Jobs/ProcessSubmission.php index ad6e2cf7f7..21538fb9b7 100644 --- a/app/Jobs/ProcessSubmission.php +++ b/app/Jobs/ProcessSubmission.php @@ -80,7 +80,7 @@ private function requeueSubmissionFile($buildid): bool $response = $client->request('POST', $url, ['query' => [ 'filename' => $this->filename, 'buildid' => $buildid, - 'projectid' => $this->projectid + 'projectid' => $this->projectid, ]]); return $response->getStatusCode() == 200; } else { @@ -140,7 +140,7 @@ public function handle() // Store record for successful job if asynchronously parsing. if (config('queue.default') !== 'sync') { SuccessfulJob::create([ - 'filename' => $this->filename + 'filename' => $this->filename, ]); } } diff --git a/app/Models/AuthToken.php b/app/Models/AuthToken.php index a839e68931..d409ea78a7 100644 --- a/app/Models/AuthToken.php +++ b/app/Models/AuthToken.php @@ -8,13 +8,13 @@ class AuthToken extends Model { - const SCOPE_FULL_ACCESS = 'full_access'; - const SCOPE_SUBMIT_ONLY = 'submit_only'; + public const SCOPE_FULL_ACCESS = 'full_access'; + public const SCOPE_SUBMIT_ONLY = 'submit_only'; // Eloquent requires this since we use a non-default creation date column // and have no updated timestamp column at all. - const CREATED_AT = 'created'; - const UPDATED_AT = null; + public const CREATED_AT = 'created'; + public const UPDATED_AT = null; protected $table = 'authtoken'; @@ -29,6 +29,6 @@ class AuthToken extends Model 'expires', 'description', 'projectid', - 'scope' + 'scope', ]; } diff --git a/app/Models/Banner.php b/app/Models/Banner.php index 3f800a3992..59cdf3cea3 100644 --- a/app/Models/Banner.php +++ b/app/Models/Banner.php @@ -24,6 +24,6 @@ class Banner extends Model protected $fillable = [ 'projectid', - 'text' + 'text', ]; } diff --git a/app/Models/BuildTest.php b/app/Models/BuildTest.php index 769c0ff857..ac3b8db537 100644 --- a/app/Models/BuildTest.php +++ b/app/Models/BuildTest.php @@ -17,7 +17,7 @@ class BuildTest extends Model protected $attributes = [ 'timemean' => 0.0, - 'timestd' => 0.0 + 'timestd' => 0.0, ]; /** @@ -77,7 +77,7 @@ public function GetUrlForSelf(): string */ public static function marshalMissing($name, $buildid, $projectid, $projectshowtesttime, $testtimemaxstatus, $testdate): array { - $data = array(); + $data = []; $data['name'] = $name; $data['status'] = 'missing'; $data['id'] = ''; @@ -100,10 +100,10 @@ public static function marshalMissing($name, $buildid, $projectid, $projectshowt public static function marshalStatus($status): array { - $statuses = array('passed' => array('Passed', 'normal'), - 'failed' => array('Failed', 'error'), - 'notrun' => array('Not Run', 'warning'), - 'missing' => array('Missing', 'missing')); + $statuses = ['passed' => ['Passed', 'normal'], + 'failed' => ['Failed', 'error'], + 'notrun' => ['Not Run', 'warning'], + 'missing' => ['Missing', 'missing']]; return $statuses[$status]; } @@ -113,7 +113,7 @@ public static function marshal($data, $buildid, $projectid, $projectshowtesttime { $marshaledStatus = self::marshalStatus($data['status']); if ($data['details'] === 'Disabled') { - $marshaledStatus = array('Not Run', 'disabled-test'); + $marshaledStatus = ['Not Run', 'disabled-test']; } $marshaledData = [ 'id' => $data['id'], @@ -127,7 +127,7 @@ public static function marshal($data, $buildid, $projectid, $projectshowtesttime 'details' => $data['details'], 'summaryLink' => "testSummary.php?project=$projectid&name=" . urlencode($data['name']) . "&date=$testdate", 'summary' => 'Summary', /* Default value later replaced by AJAX */ - 'detailsLink' => "test/{$data['buildtestid']}" + 'detailsLink' => "test/{$data['buildtestid']}", ]; if ($data['newstatus']) { diff --git a/app/Models/Test.php b/app/Models/Test.php index cca558239d..c682d1f48c 100644 --- a/app/Models/Test.php +++ b/app/Models/Test.php @@ -11,10 +11,10 @@ class Test extends Model public $timestamps = false; - const FAILED = 'failed'; - const PASSED = 'passed'; - const OTHER_FAULT = 'OTHER_FAULT'; - const TIMEOUT = 'Timeout'; - const NOTRUN = 'notrun'; - const DISABLED = 'Disabled'; + public const FAILED = 'failed'; + public const PASSED = 'passed'; + public const OTHER_FAULT = 'OTHER_FAULT'; + public const TIMEOUT = 'Timeout'; + public const NOTRUN = 'notrun'; + public const DISABLED = 'Disabled'; } diff --git a/app/Models/User.php b/app/Models/User.php index e9a0bd32cf..c6401de497 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -31,7 +31,7 @@ class User extends Authenticatable implements MustVerifyEmail * @var array */ protected $fillable = [ - 'firstname', 'lastname', 'email', 'password', 'institution' + 'firstname', 'lastname', 'email', 'password', 'institution', ]; /** diff --git a/app/Services/AuthTokenService.php b/app/Services/AuthTokenService.php index 2cc974e7d2..26ae03c294 100644 --- a/app/Services/AuthTokenService.php +++ b/app/Services/AuthTokenService.php @@ -79,7 +79,7 @@ public static function generateToken(int $user_id, int $project_id, string $scop $auth_token = AuthToken::create($params); return [ 'raw_token' => $token, - 'token' => $auth_token + 'token' => $auth_token, ]; } diff --git a/app/Services/TestCreator.php b/app/Services/TestCreator.php index b1a9a37a36..2f453bbce7 100755 --- a/app/Services/TestCreator.php +++ b/app/Services/TestCreator.php @@ -177,7 +177,7 @@ public function create(Build $build): void } else { DB::insert('INSERT INTO test (projectid, name) VALUES (:projectid, :name)', [ ':projectid' => $this->projectid, - ':name' => $this->testName + ':name' => $this->testName, ]); $testid = DB::getPdo()->lastInsertId(); } diff --git a/app/cdash/app/Controller/Api.php b/app/cdash/app/Controller/Api.php index f9ccb71b0a..bb9b03787a 100644 --- a/app/cdash/app/Controller/Api.php +++ b/app/cdash/app/Controller/Api.php @@ -23,7 +23,7 @@ **/ abstract class Api { - const BEGIN_EPOCH = '1980-01-01 00:00:00'; + public const BEGIN_EPOCH = '1980-01-01 00:00:00'; protected $db; diff --git a/app/cdash/app/Controller/Api/BuildTestApi.php b/app/cdash/app/Controller/Api/BuildTestApi.php index fcbab47599..2e2f46a419 100644 --- a/app/cdash/app/Controller/Api/BuildTestApi.php +++ b/app/cdash/app/Controller/Api/BuildTestApi.php @@ -62,7 +62,7 @@ public function __construct(Database $db, BuildTest $buildtest) ':projectid' => $this->project->Id, ':type' => $this->build->Type, ':buildname' => $this->build->Name, - ':testname' => $this->test->name + ':testname' => $this->test->name, ]; } diff --git a/app/cdash/app/Controller/Api/Index.php b/app/cdash/app/Controller/Api/Index.php index 076bd465c6..314ab7f40b 100644 --- a/app/cdash/app/Controller/Api/Index.php +++ b/app/cdash/app/Controller/Api/Index.php @@ -223,7 +223,7 @@ public function getDynamicBuilds(): array self::BEGIN_EPOCH, $this->endDate, self::BEGIN_EPOCH, - $this->endDate + $this->endDate, ]); foreach ($stmt as $rule) { @@ -1137,7 +1137,7 @@ private function getChildBuildsHyperlink(int $parentid): string // Trim off any filter parameters. Previously we did this step with a simple // strpos check, but since the change to AngularJS query parameters are no // longer guaranteed to appear in any particular order. - $accepted_parameters = array('project', 'parentid', 'subproject'); + $accepted_parameters = ['project', 'parentid', 'subproject']; $parsed_url = parse_url($baseurl); $query = $parsed_url['query']; @@ -1470,14 +1470,14 @@ public function determineNextPrevious(array &$response, string $base_url): void } // Use the project model to get the bounds of the current testing day. - list($beginningOfDay, $endOfDay) = + [$beginningOfDay, $endOfDay] = $this->project->ComputeTestingDayBounds($this->date); // Query the database to find the previous testing day // that has build results. $query_params = [ ':projectid' => $this->project->Id, - ':time' => $beginningOfDay + ':time' => $beginningOfDay, ]; // Only search for builds from a certain group when buildGroupName is set. diff --git a/app/cdash/app/Controller/Api/QueryTests.php b/app/cdash/app/Controller/Api/QueryTests.php index d049b822df..19b12cc07f 100644 --- a/app/cdash/app/Controller/Api/QueryTests.php +++ b/app/cdash/app/Controller/Api/QueryTests.php @@ -210,7 +210,7 @@ public function getResponse() get_dashboard_JSON_by_name($this->project->Name, $this->date, $response); - list($previousdate, $currentstarttime, $nextdate) = + [$previousdate, $currentstarttime, $nextdate] = get_dates($this->date, $this->project->NightlyTime); // Filters diff --git a/app/cdash/app/Controller/Api/ResultsApi.php b/app/cdash/app/Controller/Api/ResultsApi.php index 8abe8d640b..69e1efc3a2 100644 --- a/app/cdash/app/Controller/Api/ResultsApi.php +++ b/app/cdash/app/Controller/Api/ResultsApi.php @@ -90,7 +90,7 @@ public function validateDateString($date) public function setDate($date) { $this->project->Fill(); - list($previousdate, $beginning_timestamp, $nextdate, $d) = + [$previousdate, $beginning_timestamp, $nextdate, $d] = get_dates($date, $this->project->NightlyTime); if (is_null($date)) { $date = $d; @@ -124,7 +124,7 @@ public function determineDateRange(&$response) if ($begin && $end) { // Honor 'begin' & 'end' parameters to specify a range of dates. // Compute a date range if both arguments were specified. - list($unused, $beginning_timestamp) = + [$unused, $beginning_timestamp] = get_dates($begin, $this->project->NightlyTime); $this->currentStartTime = $beginning_timestamp; $this->beginDate = gmdate(FMT_DATETIME, $beginning_timestamp); @@ -132,7 +132,7 @@ public function determineDateRange(&$response) $this->date = $end; $response['end'] = $this->date; - list($previousdate, $end_timestamp, $nextdate) = + [$previousdate, $end_timestamp, $nextdate] = get_dates($this->date, $this->project->NightlyTime); $this->previousDate = $previousdate; $this->nextDate = $nextdate; diff --git a/app/cdash/app/Controller/Api/TestDetails.php b/app/cdash/app/Controller/Api/TestDetails.php index 3f87b8fdad..8aed810992 100644 --- a/app/cdash/app/Controller/Api/TestDetails.php +++ b/app/cdash/app/Controller/Api/TestDetails.php @@ -157,7 +157,7 @@ public function getResponse() 'priorrevision' => '', 'path' => '', 'revisionurl' => '', - 'revisiondiff' => '' + 'revisiondiff' => '', ]; $stmt = $this->db->prepare( 'SELECT status, revision, priorrevision, path diff --git a/app/cdash/app/Controller/Api/TestGraph.php b/app/cdash/app/Controller/Api/TestGraph.php index eaa1ab7149..9d1ed402a5 100644 --- a/app/cdash/app/Controller/Api/TestGraph.php +++ b/app/cdash/app/Controller/Api/TestGraph.php @@ -48,22 +48,22 @@ public function getResponse() $this->testHistoryQueryExtraColumns = ', b2t.time, b2t.timemean, b2t.timestd'; $chart_data[] = [ 'label' => 'Execution Time (seconds)', - 'data' => [] + 'data' => [], ]; $chart_data[] = [ 'label' => 'Acceptable Range', - 'data' => [] + 'data' => [], ]; break; case 'status': $this->testHistoryQueryExtraColumns = ', b2t.status'; $chart_data[] = [ 'label' => 'Passed', - 'data' => [] + 'data' => [], ]; $chart_data[] = [ 'label' => 'Failed', - 'data' => [] + 'data' => [], ]; break; case 'measurement': @@ -73,7 +73,7 @@ public function getResponse() } $chart_data[] = [ 'label' => $measurement_name, - 'data' => [] + 'data' => [], ]; $this->testHistoryQueryExtraColumns = ', tm.value'; $this->testHistoryQueryExtraJoins = 'JOIN testmeasurement tm ON (b2t.outputid = tm.outputid)'; diff --git a/app/cdash/app/Controller/Api/Timeline.php b/app/cdash/app/Controller/Api/Timeline.php index b0c04af9e2..e5200f7a8b 100644 --- a/app/cdash/app/Controller/Api/Timeline.php +++ b/app/cdash/app/Controller/Api/Timeline.php @@ -40,9 +40,9 @@ class Timeline extends Index // in Javascript. private $timeToDate; - const ERROR = 0; - const FAILURE = 1; - const CLEAN = 2; + public const ERROR = 0; + public const FAILURE = 1; + public const CLEAN = 2; public function __construct(Database $db, Project $project) { @@ -133,7 +133,7 @@ private function chartForIndex() [ 'name' => 'testfailed', 'prettyname' => 'Test Failures', - ] + ], ]; // Query for defects on expected builds only. @@ -155,7 +155,7 @@ private function chartForIndex() $response['colors'] = [ $this->colors[self::CLEAN], $this->colors[self::FAILURE], - $this->colors[self::ERROR] + $this->colors[self::ERROR], ]; return $response; } @@ -174,7 +174,7 @@ private function chartForTestOverview() [ 'name' => 'testpassed', 'prettyname' => 'Passing Tests', - ] + ], ]; $stmt = $this->db->prepare(" @@ -191,7 +191,7 @@ private function chartForTestOverview() $response['colors'] = [ $this->colors[self::CLEAN], $this->colors[self::FAILURE], - $this->colors[self::ERROR] + $this->colors[self::ERROR], ]; return $response; } @@ -215,12 +215,12 @@ private function chartForBuildGroup() [ 'name' => 'testfailed', 'prettyname' => 'Test Failures', - ] + ], ]; $colors = [ $this->colors[self::CLEAN], $this->colors[self::FAILURE], - $this->colors[self::ERROR] + $this->colors[self::ERROR], ]; $group_type = $buildgroup->GetType(); @@ -239,7 +239,7 @@ private function chartForBuildGroup() ORDER BY starttime'); $query_params = [ ':projectid' => $this->project->Id, - ':buildgroupname' => $groupname + ':buildgroupname' => $groupname, ]; if (!pdo_execute($stmt, $query_params)) { abort(500, 'Failed to load results'); @@ -289,7 +289,7 @@ private function chartForBuildGroup() $error_types = [ 'countbuilderrors', 'countconfigureerrors', - 'countupdateerrors' + 'countupdateerrors', ]; $build['errors'] = 0; foreach ($error_types as $error_type) { @@ -322,7 +322,7 @@ private function getTimelineChartData($builds) // Use this build's starttime to get the beginning of the appropriate // testing day. $test_date = TestingDay::get($this->project, $build['starttime']); - list($unused, $start_of_day) = + [$unused, $start_of_day] = get_dates($test_date, $this->project->NightlyTime); // Convert timestamp to milliseconds for our JS charting library. @@ -359,9 +359,9 @@ private function getTimelineChartData($builds) // Determine the range of the chart that should be selected by default. // This is referred to as the extent. - list($unused, $begin_extent) = get_dates($this->beginDate, $this->project->NightlyTime); + [$unused, $begin_extent] = get_dates($this->beginDate, $this->project->NightlyTime); $begin_extent *= 1000; - list($unused, $end_extent) = get_dates($this->endDate, $this->project->NightlyTime); + [$unused, $end_extent] = get_dates($this->endDate, $this->project->NightlyTime); $end_extent *= 1000; if ($begin_extent > $end_extent) { $begin_extent = $end_extent; @@ -392,7 +392,7 @@ private function getTimelineChartData($builds) new \DateTime($this->timeToDate[$newest_time_ms])); foreach ($period as $datetime) { $date = $datetime->format('Y-m-d'); - list($unused, $start_of_day) = get_dates($date, $this->project->NightlyTime); + [$unused, $start_of_day] = get_dates($date, $this->project->NightlyTime); $start_of_day_ms = $start_of_day * 1000; $this->initializeDate($start_of_day_ms, $date); } @@ -409,7 +409,7 @@ private function getTimelineChartData($builds) foreach ($this->defectTypes as $defect_type) { $chart_keys[] = [ 'name' => $defect_type['name'], - 'prettyname' => $defect_type['prettyname'] + 'prettyname' => $defect_type['prettyname'], ]; } if ($this->includeCleanBuilds) { diff --git a/app/cdash/app/Controller/Api/ViewTest.php b/app/cdash/app/Controller/Api/ViewTest.php index 9da879e6c9..1dcb0cf31d 100644 --- a/app/cdash/app/Controller/Api/ViewTest.php +++ b/app/cdash/app/Controller/Api/ViewTest.php @@ -369,7 +369,7 @@ public function getResponse() // Gather date information. $testdate = $this->date; - list($previousdate, $currentstarttime, $nextdate, $today) = + [$previousdate, $currentstarttime, $nextdate, $today] = get_dates($this->date, $this->project->NightlyTime); $beginning_timestamp = $currentstarttime; $end_timestamp = $currentstarttime + 3600 * 24; @@ -634,7 +634,7 @@ private function exportAsCsv($etestquery, $etest, $stmt, $projectshowtesttime, $ $csv_contents = []; // Standard columns. - $csv_headers = array('Name', 'Time' ,'Details' , 'Status'); + $csv_headers = ['Name', 'Time','Details', 'Status']; if ($projectshowtesttime) { $csv_headers[] = 'Time Status'; } diff --git a/app/cdash/app/Controller/Auth/Session.php b/app/cdash/app/Controller/Auth/Session.php index 429637ccd9..2857374931 100644 --- a/app/cdash/app/Controller/Auth/Session.php +++ b/app/cdash/app/Controller/Auth/Session.php @@ -23,8 +23,8 @@ */ class Session { - const EXTEND_GC_LIFETIME = 600; - const CACHE_NOCACHE = 'nocache'; + public const EXTEND_GC_LIFETIME = 600; + public const CACHE_NOCACHE = 'nocache'; private $system; diff --git a/app/cdash/app/Lib/Repository/GitHub.php b/app/cdash/app/Lib/Repository/GitHub.php index 3b0e50aac5..b8c9522f07 100644 --- a/app/cdash/app/Lib/Repository/GitHub.php +++ b/app/cdash/app/Lib/Repository/GitHub.php @@ -38,7 +38,7 @@ */ class GitHub implements RepositoryInterface { - const BASE_URI = 'https://api.github.com'; + public const BASE_URI = 'https://api.github.com'; /** @var string $installationId */ private $installationId; @@ -334,7 +334,7 @@ public function generateCheckPayloadFromBuildRows($build_rows, $head_sha) 'head_sha' => $head_sha, 'details_url' => $summary_url, 'started_at' => $now, - 'status' => 'in_progress' + 'status' => 'in_progress', ]; // Populate payload with build results. @@ -505,7 +505,7 @@ public function compareCommits(BuildUpdate $update) $memcache_enabled = $this->config->get('CDASH_MEMECACHE_ENABLED'); $memcache_prefix = $this->config->get('CDASH_MEMCACHE_PREFIX'); if ($memcache_enabled) { - list($server, $port) = $this->config->get('CDASH_MEMCACHE_SERVER'); + [$server, $port] = $this->config->get('CDASH_MEMCACHE_SERVER'); $memcache = cdash_memcache_connect($server, $port); // Disable memcache for this request if it fails to connect. if ($memcache === false) { @@ -637,7 +637,7 @@ public function compareCommits(BuildUpdate $update) if (!is_array($commit_array) || !array_key_exists('files', $commit_array)) { // Skip to the next commit if no list of files was returned. - $cached_commits[$sha] = array(); + $cached_commits[$sha] = []; continue; } diff --git a/app/cdash/app/Middleware/OAuth2.php b/app/cdash/app/Middleware/OAuth2.php index c6010a1d46..17c706bd6a 100644 --- a/app/cdash/app/Middleware/OAuth2.php +++ b/app/cdash/app/Middleware/OAuth2.php @@ -176,7 +176,7 @@ public function getEmail() if (!$this->Email) { $details = $this->getOwnerDetails(); $email = (object)[ - 'email' => strtolower($details->getEmail()) + 'email' => strtolower($details->getEmail()), ]; $this->Email = collect([$email]); } diff --git a/app/cdash/app/Middleware/OAuth2/GitHub.php b/app/cdash/app/Middleware/OAuth2/GitHub.php index 7113c726c8..11792ab099 100644 --- a/app/cdash/app/Middleware/OAuth2/GitHub.php +++ b/app/cdash/app/Middleware/OAuth2/GitHub.php @@ -27,8 +27,8 @@ */ class GitHub extends OAuth2 { - const AUTH_REQUEST_METHOD = 'GET'; - const AUTH_REQUEST_URI = 'https://api.github.com/user/emails'; + public const AUTH_REQUEST_METHOD = 'GET'; + public const AUTH_REQUEST_URI = 'https://api.github.com/user/emails'; /** * GitHub constructor diff --git a/app/cdash/app/Model/ActionableTypes.php b/app/cdash/app/Model/ActionableTypes.php index 7e5441253b..8c03bd0b91 100644 --- a/app/cdash/app/Model/ActionableTypes.php +++ b/app/cdash/app/Model/ActionableTypes.php @@ -11,19 +11,19 @@ */ class ActionableTypes { - const BUILD_ERROR = 'BuildError'; - const BUILD_WARNING = 'BuildWarning'; - const CONFIGURE = 'Configure'; - const DYNAMIC_ANALYSIS = 'DynamicAnalysis'; - const TEST = 'TestFailure'; - const UPDATE = 'UpdateError'; + public const BUILD_ERROR = 'BuildError'; + public const BUILD_WARNING = 'BuildWarning'; + public const CONFIGURE = 'Configure'; + public const DYNAMIC_ANALYSIS = 'DynamicAnalysis'; + public const TEST = 'TestFailure'; + public const UPDATE = 'UpdateError'; - const UPDATE_FIX = 'UpdateFix'; - const BUILD_WARNING_FIX = 'BuildWarningFix'; - const BUILD_ERROR_FIX = 'BuildErrorFix'; - const CONFIGURE_FIX = 'ConfigureFix'; - const TEST_FIX = 'TestFix'; - const MISSING_TEST = 'TestMissing'; + public const UPDATE_FIX = 'UpdateFix'; + public const BUILD_WARNING_FIX = 'BuildWarningFix'; + public const BUILD_ERROR_FIX = 'BuildErrorFix'; + public const CONFIGURE_FIX = 'ConfigureFix'; + public const TEST_FIX = 'TestFix'; + public const MISSING_TEST = 'TestMissing'; public static $categories = [ self::UPDATE => 1, diff --git a/app/cdash/app/Model/Build.php b/app/cdash/app/Model/Build.php index be6f0612f1..129f3f9f27 100644 --- a/app/cdash/app/Model/Build.php +++ b/app/cdash/app/Model/Build.php @@ -31,12 +31,12 @@ class Build { - const TYPE_ERROR = 0; - const TYPE_WARN = 1; - const STATUS_NEW = 1; + public const TYPE_ERROR = 0; + public const TYPE_WARN = 1; + public const STATUS_NEW = 1; - const PARENT_BUILD = -1; - const STANDALONE_BUILD = 0; + public const PARENT_BUILD = -1; + public const STANDALONE_BUILD = 0; public $Id; public $SiteId; @@ -276,7 +276,7 @@ public function SaveTotalTestsTime($update_parent = true) // tests. $total_proc_time = 0.0; foreach ($this->TestCollection as $test) { - $exec_time = (double)$test->time; + $exec_time = (float)$test->time; $num_procs = 1.0; foreach ($test->measurements as $measurement) { if ($measurement->name == 'Processors') { @@ -2425,7 +2425,7 @@ public function ComputeTestingDayBounds() $build_date = $this->GetDate(); $this->GetProject()->Fill(); - list($this->BeginningOfDay, $this->EndOfDay) = + [$this->BeginningOfDay, $this->EndOfDay] = $this->Project->ComputeTestingDayBounds($build_date); return true; } @@ -2643,7 +2643,7 @@ public function AddBuild($nbuilderrors = -1, $nbuildwarnings = -1) 'buildwarnings' => $nbuildwarnings, 'parentid' => $this->ParentId, 'uuid' => $this->Uuid, - 'changeid' => $this->PullRequest + 'changeid' => $this->PullRequest, ]); $build_created = true; $this->Id = $new_id; @@ -3083,7 +3083,7 @@ public function GetDiffWithPreviousBuild() 'Configure' => [ 'errors' => ($this->BuildConfigure ? $this->BuildConfigure->NumberOfErrors : 0), 'warnings' => ($this->BuildConfigure ? $this->BuildConfigure->NumberOfWarnings : 0), - ] , + ], 'TestFailure' => [ 'passed' => [ 'new' => $passed, @@ -3113,11 +3113,11 @@ public function GetDiffWithPreviousBuild() 'Configure' => [ 'errors' => $diff['configureerrors'], 'warnings' => $diff['configurewarnings'], - ] , + ], 'TestFailure' => [ 'passed' => [ 'new' => $diff['testpassedpositive'], - 'broken' => $diff['testpassednegative'] + 'broken' => $diff['testpassednegative'], ], 'failed' => [ 'new' => $diff['testfailedpositive'], @@ -3125,7 +3125,7 @@ public function GetDiffWithPreviousBuild() ], 'notrun' => [ 'new' => $diff['testnotrunpositive'], - 'fixed' => $diff['testnotrunnegative'] + 'fixed' => $diff['testnotrunnegative'], ], ], ]; diff --git a/app/cdash/app/Model/BuildConfigure.php b/app/cdash/app/Model/BuildConfigure.php index 6002c52bf2..172f0fc057 100644 --- a/app/cdash/app/Model/BuildConfigure.php +++ b/app/cdash/app/Model/BuildConfigure.php @@ -346,13 +346,13 @@ public function ComputeErrors() public static function marshal($data) { - $response = array( + $response = [ 'status' => $data['status'], 'command' => $data['command'], 'output' => $data['log'], 'configureerrors' => $data['configureerrors'], - 'configurewarnings' => $data['configurewarnings'] - ); + 'configurewarnings' => $data['configurewarnings'], + ]; if (isset($data['subprojectid'])) { $response['subprojectid'] = $data['subprojectid']; diff --git a/app/cdash/app/Model/BuildError.php b/app/cdash/app/Model/BuildError.php index 96881e241a..bec82fccc7 100644 --- a/app/cdash/app/Model/BuildError.php +++ b/app/cdash/app/Model/BuildError.php @@ -88,7 +88,7 @@ public function Insert(): bool $this->PreContext, $this->PostContext, intval($this->RepeatCount), - $crc32 + $crc32, ]); if ($query === false) { add_last_sql_error('BuildError Insert', 0, $this->BuildId); @@ -148,21 +148,21 @@ public static function marshal($data, Project $project, $revision, BuildError $b // Sets up access to $file and $directory extract($builderror->GetSourceFile($data)); - $marshaled = array( + $marshaled = [ 'new' => (isset($data['newstatus'])) ? $data['newstatus'] : -1, 'logline' => $data['logline'], - 'cvsurl' => get_diff_url($project->Id, $project->CvsUrl, $directory, $file, $revision) - ); + 'cvsurl' => get_diff_url($project->Id, $project->CvsUrl, $directory, $file, $revision), + ]; // When building without launchers, CTest truncates the source dir to // /...//. Use this pattern to linkify compiler output. $source_dir = "/\.\.\./[^/]+"; - $marshaled = array_merge($marshaled, array( + $marshaled = array_merge($marshaled, [ 'precontext' => linkify_compiler_output($project->CvsUrl, $source_dir, $revision, $data['precontext']), 'text' => linkify_compiler_output($project->CvsUrl, $source_dir, $revision, $data['text']), 'postcontext' => linkify_compiler_output($project->CvsUrl, $source_dir, $revision, $data['postcontext']), 'sourcefile' => $data['sourcefile'], - 'sourceline' => $data['sourceline'])); + 'sourceline' => $data['sourceline']]); if (isset($data['subprojectid'])) { $marshaled['subprojectid'] = $data['subprojectid']; diff --git a/app/cdash/app/Model/BuildErrorFilter.php b/app/cdash/app/Model/BuildErrorFilter.php index bb0c4a9491..9938eab0ec 100644 --- a/app/cdash/app/Model/BuildErrorFilter.php +++ b/app/cdash/app/Model/BuildErrorFilter.php @@ -63,7 +63,7 @@ public function AddOrUpdateFilters($warnings, $errors) $query_params = [ ':errors' => $errors, ':projectid' => $this->Project->Id, - ':warnings' => $warnings + ':warnings' => $warnings, ]; if ($this->PDO->execute($stmt, $query_params)) { $this->Fill(); diff --git a/app/cdash/app/Model/BuildFailure.php b/app/cdash/app/Model/BuildFailure.php index 1d9a51bbd3..3c4afd2502 100644 --- a/app/cdash/app/Model/BuildFailure.php +++ b/app/cdash/app/Model/BuildFailure.php @@ -126,7 +126,7 @@ public function Insert(): bool $targetName, $outputFile, $outputType, - $crc32 + $crc32, ]); if ($query === false) { add_last_sql_error('BuildFailure InsertDetails', 0, $this->BuildId); @@ -153,7 +153,7 @@ public function Insert(): bool $id = pdo_insert_id('buildfailure'); // Insert the arguments - $argumentids = array(); + $argumentids = []; foreach ($this->Arguments as $argument) { // Limit the argument to 255 @@ -248,7 +248,7 @@ public function GetBuildFailureArguments($buildFailureId): array { $response = [ 'argumentfirst' => null, - 'arguments' => [] + 'arguments' => [], ]; $sql = " @@ -284,15 +284,15 @@ public static function marshal($data, Project $project, $revision, $linkifyOutpu { deepEncodeHTMLEntities($data); - $marshaled = array_merge(array( + $marshaled = array_merge([ 'language' => $data['language'], 'sourcefile' => $data['sourcefile'], 'targetname' => $data['targetname'], 'outputfile' => $data['outputfile'], 'outputtype' => $data['outputtype'], 'workingdirectory' => $data['workingdirectory'], - 'exitcondition' => $data['exitcondition'] - ), $buildfailure->GetBuildFailureArguments($data['id'])); + 'exitcondition' => $data['exitcondition'], + ], $buildfailure->GetBuildFailureArguments($data['id'])); $marshaled['stderror'] = $data['stderror']; $marshaled['stdoutput'] = $data['stdoutput']; diff --git a/app/cdash/app/Model/BuildGroup.php b/app/cdash/app/Model/BuildGroup.php index cd17b80a4a..5afdabdf9a 100644 --- a/app/cdash/app/Model/BuildGroup.php +++ b/app/cdash/app/Model/BuildGroup.php @@ -21,8 +21,8 @@ class BuildGroup { - const NIGHTLY = 'Nightly'; - const EXPERIMENTAL = 'Experimental'; + public const NIGHTLY = 'Nightly'; + public const EXPERIMENTAL = 'Experimental'; private $Id; private $ProjectId; @@ -411,7 +411,7 @@ public function Save(): bool $this->IncludeSubProjectTotal, $this->EmailCommitters, $this->Type, - $this->Id + $this->Id, ]); if ($query === false) { @@ -435,7 +435,7 @@ public function Save(): bool $this->SummaryEmail, $this->IncludeSubProjectTotal, $this->EmailCommitters, - $this->Type + $this->Type, ]); $prepared_array = $this->PDO->createPreparedArray(count($values)); diff --git a/app/cdash/app/Model/BuildGroupRule.php b/app/cdash/app/Model/BuildGroupRule.php index c650230da9..d9b7c8395c 100644 --- a/app/cdash/app/Model/BuildGroupRule.php +++ b/app/cdash/app/Model/BuildGroupRule.php @@ -76,7 +76,7 @@ public function Exists() ':buildtype' => $this->BuildType, ':buildname' => $this->BuildName, ':siteid' => $this->SiteId, - ':endtime' => $this->EndTime + ':endtime' => $this->EndTime, ]; $this->PDO->execute($stmt, $query_params); @@ -110,7 +110,7 @@ public function Save() ':siteid' => $this->SiteId, ':expected' => $this->Expected, ':starttime' => $this->StartTime, - ':endtime' => $this->EndTime + ':endtime' => $this->EndTime, ]; return $this->PDO->execute($stmt, $query_params); } @@ -188,7 +188,7 @@ private function SoftDelete() ':buildtype' => $this->BuildType, ':buildname' => $this->BuildName, ':siteid' => $this->SiteId, - ':begin_epoch' => '1980-01-01 00:00:00' + ':begin_epoch' => '1980-01-01 00:00:00', ]; return $this->PDO->execute($stmt, $query_params); } @@ -214,7 +214,7 @@ private function HardDelete() ':siteid' => $this->SiteId, ':expected' => $this->Expected, ':starttime' => $this->StartTime, - ':endtime' => $this->EndTime + ':endtime' => $this->EndTime, ]; return $this->PDO->execute($stmt, $query_params); } @@ -281,7 +281,7 @@ public static function DeleteExpiredRulesForProject($projectid, $cutoff_date) AND endtime < :endtime"); $query_params = [ ':projectid' => $projectid, - ':endtime' => $cutoff_date + ':endtime' => $cutoff_date, ]; $db->execute($stmt, $query_params); } diff --git a/app/cdash/app/Model/BuildProperties.php b/app/cdash/app/Model/BuildProperties.php index 4f68aa327c..d626ae7af7 100644 --- a/app/cdash/app/Model/BuildProperties.php +++ b/app/cdash/app/Model/BuildProperties.php @@ -77,7 +77,7 @@ public function Save() VALUES (:buildid, :properties)'); $query_params = [ ':buildid' => $this->Build->Id, - ':properties' => $properties_str + ':properties' => $properties_str, ]; return $this->PDO->execute($stmt, $query_params); } diff --git a/app/cdash/app/Model/BuildRelationship.php b/app/cdash/app/Model/BuildRelationship.php index 2897f860d0..57d89cb9c1 100644 --- a/app/cdash/app/Model/BuildRelationship.php +++ b/app/cdash/app/Model/BuildRelationship.php @@ -175,7 +175,7 @@ public function marshal() return [ 'buildid' => $this->Build->Id, 'relatedid' => $this->RelatedBuild->Id, - 'relationship' => $this->Relationship + 'relationship' => $this->Relationship, ]; } diff --git a/app/cdash/app/Model/BuildUpdate.php b/app/cdash/app/Model/BuildUpdate.php index 909234750a..224e71a12f 100644 --- a/app/cdash/app/Model/BuildUpdate.php +++ b/app/cdash/app/Model/BuildUpdate.php @@ -39,7 +39,7 @@ class BuildUpdate public function __construct() { - $this->Files = array(); + $this->Files = []; $this->Command = ''; $this->Append = false; $this->PDO = Database::getInstance()->getPdo(); diff --git a/app/cdash/app/Model/BuildUpdateFile.php b/app/cdash/app/Model/BuildUpdateFile.php index b5780b76b7..57c2266bbe 100644 --- a/app/cdash/app/Model/BuildUpdateFile.php +++ b/app/cdash/app/Model/BuildUpdateFile.php @@ -79,7 +79,7 @@ public function Insert(): bool $this->PriorRevision ?? '', $this->Status ?? '', $this->Committer ?? '', - $this->CommitterEmail ?? '' + $this->CommitterEmail ?? '', ]); if ($query === false) { diff --git a/app/cdash/app/Model/BuildUserNote.php b/app/cdash/app/Model/BuildUserNote.php index 04df44f2c4..a2fa1c25ef 100644 --- a/app/cdash/app/Model/BuildUserNote.php +++ b/app/cdash/app/Model/BuildUserNote.php @@ -85,7 +85,7 @@ public function Insert() public function marshal() { $pdo = get_link_identifier()->getPdo(); - $marshaledNote = array(); + $marshaledNote = []; $user = User::find($this->UserId); $marshaledNote['user'] = $user->full_name; @@ -122,7 +122,7 @@ public static function getNotesForBuild($buildid) 'SELECT * FROM buildnote WHERE buildid=? ORDER BY timestamp ASC'); pdo_execute($stmt, [$buildid]); - $notes = array(); + $notes = []; while ($row = $stmt->fetch()) { $note = new BuildUserNote(); $note->BuildId = $buildid; diff --git a/app/cdash/app/Model/Coverage.php b/app/cdash/app/Model/Coverage.php index f23aa26c0b..8e488026b3 100644 --- a/app/cdash/app/Model/Coverage.php +++ b/app/cdash/app/Model/Coverage.php @@ -40,7 +40,7 @@ class Coverage public function AddLabel($label) { if (!isset($this->Labels)) { - $this->Labels = array(); + $this->Labels = []; } $label->CoverageFileId = $this->CoverageFile->Id; diff --git a/app/cdash/app/Model/CoverageFileLog.php b/app/cdash/app/Model/CoverageFileLog.php index 4a6933f347..a605bae3d0 100644 --- a/app/cdash/app/Model/CoverageFileLog.php +++ b/app/cdash/app/Model/CoverageFileLog.php @@ -91,7 +91,7 @@ public function Insert($append = false) ->insert([ 'buildid' => $this->BuildId, 'fileid' => $this->FileId, - 'log' => $log + 'log' => $log, ]); } } @@ -133,7 +133,7 @@ public function Load($for_update = false) if (empty($log_entry)) { continue; } - list($line, $value) = explode(':', $log_entry); + [$line, $value] = explode(':', $log_entry); if (is_numeric($line)) { $lines_retrieved[] = intval($line); } else { @@ -159,11 +159,11 @@ public function Load($for_update = false) if (empty($log_entry)) { continue; } - list($line, $value) = explode(':', $log_entry); + [$line, $value] = explode(':', $log_entry); if ($line[0] === 'b') { // Branch coverage $line = ltrim($line, 'b'); - list($covered, $total) = explode('/', $value); + [$covered, $total] = explode('/', $value); $this->AddBranch($line, $covered, $total); } else { // Line coverage @@ -196,7 +196,7 @@ public function GetStats() } foreach ($this->Branches as $line => $value) { - list($timesHit, $total) = explode('/', $value); + [$timesHit, $total] = explode('/', $value); $stats['branchestested'] += $timesHit; $stats['branchesuntested'] += ($total - $timesHit); } @@ -237,7 +237,7 @@ public function UpdateAggregate() ', [ intval($this->AggregateBuildId), intval($this->Build->ProjectId), - intval($this->Build->SubProjectId) + intval($this->Build->SubProjectId), ]); if (!$row || !array_key_exists('id', $row)) { // An aggregate build for this SubProject doesn't exist yet. diff --git a/app/cdash/app/Model/CoverageSummary.php b/app/cdash/app/Model/CoverageSummary.php index d465c9395f..36763fd6d8 100644 --- a/app/cdash/app/Model/CoverageSummary.php +++ b/app/cdash/app/Model/CoverageSummary.php @@ -31,7 +31,7 @@ class CoverageSummary public function __construct() { - $this->Coverages = array(); + $this->Coverages = []; } public function AddCoverage($coverage): void diff --git a/app/cdash/app/Model/DailyUpdateFile.php b/app/cdash/app/Model/DailyUpdateFile.php index a4f01b189c..5101db285a 100644 --- a/app/cdash/app/Model/DailyUpdateFile.php +++ b/app/cdash/app/Model/DailyUpdateFile.php @@ -88,7 +88,7 @@ public function Save(): bool $this->Revision, $this->PriorRevision, $this->DailyUpdateId, - $this->Filename + $this->Filename, ]); if ($query === false) { @@ -114,7 +114,7 @@ public function Save(): bool $this->Author, $this->Log, $this->Revision, - $this->PriorRevision + $this->PriorRevision, ]); if ($query === false) { diff --git a/app/cdash/app/Model/DynamicAnalysis.php b/app/cdash/app/Model/DynamicAnalysis.php index 78fbd8df20..b0144a1b01 100644 --- a/app/cdash/app/Model/DynamicAnalysis.php +++ b/app/cdash/app/Model/DynamicAnalysis.php @@ -20,9 +20,9 @@ class DynamicAnalysis { - const PASSED = 'passed'; - const FAILED = 'failed'; - const NOTRUN = 'notrun'; + public const PASSED = 'passed'; + public const FAILED = 'failed'; + public const NOTRUN = 'notrun'; public $Id; public $Status; @@ -167,7 +167,7 @@ public function Insert() // Handle log decoding/decompression if (strtolower($this->LogEncoding ?? '') == 'base64') { - $this->Log = str_replace(array("\r\n", "\n", "\r"), '', $this->Log); + $this->Log = str_replace(["\r\n", "\n", "\r"], '', $this->Log); $this->Log = base64_decode($this->Log); } if (strtolower($this->LogCompression ?? '') == 'gzip') { @@ -199,12 +199,12 @@ public function Insert() $this->Log .= $truncated_msg; } - $this->Status = $this->Status ?? ''; - $this->Checker = $this->Checker ?? ''; - $this->Name = $this->Name ?? ''; + $this->Status ??= ''; + $this->Checker ??= ''; + $this->Name ??= ''; $path = substr($this->Path, 0, 255); $fullCommandLine = substr($this->FullCommandLine, 0, 255); - $this->Log = $this->Log ?? ''; + $this->Log ??= ''; $this->BuildId = intval($this->BuildId); $db = Database::getInstance(); @@ -237,7 +237,7 @@ public function Insert() $this->Name, $path, $fullCommandLine, - $this->Log + $this->Log, ])); if ($query === false) { diff --git a/app/cdash/app/Model/LabelEmail.php b/app/cdash/app/Model/LabelEmail.php index 1026e67afb..6152095e04 100644 --- a/app/cdash/app/Model/LabelEmail.php +++ b/app/cdash/app/Model/LabelEmail.php @@ -136,7 +136,7 @@ public function GetLabels(): array|false return false; } - $labelids = array(); + $labelids = []; foreach ($labels as $labels_array) { $labelids[] = intval($labels_array['labelid']); } diff --git a/app/cdash/app/Model/ModelType.php b/app/cdash/app/Model/ModelType.php index 285f731faf..1ce4b69d29 100644 --- a/app/cdash/app/Model/ModelType.php +++ b/app/cdash/app/Model/ModelType.php @@ -16,12 +16,12 @@ class ModelType { - const PROJECT = 1; - const BUILD = 2; - const UPDATE = 3; - const CONFIGURE = 4; - const TEST = 5; - const COVERAGE = 6; - const DYNAMICANALYSIS = 7; - const USER = 8; + public const PROJECT = 1; + public const BUILD = 2; + public const UPDATE = 3; + public const CONFIGURE = 4; + public const TEST = 5; + public const COVERAGE = 6; + public const DYNAMICANALYSIS = 7; + public const USER = 8; } diff --git a/app/cdash/app/Model/Project.php b/app/cdash/app/Model/Project.php index 639d3fc797..cf1d1b2ce8 100644 --- a/app/cdash/app/Model/Project.php +++ b/app/cdash/app/Model/Project.php @@ -37,13 +37,13 @@ /** Main project class */ class Project { - const PROJECT_ADMIN = 2; - const SITE_MAINTAINER = 1; - const PROJECT_USER = 0; + public const PROJECT_ADMIN = 2; + public const SITE_MAINTAINER = 1; + public const PROJECT_USER = 0; - const ACCESS_PRIVATE = 0; - const ACCESS_PUBLIC = 1; - const ACCESS_PROTECTED = 2; + public const ACCESS_PRIVATE = 0; + public const ACCESS_PUBLIC = 1; + public const ACCESS_PROTECTED = 2; public $Name; public $Id; @@ -548,7 +548,7 @@ public function AddRepositories($repositories, $usernames, $passwords, $branches } DB::table('project2repositories')->insert([ 'projectid' => (int) $this->Id, - 'repositoryid' => $repositoryid + 'repositoryid' => $repositoryid, ]); } } @@ -1064,7 +1064,7 @@ public function GetLabels($days): array|false intval($this->Id), $today, intval($this->Id), - $today + $today, ]); $labelids = []; @@ -1454,7 +1454,7 @@ public function UpdateBuildFilters(): bool */ public function ComputeTestingDayBounds($date): array { - list($unused, $beginning_timestamp) = get_dates($date, $this->NightlyTime); + [$unused, $beginning_timestamp] = get_dates($date, $this->NightlyTime); $datetime = new \DateTime(); $datetime->setTimeStamp($beginning_timestamp); diff --git a/app/cdash/app/Model/Repository.php b/app/cdash/app/Model/Repository.php index 8ce55af879..a8f865705d 100644 --- a/app/cdash/app/Model/Repository.php +++ b/app/cdash/app/Model/Repository.php @@ -20,29 +20,29 @@ class Repository { - const CVS = 0; - const SVN = 1; + public const CVS = 0; + public const SVN = 1; - const VIEWER_CGIT = 'CGit'; - const VIEWER_CVSTRAC = 'CVSTrac'; - const VIEWER_FISHEYE = 'Fisheye'; - const VIEWER_GITHUB = 'GitHub'; - const VIEWER_GITLAB = 'GitLab'; - const VIEWER_GITORIOUS = 'Gitorious'; - const VIEWER_GITWEB = 'GitWeb'; - const VIEWER_GITWEB2 = 'GitWeb2'; - const VIEWER_HGWEB = 'Hgweb'; - const VIEWER_STASH = 'Atlassian Stash'; - const VIEWER_LOGGERHEAD = 'Loggerhead'; - const VIEWER_P4WEB = 'P4Web'; - const VIEWER_PHAB_GIT = 'Phabricator'; - const VIEWER_REDMINE = 'Redmine'; - const VIEWER_ALLURA = 'SourceForge Allura'; - const VIEWER_TRAC = 'Trac'; - const VIEWER_VIEWCVS = 'ViewCVS'; - const VIEWER_VIEWVC = 'ViewVC'; - const VIEWER_VIEWVC_1_1 = 'ViewVC1.1'; - const VIEWER_WEBSVN = 'WebSVN'; + public const VIEWER_CGIT = 'CGit'; + public const VIEWER_CVSTRAC = 'CVSTrac'; + public const VIEWER_FISHEYE = 'Fisheye'; + public const VIEWER_GITHUB = 'GitHub'; + public const VIEWER_GITLAB = 'GitLab'; + public const VIEWER_GITORIOUS = 'Gitorious'; + public const VIEWER_GITWEB = 'GitWeb'; + public const VIEWER_GITWEB2 = 'GitWeb2'; + public const VIEWER_HGWEB = 'Hgweb'; + public const VIEWER_STASH = 'Atlassian Stash'; + public const VIEWER_LOGGERHEAD = 'Loggerhead'; + public const VIEWER_P4WEB = 'P4Web'; + public const VIEWER_PHAB_GIT = 'Phabricator'; + public const VIEWER_REDMINE = 'Redmine'; + public const VIEWER_ALLURA = 'SourceForge Allura'; + public const VIEWER_TRAC = 'Trac'; + public const VIEWER_VIEWCVS = 'ViewCVS'; + public const VIEWER_VIEWVC = 'ViewVC'; + public const VIEWER_VIEWVC_1_1 = 'ViewVC1.1'; + public const VIEWER_WEBSVN = 'WebSVN'; /** * @return array diff --git a/app/cdash/app/Model/SubProjectGroup.php b/app/cdash/app/Model/SubProjectGroup.php index 5063daf935..7f831f9458 100644 --- a/app/cdash/app/Model/SubProjectGroup.php +++ b/app/cdash/app/Model/SubProjectGroup.php @@ -344,7 +344,7 @@ public function Save(): bool $this->CoverageThreshold, $starttime, $endtime, - $position + $position, ])); if ($query === false) { diff --git a/app/cdash/app/Model/UserProject.php b/app/cdash/app/Model/UserProject.php index 05f5b65fe5..56b1afe1e0 100644 --- a/app/cdash/app/Model/UserProject.php +++ b/app/cdash/app/Model/UserProject.php @@ -30,9 +30,9 @@ class UserProject public $ProjectId; private $PDO; - const NORMAL_USER = 0; - const SITE_MAINTAINER = 1; - const PROJECT_ADMIN = 2; + public const NORMAL_USER = 0; + public const SITE_MAINTAINER = 1; + public const PROJECT_ADMIN = 2; public function __construct() { @@ -129,7 +129,7 @@ public function Save(): bool $this->EmailSuccess, $this->EmailMissingSites, $this->UserId, - $this->ProjectId + $this->ProjectId, ]); if ($query === false) { add_last_sql_error('User2Project Update'); @@ -156,7 +156,7 @@ public function Save(): bool $this->EmailType, $this->EmailCategory, $this->EmailSuccess, - $this->EmailMissingSites + $this->EmailMissingSites, ]); if ($query === false) { add_last_sql_error('User2Project Create'); diff --git a/app/cdash/app/Service/RepositoryService.php b/app/cdash/app/Service/RepositoryService.php index 2162a19c3a..617fd3cdb2 100644 --- a/app/cdash/app/Service/RepositoryService.php +++ b/app/cdash/app/Service/RepositoryService.php @@ -49,7 +49,7 @@ protected function setStatus($context, $description, $revision, $state, 'description' => $description, 'commit_hash' => $revision, 'state' => $state, - 'target_url' => $target_url + 'target_url' => $target_url, ]; $this->repository->setStatus($options); } diff --git a/app/cdash/include/Messaging/Notification/NotifyOn.php b/app/cdash/include/Messaging/Notification/NotifyOn.php index c995a3ab24..7fcee558c2 100644 --- a/app/cdash/include/Messaging/Notification/NotifyOn.php +++ b/app/cdash/include/Messaging/Notification/NotifyOn.php @@ -3,21 +3,21 @@ class NotifyOn { - const AUTHORED = 'Authored'; - const UPDATE_ERROR = 'UpdateError'; - const UPDATE = 'Update'; - const CONFIGURE = 'Configure'; - const BUILD_WARNING = 'BuildWarning'; - const BUILD_ERROR = 'BuildError'; - const TEST_FAILURE = 'TestFailure'; - const DYNAMIC_ANALYSIS = 'DynamicAnalysis'; - const FIXED = 'Fixed'; - const FILTERED = 'Filtered'; - const LABELED = 'Labeled'; - const SITE_MISSING = 'SiteMissing'; - const GROUP_NIGHTLY = 'GroupMembership'; - const ANY = 'Any'; - const NEVER = 'Never'; - const REDUNDANT = 'Redundant'; - const SUMMARY = 'Summary'; + public const AUTHORED = 'Authored'; + public const UPDATE_ERROR = 'UpdateError'; + public const UPDATE = 'Update'; + public const CONFIGURE = 'Configure'; + public const BUILD_WARNING = 'BuildWarning'; + public const BUILD_ERROR = 'BuildError'; + public const TEST_FAILURE = 'TestFailure'; + public const DYNAMIC_ANALYSIS = 'DynamicAnalysis'; + public const FIXED = 'Fixed'; + public const FILTERED = 'Filtered'; + public const LABELED = 'Labeled'; + public const SITE_MISSING = 'SiteMissing'; + public const GROUP_NIGHTLY = 'GroupMembership'; + public const ANY = 'Any'; + public const NEVER = 'Never'; + public const REDUNDANT = 'Redundant'; + public const SUMMARY = 'Summary'; } diff --git a/app/cdash/include/Messaging/Preferences/BitmaskNotificationPreferences.php b/app/cdash/include/Messaging/Preferences/BitmaskNotificationPreferences.php index b5eabad127..a12d4bc959 100644 --- a/app/cdash/include/Messaging/Preferences/BitmaskNotificationPreferences.php +++ b/app/cdash/include/Messaging/Preferences/BitmaskNotificationPreferences.php @@ -3,25 +3,25 @@ class BitmaskNotificationPreferences extends NotificationPreferences { - const EMAIL_UPDATE = 2; // 2^1 - const EMAIL_CONFIGURE = 4; // 2^2 - const EMAIL_WARNING = 8; // 2^3 - const EMAIL_ERROR = 16; // 2^4 - const EMAIL_TEST = 32; // 2^5 - const EMAIL_DYNAMIC_ANALYSIS = 64; // 2^6 - const EMAIL_FIXES = 128; // 2^7 - const EMAIL_MISSING_SITES = 256; // 2^8 + public const EMAIL_UPDATE = 2; // 2^1 + public const EMAIL_CONFIGURE = 4; // 2^2 + public const EMAIL_WARNING = 8; // 2^3 + public const EMAIL_ERROR = 16; // 2^4 + public const EMAIL_TEST = 32; // 2^5 + public const EMAIL_DYNAMIC_ANALYSIS = 64; // 2^6 + public const EMAIL_FIXES = 128; // 2^7 + public const EMAIL_MISSING_SITES = 256; // 2^8 // NEW MASKS - const EMAIL_NEVER = 0; - const EMAIL_FILTERED = 1; // 2^0 - const EMAIL_USER_CHECKIN_ISSUE_ANY_SECTION = 512; // 2^9 - const EMAIL_ANY_USER_CHECKIN_ISSUE_NIGHTLY_SECTION = 1024; // 2^10 - const EMAIL_ANY_USER_CHECKIN_ISSUE_ANY_SECTION = 2048; // 2^11 - const EMAIL_SUBSCRIBED_LABELS = 4096; // 2^12 - const EMAIL_NO_REDUNDANT = 8192; // 2^13 + public const EMAIL_NEVER = 0; + public const EMAIL_FILTERED = 1; // 2^0 + public const EMAIL_USER_CHECKIN_ISSUE_ANY_SECTION = 512; // 2^9 + public const EMAIL_ANY_USER_CHECKIN_ISSUE_NIGHTLY_SECTION = 1024; // 2^10 + public const EMAIL_ANY_USER_CHECKIN_ISSUE_ANY_SECTION = 2048; // 2^11 + public const EMAIL_SUBSCRIBED_LABELS = 4096; // 2^12 + public const EMAIL_NO_REDUNDANT = 8192; // 2^13 - const DEFAULT_PREFERENCES = 8248; + public const DEFAULT_PREFERENCES = 8248; protected $preferences = []; diff --git a/app/cdash/include/Messaging/Topic/Topic.php b/app/cdash/include/Messaging/Topic/Topic.php index 995129a70f..f3aa666a5a 100644 --- a/app/cdash/include/Messaging/Topic/Topic.php +++ b/app/cdash/include/Messaging/Topic/Topic.php @@ -8,14 +8,14 @@ abstract class Topic implements TopicInterface { - const BUILD_ERROR = 'BuildError'; - const BUILD_WARNING = 'BuildWarning'; - const CONFIGURE = 'Configure'; - const DYNAMIC_ANALYSIS = 'DynamicAnalysis'; - const LABELED = 'Labeled'; - const TEST_FAILURE = 'TestFailure'; - const TEST_MISSING = 'TestMissing'; - const UPDATE_ERROR = 'UpdateError'; + public const BUILD_ERROR = 'BuildError'; + public const BUILD_WARNING = 'BuildWarning'; + public const CONFIGURE = 'Configure'; + public const DYNAMIC_ANALYSIS = 'DynamicAnalysis'; + public const LABELED = 'Labeled'; + public const TEST_FAILURE = 'TestFailure'; + public const TEST_MISSING = 'TestMissing'; + public const UPDATE_ERROR = 'UpdateError'; /** @var SubscriberInterface $subscriber */ protected $subscriber; diff --git a/app/cdash/include/Test/BuildDiffForTesting.php b/app/cdash/include/Test/BuildDiffForTesting.php index db6c5b4d1e..f90e13e5f3 100644 --- a/app/cdash/include/Test/BuildDiffForTesting.php +++ b/app/cdash/include/Test/BuildDiffForTesting.php @@ -37,7 +37,7 @@ trait BuildDiffForTesting ]; private $fixed_keys = [ - 'builderrorsnegative' , + 'builderrorsnegative', 'buildwarningsnegative', 'testfailednegative', 'testnotrunnegative', diff --git a/app/cdash/include/Test/UseCase/BuildUseCase.php b/app/cdash/include/Test/UseCase/BuildUseCase.php index 98519bdb73..c2f896d75e 100644 --- a/app/cdash/include/Test/UseCase/BuildUseCase.php +++ b/app/cdash/include/Test/UseCase/BuildUseCase.php @@ -8,8 +8,8 @@ class BuildUseCase extends UseCase { - const WARNING = 0; - const ERROR = 1; + public const WARNING = 0; + public const ERROR = 1; private $command; @@ -103,7 +103,7 @@ protected function createFailureLabelsElement(DOMElement $parent, $attributes) public function createFailure(array $default_properties) { - list($type, $properties) = $default_properties; + [$type, $properties] = $default_properties; $properties['type'] = $type === self::ERROR ? 'Error' : 'Warning'; $this->createAction($properties) diff --git a/app/cdash/include/Test/UseCase/DynamicAnalysisUseCase.php b/app/cdash/include/Test/UseCase/DynamicAnalysisUseCase.php index 1b06767e63..47fc88fae6 100644 --- a/app/cdash/include/Test/UseCase/DynamicAnalysisUseCase.php +++ b/app/cdash/include/Test/UseCase/DynamicAnalysisUseCase.php @@ -24,8 +24,8 @@ class DynamicAnalysisUseCase extends UseCase { - const FAILED = 'failed'; - const PASSED = 'passed'; + public const FAILED = 'failed'; + public const PASSED = 'passed'; private $working_directory; private $checker; @@ -34,7 +34,7 @@ public function __construct(array $properties = []) { parent::__construct('DynamicAnalysis', $properties); $faker = parent::getFaker(); - $this->working_directory = isset($properties['WorkingDirectory']) ? $properties['WorkingDirectory'] : + $this->working_directory = $properties['WorkingDirectory'] ?? "/users/{$faker->firstName}/{$faker->word}"; $this->checker = '/usr/bin/valgrind'; } diff --git a/app/cdash/include/Test/UseCase/TestUseCase.php b/app/cdash/include/Test/UseCase/TestUseCase.php index fe334f84ce..240842db05 100644 --- a/app/cdash/include/Test/UseCase/TestUseCase.php +++ b/app/cdash/include/Test/UseCase/TestUseCase.php @@ -8,20 +8,20 @@ class TestUseCase extends UseCase { - const EXIT_CODE = 'Exit Code'; - const EXIT_VALUE = 'Exit Value'; - const EXE_TIME = 'Execution Time'; - const COMPLETION_STATUS = 'Completion Status'; - const CMD_LINE = 'Command Line'; + public const EXIT_CODE = 'Exit Code'; + public const EXIT_VALUE = 'Exit Value'; + public const EXE_TIME = 'Execution Time'; + public const COMPLETION_STATUS = 'Completion Status'; + public const CMD_LINE = 'Command Line'; - const TEXT_STRING = 'text/string'; - const NUM_DOUBLE = 'numeric/double'; + public const TEXT_STRING = 'text/string'; + public const NUM_DOUBLE = 'numeric/double'; - const FAILED = 'failed'; - const PASSED = 'passed'; - const OTHERFAULT = 'OTHER_FAULT'; - const TIMEOUT = 'Timeout'; - const NOTRUN = 'notrun'; + public const FAILED = 'failed'; + public const PASSED = 'passed'; + public const OTHERFAULT = 'OTHER_FAULT'; + public const TIMEOUT = 'Timeout'; + public const NOTRUN = 'notrun'; public function __construct(array $properties = []) { @@ -143,8 +143,7 @@ protected function createResultsElement(DOMElement $parent, $attributes) $code_value = $code->appendChild(new DOMElement('Value')); /** @var DOMElement $exectime */ - $exectime_text = isset($attributes['Execution Time']) ? - $attributes['Execution Time'] : '0.012004'; + $exectime_text = $attributes['Execution Time'] ?? '0.012004'; $exectime = $results->appendChild(new DOMElement('NamedMeasurement')); $exectime->setAttribute('name', 'Execution Time'); diff --git a/app/cdash/include/Test/UseCase/UpdateUseCase.php b/app/cdash/include/Test/UseCase/UpdateUseCase.php index a719c6eefd..eddc99465b 100644 --- a/app/cdash/include/Test/UseCase/UpdateUseCase.php +++ b/app/cdash/include/Test/UseCase/UpdateUseCase.php @@ -3,8 +3,8 @@ class UpdateUseCase extends UseCase { - const TYPE = 'Update'; - const FAILED = 'FAILED'; + public const TYPE = 'Update'; + public const FAILED = 'FAILED'; private $mode; private $generator; @@ -77,7 +77,7 @@ public function build() // create UpdateReturnStatus element $status = $update->appendChild(new \DOMElement('UpdateReturnStatus')); - $text = isset($prop['UpdateReturnStatus']) ? $prop['UpdateReturnStatus'] : ''; + $text = $prop['UpdateReturnStatus'] ?? ''; $status->appendChild(new \DOMText($text)); $xml_str = $xml->saveXML($xml); @@ -222,7 +222,7 @@ public function setPackages(array $packages) public function createPackage(array $properties) { if ($this->isSequential($properties)) { - list($name, $file, $author) = $properties; + [$name, $file, $author] = $properties; $properties = [ 'Name' => $name, 'File' => $file, diff --git a/app/cdash/include/Test/UseCase/UseCase.php b/app/cdash/include/Test/UseCase/UseCase.php index ae47f7c9b0..ae31368867 100644 --- a/app/cdash/include/Test/UseCase/UseCase.php +++ b/app/cdash/include/Test/UseCase/UseCase.php @@ -10,16 +10,16 @@ abstract class UseCase { /* actionable steps */ - const TEST = 'Test'; - const CONFIG = 'Config'; - const UPDATE = 'Update'; - const BUILD = 'Build'; - const DYNAMIC_ANALYSIS = 'DynamicAnalysis'; + public const TEST = 'Test'; + public const CONFIG = 'Config'; + public const UPDATE = 'Update'; + public const BUILD = 'Build'; + public const DYNAMIC_ANALYSIS = 'DynamicAnalysis'; /* build types (modes) */ - const NIGHTLY = 'Nightly'; - const CONTINUOUS = 'Continuous'; - const EXPERIMENTAL = 'Experimental'; + public const NIGHTLY = 'Nightly'; + public const CONTINUOUS = 'Continuous'; + public const EXPERIMENTAL = 'Experimental'; private $faker; private $ids; @@ -217,10 +217,10 @@ public function getXmlHandler(AbstractHandler $handler, $xml) $parser = xml_parser_create(); xml_set_element_handler( $parser, - array($handler, 'startElement'), - array($handler, 'endElement') + [$handler, 'startElement'], + [$handler, 'endElement'] ); - xml_set_character_data_handler($parser, array($handler, 'text')); + xml_set_character_data_handler($parser, [$handler, 'text']); xml_parse($parser, $xml, false); return $handler; } diff --git a/app/cdash/include/api_common.php b/app/cdash/include/api_common.php index 2febe7741b..8cecf7baa1 100644 --- a/app/cdash/include/api_common.php +++ b/app/cdash/include/api_common.php @@ -108,7 +108,7 @@ function can_administrate_project($projectid) */ function get_param($name, $required = true) { - $value = isset($_REQUEST[$name]) ? $_REQUEST[$name] : null; + $value = $_REQUEST[$name] ?? null; if ($required && !$value) { json_error_response(['error' => "Valid $name required"]); return null; diff --git a/app/cdash/include/autoremove.php b/app/cdash/include/autoremove.php index 941c800c9e..72d5dee663 100644 --- a/app/cdash/include/autoremove.php +++ b/app/cdash/include/autoremove.php @@ -32,7 +32,7 @@ function removeBuildsGroupwise(int $projectid, int $maxbuilds, bool $force = fal $db = Database::getInstance(); $buildgroups = $db->executePrepared('SELECT id, autoremovetimeframe FROM buildgroup WHERE projectid=?', [$projectid]); - $buildids = array(); + $buildids = []; foreach ($buildgroups as $buildgroup) { $days = $buildgroup['autoremovetimeframe']; @@ -103,7 +103,7 @@ function removeFirstBuilds($projectid, $days, $maxbuilds, $force = false, $echo ', [$startdate, intval($projectid)]); add_last_sql_error('dailyupdates::removeFirstBuilds'); - $buildids = array(); + $buildids = []; foreach ($builds as $builds_array) { $buildids[] = $builds_array['id']; } diff --git a/app/cdash/include/common.php b/app/cdash/include/common.php index 79d9c4b971..db5924615f 100644 --- a/app/cdash/include/common.php +++ b/app/cdash/include/common.php @@ -86,9 +86,9 @@ function generate_XSLT($xml, string $pageName, bool $return_html = false): strin $xh = new XSLTProcessor(); - $arguments = array( - '/_xml' => $xml - ); + $arguments = [ + '/_xml' => $xml, + ]; if (!empty($config->get('CDASH_DEBUG_XML'))) { $tmp = preg_replace("#<[A-Za-z0-9\-_.]{1,250}>#", "\\0\n", $xml); @@ -374,7 +374,7 @@ function get_project_name($projectid): string */ function get_geolocation($ip) { - $location = array(); + $location = []; $lat = ''; $long = ''; @@ -395,7 +395,7 @@ function get_geolocation($ip) ob_end_clean(); curl_close($curl); } elseif (ini_get('allow_url_fopen')) { - $options = array('http' => array('timeout' => 5.0)); + $options = ['http' => ['timeout' => 5.0]]; $context = stream_context_create($options); $httpReply = file_get_contents($url, false, $context); } else { @@ -429,7 +429,7 @@ function get_geolocation($ip) foreach ($config->get('CDASH_DEFAULT_IP_LOCATIONS') as $defaultlocation) { $defaultip = $defaultlocation['IP']; - if (preg_match('#^' . strtr(preg_quote($defaultip, '#'), array('\*' => '.*', '\?' => '.')) . '$#i', $ip)) { + if (preg_match('#^' . strtr(preg_quote($defaultip, '#'), ['\*' => '.*', '\?' => '.']) . '$#i', $ip)) { $location['latitude'] = $defaultlocation['latitude']; $location['longitude'] = $defaultlocation['longitude']; } @@ -449,7 +449,7 @@ function remove_project_builds($projectid): void $build = DB::select('SELECT id FROM build WHERE projectid=?', [intval($projectid)]); - $buildids = array(); + $buildids = []; foreach ($build as $build_array) { $buildids[] = (int) $build_array->id; } @@ -982,7 +982,7 @@ function get_dates($date, $nightlytime): array $todaydate = mktime(0, 0, 0, intval(date2month($date)), intval(date2day($date)), intval(date2year($date))); $previousdate = date(FMT_DATE, $todaydate - 3600 * 24); $nextdate = date(FMT_DATE, $todaydate + 3600 * 24); - return array($previousdate, $today, $nextdate, $date); + return [$previousdate, $today, $nextdate, $date]; } function has_next_date($date, $currentstarttime): bool @@ -1033,7 +1033,7 @@ function get_cdash_dashboard_xml_by_name(string $projectname, $date): string $project_array = array_merge($default, $result); - list($previousdate, $currentstarttime, $nextdate) = get_dates($date, $project_array['nightlytime']); + [$previousdate, $currentstarttime, $nextdate] = get_dates($date, $project_array['nightlytime']); $xml = ' ' . date('l, F d Y H:i:s', time()) . ' @@ -1237,10 +1237,10 @@ function begin_XML_for_XSLT(): string function begin_JSON_response(): array { - $response = array(); + $response = []; $response['version'] = CDash\Config::getVersion(); - $user_response = array(); + $user_response = []; $userid = Auth::id(); if ($userid) { $user = Auth::user(); @@ -1275,7 +1275,7 @@ function get_dashboard_JSON($projectname, $date, &$response) if (is_null($date)) { $date = date(FMT_DATE); } - list($previousdate, $currentstarttime, $nextdate) = get_dates($date, $project_array['nightlytime']); + [$previousdate, $currentstarttime, $nextdate] = get_dates($date, $project_array['nightlytime']); $response['datetime'] = date('l, F d Y H:i:s', time()); $response['date'] = $date; @@ -1360,7 +1360,7 @@ function DeleteDirectory(string $dirName): void new RecursiveDirectoryIterator($dirName), RecursiveIteratorIterator::CHILD_FIRST); foreach ($iterator as $file) { - if (in_array($file->getBasename(), array('.', '..'))) { + if (in_array($file->getBasename(), ['.', '..'])) { continue; } if ($file->isDir()) { diff --git a/app/cdash/include/ctestparserutils.php b/app/cdash/include/ctestparserutils.php index 6ccf309ffc..ccf39eb40a 100644 --- a/app/cdash/include/ctestparserutils.php +++ b/app/cdash/include/ctestparserutils.php @@ -77,8 +77,8 @@ function compute_error_difference($buildid, $previousbuildid, $warning) // Recurring buildfailures are represented by the buildfailuredetails table. // Get a list of buildfailuredetails IDs for the current build and the // previous build. - $current_failures = array(); - $previous_failures = array(); + $current_failures = []; + $previous_failures = []; $stmt = $pdo->prepare( 'SELECT bf.detailsid FROM buildfailure AS bf diff --git a/app/cdash/include/dailyupdates.php b/app/cdash/include/dailyupdates.php index 4bc041f03e..40dd345076 100644 --- a/app/cdash/include/dailyupdates.php +++ b/app/cdash/include/dailyupdates.php @@ -35,7 +35,7 @@ function get_related_dates(string $projectnightlytime, string $basedate): array { - $dates = array(); + $dates = []; $nightlytime = $projectnightlytime; if (strlen($basedate) == 0) { @@ -128,7 +128,7 @@ function is_cvs_root($root): bool /** Get the CVS repository commits */ function get_cvs_repository_commits($cvsroot, $dates): array { - $commits = array(); + $commits = []; // Compute time stamp range expressed as $fromtime and $totime for cvs // @@ -170,7 +170,7 @@ function get_cvs_repository_commits($cvsroot, $dates): array $npos = strpos($vv, '--------------------'); if ($npos !== false && $npos === 0) { if ($in_revision_chunk === 1) { - $commit = array(); + $commit = []; $commit['directory'] = $current_directory; $commit['filename'] = $current_filename; $commit['revision'] = $current_revision; @@ -234,7 +234,7 @@ function get_cvs_repository_commits($cvsroot, $dates): array // still $in_revision_chunk? $npos = strpos($vv, '===================='); if ($npos !== false && $npos === 0) { - $commit = array(); + $commit = []; $commit['directory'] = $current_directory; $commit['filename'] = $current_filename; $commit['revision'] = $current_revision; @@ -266,8 +266,8 @@ function get_cvs_repository_commits($cvsroot, $dates): array function get_p4_repository_commits($root, $branch, $dates): array { $config = Config::getInstance(); - $commits = array(); - $users = array(); + $commits = []; + $users = []; // Add the command line specified by the user in the "Repository" field // of the project settings "Repository" tab and set the message language @@ -292,7 +292,7 @@ function get_p4_repository_commits($root, $branch, $dates): array $raw_output = `$p4command describe -s $matches[1]`; $describe_lines = explode("\n", $raw_output); - $commit = array(); + $commit = []; // Parse the changelist description and add each file modified to the // commits list @@ -311,7 +311,7 @@ function get_p4_repository_commits($root, $branch, $dates): array } else { $raw_output = `$p4command users -m 1 $user`; if (preg_match("/^(.+) <(.*)> \((.*)\) accessed (.*)$/", $raw_output, $matches)) { - $newuser = array(); + $newuser = []; $newuser['username'] = $matches[1]; $newuser['email'] = $matches[2]; $newuser['name'] = $matches[3]; @@ -344,7 +344,7 @@ function get_p4_repository_commits($root, $branch, $dates): array function get_git_repository_commits($gitroot, $dates, $branch, $previousrevision): array { $config = Config::getInstance(); - $commits = array(); + $commits = []; $gitcommand = $config->get('CDASH_GIT_COMMAND'); $gitlocaldirectory = $config->get('CDASH_DEFAULT_GIT_DIRECTORY'); @@ -402,7 +402,7 @@ function get_git_repository_commits($gitroot, $dates, $branch, $previousrevision foreach ($lines as $line) { if (substr($line, 0, 6) == 'commit') { - $commit = array(); + $commit = []; $commit['revision'] = substr($line, 7); $commit['priorrevision'] = ''; $commit['comment'] = ''; @@ -439,7 +439,7 @@ function get_git_repository_commits($gitroot, $dates, $branch, $previousrevision /** Get the SVN repository commits */ function get_svn_repository_commits($svnroot, $dates, $username = '', $password = ''): array { - $commits = array(); + $commits = []; // To pick up all possible changes, the svn log query has to go back // *2* days -- svn log (for date queries) spits out all changes since @@ -464,7 +464,7 @@ function get_svn_repository_commits($svnroot, $dates, $username = '', $password $lines = explode("\n", $raw_output); - $gathered_file_lines = array(); + $gathered_file_lines = []; $current_author = ''; $current_comment = ''; $current_directory = ''; @@ -510,7 +510,7 @@ function get_svn_repository_commits($svnroot, $dates, $username = '', $password $current_directory = remove_directory_from_filename($current_filename); - $commit = array(); + $commit = []; $commit['directory'] = $current_directory; $commit['filename'] = $current_filename; $commit['revision'] = $current_revision; @@ -523,7 +523,7 @@ function get_svn_repository_commits($svnroot, $dates, $username = '', $password } else { //echo "excluding: '" . $current_time . "' (" . gmdate(FMT_DATETIMEMS, $current_time) . ")
"; } - $gathered_file_lines = array(); + $gathered_file_lines = []; } $current_comment = ''; $last_chunk_line_number = $line_number; @@ -595,7 +595,7 @@ function get_svn_repository_commits($svnroot, $dates, $username = '', $password /** Get BZR repository commits */ function get_bzr_repository_commits($bzrroot, $dates): array { - $commits = array(); + $commits = []; $fromtime = gmdate(FMT_DATETIMESTD, $dates['nightly-1'] + 1) . ' GMT'; $totime = gmdate(FMT_DATETIMESTD, $dates['nightly-0']) . ' GMT'; @@ -619,7 +619,7 @@ function get_bzr_repository_commits($bzrroot, $dates): array foreach ($files as $file) { $current_filename = $file->nodeValue; $current_directory = remove_directory_from_filename($current_filename); - $commit = array(); + $commit = []; $commit['directory'] = $current_directory; $commit['filename'] = $current_filename; $commit['revision'] = $current_revision; @@ -664,7 +664,7 @@ function get_repository_commits(int $projectid, $dates): array $cvsviewer = $cvsviewers_array['cvsviewertype']; // Start with an empty array: - $commits = array(); + $commits = []; foreach ($repositories as $repositories_array) { $root = $repositories_array['url']; @@ -797,7 +797,7 @@ function sendEmailExpectedBuilds($projectid, $currentstarttime): void $currentEndUTCTime, $projectid, $currentBeginUTCTime, - $currentEndUTCTime + $currentEndUTCTime, ]); $projectname = get_project_name($projectid); @@ -907,7 +907,7 @@ function cleanUserTemp(): void function sendEmailUnregisteredUsers(int $projectid, $cvsauthors): void { $config = Config::getInstance(); - $unregisteredusers = array(); + $unregisteredusers = []; foreach ($cvsauthors as $author) { if ($author == 'Local User') { continue; @@ -975,7 +975,7 @@ function addDailyChanges(int $projectid): void $project = new Project(); $project->Id = $projectid; $project->Fill(); - list($previousdate, $currentstarttime, $nextdate) = get_dates('now', $project->NightlyTime); + [$previousdate, $currentstarttime, $nextdate] = get_dates('now', $project->NightlyTime); $date = gmdate(FMT_DATE, $currentstarttime); $db = Database::getInstance(); @@ -989,7 +989,7 @@ function addDailyChanges(int $projectid): void AND date=? ', [$projectid, $date]); if (intval($query['c']) === 0) { - $cvsauthors = array(); + $cvsauthors = []; $db->executePrepared(" INSERT INTO dailyupdate (projectid, date, command, type, status) @@ -1036,7 +1036,7 @@ function addDailyChanges(int $projectid): void $email, $log, $revision, - $priorrevision + $priorrevision, ]); add_last_sql_error('addDailyChanges', $projectid); } @@ -1167,7 +1167,7 @@ function addDailyChanges(int $projectid): void endtime < :endtime"); $query_params = [ ':projectid' => $project->Id, - ':endtime' => $cutoff_date + ':endtime' => $cutoff_date, ]; $db->execute($stmt, $query_params); while ($row = $stmt->fetch()) { diff --git a/app/cdash/include/filterdataFunctions.php b/app/cdash/include/filterdataFunctions.php index 23f59ef5fe..3d85ed9ae9 100644 --- a/app/cdash/include/filterdataFunctions.php +++ b/app/cdash/include/filterdataFunctions.php @@ -103,7 +103,7 @@ public function __construct() break; } } - $this->FiltersAffectedBySubProjects = array( + $this->FiltersAffectedBySubProjects = [ 'buildduration', 'builderrors', 'buildwarnings', @@ -114,17 +114,17 @@ public function __construct() 'testsfailed', 'testsnotrun', 'testspassed', - 'testtimestatus'); + 'testtimestatus']; } public function getDefaultFilter() { - return array( + return [ 'field' => 'site', 'fieldtype' => 'string', 'compare' => 63, 'value' => '', - ); + ]; } public function getFilterDefinitionsXML() @@ -362,7 +362,7 @@ public function getDefaultFilter() return [ 'field' => 'subprojects', 'compare' => 92, - 'value' => '' + 'value' => '', ]; } } @@ -371,12 +371,12 @@ class QueryTestsPhpFilters extends DefaultFilters { public function getDefaultFilter() { - return array( + return [ 'field' => 'testname', 'fieldtype' => 'string', 'compare' => 63, 'value' => '', - ); + ]; } public function getFilterDefinitionsXML() @@ -473,12 +473,12 @@ class ViewCoveragePhpFilters extends DefaultFilters { public function getDefaultFilter() { - return array( + return [ 'field' => 'filename', 'fieldtype' => 'string', 'compare' => 63, 'value' => '', - ); + ]; } public function getDefaultShowLimit() @@ -561,12 +561,12 @@ class ViewTestPhpFilters extends DefaultFilters { public function getDefaultFilter() { - return array( + return [ 'field' => 'testname', 'fieldtype' => 'string', 'compare' => 63, 'value' => '', - ); + ]; } public function getFilterDefinitionsXML() @@ -634,12 +634,12 @@ class CompareCoveragePhpFilters extends DefaultFilters { public function getDefaultFilter() { - return array( + return [ 'field' => 'subproject', 'fieldtype' => 'string', 'compare' => 61, - 'value' => '' - ); + 'value' => '', + ]; } public function getFilterDefinitionsXML() @@ -669,12 +669,12 @@ class TestOverviewPhpFilters extends DefaultFilters { public function getDefaultFilter() { - return array( + return [ 'field' => 'buildname', 'fieldtype' => 'string', 'compare' => 63, - 'value' => '' - ); + 'value' => '', + ]; } public function getFilterDefinitionsXML() @@ -979,7 +979,7 @@ function get_sql_compare_and_value($compare, $value) trigger_error('unknown $compare value: ' . $compare, E_USER_WARNING); break; } - return array($sql_compare, $sql_value); + return [$sql_compare, $sql_value]; } // Parse a filter's field, compare, and value from the request and return an @@ -1020,7 +1020,7 @@ function parse_filter_from_request($field_var, $compare_var, $value_var, return [ 'field' => $field, 'compare' => $compare, - 'value' => $value + 'value' => $value, ]; } @@ -1062,7 +1062,7 @@ function get_filterdata_from_request($page_id = '') $showlimit = intval($_GET['showlimit'] ?? 0); $limit = intval($_GET['limit'] ?? 0); - $clear = isset($_GET['clear']) ? $_GET['clear'] : ''; + $clear = $_GET['clear'] ?? ''; if ($clear == 'Clear') { $filtercount = 0; } @@ -1075,7 +1075,7 @@ function get_filterdata_from_request($page_id = '') // Handle block of filters. $subfiltercount = pdo_real_escape_numeric(@$_GET["field{$i}count"]); $filter = [ - 'filters' => [] + 'filters' => [], ]; for ($j = 1; $j <= $subfiltercount; ++$j) { $filter['filters'][] = parse_filter_from_request( @@ -1231,7 +1231,7 @@ function generate_filterdata_sql($filterdata) // Return a list of label IDs that match the specified filterdata. function get_label_ids_from_filterdata($filterdata) { - $label_ids = array(); + $label_ids = []; $clauses = 0; $label_sql = ''; $sql_combine = $filterdata['filtercombine']; diff --git a/app/cdash/include/log.php b/app/cdash/include/log.php index 19efaa4ba1..d9c6c094df 100644 --- a/app/cdash/include/log.php +++ b/app/cdash/include/log.php @@ -88,7 +88,7 @@ function add_log($text, $function, $type = LOG_INFO, $projectid = 0, $buildid = $buildid = $GLOBALS['PHP_ERROR_BUILD_ID']; } - $context = array('function' => $function); + $context = ['function' => $function]; if ($projectid !== 0 && !is_null($projectid)) { $context['project_id'] = $projectid; diff --git a/app/cdash/include/repository.php b/app/cdash/include/repository.php index 02f5048f77..7dafbc5bf5 100644 --- a/app/cdash/include/repository.php +++ b/app/cdash/include/repository.php @@ -804,13 +804,13 @@ function post_github_pull_request_comment(Project $project, $pull_request, $comm // Format our comment using Github's comment syntax. $message = "[$comment]($cdash_url)"; - $data = array('body' => $message); + $data = ['body' => $message]; $data_string = json_encode($data); $ch = curl_init($post_url); - curl_setopt($ch, CURLOPT_HTTPHEADER, array( + curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Content-Type: application/json', - 'Content-Length: ' . strlen($data_string)) + 'Content-Length: ' . strlen($data_string)] ); curl_setopt($ch, CURLOPT_HEADER, 1); $userpwd = $repo['username'] . ':' . $repo['password']; @@ -827,7 +827,7 @@ function post_github_pull_request_comment(Project $project, $pull_request, $comm 'post_github_pull_request_comment', LOG_ERR, $project->Id); } elseif (config('app.debug')) { - $matches = array(); + $matches = []; preg_match("#/comments/(\d+)#", $retval, $matches); add_log( 'Just posted comment #' . $matches[1], diff --git a/app/cdash/include/sendemail.php b/app/cdash/include/sendemail.php index 6f3a58fcd7..ee637b6919 100644 --- a/app/cdash/include/sendemail.php +++ b/app/cdash/include/sendemail.php @@ -110,7 +110,7 @@ function check_email_errors(int $buildid, bool $checktesttimeingchanged, int $te /** Check for update errors for a given build. */ function check_email_update_errors(int $buildid): array { - $errors = array(); + $errors = []; $errors['errors'] = true; $errors['hasfixes'] = false; @@ -324,7 +324,7 @@ function get_email_summary(int $buildid, array $errors, $errorkey, int $maxitems } } elseif ($errorkey === 'missing_tests') { // sanity check - $missing = isset($errors['missing_tests']['count']) ? $errors['missing_tests']['count'] : 0; + $missing = $errors['missing_tests']['count'] ?? 0; if ($missing) { $information .= "\n\n*Missing tests*"; diff --git a/app/cdash/include/upgrade_functions.php b/app/cdash/include/upgrade_functions.php index b913fc1ee1..d738ad819c 100644 --- a/app/cdash/include/upgrade_functions.php +++ b/app/cdash/include/upgrade_functions.php @@ -182,7 +182,7 @@ function AddTablePrimaryKey($table, $field) add_log("Adding primarykey $field to $table", 'AddTablePrimaryKey'); $query = 'ALTER TABLE "' . $table . '" ADD PRIMARY KEY ("' . $field . '")'; $version = pdo_get_vendor_version(); - list($major, $minor, $patch) = explode(".", $version); + [$major, $minor, $patch] = explode(".", $version); // As of MySQL 5.7.4, the IGNORE clause for ALTER TABLE is removed and its use produces an error. // Retaining original query for backwards compatibility @@ -272,9 +272,9 @@ function ComputeTestTiming($days = 4) "); echo pdo_error(); - $testarray = array(); + $testarray = []; while ($test_array = pdo_fetch_array($previoustest)) { - $test = array(); + $test = []; $test['id'] = $test_array['testid']; $test['name'] = $test_array['name']; $testarray[] = $test; @@ -658,10 +658,10 @@ function AddUniqueConstraintToSiteTable($site_table) // Tables with a siteid field that will need to be updated as we prune // out duplicate sites. - $tables_to_update = array('build', 'build2grouprule', 'site2user', + $tables_to_update = ['build', 'build2grouprule', 'site2user', 'client_job', 'client_site2cmake', 'client_site2compiler', 'client_site2library', 'client_site2program', - 'client_site2project'); + 'client_site2project']; // Find all the rows that will violate this new unique constraint. $query = "SELECT name, COUNT(*) FROM $site_table @@ -690,7 +690,7 @@ function AddUniqueConstraintToSiteTable($site_table) // Now that we've identified which row to keep, let's find all its // duplicates to remove. - $ids_to_remove = array(); + $ids_to_remove = []; $dupe_query = "SELECT id FROM $site_table WHERE id != $id_to_keep AND name = '$name'"; diff --git a/app/cdash/public/api/v1/GitHub/webhook.php b/app/cdash/public/api/v1/GitHub/webhook.php index 27115b0b08..51ce905fb3 100644 --- a/app/cdash/public/api/v1/GitHub/webhook.php +++ b/app/cdash/public/api/v1/GitHub/webhook.php @@ -34,7 +34,7 @@ function handle_error($msg) } elseif (!extension_loaded('hash')) { handle_error("Missing 'hash' extension to check the secret code validity."); } - list($algo, $hash) = explode('=', $_SERVER['HTTP_X_HUB_SIGNATURE'], 2) + array('', ''); + [$algo, $hash] = explode('=', $_SERVER['HTTP_X_HUB_SIGNATURE'], 2) + ['', '']; if (!in_array($algo, hash_algos(), true)) { handle_error("Hash algorithm '$algo' is not supported."); } diff --git a/app/cdash/public/api/v1/build.php b/app/cdash/public/api/v1/build.php index 219653fd88..4aee7c0231 100644 --- a/app/cdash/public/api/v1/build.php +++ b/app/cdash/public/api/v1/build.php @@ -122,7 +122,7 @@ function rest_get($build) ':type' => $build->Type, ':name' => $build->Name, ':projectid' => $build->ProjectId, - ':starttime' => $build->StartTime + ':starttime' => $build->StartTime, ]; // Prepared statement to find the oldest submission for this build. diff --git a/app/cdash/public/api/v1/buildgroup.php b/app/cdash/public/api/v1/buildgroup.php index a24aa8e39e..d896297b33 100644 --- a/app/cdash/public/api/v1/buildgroup.php +++ b/app/cdash/public/api/v1/buildgroup.php @@ -318,7 +318,7 @@ function rest_post($pdo, $projectid) $siteid = $_POST['site']['id']; } - $sql_match = $match = isset($_POST['match']) ? $_POST['match'] : ''; + $sql_match = $match = $_POST['match'] ?? ''; if (!empty($match)) { $sql_match = $_POST['match']; } diff --git a/app/cdash/public/api/v1/computeClassifier.php b/app/cdash/public/api/v1/computeClassifier.php index 4b98d19e9d..d55c09b9c8 100644 --- a/app/cdash/public/api/v1/computeClassifier.php +++ b/app/cdash/public/api/v1/computeClassifier.php @@ -73,7 +73,7 @@ foreach ($allProperties as $propertyName => $propertyData) { if ($propertyData['type'] == 'number') { // Numerical property. - list($classifierName, $score) = + [$classifierName, $score] = find_numerical_classifier($propertyName, $propertyData, $builds); $classifiers[] = ['classifier' => $classifierName, 'accuracy' => $score]; @@ -137,8 +137,8 @@ function compute_classifier_score($inGroup, $outGroup) } // Count number of successful and failed samples for the in & out groups. - list($numSucceededInGroup, $numFailedInGroup) = count_samples($inGroup); - list($numSucceededOutGroup, $numFailedOutGroup) = count_samples($outGroup); + [$numSucceededInGroup, $numFailedInGroup] = count_samples($inGroup); + [$numSucceededOutGroup, $numFailedOutGroup] = count_samples($outGroup); // We initially assume that the in group should contain true samples and the // out group should contain false samples. diff --git a/app/cdash/public/api/v1/expectedbuild.php b/app/cdash/public/api/v1/expectedbuild.php index 21c9b238f3..bd2b997308 100644 --- a/app/cdash/public/api/v1/expectedbuild.php +++ b/app/cdash/public/api/v1/expectedbuild.php @@ -52,7 +52,7 @@ function rest_delete($siteid, $buildgroupid, $buildname, $buildtype) */ function rest_get($siteid, $buildgroupid, $buildname, $buildtype, $projectid) { - $response = array(); + $response = []; if (!array_key_exists('currenttime', $_REQUEST)) { abort(400, '"currenttime" not specified in request.'); @@ -75,7 +75,7 @@ function rest_get($siteid, $buildgroupid, $buildname, $buildtype, $projectid) ':buildtype' => $buildtype, ':buildname' => $buildname, ':projectid' => $projectid, - ':starttime' => $currentUTCtime + ':starttime' => $currentUTCtime, ]; $db->execute($stmt, $query_params); $lastBuildDate = $stmt->fetchColumn(); @@ -124,7 +124,7 @@ function rest_post($siteid, $buildgroupid, $buildname, $buildtype) if (!is_null($rest_json)) { $_REQUEST = array_merge($_REQUEST, $rest_json); } -$required_params = array('siteid', 'groupid', 'name', 'type'); +$required_params = ['siteid', 'groupid', 'name', 'type']; foreach ($required_params as $param) { if (!array_key_exists($param, $_REQUEST)) { abort(400, "$param not specified."); diff --git a/app/cdash/public/api/v1/index.php b/app/cdash/public/api/v1/index.php index 983ae82c85..72c56b869f 100644 --- a/app/cdash/public/api/v1/index.php +++ b/app/cdash/public/api/v1/index.php @@ -119,7 +119,7 @@ $page_id = 'index.php'; // Begin menu definition -$response['menu'] = array(); +$response['menu'] = []; $beginning_UTCDate = $controller->getBeginDate(); $end_UTCDate = $controller->getEndDate(); if ($Project->GetNumberOfSubProjects($end_UTCDate) > 0) { @@ -138,14 +138,14 @@ $controller->setSubProjectId($subprojectid); $response['subprojectname'] = $subproject_name; - $subproject_response = array(); + $subproject_response = []; $subproject_response['name'] = $SubProject->GetName(); $dependencies = $SubProject->GetDependencies(); if ($dependencies) { - $dependencies_response = array(); + $dependencies_response = []; foreach ($dependencies as $dependency) { - $dependency_response = array(); + $dependency_response = []; $DependProject = new SubProject(); $DependProject->SetId($dependency); $result = $DependProject->CommonBuildQuery($beginning_UTCDate, $end_UTCDate, false); @@ -257,7 +257,7 @@ // Check if we need to summarize coverage by subproject groups. // This happens when we have subprojects and we're looking at the children // of a specific build. -$coverage_groups = array(); +$coverage_groups = []; $groupId = -1; if (isset($_GET['parentid']) && (int) $_GET['parentid'] > 0 && $Project->GetNumberOfSubProjects($end_UTCDate) > 0) { $groups = $Project->GetSubProjectGroups(); @@ -265,7 +265,7 @@ // Keep track of coverage info on a per-group basis. $groupId = $group->GetId(); - $coverage_groups[$groupId] = array(); + $coverage_groups[$groupId] = []; $coverageThreshold = $group->GetCoverageThreshold(); $coverage_groups[$groupId]['thresholdgreen'] = $coverageThreshold; $coverage_groups[$groupId]['thresholdyellow'] = $coverageThreshold * 0.7; @@ -273,11 +273,11 @@ $coverage_groups[$groupId]['loctested'] = 0; $coverage_groups[$groupId]['locuntested'] = 0; $coverage_groups[$groupId]['position'] = $group->GetPosition(); - $coverage_groups[$groupId]['coverages'] = array(); + $coverage_groups[$groupId]['coverages'] = []; } if (count($groups) > 1) { // Add a Total group too. - $coverage_groups[0] = array(); + $coverage_groups[0] = []; $coverageThreshold = (int) $Project->CoverageThreshold; $coverage_groups[0]['thresholdgreen'] = $coverageThreshold; $coverage_groups[0]['thresholdyellow'] = $coverageThreshold * 0.7; @@ -297,8 +297,8 @@ } // Generate the JSON response from the rows of builds. -$response['coverages'] = array(); -$response['dynamicanalyses'] = array(); +$response['coverages'] = []; +$response['dynamicanalyses'] = []; $num_nightly_coverages_builds = 0; $show_aggregate = false; $response['comparecoverage'] = 0; @@ -371,7 +371,7 @@ $loctested = (int) $build_array['loctested']; $locuntested = (int) $build_array['locuntested']; if ($loctested + $locuntested > 0) { - $coverage_response = array(); + $coverage_response = []; $coverage_response['buildid'] = (int) $build_array['id']; if ($linkToChildCoverage) { $coverage_response['childlink'] = $build_response['multiplebuildshyperlink'] . '##Coverage'; @@ -460,7 +460,7 @@ // of its own. $linkToChildrenDA = in_array((int) $build_array['id'], $linkToChildrenDAArray, true); - $DA_response = array(); + $DA_response = []; $DA_response['site'] = $build_array['sitename']; $DA_response['siteid'] = $build_array['siteid']; $DA_response['buildname'] = $build_array['name']; @@ -525,11 +525,11 @@ // Create a separate "all buildgroups" section of our response. // This is used to allow project admins to move builds between groups. -$response['all_buildgroups'] = array(); +$response['all_buildgroups'] = []; foreach ($controller->buildgroupsResponse as $group) { $response['all_buildgroups'][] = [ 'id' => $group['id'], - 'name' => $group['name'] + 'name' => $group['name'], ]; } @@ -624,7 +624,7 @@ // Generate coverage by group here. if (count($coverage_groups) > 0) { - $response['coveragegroups'] = array(); + $response['coveragegroups'] = []; foreach ($coverage_groups as $groupid => $group) { $loctested = $group['loctested']; $locuntested = $group['locuntested']; diff --git a/app/cdash/public/api/v1/manageBuildGroup.php b/app/cdash/public/api/v1/manageBuildGroup.php index fad8725097..d06106f8f1 100644 --- a/app/cdash/public/api/v1/manageBuildGroup.php +++ b/app/cdash/public/api/v1/manageBuildGroup.php @@ -130,11 +130,11 @@ $Project = new Project(); $Project->Id = $projectid; $buildgroups = $Project->GetBuildGroups(); -$buildgroups_response = array(); -$dynamics_response = array(); +$buildgroups_response = []; +$dynamics_response = []; /** @var BuildGroup $buildgroup */ foreach ($buildgroups as $buildgroup) { - $buildgroup_response = array(); + $buildgroup_response = []; if ($show == $buildgroup->GetId()) { $buildgroup_response['selected'] = '1'; @@ -239,9 +239,9 @@ $response['error'] = $err; } -$wildcards_response = array(); +$wildcards_response = []; foreach ($wildcards as $wildcard_array) { - $wildcard_response = array(); + $wildcard_response = []; $wildcard_response['buildgroupname'] = $wildcard_array['name']; $wildcard_response['buildgroupid'] = $wildcard_array['id']; $wildcard_response['buildtype'] = $wildcard_array['buildtype']; diff --git a/app/cdash/public/api/v1/manageOverview.php b/app/cdash/public/api/v1/manageOverview.php index b15cc77d82..187d66c2de 100644 --- a/app/cdash/public/api/v1/manageOverview.php +++ b/app/cdash/public/api/v1/manageOverview.php @@ -111,10 +111,10 @@ add_last_sql_error('manageOverview::overviewgroups', $projectid); -$build_response = array(); -$static_response = array(); +$build_response = []; +$static_response = []; foreach ($query as $overviewgroup_row) { - $group_response = array(); + $group_response = []; $group_response['id'] = intval($overviewgroup_row['id']); $group_response['name'] = $overviewgroup_row['name']; $type = $overviewgroup_row['type']; @@ -148,9 +148,9 @@ ', [intval($projectid)]); add_last_sql_error('manageOverview::buildgroups', $projectid); -$availablegroups_response = array(); +$availablegroups_response = []; foreach ($buildgroup_rows as $buildgroup_row) { - $buildgroup_response = array(); + $buildgroup_response = []; $buildgroup_response['id'] = intval($buildgroup_row['id']); $buildgroup_response['name'] = $buildgroup_row['name']; $availablegroups_response[] = $buildgroup_response; diff --git a/app/cdash/public/api/v1/project.php b/app/cdash/public/api/v1/project.php index 0eec7c6f51..c5280ce7cc 100644 --- a/app/cdash/public/api/v1/project.php +++ b/app/cdash/public/api/v1/project.php @@ -272,10 +272,10 @@ function populate_project($Project) if (isset($project_settings['repositories'])) { // Add the repositories. - $repo_urls = array(); - $repo_branches = array(); - $repo_usernames = array(); - $repo_passwords = array(); + $repo_urls = []; + $repo_branches = []; + $repo_usernames = []; + $repo_passwords = []; foreach ($project_settings['repositories'] as $repo) { $repo_urls[] = $repo['url']; $repo_branches[] = $repo['branch']; diff --git a/app/cdash/public/api/v1/subproject.php b/app/cdash/public/api/v1/subproject.php index 64882585b7..a2048ff419 100644 --- a/app/cdash/public/api/v1/subproject.php +++ b/app/cdash/public/api/v1/subproject.php @@ -104,20 +104,20 @@ function rest_get($projectid): bool } $dependencies = $SubProject->GetDependencies(); - $dependencies_response = array(); - $available_dependencies_response = array(); + $dependencies_response = []; + $available_dependencies_response = []; foreach ($query as $row) { if (intval($row['id']) === $subprojectid) { continue; } if (is_array($dependencies) && in_array($row['id'], $dependencies)) { - $dep = array(); + $dep = []; $dep['id'] = intval($row['id']); $dep['name'] = $row['name']; $dependencies_response[] = $dep; } else { - $avail = array(); + $avail = []; $avail['id'] = intval($row['id']); $avail['name'] = $row['name']; $available_dependencies_response[] = $avail; @@ -183,7 +183,7 @@ function rest_post($projectid) $SubProject->Save(); // Respond with a JSON representation of this new subproject - $response = array(); + $response = []; $response['id'] = $SubProject->GetId(); $response['name'] = $SubProject->GetName(); $response['group'] = $SubProject->GetGroupId(); @@ -205,7 +205,7 @@ function rest_post($projectid) $Group->Save(); // Respond with a JSON representation of this new group - $response = array(); + $response = []; $response['id'] = $Group->GetId(); $response['name'] = $Group->GetName(); $response['is_default'] = $Group->GetIsDefault(); diff --git a/app/cdash/tests/case/CDash/DynamicAnalysisUseCaseTest.php b/app/cdash/tests/case/CDash/DynamicAnalysisUseCaseTest.php index 7229cca36b..625f0c4f6d 100644 --- a/app/cdash/tests/case/CDash/DynamicAnalysisUseCaseTest.php +++ b/app/cdash/tests/case/CDash/DynamicAnalysisUseCaseTest.php @@ -45,7 +45,7 @@ public function testDynamicAnalysisUseCase() ->createPassedTest( 'thirdparty', ['Labels' => - ['MyThirdPartyDependency', 'NotASubproject'] + ['MyThirdPartyDependency', 'NotASubproject'], ] ); diff --git a/app/cdash/tests/case/CDash/Lib/Repository/GitHubTest.php b/app/cdash/tests/case/CDash/Lib/Repository/GitHubTest.php index 42e128f789..5f86061e08 100644 --- a/app/cdash/tests/case/CDash/Lib/Repository/GitHubTest.php +++ b/app/cdash/tests/case/CDash/Lib/Repository/GitHubTest.php @@ -153,11 +153,11 @@ public function testGenerateCheckPayloadFromBuildRows() 'name' => 'CDash', 'head_sha' => 'zzz', 'details_url' => $index_url, - 'status' => 'in_progress' + 'status' => 'in_progress', ]; $expected['output'] = [ 'title' => 'Awaiting results', - 'summary' => "[CDash has not parsed any results for this check yet.]($index_url)" + 'summary' => "[CDash has not parsed any results for this check yet.]($index_url)", ]; $build_rows = []; $actual = $sut->generateCheckPayloadFromBuildRows($build_rows, 'zzz'); @@ -178,7 +178,7 @@ public function testGenerateCheckPayloadFromBuildRows() 'configureerrors' => 0, 'builderrors' => 0, 'testfailed' => 0, - 'done' => 0 + 'done' => 0, ]; $build_rows[] = $build_row; $actual = $sut->generateCheckPayloadFromBuildRows($build_rows, 'zzz'); @@ -213,7 +213,7 @@ public function testGenerateCheckPayloadFromBuildRows() 'configureerrors' => 5, 'builderrors' => 0, 'testfailed' => 0, - 'done' => 1 + 'done' => 1, ]; $build_rows[] = [ 'name' => 'c', @@ -222,7 +222,7 @@ public function testGenerateCheckPayloadFromBuildRows() 'configureerrors' => 0, 'builderrors' => 1, 'testfailed' => 0, - 'done' => 1 + 'done' => 1, ]; $build_rows[] = [ 'name' => 'd', @@ -231,7 +231,7 @@ public function testGenerateCheckPayloadFromBuildRows() 'configureerrors' => 0, 'builderrors' => 0, 'testfailed' => 7, - 'done' => 1 + 'done' => 1, ]; $actual = $sut->generateCheckPayloadFromBuildRows($build_rows, 'zzz'); unset($actual['started_at']); @@ -258,7 +258,7 @@ public function testDedupeAndSortBuildRows() $expected = [ ['id' => 4, 'name' => 'a', 'starttime' => '2019-05-01 18:08:38'], ['id' => 6, 'name' => 'b', 'starttime' => '2019-05-01 18:08:40'], - ['id' => 1, 'name' => 'c', 'starttime' => '2019-05-01 18:08:35'] + ['id' => 1, 'name' => 'c', 'starttime' => '2019-05-01 18:08:35'], ]; $this->assertEquals($expected, $actual); } @@ -269,7 +269,7 @@ private function setupAuthentication() $repositories = []; $repositories[] = [ 'url' => $github_url, - 'username' => 12345 + 'username' => 12345, ]; $this->project->CvsUrl = $github_url; $this->project->expects($this->once()) diff --git a/app/cdash/tests/case/CDash/Model/BuildErrorTest.php b/app/cdash/tests/case/CDash/Model/BuildErrorTest.php index 138658bb7a..ec276d000d 100644 --- a/app/cdash/tests/case/CDash/Model/BuildErrorTest.php +++ b/app/cdash/tests/case/CDash/Model/BuildErrorTest.php @@ -44,7 +44,7 @@ public function testMarshalBuildError() 'postcontext' => " asdf = 0;\n ^\n[100%] Linking CXX executable main", 'sourcefile' => 'src/main.cpp', 'sourceline' => '2', - 'text' => '/.../foo/src/main.cpp:2:3: error: `asdf` not declared in this scope' + 'text' => '/.../foo/src/main.cpp:2:3: error: `asdf` not declared in this scope', ]; $this->mock_project->CvsUrl = 'https://github.com/FooCo/foo'; @@ -58,7 +58,7 @@ public function testMarshalBuildError() 'text' => "src/main.cpp:2:3: error: `asdf` not declared in this scope", 'postcontext' => " asdf = 0;\n ^\n[100%] Linking CXX executable main", 'sourcefile' => 'src/main.cpp', - 'sourceline' => '2' + 'sourceline' => '2', ]; $this->assertEquals($expected, $marshaled); } diff --git a/app/cdash/tests/case/CDash/Model/BuildFailureTest.php b/app/cdash/tests/case/CDash/Model/BuildFailureTest.php index de11f2f2e8..63775cee1b 100644 --- a/app/cdash/tests/case/CDash/Model/BuildFailureTest.php +++ b/app/cdash/tests/case/CDash/Model/BuildFailureTest.php @@ -54,7 +54,7 @@ public function testMarshalBuildFailure() 'stdoutput' => '', 'stderror' => '/projects/foo/src/main.cpp: In function `int main(int, char**)`: /projects/foo/src/main.cpp:2:3: error: `asdf` was not declared in this scope - asdf = 0;' + asdf = 0;', ]; $this->mock_project->CvsUrl = 'https://github.com/FooCo/foo'; $marshaled = $this->mock_buildfailure->marshal($input_data, $this->mock_project, '12', true, $this->mock_buildfailure); @@ -69,7 +69,7 @@ public function testMarshalBuildFailure() 'exitcondition' => '2', 'stdoutput' => '', 'stderror' => "foo/src/main.cpp: In function `int main(int, char**)`:\nsrc/main.cpp:2:3: error: `asdf` was not declared in this scope\n asdf = 0;", - 'cvsurl' => 'https://github.com/FooCo/foo/blob/12/src/main.cpp' + 'cvsurl' => 'https://github.com/FooCo/foo/blob/12/src/main.cpp', ]; $this->assertEquals($expected, $marshaled); } diff --git a/app/cdash/tests/case/CDash/Model/BuildRelationshipTest.php b/app/cdash/tests/case/CDash/Model/BuildRelationshipTest.php index 64f8bc7bd7..f7c2aa8dd3 100644 --- a/app/cdash/tests/case/CDash/Model/BuildRelationshipTest.php +++ b/app/cdash/tests/case/CDash/Model/BuildRelationshipTest.php @@ -146,7 +146,7 @@ public function testMarshal() $expected = [ 'buildid' => 1, 'relatedid' => 2, - 'relationship' => 'depends on' + 'relationship' => 'depends on', ]; $actual = $this->relationship->marshal(); $this->assertEquals($expected, $actual); diff --git a/app/cdash/tests/case/CDash/Model/BuildTest.php b/app/cdash/tests/case/CDash/Model/BuildTest.php index 2be67adea9..1ef3c87b1c 100644 --- a/app/cdash/tests/case/CDash/Model/BuildTest.php +++ b/app/cdash/tests/case/CDash/Model/BuildTest.php @@ -62,7 +62,7 @@ public function testGetBuildEmailCollection() 'testfailedpositive' => 90, 'testfailednegative' => 10, 'testnotrunpositive' => 11, - 'testnotrunnegative' => 12 + 'testnotrunnegative' => 12, ]); diff --git a/app/cdash/tests/case/CDash/MultipleSubprojectsEmailTest.php b/app/cdash/tests/case/CDash/MultipleSubprojectsEmailTest.php index e7e92bd092..28ac35a6b3 100644 --- a/app/cdash/tests/case/CDash/MultipleSubprojectsEmailTest.php +++ b/app/cdash/tests/case/CDash/MultipleSubprojectsEmailTest.php @@ -191,28 +191,28 @@ public function testMultipleSubprojectsTestSubmission() [ 'simpletest@localhost', BitmaskNotificationPreferences::EMAIL_TEST | - BitmaskNotificationPreferences::EMAIL_ANY_USER_CHECKIN_ISSUE_ANY_SECTION + BitmaskNotificationPreferences::EMAIL_ANY_USER_CHECKIN_ISSUE_ANY_SECTION, ], [ 'nox-noemail@noemail', BitmaskNotificationPreferences::EMAIL_TEST | BitmaskNotificationPreferences::EMAIL_ANY_USER_CHECKIN_ISSUE_ANY_SECTION | BitmaskNotificationPreferences::EMAIL_SUBSCRIBED_LABELS, - ['NOX', 'MyExperimentalFeature'] + ['NOX', 'MyExperimentalFeature'], ], [ 'optika-noemail@noemail', BitmaskNotificationPreferences::EMAIL_TEST | BitmaskNotificationPreferences::EMAIL_ANY_USER_CHECKIN_ISSUE_ANY_SECTION | BitmaskNotificationPreferences::EMAIL_SUBSCRIBED_LABELS, - ['Optika', 'MyThirdPartyDependency'] + ['Optika', 'MyThirdPartyDependency'], ], [ 'trop-noemail@noemail', BitmaskNotificationPreferences::EMAIL_TEST | BitmaskNotificationPreferences::EMAIL_ANY_USER_CHECKIN_ISSUE_ANY_SECTION | BitmaskNotificationPreferences::EMAIL_SUBSCRIBED_LABELS, - ['RTOp'] + ['RTOp'], ], ]; @@ -266,28 +266,28 @@ public function testMultipleSubprojectsConfigureSubmission() [ 'simpletest@localhost', BitmaskNotificationPreferences::EMAIL_CONFIGURE | - BitmaskNotificationPreferences::EMAIL_ANY_USER_CHECKIN_ISSUE_ANY_SECTION + BitmaskNotificationPreferences::EMAIL_ANY_USER_CHECKIN_ISSUE_ANY_SECTION, ], [ 'nox-noemail@noemail', BitmaskNotificationPreferences::EMAIL_CONFIGURE | BitmaskNotificationPreferences::EMAIL_ANY_USER_CHECKIN_ISSUE_ANY_SECTION | BitmaskNotificationPreferences::EMAIL_SUBSCRIBED_LABELS, - ['NOX', 'MyExperimentalFeature'] + ['NOX', 'MyExperimentalFeature'], ], [ 'optika-noemail@noemail', BitmaskNotificationPreferences::EMAIL_CONFIGURE | BitmaskNotificationPreferences::EMAIL_ANY_USER_CHECKIN_ISSUE_ANY_SECTION | BitmaskNotificationPreferences::EMAIL_SUBSCRIBED_LABELS, - ['Optika', 'MyThirdPartyDependency'] + ['Optika', 'MyThirdPartyDependency'], ], [ 'trop-noemail@noemail', BitmaskNotificationPreferences::EMAIL_CONFIGURE | BitmaskNotificationPreferences::EMAIL_ANY_USER_CHECKIN_ISSUE_ANY_SECTION | BitmaskNotificationPreferences::EMAIL_SUBSCRIBED_LABELS, - ['RTOp'] + ['RTOp'], ], ]; @@ -323,7 +323,7 @@ public function testBuildUseCase() 'simpletest@localhost', BitmaskNotificationPreferences::EMAIL_ERROR | BitmaskNotificationPreferences::EMAIL_WARNING | - BitmaskNotificationPreferences::EMAIL_ANY_USER_CHECKIN_ISSUE_ANY_SECTION + BitmaskNotificationPreferences::EMAIL_ANY_USER_CHECKIN_ISSUE_ANY_SECTION, ], [ 'nox-noemail@noemail', @@ -331,7 +331,7 @@ public function testBuildUseCase() BitmaskNotificationPreferences::EMAIL_WARNING | BitmaskNotificationPreferences::EMAIL_ANY_USER_CHECKIN_ISSUE_ANY_SECTION | BitmaskNotificationPreferences::EMAIL_SUBSCRIBED_LABELS, - ['NOX', 'MyExperimentalFeature'] + ['NOX', 'MyExperimentalFeature'], ], [ 'optika-noemail@noemail', @@ -339,7 +339,7 @@ public function testBuildUseCase() BitmaskNotificationPreferences::EMAIL_WARNING | BitmaskNotificationPreferences::EMAIL_ANY_USER_CHECKIN_ISSUE_ANY_SECTION | BitmaskNotificationPreferences::EMAIL_SUBSCRIBED_LABELS, - ['Optika', 'MyThirdPartyDependency'] + ['Optika', 'MyThirdPartyDependency'], ], [ 'trop-noemail@noemail', @@ -347,7 +347,7 @@ public function testBuildUseCase() BitmaskNotificationPreferences::EMAIL_WARNING | BitmaskNotificationPreferences::EMAIL_ANY_USER_CHECKIN_ISSUE_ANY_SECTION | BitmaskNotificationPreferences::EMAIL_SUBSCRIBED_LABELS, - ['RTOp'] + ['RTOp'], ], ]; @@ -383,7 +383,7 @@ public function testDyanamicAnalysisUseCaseBuild() ->createPassedTest( 'thirdparty', ['Labels' => - ['MyThirdPartyDependency', 'NotASubproject'] + ['MyThirdPartyDependency', 'NotASubproject'], ] ) ->setStartTime($start) @@ -393,7 +393,7 @@ public function testDyanamicAnalysisUseCaseBuild() [ // This user should receive email 'user_1@company.tld', BitmaskNotificationPreferences::EMAIL_DYNAMIC_ANALYSIS, - [] + [], ], [ // This user should not receive an email as they are not an author @@ -401,13 +401,13 @@ public function testDyanamicAnalysisUseCaseBuild() BitmaskNotificationPreferences::EMAIL_WARNING | BitmaskNotificationPreferences::EMAIL_ERROR | BitmaskNotificationPreferences::EMAIL_USER_CHECKIN_ISSUE_ANY_SECTION, - [] + [], ], [ // This user should receive an email, subscribed to two labels, one present 'user_3@company.tld', BitmaskNotificationPreferences::EMAIL_SUBSCRIBED_LABELS, - ['MyThirdPartyDependency1', 'MyProductionCode'] + ['MyThirdPartyDependency1', 'MyProductionCode'], ], [ // This user should receive an email, with MyExperimentalFeature appended to subject @@ -420,7 +420,7 @@ public function testDyanamicAnalysisUseCaseBuild() 'user_5@company.tld', BitmaskNotificationPreferences::EMAIL_USER_CHECKIN_ISSUE_ANY_SECTION, [], - ] + ], ]; $notifications = $this->getNotifications($subscribers); diff --git a/app/cdash/tests/case/CDash/TestUseCaseTest.php b/app/cdash/tests/case/CDash/TestUseCaseTest.php index 1c746c0151..c6abc45eca 100644 --- a/app/cdash/tests/case/CDash/TestUseCaseTest.php +++ b/app/cdash/tests/case/CDash/TestUseCaseTest.php @@ -281,7 +281,7 @@ public function testTestUseCaseCreatesMultisubprojectTestXMLFile() ->createSite([ 'Name' => 'Site.Name', 'BuildName' => 'SomeOS-SomeBuild', - 'BuildStamp' => '123456789-2018-Nightly' + 'BuildStamp' => '123456789-2018-Nightly', ]) ->setStartTime(1235383453) ->setEndTime(1235383473) diff --git a/app/cdash/tests/case/CDash/UpdateUseCaseTest.php b/app/cdash/tests/case/CDash/UpdateUseCaseTest.php index e2ad5170f1..36796a8d93 100644 --- a/app/cdash/tests/case/CDash/UpdateUseCaseTest.php +++ b/app/cdash/tests/case/CDash/UpdateUseCaseTest.php @@ -39,8 +39,8 @@ public function testRandomizeCheckinDate() { /** @var \CDash\Test\UseCase\UpdateUseCase $sut */ $sut = UseCase::createBuilder($this, UseCase::UPDATE); - list($date, $time, $tz) = explode(' ', $sut->randomizeCheckinDate()); - list($y, $m, $d) = explode('-', $date); + [$date, $time, $tz] = explode(' ', $sut->randomizeCheckinDate()); + [$y, $m, $d] = explode('-', $date); $yesterday = date('d', strtotime('-1 days')); $this->assertEquals($yesterday, $d); } diff --git a/app/cdash/tests/kwtest/kw_db.php b/app/cdash/tests/kwtest/kw_db.php index 969458e3f2..cd4a836fbc 100644 --- a/app/cdash/tests/kwtest/kw_db.php +++ b/app/cdash/tests/kwtest/kw_db.php @@ -211,7 +211,7 @@ public function query($query) if (!$resource || $resource === true) { return false; } - $result = array(); + $result = []; while ($row = pdo_fetch_array($resource, PDO::FETCH_ASSOC)) { $result[] = $row; } @@ -253,7 +253,7 @@ public function query($query) if (!$resource) { return false; } - $result = array(); + $result = []; while ($row = pdo_fetch_array($resource, PDO::FETCH_ASSOC)) { $result[] = $row; } diff --git a/app/cdash/tests/kwtest/kw_test_manager.php b/app/cdash/tests/kwtest/kw_test_manager.php index 5151b673dc..43e16d2e5b 100644 --- a/app/cdash/tests/kwtest/kw_test_manager.php +++ b/app/cdash/tests/kwtest/kw_test_manager.php @@ -67,7 +67,7 @@ public function getTestCaseList() if (!$this->testDir) { die("please, set the test directory\n"); } - $testsFile = array(); + $testsFile = []; foreach (glob($this->testDir . '/test_*.php') as $file) { $fileinfo = pathinfo($file); if (strcmp($fileinfo['basename'], 'test_install.php') != 0 && diff --git a/app/cdash/tests/kwtest/kw_web_tester.php b/app/cdash/tests/kwtest/kw_web_tester.php index 44af64bf38..855cdae447 100644 --- a/app/cdash/tests/kwtest/kw_web_tester.php +++ b/app/cdash/tests/kwtest/kw_web_tester.php @@ -456,7 +456,7 @@ public function createProject($input_settings, $update = false, return false; } // Specify some default settings. - $settings = array( + $settings = [ 'AutoremoveMaxBuilds' => 500, 'AutoremoveTimeframe' => 60, 'CoverageThreshold' => 70, @@ -473,7 +473,7 @@ public function createProject($input_settings, $update = false, 'UploadQuota' => 1, 'ViewSubProjectsLink' => 1, 'WarningsFilter' => '', - 'ErrorsFilter' => ''); + 'ErrorsFilter' => '']; $submit_button = 'Submit'; } @@ -547,7 +547,7 @@ public function deleteProject($projectid) $client = $this->getGuzzleClient(); // Delete project. - $project_array = array('Id' => $projectid); + $project_array = ['Id' => $projectid]; try { $response = $client->delete( $this->url . '/api/v1/project.php', @@ -732,7 +732,7 @@ private function setQueryParameters($url) if (!empty($query)) { foreach (explode("&", $query) as $parameter) { if (strpos($parameter, '=') !== false) { - list($key, $value) = explode('=', $parameter); + [$key, $value] = explode('=', $parameter); $this->setRequestKeyValuePair($parameters, $key, $value); } else { $this->setRequestKeyValuePair($parameters, $parameter, ''); @@ -755,13 +755,13 @@ private function setRequestKeyValuePair(&$parameters, $key, $value) // Handle key names that represent arrays of values if (preg_match('/^(\w+)\[(\w+)\]=?$/', $key, $parts)) { - list(, $key, $index) = $parts; + [, $key, $index] = $parts; if (!isset($parameters[$key])) { $parameters[$key] = []; } $parameters[$key][$index] = $value; } elseif (preg_match('/^(\w+)\[]$/', $key, $parts)) { - list(, $key) = $parts; + [, $key] = $parts; if (!isset($parameters[$key])) { $parameters[$key] = []; } diff --git a/app/cdash/tests/kwtest/simpletest/arguments.php b/app/cdash/tests/kwtest/simpletest/arguments.php index 120d2b2e30..d80f8d3f77 100644 --- a/app/cdash/tests/kwtest/simpletest/arguments.php +++ b/app/cdash/tests/kwtest/simpletest/arguments.php @@ -9,7 +9,7 @@ */ class SimpleArguments { - private $all = array(); + private $all = []; /** * Parses the command line arguments. The usual formats @@ -26,7 +26,7 @@ public function __construct($arguments) { array_shift($arguments); while (count($arguments) > 0) { - list($key, $value) = $this->parseArgument($arguments); + [$key, $value] = $this->parseArgument($arguments); $this->assign($key, $value); } } @@ -44,7 +44,7 @@ public function assign($key, $value) if ($this->$key === false) { $this->all[$key] = $value; } elseif (!is_array($this->$key)) { - $this->all[$key] = array($this->$key, $value); + $this->all[$key] = [$this->$key, $value]; } else { $this->all[$key][] = $value; } @@ -62,13 +62,13 @@ private function parseArgument(&$arguments) { $argument = array_shift($arguments); if (preg_match('/^-(\w)=(.+)$/', $argument, $matches)) { - return array($matches[1], $matches[2]); + return [$matches[1], $matches[2]]; } elseif (preg_match('/^-(\w)$/', $argument, $matches)) { - return array($matches[1], $this->nextNonFlagElseTrue($arguments)); + return [$matches[1], $this->nextNonFlagElseTrue($arguments)]; } elseif (preg_match('/^--(\w+)=(.+)$/', $argument, $matches)) { - return array($matches[1], $matches[2]); + return [$matches[1], $matches[2]]; } elseif (preg_match('/^--(\w+)$/', $argument, $matches)) { - return array($matches[1], $this->nextNonFlagElseTrue($arguments)); + return [$matches[1], $this->nextNonFlagElseTrue($arguments)]; } } @@ -141,8 +141,8 @@ public function all() class SimpleHelp { private $overview; - private $flag_sets = array(); - private $explanations = array(); + private $flag_sets = []; + private $explanations = []; /** * Sets up the top level explanation for the program. @@ -163,7 +163,7 @@ public function __construct($overview = '') */ public function explainFlag($flags, $explanation) { - $flags = is_array($flags) ? $flags : array($flags); + $flags = is_array($flags) ? $flags : [$flags]; $this->flag_sets[] = $flags; $this->explanations[] = $explanation; } diff --git a/app/cdash/tests/kwtest/simpletest/authentication.php b/app/cdash/tests/kwtest/simpletest/authentication.php index ec80de2260..f88e0e9f5d 100644 --- a/app/cdash/tests/kwtest/simpletest/authentication.php +++ b/app/cdash/tests/kwtest/simpletest/authentication.php @@ -140,7 +140,7 @@ public function __construct() */ public function restartSession() { - $this->realms = array(); + $this->realms = []; } /** diff --git a/app/cdash/tests/kwtest/simpletest/autorun.php b/app/cdash/tests/kwtest/simpletest/autorun.php index adbb455ce9..dcfbf2a8b1 100644 --- a/app/cdash/tests/kwtest/simpletest/autorun.php +++ b/app/cdash/tests/kwtest/simpletest/autorun.php @@ -67,7 +67,7 @@ function run_local_tests() function tests_have_run() { if ($context = SimpleTest::getContext()) { - return (boolean)$context->getTest(); + return (bool)$context->getTest(); } return false; } @@ -100,5 +100,5 @@ function capture_new_classes() global $SIMPLETEST_AUTORUNNER_INITIAL_CLASSES; return array_map('strtolower', array_diff(get_declared_classes(), $SIMPLETEST_AUTORUNNER_INITIAL_CLASSES ? - $SIMPLETEST_AUTORUNNER_INITIAL_CLASSES : array())); + $SIMPLETEST_AUTORUNNER_INITIAL_CLASSES : [])); } diff --git a/app/cdash/tests/kwtest/simpletest/browser.php b/app/cdash/tests/kwtest/simpletest/browser.php index adc89e7d47..647b89973b 100644 --- a/app/cdash/tests/kwtest/simpletest/browser.php +++ b/app/cdash/tests/kwtest/simpletest/browser.php @@ -17,7 +17,7 @@ require_once dirname(__FILE__) . '/frames.php'; require_once dirname(__FILE__) . '/user_agent.php'; if (!SimpleTest::getParsers()) { - SimpleTest::setParsers(array(new SimplePHPPageBuilder())); + SimpleTest::setParsers([new SimplePHPPageBuilder()]); } /**#@-*/ @@ -30,7 +30,7 @@ */ class SimpleBrowserHistory { - private $sequence = array(); + private $sequence = []; private $position = -1; /** @@ -70,7 +70,7 @@ public function recordEntry($url, $parameters) $this->dropFuture(); array_push( $this->sequence, - array('url' => $url, 'parameters' => $parameters)); + ['url' => $url, 'parameters' => $parameters]); $this->position++; } @@ -318,7 +318,7 @@ protected function load($url, $parameters) if (!$frame || !$this->page->hasFrames() || (strtolower($frame) == '_top')) { return $this->loadPage($url, $parameters); } - return $this->loadFrame(array($frame), $url, $parameters); + return $this->loadFrame([$frame], $url, $parameters); } /** @@ -950,7 +950,7 @@ public function clickSubmitById($id, $additional = false) */ public function isSubmit($label) { - return (boolean)$this->page->getFormBySubmit(new SimpleByLabel($label)); + return (bool)$this->page->getFormBySubmit(new SimpleByLabel($label)); } /** @@ -1029,7 +1029,7 @@ public function clickImageById($id, $x = 1, $y = 1, $additional = false) */ public function isImage($label) { - return (boolean)$this->page->getFormByImage(new SimpleByLabel($label)); + return (bool)$this->page->getFormByImage(new SimpleByLabel($label)); } /** diff --git a/app/cdash/tests/kwtest/simpletest/cookies.php b/app/cdash/tests/kwtest/simpletest/cookies.php index 701ea1a3ff..21ae779cc5 100644 --- a/app/cdash/tests/kwtest/simpletest/cookies.php +++ b/app/cdash/tests/kwtest/simpletest/cookies.php @@ -232,7 +232,7 @@ class SimpleCookieJar */ public function __construct() { - $this->cookies = array(); + $this->cookies = []; } /** @@ -242,7 +242,7 @@ public function __construct() */ public function restartSession($date = false) { - $surviving_cookies = array(); + $surviving_cookies = []; for ($i = 0; $i < count($this->cookies); $i++) { if (!$this->cookies[$i]->getValue()) { continue; @@ -332,7 +332,7 @@ public function getCookieValue($host, $path, $name) } } } - return (isset($value) ? $value : false); + return ($value ?? false); } /** @@ -367,7 +367,7 @@ protected function isMatch($cookie, $host, $path, $name) */ public function selectAsPairs($url) { - $pairs = array(); + $pairs = []; foreach ($this->cookies as $cookie) { if ($this->isMatch($cookie, $url->getHost(), $url->getPath(), $cookie->getName())) { $pairs[] = $cookie->getName() . '=' . $cookie->getValue(); diff --git a/app/cdash/tests/kwtest/simpletest/default_reporter.php b/app/cdash/tests/kwtest/simpletest/default_reporter.php index 88c10a5fff..9c62a2a46f 100644 --- a/app/cdash/tests/kwtest/simpletest/default_reporter.php +++ b/app/cdash/tests/kwtest/simpletest/default_reporter.php @@ -20,10 +20,10 @@ */ class SimpleCommandLineParser { - private $to_property = array( + private $to_property = [ 'case' => 'case', 'c' => 'case', 'test' => 'test', 't' => 'test', - ); + ]; private $case = ''; private $test = ''; private $xml = false; @@ -110,16 +110,16 @@ public function help() public function getHelpText() { return << [args...] + SimpleTest command line default reporter (autorun) + Usage: php [args...] - -c Run only the test-case - -t Run only the test method - -s Suppress skip messages - -x Return test results in XML - -h Display this help message + -c Run only the test-case + -t Run only the test method + -s Suppress skip messages + -x Return test results in XML + -h Display this help message -HELP; + HELP; } } @@ -137,7 +137,7 @@ public function __construct() { if (SimpleReporter::inCli()) { $parser = new SimpleCommandLineParser($_SERVER['argv']); - $interfaces = $parser->isXml() ? array('XmlReporter') : array('TextReporter'); + $interfaces = $parser->isXml() ? ['XmlReporter'] : ['TextReporter']; if ($parser->help()) { // I'm not sure if we should do the echo'ing here -- ezyang echo $parser->getHelpText(); diff --git a/app/cdash/tests/kwtest/simpletest/dumper.php b/app/cdash/tests/kwtest/simpletest/dumper.php index 0b8140a95d..6f1e64b5ca 100644 --- a/app/cdash/tests/kwtest/simpletest/dumper.php +++ b/app/cdash/tests/kwtest/simpletest/dumper.php @@ -321,7 +321,7 @@ protected function describeObjectDifference($first, $second, $identical) protected function getMembers($object) { $reflection = new ReflectionObject($object); - $members = array(); + $members = []; foreach ($reflection->getProperties() as $property) { if (method_exists($property, 'setAccessible')) { $property->setAccessible(true); @@ -377,12 +377,12 @@ protected function stringDiffersAt($first, $second) return 0; } if (strlen($first) < strlen($second)) { - list($first, $second) = array($second, $first); + [$first, $second] = [$second, $first]; } $position = 0; $step = strlen($first); while ($step > 1) { - $step = (integer)(($step + 1) / 2); + $step = (int)(($step + 1) / 2); if (strncmp($first, $second, $position + $step) == 0) { $position += $step; } diff --git a/app/cdash/tests/kwtest/simpletest/eclipse.php b/app/cdash/tests/kwtest/simpletest/eclipse.php index aad96fc989..550720225f 100644 --- a/app/cdash/tests/kwtest/simpletest/eclipse.php +++ b/app/cdash/tests/kwtest/simpletest/eclipse.php @@ -74,8 +74,8 @@ public function &createInvoker(&$invoker) */ public function escapeVal($raw) { - $needle = array('\\', '"', '/', "\b", "\f", "\n", "\r", "\t"); - $replace = array('\\\\', '\"', '\/', '\b', '\f', '\n', '\r', '\t'); + $needle = ['\\', '"', '/', "\b", "\f", "\n", "\r", "\t"]; + $replace = ['\\\\', '\"', '\/', '\b', '\f', '\n', '\r', '\t']; return str_replace($needle, $replace, $raw); } diff --git a/app/cdash/tests/kwtest/simpletest/encoding.php b/app/cdash/tests/kwtest/simpletest/encoding.php index 6e3437fb2d..bbac78b99c 100644 --- a/app/cdash/tests/kwtest/simpletest/encoding.php +++ b/app/cdash/tests/kwtest/simpletest/encoding.php @@ -197,7 +197,7 @@ class SimpleEncoding public function __construct($query = false) { if (!$query) { - $query = array(); + $query = []; } $this->clear(); $this->merge($query); @@ -208,7 +208,7 @@ public function __construct($query = false) */ public function clear() { - $this->request = array(); + $this->request = []; } /** @@ -276,7 +276,7 @@ public function merge($query) */ public function getValue($key) { - $values = array(); + $values = []; foreach ($this->request as $pair) { if ($pair->isKey($key)) { $values[] = $pair->getValue(); @@ -307,7 +307,7 @@ public function getAll() */ protected function encode() { - $statements = array(); + $statements = []; foreach ($this->request as $pair) { if ($statement = $pair->asRequest()) { $statements[] = $statement; @@ -461,7 +461,7 @@ public function getContentType() */ public function writeHeadersTo(&$socket) { - $socket->write('Content-Length: ' . (integer)strlen($this->encode()) . "\r\n"); + $socket->write('Content-Length: ' . (int)strlen($this->encode()) . "\r\n"); $socket->write('Content-Type: ' . $this->getContentType() . "\r\n"); } @@ -516,7 +516,7 @@ public function hasMoreThanOneLevel($query) public function rewriteArrayWithMultipleLevels($query) { - $query_ = array(); + $query_ = []; foreach ($query as $key => $value) { if (is_array($value)) { foreach ($value as $sub_key => $sub_value) { @@ -604,7 +604,7 @@ public function __construct($query = false, $boundary = false) */ public function writeHeadersTo(&$socket) { - $socket->write('Content-Length: ' . (integer)strlen($this->encode()) . "\r\n"); + $socket->write('Content-Length: ' . (int)strlen($this->encode()) . "\r\n"); $socket->write('Content-Type: multipart/form-data; boundary=' . $this->boundary . "\r\n"); } diff --git a/app/cdash/tests/kwtest/simpletest/errors.php b/app/cdash/tests/kwtest/simpletest/errors.php index 986c5d3df2..12d1250b86 100644 --- a/app/cdash/tests/kwtest/simpletest/errors.php +++ b/app/cdash/tests/kwtest/simpletest/errors.php @@ -79,8 +79,8 @@ public function __construct() */ public function clear() { - $this->queue = array(); - $this->expectation_queue = array(); + $this->queue = []; + $this->expectation_queue = []; } /** @@ -102,7 +102,7 @@ public function setTestCase($test) */ public function expectError($expected, $message) { - array_push($this->expectation_queue, array($expected, $message)); + array_push($this->expectation_queue, [$expected, $message]); } /** @@ -124,11 +124,11 @@ public function add($severity, $content, $filename, $line) */ public function tally() { - while (list($severity, $message, $file, $line) = $this->extract()) { + while ([$severity, $message, $file, $line] = $this->extract()) { $severity = $this->getSeverityAsString($severity); $this->test->error($severity, $message, $file, $line); } - while (list($expected, $message) = $this->extractExpectation()) { + while ([$expected, $message] = $this->extractExpectation()) { $this->test->assert($expected, false, '%s -> Expected error not caught'); } } @@ -144,7 +144,7 @@ public function tally() protected function testLatestError($severity, $content, $filename, $line) { if ($expectation = $this->extractExpectation()) { - list($expected, $message) = $expectation; + [$expected, $message] = $expectation; $this->test->assert($expected, $content, sprintf( $message, "%s -> PHP error [$content] severity [" . @@ -191,7 +191,7 @@ protected function extractExpectation() */ public static function getSeverityAsString($severity) { - static $map = array( + static $map = [ E_STRICT => 'E_STRICT', E_ERROR => 'E_ERROR', E_WARNING => 'E_WARNING', @@ -203,7 +203,7 @@ public static function getSeverityAsString($severity) E_COMPILE_WARNING => 'E_COMPILE_WARNING', E_USER_ERROR => 'E_USER_ERROR', E_USER_WARNING => 'E_USER_WARNING', - E_USER_NOTICE => 'E_USER_NOTICE'); + E_USER_NOTICE => 'E_USER_NOTICE']; if (defined('E_RECOVERABLE_ERROR')) { $map[E_RECOVERABLE_ERROR] = 'E_RECOVERABLE_ERROR'; } diff --git a/app/cdash/tests/kwtest/simpletest/exceptions.php b/app/cdash/tests/kwtest/simpletest/exceptions.php index 2e435b602a..960e8f7083 100644 --- a/app/cdash/tests/kwtest/simpletest/exceptions.php +++ b/app/cdash/tests/kwtest/simpletest/exceptions.php @@ -226,6 +226,6 @@ public function clear() { $this->expected = false; $this->message = false; - $this->ignored = array(); + $this->ignored = []; } } diff --git a/app/cdash/tests/kwtest/simpletest/expectation.php b/app/cdash/tests/kwtest/simpletest/expectation.php index a51feec7ee..29ac42989e 100644 --- a/app/cdash/tests/kwtest/simpletest/expectation.php +++ b/app/cdash/tests/kwtest/simpletest/expectation.php @@ -161,7 +161,7 @@ class TrueExpectation extends SimpleExpectation */ public function test($compare) { - return (boolean)$compare; + return (bool)$compare; } /** @@ -189,7 +189,7 @@ class FalseExpectation extends SimpleExpectation */ public function test($compare) { - return !(boolean)$compare; + return !(bool)$compare; } /** @@ -622,7 +622,7 @@ protected function getPattern() */ public function test($compare) { - return (boolean)preg_match($this->getPattern(), $compare); + return (bool)preg_match($this->getPattern(), $compare); } /** @@ -761,7 +761,7 @@ public function test($compare) protected function canonicalType($type) { $type = strtolower($type); - $map = array('boolean' => 'bool'); + $map = ['boolean' => 'bool']; if (isset($map[$type])) { $type = $map[$type]; } @@ -850,7 +850,7 @@ public function __construct($method, $message = '%s') */ public function test($compare) { - return (boolean)(is_object($compare) && method_exists($compare, $this->method)); + return (bool)(is_object($compare) && method_exists($compare, $this->method)); } /** diff --git a/app/cdash/tests/kwtest/simpletest/form.php b/app/cdash/tests/kwtest/simpletest/form.php index ee7922e076..a357058b4e 100644 --- a/app/cdash/tests/kwtest/simpletest/form.php +++ b/app/cdash/tests/kwtest/simpletest/form.php @@ -40,11 +40,11 @@ public function __construct($tag, $page) $this->encoding = $this->setEncodingClass($tag); $this->default_target = false; $this->id = $tag->getAttribute('id'); - $this->buttons = array(); - $this->images = array(); - $this->widgets = array(); - $this->radios = array(); - $this->checkboxes = array(); + $this->buttons = []; + $this->images = []; + $this->widgets = []; + $this->radios = []; + $this->checkboxes = []; } /** @@ -303,7 +303,7 @@ public function hasImage($selector) */ public function submitButton($selector, $additional = false) { - $additional = $additional ? $additional : array(); + $additional = $additional ? $additional : []; foreach ($this->buttons as $button) { if ($selector->isMatch($button)) { $encoding = $this->encode(); @@ -329,7 +329,7 @@ public function submitButton($selector, $additional = false) */ public function submitImage($selector, $x, $y, $additional = false) { - $additional = $additional ? $additional : array(); + $additional = $additional ? $additional : []; foreach ($this->images as $image) { if ($selector->isMatch($image)) { $encoding = $this->encode(); diff --git a/app/cdash/tests/kwtest/simpletest/frames.php b/app/cdash/tests/kwtest/simpletest/frames.php index e2d1fdd6ad..0100da1f7f 100644 --- a/app/cdash/tests/kwtest/simpletest/frames.php +++ b/app/cdash/tests/kwtest/simpletest/frames.php @@ -32,9 +32,9 @@ class SimpleFrameset public function __construct($page) { $this->frameset = $page; - $this->frames = array(); + $this->frames = []; $this->focus = false; - $this->names = array(); + $this->names = []; } /** @@ -81,10 +81,10 @@ public function setFrame($path, $page) public function getFrameFocus() { if ($this->focus === false) { - return array(); + return []; } return array_merge( - array($this->getPublicNameFromIndex($this->focus)), + [$this->getPublicNameFromIndex($this->focus)], $this->frames[$this->focus]->getFrameFocus()); } @@ -183,7 +183,7 @@ public function hasFrames() */ public function getFrames() { - $report = array(); + $report = []; for ($i = 0; $i < count($this->frames); $i++) { $report[$this->getPublicNameFromIndex($i)] = $this->frames[$i]->getFrames(); @@ -393,7 +393,7 @@ public function getUrls() if (is_integer($this->focus)) { return $this->frames[$this->focus]->getUrls(); } - $urls = array(); + $urls = []; foreach ($this->frames as $frame) { $urls = array_merge($urls, $frame->getUrls()); } @@ -413,7 +413,7 @@ public function getUrlsByLabel($label) $this->frames[$this->focus]->getUrlsByLabel($label), $this->focus); } - $urls = array(); + $urls = []; foreach ($this->frames as $index => $frame) { $urls = array_merge( $urls, @@ -453,7 +453,7 @@ public function getUrlById($id) */ protected function tagUrlsWithFrame($urls, $frame) { - $tagged = array(); + $tagged = []; foreach ($urls as $url) { if (!$url->getTarget()) { $url->setTarget($this->getPublicNameFromIndex($frame)); diff --git a/app/cdash/tests/kwtest/simpletest/http.php b/app/cdash/tests/kwtest/simpletest/http.php index fc47cf8a5c..d918053930 100644 --- a/app/cdash/tests/kwtest/simpletest/http.php +++ b/app/cdash/tests/kwtest/simpletest/http.php @@ -94,9 +94,9 @@ public function createConnection($method, $timeout) */ protected function createSocket($scheme, $host, $port, $timeout) { - if (in_array($scheme, array('file'))) { + if (in_array($scheme, ['file'])) { return new SimpleFileSocket($this->url); - } elseif (in_array($scheme, array('https'))) { + } elseif (in_array($scheme, ['https'])) { return new SimpleSecureSocket($host, $port, $timeout); } else { return new SimpleSocket($host, $port, $timeout); @@ -207,8 +207,8 @@ public function __construct($route, $encoding) { $this->route = $route; $this->encoding = $encoding; - $this->headers = array(); - $this->cookies = array(); + $this->headers = []; + $this->cookies = []; } /** @@ -308,7 +308,7 @@ public function __construct($headers) $this->http_version = false; $this->mime_type = ''; $this->location = false; - $this->cookies = array(); + $this->cookies = []; $this->authentication = false; $this->realm = false; foreach (explode("\r\n", $headers) as $header_line) { @@ -340,7 +340,7 @@ public function getRaw() */ public function getResponseCode() { - return (integer)$this->response_code; + return (int)$this->response_code; } /** @@ -359,8 +359,8 @@ public function getLocation() */ public function isRedirect() { - return in_array($this->response_code, array(301, 302, 303, 307)) && - (boolean)$this->getLocation(); + return in_array($this->response_code, [301, 302, 303, 307]) && + (bool)$this->getLocation(); } /** @@ -371,8 +371,8 @@ public function isRedirect() public function isChallenge() { return ($this->response_code == 401) && - (boolean)$this->authentication && - (boolean)$this->realm; + (bool)$this->authentication && + (bool)$this->realm; } /** @@ -453,7 +453,7 @@ protected function parseHeaderLine($header_line) protected function parseCookie($cookie_line) { $parts = explode(';', $cookie_line); - $cookie = array(); + $cookie = []; preg_match('/\s*(.*?)\s*=(.*)/', array_shift($parts), $cookie); foreach ($parts as $part) { if (preg_match('/\s*(.*?)\s*=(.*)/', $part, $matches)) { @@ -463,8 +463,8 @@ protected function parseCookie($cookie_line) return new SimpleCookie( $cookie[1], trim($cookie[2]), - isset($cookie['path']) ? $cookie['path'] : '', - isset($cookie['expires']) ? $cookie['expires'] : false); + $cookie['path'] ?? '', + $cookie['expires'] ?? false); } } @@ -518,7 +518,7 @@ protected function parse($raw) $this->setError('Could not split headers from content'); $this->headers = new SimpleHttpHeaders($raw); } else { - list($headers, $this->content) = explode("\r\n\r\n", $raw, 2); + [$headers, $this->content] = explode("\r\n\r\n", $raw, 2); $this->headers = new SimpleHttpHeaders($headers); } } diff --git a/app/cdash/tests/kwtest/simpletest/mock_objects.php b/app/cdash/tests/kwtest/simpletest/mock_objects.php index 4ac0604c07..9226f774c9 100644 --- a/app/cdash/tests/kwtest/simpletest/mock_objects.php +++ b/app/cdash/tests/kwtest/simpletest/mock_objects.php @@ -107,7 +107,7 @@ protected function describeDifference($expected, $parameters) '] but got ' . count($parameters) . ' arguments of [' . $this->renderArguments($parameters) . ']'; } - $messages = array(); + $messages = []; for ($i = 0; $i < count($expected); $i++) { $comparison = $this->coerceToExpectation($expected[$i]); if (!$comparison->test($parameters[$i])) { @@ -141,7 +141,7 @@ protected function coerceToExpectation($expected) */ protected function renderArguments($args) { - $descriptions = array(); + $descriptions = []; if (is_array($args)) { foreach ($args as $arg) { $dumper = new SimpleDumper(); @@ -300,7 +300,7 @@ class SimpleSignatureMap */ public function __construct() { - $this->map = array(); + $this->map = []; } /** @@ -311,7 +311,7 @@ public function __construct() public function add($parameters, $action) { $place = count($this->map); - $this->map[$place] = array(); + $this->map[$place] = []; $this->map[$place]['params'] = new ParametersExpectation($parameters); $this->map[$place]['content'] = $action; } @@ -395,8 +395,8 @@ class SimpleCallSchedule */ public function __construct() { - $this->always = array(); - $this->at = array(); + $this->always = []; + $this->at = []; } /** @@ -431,7 +431,7 @@ public function registerAt($step, $method, $args, $action) $args = $this->replaceWildcards($args); $method = strtolower($method); if (!isset($this->at[$method])) { - $this->at[$method] = array(); + $this->at[$method] = []; } if (!isset($this->at[$method][$step])) { $this->at[$method][$step] = new SimpleSignatureMap(); @@ -678,11 +678,11 @@ public function __construct() { $this->actions = new SimpleCallSchedule(); $this->expectations = new SimpleCallSchedule(); - $this->call_counts = array(); - $this->expected_counts = array(); - $this->max_counts = array(); - $this->expected_args = array(); - $this->expected_args_at = array(); + $this->call_counts = []; + $this->expected_counts = []; + $this->max_counts = []; + $this->expected_args = []; + $this->expected_args_at = []; $this->getCurrentTestCase()->tell($this); } @@ -944,7 +944,7 @@ public function expectAt($timing, $method, $args, $message = '%s') $this->checkArgumentsIsArray($args, 'set expected arguments at time'); $args = $this->replaceWildcards($args); if (!isset($this->expected_args_at[$timing])) { - $this->expected_args_at[$timing] = array(); + $this->expected_args_at[$timing] = []; } $method = strtolower($method); $message .= Mock::getExpectationLine(); @@ -1296,7 +1296,7 @@ public static function generatePartial($class, $mock_class, $methods) */ public static function getExpectationLine() { - $trace = new SimpleStackTrace(array('expect')); + $trace = new SimpleStackTrace(['expect']); return $trace->traceMethod(); } } @@ -1346,7 +1346,7 @@ public function generate($methods) if ($mock_reflection->classExistsSansAutoload()) { return false; } - $code = $this->createClassCode($methods ? $methods : array()); + $code = $this->createClassCode($methods ? $methods : []); return eval("$code return \$code;"); } @@ -1370,10 +1370,10 @@ public function generateSubclass($methods) return false; } if ($this->reflection->isInterface() || $this->reflection->hasFinal()) { - $code = $this->createClassCode($methods ? $methods : array()); + $code = $this->createClassCode($methods ? $methods : []); return eval("$code return \$code;"); } else { - $code = $this->createSubclassCode($methods ? $methods : array()); + $code = $this->createSubclassCode($methods ? $methods : []); return eval("$code return \$code;"); } } @@ -1409,7 +1409,7 @@ protected function createClassCode($methods) { $implements = ''; $interfaces = $this->reflection->getInterfaces(); - $interfaces = array_diff($interfaces, array('Traversable')); + $interfaces = array_diff($interfaces, ['Traversable']); if (count($interfaces) > 0) { $implements = 'implements ' . implode(', ', $interfaces); } @@ -1542,7 +1542,7 @@ protected function isConstructor($method) { return in_array( strtolower($method), - array('__construct', '__destruct')); + ['__construct', '__destruct']); } /** diff --git a/app/cdash/tests/kwtest/simpletest/page.php b/app/cdash/tests/kwtest/simpletest/page.php index 5a93d10021..f93d0e8d62 100644 --- a/app/cdash/tests/kwtest/simpletest/page.php +++ b/app/cdash/tests/kwtest/simpletest/page.php @@ -19,12 +19,12 @@ */ class SimplePage { - private $links = array(); + private $links = []; private $title = false; private $last_widget; private $label; - private $forms = array(); - private $frames = array(); + private $forms = []; + private $frames = []; private $transport_error; private $raw; private $text = false; @@ -222,7 +222,7 @@ public function getRealm() */ public function getFrameFocus() { - return array(); + return []; } /** @@ -268,7 +268,7 @@ public function setFrames($frames) protected function linkIsAbsolute($url) { $parsed = new SimpleUrl($url); - return (boolean)($parsed->getScheme() && $parsed->getHost()); + return (bool)($parsed->getScheme() && $parsed->getHost()); } /** @@ -311,7 +311,7 @@ public function getFrameset() if (!$this->hasFrames()) { return false; } - $urls = array(); + $urls = []; for ($i = 0; $i < count($this->frames); $i++) { $name = $this->frames[$i]->getAttribute('name'); $url = new SimpleUrl($this->frames[$i]->getAttribute('src')); @@ -337,7 +337,7 @@ public function getFrames() */ public function getUrls() { - $all = array(); + $all = []; foreach ($this->links as $link) { $url = $this->getUrlFromLink($link); $all[] = $url->asString(); @@ -353,7 +353,7 @@ public function getUrls() */ public function getUrlsByLabel($label) { - $matches = array(); + $matches = []; foreach ($this->links as $link) { if ($link->getText() == $label) { $matches[] = $this->getUrlFromLink($link); diff --git a/app/cdash/tests/kwtest/simpletest/parser.php b/app/cdash/tests/kwtest/simpletest/parser.php index 24386f3134..8b56bba353 100644 --- a/app/cdash/tests/kwtest/simpletest/parser.php +++ b/app/cdash/tests/kwtest/simpletest/parser.php @@ -7,9 +7,9 @@ /**#@+ * Lexer mode stack constants */ -foreach (array('LEXER_ENTER', 'LEXER_MATCHED', +foreach (['LEXER_ENTER', 'LEXER_MATCHED', 'LEXER_UNMATCHED', 'LEXER_EXIT', - 'LEXER_SPECIAL') as $i => $constant) { + 'LEXER_SPECIAL'] as $i => $constant) { if (!defined($constant)) { define($constant, $i + 1); } @@ -36,8 +36,8 @@ class ParallelRegex public function ParallelRegex($case) { $this->_case = $case; - $this->_patterns = array(); - $this->_labels = array(); + $this->_patterns = []; + $this->_labels = []; $this->_regex = null; } @@ -94,8 +94,8 @@ public function _getCompoundedRegex() if ($this->_regex == null) { for ($i = 0, $count = count($this->_patterns); $i < $count; $i++) { $this->_patterns[$i] = '(' . str_replace( - array('/', '(', ')'), - array('\/', '\(', '\)'), + ['/', '(', ')'], + ['\/', '\(', '\)'], $this->_patterns[$i]) . ')'; } $this->_regex = '/' . implode('|', $this->_patterns) . '/' . $this->_getPerlMatchingFlags(); @@ -126,7 +126,7 @@ class SimpleStateStack */ public function SimpleStateStack($start) { - $this->_stack = array($start); + $this->_stack = [$start]; } /** @@ -190,10 +190,10 @@ class SimpleLexer public function SimpleLexer(&$parser, $start = 'accept', $case = false) { $this->_case = $case; - $this->_regexes = array(); + $this->_regexes = []; $this->_parser = &$parser; $this->_mode = new SimpleStateStack($start); - $this->_mode_handlers = array($start => $start); + $this->_mode_handlers = [$start => $start]; } /** @@ -306,7 +306,7 @@ public function parse($raw) } $length = strlen($raw); while (is_array($parsed = $this->_reduce($raw))) { - list($raw, $unmatched, $matched, $mode) = $parsed; + [$raw, $unmatched, $matched, $mode] = $parsed; if (!$this->_dispatchTokens($unmatched, $matched, $mode)) { return false; } @@ -431,7 +431,7 @@ public function _reduce($raw) $unparsed_character_count = strpos($raw, $match); $unparsed = substr($raw, 0, $unparsed_character_count); $raw = substr($raw, $unparsed_character_count + strlen($match)); - return array($raw, $unparsed, $match, $action); + return [$raw, $unparsed, $match, $action]; } return true; } @@ -465,8 +465,8 @@ public function SimpleHtmlLexer(&$parser) */ public function _getParsedTags() { - return array('a', 'base', 'title', 'form', 'input', 'button', 'textarea', 'select', - 'option', 'frameset', 'frame', 'label'); + return ['a', 'base', 'title', 'form', 'input', 'button', 'textarea', 'select', + 'option', 'frameset', 'frame', 'label']; } /** @@ -548,7 +548,7 @@ public function SimpleHtmlSaxParser(&$listener) $this->_listener = &$listener; $this->_lexer = &$this->createLexer($this); $this->_tag = ''; - $this->_attributes = array(); + $this->_attributes = []; $this->_current_attribute = ''; } @@ -596,7 +596,7 @@ public function acceptStartToken($token, $event) $this->_tag, $this->_attributes); $this->_tag = ''; - $this->_attributes = array(); + $this->_attributes = []; return $success; } if ($token != '=') { diff --git a/app/cdash/tests/kwtest/simpletest/php_parser.php b/app/cdash/tests/kwtest/simpletest/php_parser.php index 608e50e6fc..6dc4ef4873 100644 --- a/app/cdash/tests/kwtest/simpletest/php_parser.php +++ b/app/cdash/tests/kwtest/simpletest/php_parser.php @@ -7,9 +7,9 @@ /**#@+ * Lexer mode stack constants */ -foreach (array('LEXER_ENTER', 'LEXER_MATCHED', +foreach (['LEXER_ENTER', 'LEXER_MATCHED', 'LEXER_UNMATCHED', 'LEXER_EXIT', - 'LEXER_SPECIAL') as $i => $constant) { + 'LEXER_SPECIAL'] as $i => $constant) { if (!defined($constant)) { define($constant, $i + 1); } @@ -36,8 +36,8 @@ class ParallelRegex public function __construct($case) { $this->case = $case; - $this->patterns = array(); - $this->labels = array(); + $this->patterns = []; + $this->labels = []; $this->regex = null; } @@ -94,8 +94,8 @@ protected function getCompoundedRegex() if ($this->regex == null) { for ($i = 0, $count = count($this->patterns); $i < $count; $i++) { $this->patterns[$i] = '(' . str_replace( - array('/', '(', ')'), - array('\/', '\(', '\)'), + ['/', '(', ')'], + ['\/', '\(', '\)'], $this->patterns[$i]) . ')'; } $this->regex = '/' . implode('|', $this->patterns) . '/' . $this->getPerlMatchingFlags(); @@ -126,7 +126,7 @@ class SimpleStateStack */ public function __construct($start) { - $this->stack = array($start); + $this->stack = [$start]; } /** @@ -190,10 +190,10 @@ class SimpleLexer public function __construct($parser, $start = 'accept', $case = false) { $this->case = $case; - $this->regexes = array(); + $this->regexes = []; $this->parser = $parser; $this->mode = new SimpleStateStack($start); - $this->mode_handlers = array($start => $start); + $this->mode_handlers = [$start => $start]; } /** @@ -306,7 +306,7 @@ public function parse($raw) } $length = strlen($raw); while (is_array($parsed = $this->reduce($raw))) { - list($raw, $unmatched, $matched, $mode) = $parsed; + [$raw, $unmatched, $matched, $mode] = $parsed; if (!$this->dispatchTokens($unmatched, $matched, $mode)) { return false; } @@ -431,7 +431,7 @@ protected function reduce($raw) $unparsed_character_count = strpos($raw, $match); $unparsed = substr($raw, 0, $unparsed_character_count); $raw = substr($raw, $unparsed_character_count + strlen($match)); - return array($raw, $unparsed, $match, $action); + return [$raw, $unparsed, $match, $action]; } return true; } @@ -465,8 +465,8 @@ public function __construct($parser) */ protected function getParsedTags() { - return array('a', 'base', 'title', 'form', 'input', 'button', 'textarea', 'select', - 'option', 'frameset', 'frame', 'label'); + return ['a', 'base', 'title', 'form', 'input', 'button', 'textarea', 'select', + 'option', 'frameset', 'frame', 'label']; } /** @@ -548,7 +548,7 @@ public function __construct($listener) $this->listener = $listener; $this->lexer = $this->createLexer($this); $this->tag = ''; - $this->attributes = array(); + $this->attributes = []; $this->current_attribute = ''; } @@ -594,7 +594,7 @@ public function acceptStartToken($token, $event) $this->tag, $this->attributes); $this->tag = ''; - $this->attributes = array(); + $this->attributes = []; return $success; } if ($token != '=') { @@ -683,12 +683,12 @@ class SimplePhpPageBuilder private $tags; private $page; private $private_content_tag; - private $open_forms = array(); - private $complete_forms = array(); + private $open_forms = []; + private $complete_forms = []; private $frameset = false; - private $loading_frames = array(); + private $loading_frames = []; private $frameset_nesting_level = 0; - private $left_over_labels = array(); + private $left_over_labels = []; /** * Frees up any references so as to allow the PHP garbage @@ -699,12 +699,12 @@ public function free() unset($this->tags); unset($this->page); unset($this->private_content_tags); - $this->open_forms = array(); - $this->complete_forms = array(); + $this->open_forms = []; + $this->complete_forms = []; $this->frameset = false; - $this->loading_frames = array(); + $this->loading_frames = []; $this->frameset_nesting_level = 0; - $this->left_over_labels = array(); + $this->left_over_labels = []; } /** @@ -724,7 +724,7 @@ public function can() */ public function parse($response) { - $this->tags = array(); + $this->tags = []; $this->page = $this->createPage($response); $parser = $this->createParser($this); $parser->parse($response->getContent()); @@ -895,7 +895,7 @@ protected function openTag($tag) { $name = $tag->getTagName(); if (!in_array($name, array_keys($this->tags))) { - $this->tags[$name] = array(); + $this->tags[$name] = []; } $this->tags[$name][] = $tag; } @@ -954,7 +954,7 @@ protected function acceptLabelEnd() */ protected function isFormElement($name) { - return in_array($name, array('input', 'button', 'textarea', 'select')); + return in_array($name, ['input', 'button', 'textarea', 'select']); } /** diff --git a/app/cdash/tests/kwtest/simpletest/recorder.php b/app/cdash/tests/kwtest/simpletest/recorder.php index 4a19eb6398..79cf28f6dd 100644 --- a/app/cdash/tests/kwtest/simpletest/recorder.php +++ b/app/cdash/tests/kwtest/simpletest/recorder.php @@ -28,8 +28,8 @@ abstract class SimpleResult */ public function __construct($breadcrumb, $message) { - list($this->time, $this->breadcrumb, $this->message) = - array(time(), $breadcrumb, $message); + [$this->time, $this->breadcrumb, $this->message] = + [time(), $breadcrumb, $message]; } } @@ -60,7 +60,7 @@ class SimpleResultOfException extends SimpleResult */ class Recorder extends SimpleReporterDecorator { - public $results = array(); + public $results = []; /** * Stashes the pass as a SimpleResultOfPass diff --git a/app/cdash/tests/kwtest/simpletest/reflection_php4.php b/app/cdash/tests/kwtest/simpletest/reflection_php4.php index 388886b034..676831a5e9 100644 --- a/app/cdash/tests/kwtest/simpletest/reflection_php4.php +++ b/app/cdash/tests/kwtest/simpletest/reflection_php4.php @@ -79,7 +79,7 @@ public function getMethods() */ public function getInterfaces() { - return array(); + return []; } /** diff --git a/app/cdash/tests/kwtest/simpletest/reflection_php5.php b/app/cdash/tests/kwtest/simpletest/reflection_php5.php index 8d014aa336..c04c5264f5 100644 --- a/app/cdash/tests/kwtest/simpletest/reflection_php5.php +++ b/app/cdash/tests/kwtest/simpletest/reflection_php5.php @@ -98,7 +98,7 @@ public function getInterfaces() { $reflection = new ReflectionClass($this->interface); if ($reflection->isInterface()) { - return array($this->interface); + return [$this->interface]; } return $this->onlyParents($reflection->getInterfaces()); } @@ -110,7 +110,7 @@ public function getInterfaces() */ public function getInterfaceMethods() { - $methods = array(); + $methods = []; foreach ($this->getInterfaces() as $interface) { $methods = array_merge($methods, get_class_methods($interface)); } @@ -187,8 +187,8 @@ public function hasFinal() */ protected function onlyParents($interfaces) { - $parents = array(); - $blacklist = array(); + $parents = []; + $blacklist = []; foreach ($interfaces as $interface) { foreach ($interfaces as $possible_parent) { if ($interface->getName() == $possible_parent->getName()) { @@ -279,7 +279,7 @@ public function getSignature($name) if ($name == '__call') { return 'function __call($method, $arguments)'; } - if (in_array($name, array('__get', '__isset', $name == '__unset'))) { + if (in_array($name, ['__get', '__isset', $name == '__unset'])) { return "function {$name}(\$key)"; } if ($name == '__toString') { @@ -327,7 +327,7 @@ protected function getFullSignature($name) */ protected function getParameterSignatures($method) { - $signatures = array(); + $signatures = []; foreach ($method->getParameters() as $parameter) { $signature = ''; $type = $parameter->getClass(); @@ -357,7 +357,7 @@ protected function getParameterSignatures($method) */ protected function suppressSpurious($name) { - return str_replace(array('[', ']', ' '), '', $name); + return str_replace(['[', ']', ' '], '', $name); } /** diff --git a/app/cdash/tests/kwtest/simpletest/scorer.php b/app/cdash/tests/kwtest/simpletest/scorer.php index 88e35ff9ba..1ce8191936 100644 --- a/app/cdash/tests/kwtest/simpletest/scorer.php +++ b/app/cdash/tests/kwtest/simpletest/scorer.php @@ -245,7 +245,7 @@ class SimpleReporter extends SimpleScorer public function __construct() { parent::__construct(); - $this->test_stack = array(); + $this->test_stack = []; $this->size = null; $this->progress = 0; } @@ -452,7 +452,7 @@ public function getTestList() if (method_exists($this->reporter, 'getTestList')) { return $this->reporter->getTestList(); } else { - return array(); + return []; } } @@ -627,7 +627,7 @@ public function paintSignal($type, $payload) */ class MultipleReporter { - private $reporters = array(); + private $reporters = []; /** * Adds a reporter to the subscriber list. diff --git a/app/cdash/tests/kwtest/simpletest/simpletest.php b/app/cdash/tests/kwtest/simpletest/simpletest.php index 788713f53e..39bab7f335 100644 --- a/app/cdash/tests/kwtest/simpletest/simpletest.php +++ b/app/cdash/tests/kwtest/simpletest/simpletest.php @@ -89,7 +89,7 @@ public static function prefer($object) public static function preferred($classes) { if (!is_array($classes)) { - $classes = array($classes); + $classes = [$classes]; } $registry = &SimpleTest::getRegistry(); for ($i = count($registry['Preferred']) - 1; $i >= 0; $i--) { @@ -221,14 +221,14 @@ public static function getContext() */ protected static function getDefaults() { - return array( + return [ 'Parsers' => false, 'MockBaseClass' => 'SimpleMock', - 'IgnoreList' => array(), + 'IgnoreList' => [], 'DefaultProxy' => false, 'DefaultProxyUsername' => false, 'DefaultProxyPassword' => false, - 'Preferred' => array(new HtmlReporter(), new TextReporter(), new XmlReporter())); + 'Preferred' => [new HtmlReporter(), new TextReporter(), new XmlReporter()]]; } /** @@ -268,7 +268,7 @@ class SimpleTestContext */ public function clear() { - $this->resources = array(); + $this->resources = []; } /** @@ -407,6 +407,6 @@ protected function captureTrace() if (function_exists('debug_backtrace')) { return array_reverse(debug_backtrace()); } - return array(); + return []; } } diff --git a/app/cdash/tests/kwtest/simpletest/tag.php b/app/cdash/tests/kwtest/simpletest/tag.php index d3ad5640bb..709d541977 100644 --- a/app/cdash/tests/kwtest/simpletest/tag.php +++ b/app/cdash/tests/kwtest/simpletest/tag.php @@ -27,7 +27,7 @@ class SimpleTagBuilder */ public function createTag($name, $attributes) { - static $map = array( + static $map = [ 'a' => 'SimpleAnchorTag', 'title' => 'SimpleTitleTag', 'base' => 'SimpleBaseTag', @@ -36,7 +36,7 @@ public function createTag($name, $attributes) 'option' => 'SimpleOptionTag', 'label' => 'SimpleLabelTag', 'form' => 'SimpleFormTag', - 'frame' => 'SimpleFrameTag'); + 'frame' => 'SimpleFrameTag']; $attributes = $this->keysToLowerCase($attributes); if (array_key_exists($name, $map)) { $tag_class = $map[$name]; @@ -73,7 +73,7 @@ protected function createInputTag($attributes) return new SimpleTextTag($attributes); } $type = strtolower(trim($attributes['type'])); - $map = array( + $map = [ 'submit' => 'SimpleSubmitTag', 'image' => 'SimpleImageSubmitTag', 'checkbox' => 'SimpleCheckboxTag', @@ -81,7 +81,7 @@ protected function createInputTag($attributes) 'text' => 'SimpleTextTag', 'hidden' => 'SimpleTextTag', 'password' => 'SimpleTextTag', - 'file' => 'SimpleUploadTag'); + 'file' => 'SimpleUploadTag']; if (array_key_exists($type, $map)) { $tag_class = $map[$type]; return new $tag_class($attributes); @@ -96,7 +96,7 @@ protected function createInputTag($attributes) */ protected function keysToLowerCase($map) { - $lower = array(); + $lower = []; foreach ($map as $key => $value) { $lower[strtolower($key)] = $value; } @@ -195,7 +195,7 @@ public function getTagName() */ public function getChildElements() { - return array(); + return []; } /** @@ -730,7 +730,7 @@ protected function wrap($text) if ($this->wrapIsEnabled()) { return wordwrap( $text, - (integer)$this->getAttribute('cols'), + (int)$this->getAttribute('cols'), "\r\n"); } return $text; @@ -802,7 +802,7 @@ class SimpleSelectionTag extends SimpleWidget public function __construct($attributes) { parent::__construct('select', $attributes); - $this->options = array(); + $this->options = []; $this->choice = false; } @@ -890,7 +890,7 @@ class MultipleSelectionTag extends SimpleWidget public function __construct($attributes) { parent::__construct('select', $attributes); - $this->options = array(); + $this->options = []; $this->values = false; } @@ -921,7 +921,7 @@ public function addContent($content) */ public function getDefault() { - $default = array(); + $default = []; for ($i = 0, $count = count($this->options); $i < $count; $i++) { if ($this->options[$i]->getAttribute('selected') !== false) { $default[] = $this->options[$i]->getDefault(); @@ -939,7 +939,7 @@ public function getDefault() */ public function setValue($desired) { - $achieved = array(); + $achieved = []; foreach ($desired as $value) { $success = false; for ($i = 0, $count = count($this->options); $i < $count; $i++) { @@ -1154,7 +1154,7 @@ public function getDefault() */ class SimpleTagGroup { - private $widgets = array(); + private $widgets = []; /** * Adds a tag to the group. @@ -1250,7 +1250,7 @@ class SimpleCheckboxGroup extends SimpleTagGroup */ public function getValue() { - $values = array(); + $values = []; $widgets = $this->getWidgets(); for ($i = 0, $count = count($widgets); $i < $count; $i++) { if ($widgets[$i]->getValue() !== false) { @@ -1266,7 +1266,7 @@ public function getValue() */ public function getDefault() { - $values = array(); + $values = []; $widgets = $this->getWidgets(); for ($i = 0, $count = count($widgets); $i < $count; $i++) { if ($widgets[$i]->getDefault() !== false) { @@ -1309,7 +1309,7 @@ public function setValue($values) */ protected function valuesArePossible($values) { - $matches = array(); + $matches = []; $widgets = &$this->getWidgets(); for ($i = 0, $count = count($widgets); $i < $count; $i++) { $possible = $widgets[$i]->getAttribute('value'); @@ -1349,10 +1349,10 @@ protected function coerceValues($values) protected function makeArray($value) { if ($value === false) { - return array(); + return []; } if (is_string($value)) { - return array($value); + return [$value]; } return $value; } diff --git a/app/cdash/tests/kwtest/simpletest/test_case.php b/app/cdash/tests/kwtest/simpletest/test_case.php index cdbbd1cbb5..9cfb90f6b7 100644 --- a/app/cdash/tests/kwtest/simpletest/test_case.php +++ b/app/cdash/tests/kwtest/simpletest/test_case.php @@ -159,7 +159,7 @@ public function run($reporter) */ public function getTests() { - $methods = array(); + $methods = []; foreach (get_class_methods(get_class($this)) as $method) { if ($this->isTest($method)) { $methods[] = $method; @@ -190,7 +190,7 @@ protected function isTest($method) public function before($method) { $this->reporter->paintMethodStart($method); - $this->observers = array(); + $this->observers = []; } /** @@ -327,7 +327,7 @@ public function assert($expectation, $compare, $message = '%s') */ public function getAssertionLine() { - $trace = new SimpleStackTrace(array('assert', 'expect', 'pass', 'fail', 'skip')); + $trace = new SimpleStackTrace(['assert', 'expect', 'pass', 'fail', 'skip']); return $trace->traceMethod(); } @@ -426,7 +426,7 @@ protected function scrapeClassesFromFile($test_file) */ public function selectRunnableTests($candidates) { - $classes = array(); + $classes = []; foreach ($candidates as $class) { if (TestSuite::getBaseTestCase($class)) { $reflection = new SimpleReflection($class); @@ -482,7 +482,7 @@ class TestSuite public function __construct($label = false) { $this->label = $label; - $this->test_cases = array(); + $this->test_cases = []; } /** diff --git a/app/cdash/tests/kwtest/simpletest/tidy_parser.php b/app/cdash/tests/kwtest/simpletest/tidy_parser.php index 994b5ad271..607462c7b6 100644 --- a/app/cdash/tests/kwtest/simpletest/tidy_parser.php +++ b/app/cdash/tests/kwtest/simpletest/tidy_parser.php @@ -10,9 +10,9 @@ class SimpleTidyPageBuilder { private $page; - private $forms = array(); - private $labels = array(); - private $widgets_by_id = array(); + private $forms = []; + private $labels = []; + private $widgets_by_id = []; public function __destruct() { @@ -26,8 +26,8 @@ public function __destruct() private function free() { unset($this->page); - $this->forms = array(); - $this->labels = array(); + $this->forms = []; + $this->labels = []; } /** @@ -48,7 +48,7 @@ public function parse($response) { $this->page = new SimplePage($response); $tidied = tidy_parse_string($input = $this->insertGuards($response->getContent()), - array('output-xml' => false, 'wrap' => '0', 'indent' => 'no'), + ['output-xml' => false, 'wrap' => '0', 'indent' => 'no'], 'latin1'); $this->walkTree($tidied->html()); $this->attachLabels($this->widgets_by_id, $this->labels); @@ -116,7 +116,7 @@ private function stripEmptyTagGuards($html) private function insertTextareaSimpleWhitespaceGuards($html) { return preg_replace_callback('#]*)>(.*?)#is', - array($this, 'insertWhitespaceGuards'), + [$this, 'insertWhitespaceGuards'], $html); } @@ -128,8 +128,8 @@ private function insertTextareaSimpleWhitespaceGuards($html) private function insertWhitespaceGuards($matches) { return '' . - str_replace(array("\n", "\r", "\t", ' '), - array('___NEWLINE___', '___CR___', '___TAB___', '___SPACE___'), + str_replace(["\n", "\r", "\t", ' '], + ['___NEWLINE___', '___CR___', '___TAB___', '___SPACE___'], $matches[2]) . ''; } @@ -142,8 +142,8 @@ private function insertWhitespaceGuards($matches) */ private function stripTextareaWhitespaceGuards($html) { - return str_replace(array('___NEWLINE___', '___CR___', '___TAB___', '___SPACE___'), - array("\n", "\r", "\t", ' '), + return str_replace(['___NEWLINE___', '___CR___', '___TAB___', '___SPACE___'], + ["\n", "\r", "\t", ' '], $html); } @@ -205,7 +205,7 @@ private function walkForm($node, $form, $enclosing_label = '') if ($node->name == 'a') { $this->page->addLink($this->tags()->createTag($node->name, (array)$node->attribute) ->addContent($this->innerHtml($node))); - } elseif (in_array($node->name, array('input', 'button', 'textarea', 'select'))) { + } elseif (in_array($node->name, ['input', 'button', 'textarea', 'select'])) { $this->addWidgetToForm($node, $form, $enclosing_label); } elseif ($node->name == 'label') { $this->labels[] = $this->tags()->createTag($node->name, (array)$node->attribute) @@ -267,7 +267,7 @@ private function indexWidgetById($widget) return; } if (!isset($this->widgets_by_id[$id])) { - $this->widgets_by_id[$id] = array(); + $this->widgets_by_id[$id] = []; } $this->widgets_by_id[$id][] = $widget; } @@ -279,7 +279,7 @@ private function indexWidgetById($widget) */ private function collectSelectOptions($node) { - $options = array(); + $options = []; if ($node->name == 'option') { $options[] = $this->tags()->createTag($node->name, $this->attributes($node)) ->addContent($this->innerHtml($node)); @@ -301,9 +301,9 @@ private function collectSelectOptions($node) private function attributes($node) { if (!preg_match('|<[^ ]+\s(.*?)/?>|s', $node->value, $first_tag_contents)) { - return array(); + return []; } - $attributes = array(); + $attributes = []; preg_match_all('/\S+\s*=\s*\'[^\']*\'|(\S+\s*=\s*"[^"]*")|([^ =]+\s*=\s*[^ "\']+?)|[^ "\']+/', $first_tag_contents[1], $matches); foreach ($matches[0] as $unparsed) { $attributes = $this->mergeAttribute($attributes, $unparsed); @@ -321,7 +321,7 @@ private function attributes($node) private function mergeAttribute($attributes, $raw) { $parts = explode('=', $raw); - list($name, $value) = count($parts) == 1 ? array($parts[0], $parts[0]) : $parts; + [$name, $value] = count($parts) == 1 ? [$parts[0], $parts[0]] : $parts; $attributes[trim($name)] = html_entity_decode($this->dequote(trim($value)), ENT_QUOTES); return $attributes; } @@ -334,7 +334,7 @@ private function mergeAttribute($attributes, $raw) private function dequote($quoted) { if (preg_match('/^(\'([^\']*)\'|"([^"]*)")$/', $quoted, $matches)) { - return isset($matches[3]) ? $matches[3] : $matches[2]; + return $matches[3] ?? $matches[2]; } return $quoted; } @@ -346,11 +346,11 @@ private function dequote($quoted) */ private function collectFrames($node) { - $frames = array(); + $frames = []; if ($node->name == 'frame') { - $frames = array($this->tags()->createTag($node->name, (array)$node->attribute)); + $frames = [$this->tags()->createTag($node->name, (array)$node->attribute)]; } elseif ($node->hasChildren()) { - $frames = array(); + $frames = []; foreach ($node->child as $child) { $frames = array_merge($frames, $this->collectFrames($child)); } diff --git a/app/cdash/tests/kwtest/simpletest/url.php b/app/cdash/tests/kwtest/simpletest/url.php index 720081e0be..7cee890e93 100644 --- a/app/cdash/tests/kwtest/simpletest/url.php +++ b/app/cdash/tests/kwtest/simpletest/url.php @@ -39,7 +39,7 @@ class SimpleUrl */ public function __construct($url = '') { - list($x, $y) = $this->chompCoordinates($url); + [$x, $y] = $this->chompCoordinates($url); $this->setCoordinates($x, $y); $this->scheme = $this->chompScheme($url); if ($this->scheme === 'file') { @@ -50,7 +50,7 @@ public function __construct($url = '') // the scheme is file. $url = str_replace('\\', '/', $url); } - list($this->username, $this->password) = $this->chompLogin($url); + [$this->username, $this->password] = $this->chompLogin($url); $this->host = $this->chompHost($url); $this->port = false; if (preg_match('/(.*?):(.*)/', $this->host, $host_parts)) { @@ -60,7 +60,7 @@ public function __construct($url = '') $this->host = false; } else { $this->host = $host_parts[1]; - $this->port = (integer)$host_parts[2]; + $this->port = (int)$host_parts[2]; } } $this->path = $this->chompPath($url); @@ -79,9 +79,9 @@ protected function chompCoordinates(&$url) { if (preg_match('/(.*)\?(\d+),(\d+)$/', $url, $matches)) { $url = $matches[1]; - return array((integer)$matches[2], (integer)$matches[3]); + return [(int)$matches[2], (int)$matches[3]]; } - return array(false, false); + return [false, false]; } /** @@ -118,12 +118,12 @@ protected function chompLogin(&$url) if (preg_match('#^([^/]*)@(.*)#', $url, $matches)) { $url = $prefix . $matches[2]; $parts = explode(':', $matches[1]); - return array( + return [ urldecode($parts[0]), - isset($parts[1]) ? urldecode($parts[1]) : false); + isset($parts[1]) ? urldecode($parts[1]) : false]; } $url = $prefix . $url; - return array(false, false); + return [false, false]; } /** @@ -250,7 +250,7 @@ public function getHost($default = false) public function getTld() { $path_parts = pathinfo($this->getHost()); - return (isset($path_parts['extension']) ? $path_parts['extension'] : false); + return ($path_parts['extension'] ?? false); } /** @@ -320,8 +320,8 @@ public function setCoordinates($x = false, $y = false) $this->x = $this->y = false; return; } - $this->x = (integer)$x; - $this->y = (integer)$y; + $this->x = (int)$x; + $this->y = (int)$y; } /** diff --git a/app/cdash/tests/kwtest/simpletest/user_agent.php b/app/cdash/tests/kwtest/simpletest/user_agent.php index 7c33e2ea20..fafacca88e 100644 --- a/app/cdash/tests/kwtest/simpletest/user_agent.php +++ b/app/cdash/tests/kwtest/simpletest/user_agent.php @@ -34,7 +34,7 @@ class SimpleUserAgent private $proxy_username = false; private $proxy_password = false; private $connection_timeout = DEFAULT_CONNECTION_TIMEOUT; - private $additional_headers = array(); + private $additional_headers = []; /** * Starts with no cookies, realms or proxies. diff --git a/app/cdash/tests/kwtest/simpletest/web_tester.php b/app/cdash/tests/kwtest/simpletest/web_tester.php index 412adf3f92..6d05c536a7 100644 --- a/app/cdash/tests/kwtest/simpletest/web_tester.php +++ b/app/cdash/tests/kwtest/simpletest/web_tester.php @@ -91,7 +91,7 @@ protected function testSingle($compare) protected function testMultiple($compare) { if (is_string($compare)) { - $compare = array($compare); + $compare = [$compare]; } if (!is_array($compare)) { return false; @@ -206,7 +206,7 @@ protected function testHeaderLine($line) if (count($parsed = explode(':', $line, 2)) < 2) { return false; } - list($header, $value) = $parsed; + [$header, $value] = $parsed; if ($this->normaliseHeader($header) != $this->expected_header) { return false; } @@ -1227,7 +1227,7 @@ protected function assertFieldValue($identifier, $value, $expected, $message) */ public function assertResponse($responses, $message = '%s') { - $responses = (is_array($responses) ? $responses : array($responses)); + $responses = (is_array($responses) ? $responses : [$responses]); $code = $this->browser->getResponseCode(); try { $message = sprintf($message, 'Expecting response in [' . @@ -1247,7 +1247,7 @@ public function assertResponse($responses, $message = '%s') */ public function assertMime($types, $message = '%s') { - $types = (is_array($types) ? $types : array($types)); + $types = (is_array($types) ? $types : [$types]); $type = $this->browser->getMimeType(); $message = sprintf($message, 'Expecting mime type in [' . implode(', ', $types) . "] got [$type]"); @@ -1522,7 +1522,7 @@ public function assertNotEqual($first, $second, $message = '%s') */ public function getAssertionLine() { - $trace = new SimpleStackTrace(array('assert', 'click', 'pass', 'fail')); + $trace = new SimpleStackTrace(['assert', 'click', 'pass', 'fail']); return $trace->traceMethod(); } } diff --git a/app/cdash/tests/kwtest/simpletest/xml.php b/app/cdash/tests/kwtest/simpletest/xml.php index 7d5ad3bba2..d9ae90b1dd 100644 --- a/app/cdash/tests/kwtest/simpletest/xml.php +++ b/app/cdash/tests/kwtest/simpletest/xml.php @@ -53,8 +53,8 @@ protected function getIndent($offset = 0) public function toParsedXml($text) { return str_replace( - array('&', '<', '>', '"', '\''), - array('&', '<', '>', '"', '''), + ['&', '<', '>', '"', '\''], + ['&', '<', '>', '"', '''], $text); } @@ -449,7 +449,7 @@ public function getSize() { $attributes = $this->getAttributes(); if (isset($attributes['SIZE'])) { - return (integer)$attributes['SIZE']; + return (int)$attributes['SIZE']; } return 0; } @@ -477,10 +477,10 @@ public function __construct(&$listener) { $this->listener = &$listener; $this->expat = &$this->createParser(); - $this->tag_stack = array(); + $this->tag_stack = []; $this->in_content_tag = false; $this->content = ''; - $this->attributes = array(); + $this->attributes = []; } /** @@ -551,8 +551,8 @@ protected function popNestingTag() */ protected function isLeaf($tag) { - return in_array($tag, array( - 'NAME', 'PASS', 'FAIL', 'EXCEPTION', 'SKIP', 'MESSAGE', 'FORMATTED', 'SIGNAL')); + return in_array($tag, [ + 'NAME', 'PASS', 'FAIL', 'EXCEPTION', 'SKIP', 'MESSAGE', 'FORMATTED', 'SIGNAL']); } /** @@ -586,7 +586,7 @@ protected function startElement($expat, $tag, $attributes) protected function endElement($expat, $tag) { $this->in_content_tag = false; - if (in_array($tag, array('GROUP', 'CASE', 'TEST'))) { + if (in_array($tag, ['GROUP', 'CASE', 'TEST'])) { $nesting_tag = $this->popNestingTag(); $nesting_tag->paintEnd($this->listener); } elseif ($tag == 'NAME') { diff --git a/app/cdash/tests/test_actualtrilinossubmission.php b/app/cdash/tests/test_actualtrilinossubmission.php index af79ca89bd..3331b48985 100644 --- a/app/cdash/tests/test_actualtrilinossubmission.php +++ b/app/cdash/tests/test_actualtrilinossubmission.php @@ -15,14 +15,14 @@ public function __construct() public function createProjectWithName($project) { - $settings = array( + $settings = [ 'Name' => $project, 'Description' => $project . ' project created by test code in file [' . __FILE__ . ']', 'EmailBrokenSubmission' => '1', 'ShowIPAddresses' => '1', 'DisplayLabels' => '1', 'NightlyTime' => '21:00:00 America/New_York', - 'ShareLabelFilters' => '1'); + 'ShareLabelFilters' => '1']; return $this->createProject($settings); } diff --git a/app/cdash/tests/test_aggregatecoverage.php b/app/cdash/tests/test_aggregatecoverage.php index a23cd488a8..2f0e675f40 100644 --- a/app/cdash/tests/test_aggregatecoverage.php +++ b/app/cdash/tests/test_aggregatecoverage.php @@ -29,11 +29,11 @@ public function __construct() public function testAggregateCoverage() { - $files = array( + $files = [ 'debug_case/Coverage.xml', 'debug_case/CoverageLog-0.xml', 'release_case/Coverage.xml', - 'release_case/CoverageLog-0.xml'); + 'release_case/CoverageLog-0.xml']; foreach ($files as $file) { if (!$this->submitTestingFile($file)) { diff --git a/app/cdash/tests/test_aggregatesubprojectcoverage.php b/app/cdash/tests/test_aggregatesubprojectcoverage.php index 9b8c68b5d1..b9068e0ee1 100644 --- a/app/cdash/tests/test_aggregatesubprojectcoverage.php +++ b/app/cdash/tests/test_aggregatesubprojectcoverage.php @@ -27,7 +27,7 @@ public function __construct() public function testSubmitCoverage() { - $files = array( + $files = [ 'debug_case/experimental/Coverage.xml', 'debug_case/experimental/CoverageLog-0.xml', 'debug_case/production/Coverage.xml', @@ -43,8 +43,8 @@ public function testSubmitCoverage() 'release_case/thirdparty/Coverage.xml', 'release_case/thirdparty/CoverageLog-0.xml', 'release_case/releaseonly/Coverage.xml', - 'release_case/releaseonly/CoverageLog-0.xml' - ); + 'release_case/releaseonly/CoverageLog-0.xml', + ]; foreach ($files as $filename) { $file_to_submit = "$this->DataDir/$filename"; if (!$this->submission('CrossSubProjectExample', $file_to_submit)) { @@ -107,82 +107,82 @@ public function testVerifyResults() // Verify child results. // 'debug_coverage' - $experimental = array(); - $experimental['MyExperimentalFeature'] = array(); + $experimental = []; + $experimental['MyExperimentalFeature'] = []; $experimental['MyExperimentalFeature']['loctested'] = 5; $experimental['MyExperimentalFeature']['locuntested'] = 3; $experimental['MyExperimentalFeature']['percentage'] = 62.5; $success &= $this->verifyChildResult($debug_buildid, "Experimental", $experimental); - $third_party = array(); - $third_party['MyThirdPartyDependency'] = array(); + $third_party = []; + $third_party['MyThirdPartyDependency'] = []; $third_party['MyThirdPartyDependency']['loctested'] = 5; $third_party['MyThirdPartyDependency']['locuntested'] = 0; $third_party['MyThirdPartyDependency']['percentage'] = 100.0; $success &= $this->verifyChildResult($debug_buildid, "Third Party", $third_party); - $production = array(); - $production['MyEmptyCoverage'] = array(); + $production = []; + $production['MyEmptyCoverage'] = []; $production['MyEmptyCoverage']['loctested'] = 0; $production['MyEmptyCoverage']['locuntested'] = 0; $production['MyEmptyCoverage']['percentage'] = 100.0; - $production['MyProductionCode'] = array(); + $production['MyProductionCode'] = []; $production['MyProductionCode']['loctested'] = 10; $production['MyProductionCode']['locuntested'] = 6; $production['MyProductionCode']['percentage'] = 62.5; $success &= $this->verifyChildResult($debug_buildid, "Production", $production); // 'release_coverage' - $experimental = array(); - $experimental['MyExperimentalFeature'] = array(); + $experimental = []; + $experimental['MyExperimentalFeature'] = []; $experimental['MyExperimentalFeature']['loctested'] = 4; $experimental['MyExperimentalFeature']['locuntested'] = 4; $experimental['MyExperimentalFeature']['percentage'] = 50.0; $success &= $this->verifyChildResult($release_buildid, "Experimental", $experimental); - $third_party = array(); - $third_party['MyThirdPartyDependency'] = array(); + $third_party = []; + $third_party['MyThirdPartyDependency'] = []; $third_party['MyThirdPartyDependency']['loctested'] = 3; $third_party['MyThirdPartyDependency']['locuntested'] = 2; $third_party['MyThirdPartyDependency']['percentage'] = 60.0; - $third_party['MyReleaseOnlyFeature'] = array(); + $third_party['MyReleaseOnlyFeature'] = []; $third_party['MyReleaseOnlyFeature']['loctested'] = 4; $third_party['MyReleaseOnlyFeature']['locuntested'] = 4; $third_party['MyReleaseOnlyFeature']['percentage'] = 50.0; $success &= $this->verifyChildResult($release_buildid, "Third Party", $third_party); - $production = array(); - $production['MyProductionCode'] = array(); + $production = []; + $production['MyProductionCode'] = []; $production['MyProductionCode']['loctested'] = 8; $production['MyProductionCode']['locuntested'] = 8; $production['MyProductionCode']['percentage'] = 50.0; $success &= $this->verifyChildResult($release_buildid, "Production", $production); // 'Aggregate Coverage' - $experimental = array(); - $experimental['MyExperimentalFeature'] = array(); + $experimental = []; + $experimental['MyExperimentalFeature'] = []; $experimental['MyExperimentalFeature']['loctested'] = 6; $experimental['MyExperimentalFeature']['locuntested'] = 2; $experimental['MyExperimentalFeature']['percentage'] = 75.0; $success &= $this->verifyChildResult($aggregate_buildid, "Experimental", $experimental); - $third_party = array(); - $third_party['MyThirdPartyDependency'] = array(); + $third_party = []; + $third_party['MyThirdPartyDependency'] = []; $third_party['MyThirdPartyDependency']['loctested'] = 5; $third_party['MyThirdPartyDependency']['locuntested'] = 0; $third_party['MyThirdPartyDependency']['percentage'] = 100.0; - $third_party['MyReleaseOnlyFeature'] = array(); + $third_party['MyReleaseOnlyFeature'] = []; $third_party['MyReleaseOnlyFeature']['loctested'] = 4; $third_party['MyReleaseOnlyFeature']['locuntested'] = 4; $third_party['MyReleaseOnlyFeature']['percentage'] = 50.0; $success &= $this->verifyChildResult($aggregate_buildid, "Third Party", $third_party); - $production = array(); - $production['MyEmptyCoverage'] = array(); + $production = []; + $production['MyEmptyCoverage'] = []; $production['MyEmptyCoverage']['loctested'] = 0; $production['MyEmptyCoverage']['locuntested'] = 0; $production['MyEmptyCoverage']['percentage'] = 100.0; - $production['MyProductionCode'] = array(); + $production['MyProductionCode'] = []; $production['MyProductionCode']['loctested'] = 12; $production['MyProductionCode']['locuntested'] = 4; $production['MyProductionCode']['percentage'] = 75.0; @@ -193,46 +193,46 @@ public function testVerifyResults() public function testCompareCoverage() { - $answers = array( - 'Total' => array( + $answers = [ + 'Total' => [ 'debug' => 68.97, 'release' => 51.35, - 'aggregate' => 72.97), - 'Third Party' => array( + 'aggregate' => 72.97], + 'Third Party' => [ 'debug' => 100, 'release' => 53.85, - 'aggregate' => 69.23), - 'Experimental' => array( + 'aggregate' => 69.23], + 'Experimental' => [ 'debug' => 62.5, 'release' => 50, - 'aggregate' => 75), - 'Production' => array( + 'aggregate' => 75], + 'Production' => [ 'debug' => 62.5, 'release' => 50, - 'aggregate' => 75)); + 'aggregate' => 75]]; $this->compareCoverageCheck('', $answers); } public function testCompareCoverageWithFilters() { $extra_url = '&filtercount=1&showfilters=1&field1=subproject&compare1=62&value1=MyReleaseOnlyFeature'; - $answers = array( - 'Total' => array( + $answers = [ + 'Total' => [ 'debug' => 68.97, 'release' => 51.72, - 'aggregate' => 79.31), - 'Third Party' => array( + 'aggregate' => 79.31], + 'Third Party' => [ 'debug' => 100, 'release' => 60, - 'aggregate' => 100), - 'Experimental' => array( + 'aggregate' => 100], + 'Experimental' => [ 'debug' => 62.5, 'release' => 50, - 'aggregate' => 75), - 'Production' => array( + 'aggregate' => 75], + 'Production' => [ 'debug' => 62.5, 'release' => 50, - 'aggregate' => 75)); + 'aggregate' => 75]]; $this->compareCoverageCheck($extra_url, $answers); } @@ -250,7 +250,7 @@ public function compareCoverageCheck($extra_url, $answers) } // Figure out how to distinguish between our coverage builds. - $builds = array(); + $builds = []; foreach ($jsonobj['builds'] as $build) { switch ($build['name']) { case 'debug_coverage': diff --git a/app/cdash/tests/test_authtoken.php b/app/cdash/tests/test_authtoken.php index 8fd3994e44..29350cdd50 100644 --- a/app/cdash/tests/test_authtoken.php +++ b/app/cdash/tests/test_authtoken.php @@ -45,7 +45,7 @@ public function testEnableAuthenticatedSubmissions() $settings = [ 'Name' => 'AuthTokenProject', 'AuthenticateSubmissions' => true, - 'Public' => 0 + 'Public' => 0, ]; $projectid = $this->createProject($settings); if ($projectid < 1) { @@ -174,7 +174,7 @@ public function postSubmit($token) 'endtime' => '1475599870', 'track' => 'Nightly', 'type' => 'GcovTar', - 'datafilesmd5[0]=' => '5454e16948a1d58d897e174b75cc5633' + 'datafilesmd5[0]=' => '5454e16948a1d58d897e174b75cc5633', ]; $ch = curl_init(); diff --git a/app/cdash/tests/test_autoremovebuilds_on_submit.php b/app/cdash/tests/test_autoremovebuilds_on_submit.php index 08f3810cfa..c632f8af3f 100644 --- a/app/cdash/tests/test_autoremovebuilds_on_submit.php +++ b/app/cdash/tests/test_autoremovebuilds_on_submit.php @@ -110,7 +110,7 @@ public function testBuildsRemovedOnSubmission() VALUES (:groupid, :endtime)'); $query_params = [ ':groupid' => $existing_group_id, - ':endtime' => '2010-02-25 00:00:00' + ':endtime' => '2010-02-25 00:00:00', ]; $db->execute($stmt, $query_params); diff --git a/app/cdash/tests/test_bazeljson.php b/app/cdash/tests/test_bazeljson.php index 8daeffc106..861592873a 100644 --- a/app/cdash/tests/test_bazeljson.php +++ b/app/cdash/tests/test_bazeljson.php @@ -38,7 +38,7 @@ public function testBazelJSON() 'testfailed' => 1, 'testpassed' => 1, 'configureerrors' => 0, - 'configurewarnings' => 0 + 'configurewarnings' => 0, ]; foreach ($answer_key as $key => $expected) { $found = $row[$key]; @@ -90,7 +90,7 @@ public function testFilterBazelJSON() 'Name' => 'Bazel', 'Public' => 1, 'WarningsFilter' => 'unused variable', - 'ErrorsFilter' => 'use of undeclared identifier' + 'ErrorsFilter' => 'use of undeclared identifier', ]; $projectid = $this->createProject($settings); if ($projectid < 1) { @@ -121,7 +121,7 @@ public function testFilterBazelJSON() 'testfailed' => 1, 'testpassed' => 1, 'configureerrors' => 0, - 'configurewarnings' => 0 + 'configurewarnings' => 0, ]; foreach ($answer_key as $key => $expected) { $found = $row[$key]; @@ -140,7 +140,7 @@ public function testBazelSubProjs() // Create a new project. $settings = [ 'Name' => 'BazelSubProj', - 'Public' => 1 + 'Public' => 1, ]; $projectid = $this->createProject($settings); if ($projectid < 1) { @@ -185,7 +185,7 @@ public function testBazelSubProjs() 'testfailed' => 1, 'testpassed' => 1, 'configureerrors' => 0, - 'configurewarnings' => 0 + 'configurewarnings' => 0, ]; foreach ($answer_key as $key => $expected) { $found = $row[$key]; @@ -215,7 +215,7 @@ public function testBazelSubProjs() 'testfailed' => 0, 'testpassed' => 1, 'configureerrors' => 0, - 'configurewarnings' => 0 + 'configurewarnings' => 0, ]; break; case 'subproj2': @@ -225,7 +225,7 @@ public function testBazelSubProjs() 'testfailed' => 1, 'testpassed' => 0, 'configureerrors' => 0, - 'configurewarnings' => 0 + 'configurewarnings' => 0, ]; break; default: @@ -268,7 +268,7 @@ public function testBazelTestFailed() 'testfailed' => 1, 'testpassed' => 1, 'configureerrors' => 0, - 'configurewarnings' => 0 + 'configurewarnings' => 0, ]; foreach ($answer_key as $key => $expected) { $found = $row[$key]; @@ -324,7 +324,7 @@ public function testBazelTimeout() 'testfailed' => 1, 'testpassed' => 18, 'configureerrors' => 0, - 'configurewarnings' => 1 + 'configurewarnings' => 1, ]; foreach ($answer_key as $key => $expected) { $found = $row[$key]; @@ -380,7 +380,7 @@ public function testBazelConfigure() 'testfailed' => 0, 'testpassed' => 0, 'configureerrors' => 1, - 'configurewarnings' => 700 + 'configurewarnings' => 700, ]; foreach ($answer_key as $key => $expected) { $found = $row[$key]; @@ -416,7 +416,7 @@ public function testBazelDuplicateTests() 'testfailed' => 1, 'testpassed' => 0, 'configureerrors' => 0, - 'configurewarnings' => 0 + 'configurewarnings' => 0, ]; foreach ($answer_key as $key => $expected) { $found = $row[$key]; @@ -452,7 +452,7 @@ public function testMultipleLineError() 'testfailed' => 0, 'testpassed' => 0, 'configureerrors' => 0, - 'configurewarnings' => 0 + 'configurewarnings' => 0, ]; foreach ($answer_key as $key => $expected) { $found = $row[$key]; @@ -498,7 +498,7 @@ public function testShardTest() 'testfailed' => 0, 'testpassed' => 1, 'configureerrors' => 0, - 'configurewarnings' => 0 + 'configurewarnings' => 0, ]; foreach ($answer_key as $key => $expected) { $found = $row[$key]; @@ -554,7 +554,7 @@ public function testShardTestFailures() 'testfailed' => 2, 'testpassed' => 36, 'configureerrors' => 0, - 'configurewarnings' => 0 + 'configurewarnings' => 0, ]; foreach ($answer_key as $key => $expected) { $found = $row[$key]; @@ -650,7 +650,7 @@ public function testShardTestTimeout() 'testfailed' => 1, 'testpassed' => 0, 'configureerrors' => 0, - 'configurewarnings' => 0 + 'configurewarnings' => 0, ]; foreach ($answer_key as $key => $expected) { $found = $row[$key]; @@ -732,7 +732,7 @@ private function submit_data($project_name, $upload_type, $md5, $file_path, $response = $client->request('POST', $this->url . '/submit.php', [ - 'form_params' => $fields + 'form_params' => $fields, ] ); } catch (GuzzleHttp\Exception\ClientException $e) { diff --git a/app/cdash/tests/test_branchcoverage.php b/app/cdash/tests/test_branchcoverage.php index d0b3a5ae43..64c4582560 100644 --- a/app/cdash/tests/test_branchcoverage.php +++ b/app/cdash/tests/test_branchcoverage.php @@ -61,7 +61,7 @@ protected function postSubmit($token=null) 'endtime' => '1422455768', 'track' => 'Experimental', 'type' => 'GcovTar', - 'datafilesmd5[0]=' => '5454e16948a1d58d897e174b75cc5633' + 'datafilesmd5[0]=' => '5454e16948a1d58d897e174b75cc5633', ]; $ch = curl_init(); diff --git a/app/cdash/tests/test_builddetails.php b/app/cdash/tests/test_builddetails.php index 8e1b7874c8..dbce7251c6 100644 --- a/app/cdash/tests/test_builddetails.php +++ b/app/cdash/tests/test_builddetails.php @@ -18,7 +18,7 @@ public function __construct() parent::__construct(); $this->testDataDir = dirname(__FILE__) . '/data/BuildDetails'; - $this->testDataFiles = array('Subbuild1.xml', 'Subbuild2.xml', 'Subbuild3.xml'); + $this->testDataFiles = ['Subbuild1.xml', 'Subbuild2.xml', 'Subbuild3.xml']; $this->createProject(['Name' => 'BuildDetails']); @@ -29,7 +29,7 @@ public function __construct() } } - $this->builds = array(); + $this->builds = []; $builds = pdo_query("SELECT * FROM build WHERE name = 'linux' ORDER BY id"); while ($build = pdo_fetch_array($builds)) { $this->builds[] = $build; diff --git a/app/cdash/tests/test_buildfailuredetails.php b/app/cdash/tests/test_buildfailuredetails.php index caf1c3a4af..80db153f0c 100644 --- a/app/cdash/tests/test_buildfailuredetails.php +++ b/app/cdash/tests/test_buildfailuredetails.php @@ -33,7 +33,7 @@ public function testBuildFailureDetails() } // Get the buildids that we just created so we can delete them later. - $buildids = array(); + $buildids = []; $buildid_results = pdo_query( "SELECT id FROM build WHERE name='test_buildfailure'"); while ($buildid_array = pdo_fetch_array($buildid_results)) { diff --git a/app/cdash/tests/test_buildgrouprule.php b/app/cdash/tests/test_buildgrouprule.php index 708bc482eb..0e02fcefbd 100644 --- a/app/cdash/tests/test_buildgrouprule.php +++ b/app/cdash/tests/test_buildgrouprule.php @@ -137,7 +137,7 @@ public function testOnlyExpireRulesFromSameProject() $payload = [ 'buildid' => $build->Id, 'groupid' => $build->GroupId, - 'expected' => 1 + 'expected' => 1, ]; try { $response = $client->request('POST', @@ -155,7 +155,7 @@ public function testOnlyExpireRulesFromSameProject() $payload = [ 'buildid' => $build1->Id, 'expected' => 1, - 'newgroupid' => $group->GetId() + 'newgroupid' => $group->GetId(), ]; try { $response = $client->request('POST', diff --git a/app/cdash/tests/test_buildmodel.php b/app/cdash/tests/test_buildmodel.php index 4f415cc1e0..9a2d5cacef 100644 --- a/app/cdash/tests/test_buildmodel.php +++ b/app/cdash/tests/test_buildmodel.php @@ -25,8 +25,8 @@ public function __construct() $this->deleteLog($this->logfilename); $this->testDataDir = dirname(__FILE__) . '/data/BuildModel'; - $this->testDataFiles = array('build1.xml', 'build2.xml', 'build3.xml', 'build4.xml', - 'build5.xml', 'configure1.xml'); + $this->testDataFiles = ['build1.xml', 'build2.xml', 'build3.xml', 'build4.xml', + 'build5.xml', 'configure1.xml']; pdo_query("INSERT INTO project (name) VALUES ('BuildModel')"); @@ -37,13 +37,13 @@ public function __construct() } } - $this->builds = array(); + $this->builds = []; $builds = pdo_query("SELECT * FROM build WHERE name = 'buildmodel-test-build' ORDER BY id"); while ($build = pdo_fetch_array($builds)) { $this->builds[] = $build; } - $this->parentBuilds = array(); + $this->parentBuilds = []; $parentBuilds = pdo_query("SELECT * FROM build WHERE name = 'buildmodel-test-parent-build' AND parentid = -1 ORDER BY id"); while ($build = pdo_fetch_array($parentBuilds)) { $this->parentBuilds[] = $build; @@ -239,12 +239,12 @@ public function testBuildModelGetsResolvedBuildFailures() { // Make sure the first build returns no resolved build failures since it can't have any $build = $this->getBuildModel(0); - $this->assertTrue($build->GetResolvedBuildFailures(0)->fetchAll() === array()); + $this->assertTrue($build->GetResolvedBuildFailures(0)->fetchAll() === []); // The second build resolves the errored failure, but not the warning failure $build = $this->getBuildModel(1); $this->assertTrue(count($build->GetResolvedBuildFailures(0)->fetchAll()) === 1); - $this->assertTrue($build->GetResolvedBuildFailures(1)->fetchAll() === array()); + $this->assertTrue($build->GetResolvedBuildFailures(1)->fetchAll() === []); // The third build has a resolved failure of type warning $build = $this->getBuildModel(2); diff --git a/app/cdash/tests/test_buildproperties.php b/app/cdash/tests/test_buildproperties.php index 65f57f149b..bd05482e39 100644 --- a/app/cdash/tests/test_buildproperties.php +++ b/app/cdash/tests/test_buildproperties.php @@ -212,7 +212,7 @@ private function create_build($buildname, $filename, $date, $md5) 'POST', config('app.url') . '/submit.php', [ - 'form_params' => $fields + 'form_params' => $fields, ] ); } catch (GuzzleHttp\Exception\ClientException $e) { diff --git a/app/cdash/tests/test_buildrelationship.php b/app/cdash/tests/test_buildrelationship.php index adf03f4ccc..44d20b8d9c 100644 --- a/app/cdash/tests/test_buildrelationship.php +++ b/app/cdash/tests/test_buildrelationship.php @@ -94,7 +94,7 @@ public function testBuildRelationships() $payload = [ 'project' => 'InsightExample', 'buildid' => $build2->Id, - 'relatedid' => $build1->Id + 'relatedid' => $build1->Id, ]; $response = $client->request('POST', $this->url . '/api/v1/relateBuilds.php', @@ -109,14 +109,14 @@ public function testBuildRelationships() 'project' => 'InsightExample', 'buildid' => $build2->Id, 'relatedid' => $build1->Id, - 'relationship' => 'depends on' + 'relationship' => 'depends on', ], [ 'project' => 'InsightExample', 'buildid' => $build3->Id, 'relatedid' => $build2->Id, - 'relationship' => 'uses results from' - ] + 'relationship' => 'uses results from', + ], ]; foreach ($payloads as $payload) { try { diff --git a/app/cdash/tests/test_commitauthornotification.php b/app/cdash/tests/test_commitauthornotification.php index 89cca54fca..c843158c54 100644 --- a/app/cdash/tests/test_commitauthornotification.php +++ b/app/cdash/tests/test_commitauthornotification.php @@ -18,7 +18,7 @@ public function __construct() 'Name' => $this->projectName, 'Description' => "Project {$this->projectName} test for cdash testing", 'EmailBrokenSubmission' => 1, - 'EmailRedundantFailures' => 0 + 'EmailRedundantFailures' => 0, ]); $group = new BuildGroup(); $group->SetName('Continuous'); diff --git a/app/cdash/tests/test_configurewarnings.php b/app/cdash/tests/test_configurewarnings.php index 0f6564cffa..527d903aa1 100644 --- a/app/cdash/tests/test_configurewarnings.php +++ b/app/cdash/tests/test_configurewarnings.php @@ -22,17 +22,17 @@ public function __construct() public function testConfigureWarning() { - $warning_lines = array( + $warning_lines = [ 'CMake Warning (dev) at some/file/path:1234 (MESSAGE):', - 'WARNING: blah blah blah'); + 'WARNING: blah blah blah']; - $non_warning_lines = array( + $non_warning_lines = [ 'warning: blah blah blah', 'WARNING : blah blah blah', 'WARNING some other text: blah blah blah', 'This warning is for project developers. Use -Wno-dev to suppress it.', '<<< Configuring library with warnings >>>', - 'library warnings................. : yes'); + 'library warnings................. : yes']; foreach ($warning_lines as $line) { if (!BuildConfigure::IsConfigureWarning($line)) { @@ -52,7 +52,7 @@ public function testConfigureWarningDiff() // Create a project for this test. $settings = [ 'Name' => 'ConfigureWarningProject', - 'Description' => 'ConfigureWarningProject' + 'Description' => 'ConfigureWarningProject', ]; $this->ProjectId = $this->createProject($settings); if ($this->ProjectId < 1) { diff --git a/app/cdash/tests/test_consistenttestingday.php b/app/cdash/tests/test_consistenttestingday.php index dcfd8d4c93..695cd7e64a 100644 --- a/app/cdash/tests/test_consistenttestingday.php +++ b/app/cdash/tests/test_consistenttestingday.php @@ -32,7 +32,7 @@ public function testConsistentTestingDay() $this->project = new Project(); $this->project->Id = $this->createProject([ 'Name' => 'ConsistentTestingDay', - 'NightlyTime' => '16:30:00 America/New_York' + 'NightlyTime' => '16:30:00 America/New_York', ]); $this->project->Fill(); diff --git a/app/cdash/tests/test_coveragedirectories.php b/app/cdash/tests/test_coveragedirectories.php index fac8fe0b1b..05e11c340e 100644 --- a/app/cdash/tests/test_coveragedirectories.php +++ b/app/cdash/tests/test_coveragedirectories.php @@ -25,16 +25,16 @@ public function testCoverageDirectories() $project->Delete(); } - $settings = array( + $settings = [ 'Name' => 'CoverageDirectories', - 'Description' => 'Test to make sure directories display proper files'); + 'Description' => 'Test to make sure directories display proper files']; $projectid = $this->createProject($settings); if ($projectid < 1) { $this->fail('Failed to create project'); return; } - $filesToSubmit = array('prefix-Coverage.xml', 'prefix-CoverageLog-0.xml', 'sort-Coverage.xml', 'sort-CoverageLog-0.xml', 'sort-CoverageLog-1.xml'); + $filesToSubmit = ['prefix-Coverage.xml', 'prefix-CoverageLog-0.xml', 'sort-Coverage.xml', 'sort-CoverageLog-0.xml', 'sort-CoverageLog-1.xml']; $dir = dirname(__FILE__) . '/data/CoverageDirectories'; foreach ($filesToSubmit as $file) { if (!$this->submission('CoverageDirectories', "$dir/$file")) { diff --git a/app/cdash/tests/test_createpublicdashboard.php b/app/cdash/tests/test_createpublicdashboard.php index 81e9163f31..7b8d012c89 100644 --- a/app/cdash/tests/test_createpublicdashboard.php +++ b/app/cdash/tests/test_createpublicdashboard.php @@ -15,10 +15,10 @@ public function __construct() public function testCreatePublicDashboard() { - $settings = array( + $settings = [ 'Name' => 'PublicDashboard', 'Description' => "This project is for CMake dashboards run on this machine to submit to from their test suites... CMake dashboards on this machine should set CMAKE_TESTS_CDASH_SERVER to $this->url", - 'EmailAdministrator' => 1); + 'EmailAdministrator' => 1]; $this->createProject($settings); } } diff --git a/app/cdash/tests/test_crosssubprojectcoverage.php b/app/cdash/tests/test_crosssubprojectcoverage.php index cf1ab8f501..1e3e1fd1b3 100644 --- a/app/cdash/tests/test_crosssubprojectcoverage.php +++ b/app/cdash/tests/test_crosssubprojectcoverage.php @@ -30,9 +30,9 @@ public function __construct() public function testCreateProjectTest() { // Create a new project for this test. - $settings = array( + $settings = [ 'Name' => 'CrossSubProjectExample', - 'Description' => 'Example of coverage across SubProjects'); + 'Description' => 'Example of coverage across SubProjects']; $this->createProject($settings); } @@ -87,7 +87,7 @@ public function submitResults($subproject, $starttime, $endtime, $md5) } // Do the POST submission to get a pending buildid from CDash. - $post_data = array( + $post_data = [ 'project' => 'CrossSubProjectExample', 'subproject' => $subproject, 'build' => 'subproject_coverage_example', @@ -97,7 +97,7 @@ public function submitResults($subproject, $starttime, $endtime, $md5) 'endtime' => $endtime, 'track' => 'Nightly', 'type' => 'GcovTar', - 'datafilesmd5[0]=' => $md5); + 'datafilesmd5[0]=' => $md5]; $post_result = $this->post($this->url . '/submit.php', $post_data); $post_json = json_decode($post_result, true); if ($post_json['status'] != 0) { diff --git a/app/cdash/tests/test_deferredsubmissions.php b/app/cdash/tests/test_deferredsubmissions.php index e370981796..64c4359077 100644 --- a/app/cdash/tests/test_deferredsubmissions.php +++ b/app/cdash/tests/test_deferredsubmissions.php @@ -135,7 +135,7 @@ private function getToken(string $scope) $response = $this->post($this->url . '/api/authtokens/create', [ 'description' => 'mytoken', 'scope' => $scope, - 'projectid' => $this->project->Id + 'projectid' => $this->project->Id, ]); $response = json_decode($response, true); $this->token = $response['raw_token']; diff --git a/app/cdash/tests/test_dynamicanalysissummary.php b/app/cdash/tests/test_dynamicanalysissummary.php index 4a011fd336..f7194be431 100644 --- a/app/cdash/tests/test_dynamicanalysissummary.php +++ b/app/cdash/tests/test_dynamicanalysissummary.php @@ -31,7 +31,7 @@ public function __construct() $this->DataDir = dirname(__FILE__) . '/data/DynamicAnalysisSummary'; $this->ParentId = 0; $this->StandaloneBuildId = 0; - $this->ChildIds = array(); + $this->ChildIds = []; } public function testDynamicAnalysisSummary() diff --git a/app/cdash/tests/test_email.php b/app/cdash/tests/test_email.php index 3c2ad7188f..000d56899d 100644 --- a/app/cdash/tests/test_email.php +++ b/app/cdash/tests/test_email.php @@ -21,11 +21,11 @@ public function __construct() public function testCreateProjectTest() { - $settings = array( + $settings = [ 'Name' => 'EmailProjectExample', 'Description' => 'Project EmailProjectExample test for cdash testing', 'EmailBrokenSubmission' => 1, - 'EmailRedundantFailures' => 0); + 'EmailRedundantFailures' => 0]; $this->project = $this->createProject($settings); } @@ -124,7 +124,7 @@ public function testSubmissionEmailBuild() 'Build Time: 2009-02-23 10:02:04', 'Type: Nightly', 'Warnings fixed: 6', - '-CDash on' + '-CDash on', ]; if ($this->assertLogContains($expected, 15)) { $this->pass('Passed'); @@ -170,7 +170,7 @@ public function testSubmissionEmailTest() 'Build Time: 2009-02-23 10:02:04', 'Type: Nightly', 'Test failures fixed: 2', - '-CDash on' + '-CDash on', ]; if ($this->assertLogContains($expected, 15)) { diff --git a/app/cdash/tests/test_excludesubprojects.php b/app/cdash/tests/test_excludesubprojects.php index 3e6003a4d8..2402267252 100644 --- a/app/cdash/tests/test_excludesubprojects.php +++ b/app/cdash/tests/test_excludesubprojects.php @@ -240,69 +240,69 @@ public function testExcludeHonorsOtherFilters() { $baseurl = "$this->url/api/v1/index.php?project=Trilinos&date=2011-07-22&filtercombine=and&field1=site&compare1=61&value1=hut11.kitware&showfilters=1"; - $test_cases = array( - array( + $test_cases = [ + [ 'filter' => 'buildduration', 'compare' => 43, 'value' => '10m%2045s', - 'exclude' => 'Teuchos' - ), - array( + 'exclude' => 'Teuchos', + ], + [ 'filter' => 'buildduration', 'compare' => 44, 'value' => '6m%2026s', 'exclude' => 'Sacado', - 'reverse' => true - ), - array( + 'reverse' => true, + ], + [ 'filter' => 'builderrors', 'compare' => 43, 'value' => 5, - 'exclude' => 'Mesquite' - ), - array( + 'exclude' => 'Mesquite', + ], + [ 'filter' => 'buildwarnings', 'compare' => 42, 'value' => 29, - 'exclude' => 'Sacado' - ), - array( + 'exclude' => 'Sacado', + ], + [ 'filter' => 'configureduration', 'compare' => 41, 'value' => 309, - 'exclude' => 'Teuchos' - ), - array( + 'exclude' => 'Teuchos', + ], + [ 'filter' => 'configureerrors', 'compare' => 43, 'value' => 21, - 'exclude' => 'Kokkos' - ), - array( + 'exclude' => 'Kokkos', + ], + [ 'filter' => 'configurewarnings', 'compare' => 42, 'value' => 35, - 'exclude' => 'Sacado' - ), - array( + 'exclude' => 'Sacado', + ], + [ 'filter' => 'testsfailed', 'compare' => 43, 'value' => 10, - 'exclude' => 'TrilinosFramework' - ), - array( + 'exclude' => 'TrilinosFramework', + ], + [ 'filter' => 'testsnotrun', 'compare' => 42, 'value' => 65, - 'exclude' => 'Didasko' - ), - array( + 'exclude' => 'Didasko', + ], + [ 'filter' => 'testspassed', 'compare' => 42, 'value' => 33, - 'exclude' => 'Sacado' - ) - ); + 'exclude' => 'Sacado', + ], + ]; foreach ($test_cases as $test_case) { $filter = $test_case['filter']; diff --git a/app/cdash/tests/test_expiredbuildrules.php b/app/cdash/tests/test_expiredbuildrules.php index df7ad248db..a0081488ea 100644 --- a/app/cdash/tests/test_expiredbuildrules.php +++ b/app/cdash/tests/test_expiredbuildrules.php @@ -31,7 +31,7 @@ public function testExpiredBuildRules() ':siteid' => 0, ':parentgroupid' => 0, ':starttime' => '2009-02-23 00:00:00', - ':endtime' => '2009-02-25 00:00:00' + ':endtime' => '2009-02-25 00:00:00', ]; $db->execute($stmt, $query_params); diff --git a/app/cdash/tests/test_filterbuilderrors.php b/app/cdash/tests/test_filterbuilderrors.php index d4ddb9a527..c2cdbc7e3e 100644 --- a/app/cdash/tests/test_filterbuilderrors.php +++ b/app/cdash/tests/test_filterbuilderrors.php @@ -26,9 +26,9 @@ public function testFilterBuildErrors() 'Name' => 'FilterErrors', 'Public' => 1, 'ErrorsFilter' => <<createProject($settings); if ($projectid < 1) { @@ -45,7 +45,7 @@ public function testFilterBuildErrors() } // Get the buildid that we just created so we can delete it later. - $buildids = array(); + $buildids = []; $buildid_results = pdo_query( "SELECT id FROM build WHERE name='test_buildfailure'"); while ($buildid_array = pdo_fetch_array($buildid_results)) { diff --git a/app/cdash/tests/test_filtertestlabels.php b/app/cdash/tests/test_filtertestlabels.php index d1c3520242..cc3aedd67d 100644 --- a/app/cdash/tests/test_filtertestlabels.php +++ b/app/cdash/tests/test_filtertestlabels.php @@ -32,7 +32,7 @@ public function testFilterLabels() WHERE name='EmailProjectExample'"); // Get the buildid that we just created so we can delete it later. - $buildids = array(); + $buildids = []; $buildid_results = pdo_query( "SELECT id FROM build WHERE name='labeltest_build'"); while ($buildid_array = pdo_fetch_array($buildid_results)) { diff --git a/app/cdash/tests/test_hidecolumns.php b/app/cdash/tests/test_hidecolumns.php index 8d8791083c..0420e049cb 100644 --- a/app/cdash/tests/test_hidecolumns.php +++ b/app/cdash/tests/test_hidecolumns.php @@ -14,7 +14,7 @@ class HideColumnsTestCase extends KWWebTestCase public function __construct() { parent::__construct(); - $this->MethodsToTest = array('Update', 'Configure', 'Build', 'Test'); + $this->MethodsToTest = ['Update', 'Configure', 'Build', 'Test']; } public function testHideColumns() diff --git a/app/cdash/tests/test_imagecomparison.php b/app/cdash/tests/test_imagecomparison.php index 9fa7269c17..66a43c16dd 100644 --- a/app/cdash/tests/test_imagecomparison.php +++ b/app/cdash/tests/test_imagecomparison.php @@ -35,7 +35,7 @@ public function testImageComparison() JOIN test2image t2i ON (b2t.outputid=t2i.outputid) JOIN image i ON (i.id=t2i.imgid) WHERE b.name='image_comparison'"); - $imgids = array(); + $imgids = []; $buildid = 0; while ($row = $stmt->fetch()) { $buildid = $row['buildid']; diff --git a/app/cdash/tests/test_indexnextprevious.php b/app/cdash/tests/test_indexnextprevious.php index 1d55f017f7..bb076aafaf 100644 --- a/app/cdash/tests/test_indexnextprevious.php +++ b/app/cdash/tests/test_indexnextprevious.php @@ -40,7 +40,7 @@ public function testIndexNextPrevious() $build_rows = [ [$first_date, 1476079800, 'Experimental'], [$second_date, 1507637400, 'Nightly'], - [$third_date, 1539195000, 'Experimental'] + [$third_date, 1539195000, 'Experimental'], ]; foreach ($build_rows as $build_row) { $date = str_replace('-', '', $build_row[0]); diff --git a/app/cdash/tests/test_issuecreation.php b/app/cdash/tests/test_issuecreation.php index 0e55dbd912..bb8237920c 100644 --- a/app/cdash/tests/test_issuecreation.php +++ b/app/cdash/tests/test_issuecreation.php @@ -41,7 +41,7 @@ public function testIssueCreation() foreach ($project_names as $project_name) { $settings = [ 'Name' => $project_name, - 'Public' => 1 + 'Public' => 1, ]; $projectid = $this->createProject($settings); if ($projectid < 1) { @@ -132,16 +132,16 @@ public function testIssueCreation() $trackers = [ [ 'name' => 'Buganizer', - 'url' => 'https://buganizer.com/issues/new?component=123&template=456' + 'url' => 'https://buganizer.com/issues/new?component=123&template=456', ], [ 'name' => 'GitHub', - 'url' => 'https://github.com/Kitware/CDash/issues/new?' + 'url' => 'https://github.com/Kitware/CDash/issues/new?', ], [ 'name' => 'JIRA', - 'url' => 'http://jira.atlassian.com/secure/CreateIssueDetails!init.jspa?pid=123&issuetype=1' - ] + 'url' => 'http://jira.atlassian.com/secure/CreateIssueDetails!init.jspa?pid=123&issuetype=1', + ], ]; // Lookup some IDs that we will need in the answer key below. @@ -170,12 +170,12 @@ public function testIssueCreation() ], 'GitHub' => [ 'Standalone' => "https://github.com/Kitware/CDash/issues/new?title=FAILED+%28w%3D3%2C+t%3D6%2C+d%3D10%29%3A+IssueCreationProject+-+Linux-g%2B%2B-4.1-LesionSizingSandbox_Debug+-+Experimental&body=Details+on+the+submission+can+be+found+at+$encoded_base_url%2Fbuild%2F{$buildid1}%0A%0AProject%3A+IssueCreationProject%0ASite%3A+camelot.kitware%0ABuild+Name%3A+Linux-g%2B%2B-4.1-LesionSizingSandbox_Debug%0ABuild+Time%3A+2009-02-23T07%3A10%3A38+UTC%0AType%3A+Experimental%0AWarnings%3A+3%0ATests+not+passing%3A+6%0ADynamic+analysis+tests+failing%3A+10%0A%0A%0A%2AWarnings%2A+%28first+1%29%0ATesting%5CitkDescoteauxSheetnessImageFilterTest2.cxx+line+187+%28$encoded_base_url%2FviewBuildError.php%3Ftype%3D1%26buildid%3D{$buildid1}%29%0A%5C...%5CSandbox%5CTesting%5CitkDescoteauxSheetnessImageFilterTest2.cxx%3A187%3A+warning%3A+converting+to+%3C-30%3E%3C-128%3E%3C-104%3Emain%3A%3AInputPixelType%3C-30%3E%3C-128%3E%3C-103%3E+from+%3C-30%3E%3C-128%3E%3C-104%3Edouble%3C-30%3E%3C-128%3E%3C-103%3E%0A%0A%0A%0A%0A%2ATests+failing%2A+%28first+1%29%0AitkVectorSegmentationLevelSetFunctionTest1+%7C+Completed+%28OTHER_FAULT%29+%7C+%28$encoded_base_url%2Ftest%2F{$build1failedtestid}%29%0A%0A%0A%0A%2ATests+not+run%2A+%28first+1%29%0AitkVectorFiniteDifferenceFunctionTest1+%7C++%7C+%28$encoded_base_url%2Ftest%2F{$build1notruntestid}%29%0A%0A%0A%0A%2ADynamic+analysis+tests+failing+or+not+run%2A+%28first+1%29%0AitkGeodesicActiveContourLevelSetSegmentationModuleTest1+%28$encoded_base_url%2FviewDynamicAnalysisFile.php%3Fid%3D{$da_id}%29%0A%0A", - 'SubProject' => "https://github.com/Kitware/CDash/issues/new?title=FAILED+%28t%3D1%29%3A+CDash%2FSubProject1+-+test_PR_comment+-+Experimental&body=Details+on+the+submission+can+be+found+at+$encoded_base_url%2Fbuild%2F{$buildid2}%0A%0AProject%3A+CDash%0ASubProject%3A+SubProject1%0ASite%3A+elysium%0ABuild+Name%3A+test_PR_comment%0ABuild+Time%3A+2015-08-11T20%3A45%3A30+UTC%0AType%3A+Experimental%0ATests+not+passing%3A+1%0A%0A%0A%2ATests+failing%2A+%28first+1%29%0Afoo+%7C+Completed+%28Failed%29+%7C+%28$encoded_base_url%2Ftest%2F{$build2failedtestid}%29%0A%0A%40simpletest+%40user1+" + 'SubProject' => "https://github.com/Kitware/CDash/issues/new?title=FAILED+%28t%3D1%29%3A+CDash%2FSubProject1+-+test_PR_comment+-+Experimental&body=Details+on+the+submission+can+be+found+at+$encoded_base_url%2Fbuild%2F{$buildid2}%0A%0AProject%3A+CDash%0ASubProject%3A+SubProject1%0ASite%3A+elysium%0ABuild+Name%3A+test_PR_comment%0ABuild+Time%3A+2015-08-11T20%3A45%3A30+UTC%0AType%3A+Experimental%0ATests+not+passing%3A+1%0A%0A%0A%2ATests+failing%2A+%28first+1%29%0Afoo+%7C+Completed+%28Failed%29+%7C+%28$encoded_base_url%2Ftest%2F{$build2failedtestid}%29%0A%0A%40simpletest+%40user1+", ], 'JIRA' => [ 'Standalone' => "http://jira.atlassian.com/secure/CreateIssueDetails!init.jspa?pid=123&issuetype=1&summary=FAILED+%28w%3D3%2C+t%3D6%2C+d%3D10%29%3A+IssueCreationProject+-+Linux-g%2B%2B-4.1-LesionSizingSandbox_Debug+-+Experimental&description=Details+on+the+submission+can+be+found+at+$encoded_base_url%2Fbuild%2F{$buildid1}%0A%0AProject%3A+IssueCreationProject%0ASite%3A+camelot.kitware%0ABuild+Name%3A+Linux-g%2B%2B-4.1-LesionSizingSandbox_Debug%0ABuild+Time%3A+2009-02-23T07%3A10%3A38+UTC%0AType%3A+Experimental%0AWarnings%3A+3%0ATests+not+passing%3A+6%0ADynamic+analysis+tests+failing%3A+10%0A%0A%0A%2AWarnings%2A+%28first+1%29%0ATesting%5CitkDescoteauxSheetnessImageFilterTest2.cxx+line+187+%28$encoded_base_url%2FviewBuildError.php%3Ftype%3D1%26buildid%3D{$buildid1}%29%0A%5C...%5CSandbox%5CTesting%5CitkDescoteauxSheetnessImageFilterTest2.cxx%3A187%3A+warning%3A+converting+to+%3C-30%3E%3C-128%3E%3C-104%3Emain%3A%3AInputPixelType%3C-30%3E%3C-128%3E%3C-103%3E+from+%3C-30%3E%3C-128%3E%3C-104%3Edouble%3C-30%3E%3C-128%3E%3C-103%3E%0A%0A%0A%0A%0A%2ATests+failing%2A+%28first+1%29%0AitkVectorSegmentationLevelSetFunctionTest1+%7C+Completed+%28OTHER_FAULT%29+%7C+%28$encoded_base_url%2Ftest%2F{$build1failedtestid}%29%0A%0A%0A%0A%2ATests+not+run%2A+%28first+1%29%0AitkVectorFiniteDifferenceFunctionTest1+%7C++%7C+%28$encoded_base_url%2Ftest%2F{$build1notruntestid}%29%0A%0A%0A%0A%2ADynamic+analysis+tests+failing+or+not+run%2A+%28first+1%29%0AitkGeodesicActiveContourLevelSetSegmentationModuleTest1+%28$encoded_base_url%2FviewDynamicAnalysisFile.php%3Fid%3D{$da_id}%29%0A%0A", - 'SubProject' => "http://jira.atlassian.com/secure/CreateIssueDetails!init.jspa?pid=123&issuetype=1&summary=FAILED+%28t%3D1%29%3A+CDash%2FSubProject1+-+test_PR_comment+-+Experimental&description=Details+on+the+submission+can+be+found+at+$encoded_base_url%2Fbuild%2F{$buildid2}%0A%0AProject%3A+CDash%0ASubProject%3A+SubProject1%0ASite%3A+elysium%0ABuild+Name%3A+test_PR_comment%0ABuild+Time%3A+2015-08-11T20%3A45%3A30+UTC%0AType%3A+Experimental%0ATests+not+passing%3A+1%0A%0A%0A%2ATests+failing%2A+%28first+1%29%0Afoo+%7C+Completed+%28Failed%29+%7C+%28$encoded_base_url%2Ftest%2F{$build2failedtestid}%29%0A%0A%5B%7Esimpletest%5D+%5B%7Euser1%5D+" - ] + 'SubProject' => "http://jira.atlassian.com/secure/CreateIssueDetails!init.jspa?pid=123&issuetype=1&summary=FAILED+%28t%3D1%29%3A+CDash%2FSubProject1+-+test_PR_comment+-+Experimental&description=Details+on+the+submission+can+be+found+at+$encoded_base_url%2Fbuild%2F{$buildid2}%0A%0AProject%3A+CDash%0ASubProject%3A+SubProject1%0ASite%3A+elysium%0ABuild+Name%3A+test_PR_comment%0ABuild+Time%3A+2015-08-11T20%3A45%3A30+UTC%0AType%3A+Experimental%0ATests+not+passing%3A+1%0A%0A%0A%2ATests+failing%2A+%28first+1%29%0Afoo+%7C+Completed+%28Failed%29+%7C+%28$encoded_base_url%2Ftest%2F{$build2failedtestid}%29%0A%0A%5B%7Esimpletest%5D+%5B%7Euser1%5D+", + ], ]; foreach ($trackers as $tracker) { @@ -184,7 +184,7 @@ public function testIssueCreation() $settings = [ 'Id' => $this->Projects['IssueCreationProject']->Id, 'BugTrackerType' => $tracker['name'], - 'BugTrackerNewIssueUrl' => $tracker['url'] + 'BugTrackerNewIssueUrl' => $tracker['url'], ]; $this->createProject($settings, true); diff --git a/app/cdash/tests/test_javajsoncoverage.php b/app/cdash/tests/test_javajsoncoverage.php index f5e5bb8404..552ad05a8d 100644 --- a/app/cdash/tests/test_javajsoncoverage.php +++ b/app/cdash/tests/test_javajsoncoverage.php @@ -15,7 +15,7 @@ public function __construct() public function testJavaJSONCoverage() { // Do the POST submission to get a pending buildid. - $post_result = $this->post($this->url . '/submit.php', array( + $post_result = $this->post($this->url . '/submit.php', [ 'project' => 'SubProjectExample', 'build' => 'java_json_coverage', 'site' => 'localhost', @@ -24,7 +24,7 @@ public function testJavaJSONCoverage() 'endtime' => '1422455768', 'track' => 'Experimental', 'type' => 'JavaJSONTar', - 'datafilesmd5[0]=' => '67b5d3cee7b951ff2981c440b4a515ec')); + 'datafilesmd5[0]=' => '67b5d3cee7b951ff2981c440b4a515ec']); $post_json = json_decode($post_result, true); if ($post_json['status'] != 0) { diff --git a/app/cdash/tests/test_jscovercoverage.php b/app/cdash/tests/test_jscovercoverage.php index e538eb34c0..8c5ff450b1 100644 --- a/app/cdash/tests/test_jscovercoverage.php +++ b/app/cdash/tests/test_jscovercoverage.php @@ -15,7 +15,7 @@ public function __construct() public function testJSCoverCoverage() { // Do the POST submission to get a pending buildid. - $post_result = $this->post($this->url . '/submit.php', array( + $post_result = $this->post($this->url . '/submit.php', [ 'project' => 'SubProjectExample', 'build' => 'jscover_coverage', 'site' => 'localhost', @@ -24,7 +24,7 @@ public function testJSCoverCoverage() 'endtime' => '1422455768', 'track' => 'Experimental', 'type' => 'JSCoverTar', - 'datafilesmd5[0]=' => 'e99bdd400ab4643e4fbeef7ec649f04e')); + 'datafilesmd5[0]=' => 'e99bdd400ab4643e4fbeef7ec649f04e']); $post_json = json_decode($post_result, true); if ($post_json['status'] != 0) { diff --git a/app/cdash/tests/test_junithandler.php b/app/cdash/tests/test_junithandler.php index 20e38f4662..327a862b71 100644 --- a/app/cdash/tests/test_junithandler.php +++ b/app/cdash/tests/test_junithandler.php @@ -33,7 +33,7 @@ public function testJUnitHandler() // Create project. $settings = [ 'Name' => 'JUnitHandlerProject', - 'Public' => 1 + 'Public' => 1, ]; $projectid = $this->createProject($settings); if ($projectid < 1) { diff --git a/app/cdash/tests/test_multicoverage.php b/app/cdash/tests/test_multicoverage.php index 3c51fd09f7..ecc3266145 100644 --- a/app/cdash/tests/test_multicoverage.php +++ b/app/cdash/tests/test_multicoverage.php @@ -53,7 +53,7 @@ public function testTarFirst() public function submitXML() { - $filesToSubmit = array('Coverage.xml', 'CoverageLog-0.xml'); + $filesToSubmit = ['Coverage.xml', 'CoverageLog-0.xml']; $dir = dirname(__FILE__) . '/data/MultiCoverage'; foreach ($filesToSubmit as $file) { if (!$this->submission('TrilinosDriver', "$dir/$file")) { @@ -65,7 +65,7 @@ public function submitXML() public function submitTar() { - $post_result = $this->post($this->url . '/submit.php', array( + $post_result = $this->post($this->url . '/submit.php', [ 'project' => 'TrilinosDriver', 'build' => 'multi_coverage_example', 'site' => 'localhost', @@ -74,7 +74,7 @@ public function submitTar() 'endtime' => '1462462884', 'track' => 'Experimental', 'type' => 'GcovTar', - 'datafilesmd5[0]=' => '65f385dd8d360e78a35453144c0919ab')); + 'datafilesmd5[0]=' => '65f385dd8d360e78a35453144c0919ab']); $post_json = json_decode($post_result, true); if ($post_json['status'] != 0) { diff --git a/app/cdash/tests/test_multiplesubprojects.php b/app/cdash/tests/test_multiplesubprojects.php index eeda427b8f..214af4e9fe 100644 --- a/app/cdash/tests/test_multiplesubprojects.php +++ b/app/cdash/tests/test_multiplesubprojects.php @@ -9,8 +9,8 @@ class MultipleSubprojectsTestCase extends KWWebTestCase { - const EMAIL_NORMAL = 0; - const EMAIL_SUMMARY = 1; + public const EMAIL_NORMAL = 0; + public const EMAIL_SUMMARY = 1; private $buildIds; private $dataDir; @@ -160,7 +160,7 @@ private function setEmailPreference($status, $chars) "; $stmt = $pdo->query($sql); - list($this->summaryEmail, $this->emailMaxChars) = $stmt->fetch(); + [$this->summaryEmail, $this->emailMaxChars] = $stmt->fetch(); $sql = " UPDATE buildgroup @@ -245,7 +245,7 @@ public function testMultipleSubprojects() $pdo = get_link_identifier()->getPdo(); $parentid = null; - $subprojects = array("MyThirdPartyDependency", "MyExperimentalFeature", "MyProductionCode", "EmptySubproject"); + $subprojects = ["MyThirdPartyDependency", "MyExperimentalFeature", "MyProductionCode", "EmptySubproject"]; // Check index.php for this date. $this->get($this->url . "/api/v1/index.php?project=SubProjectExample&date=2016-07-28"); @@ -635,7 +635,7 @@ public function testMultipleSubprojects() // Check top-level project results. $project = $jsonobj['project']; - $project_expected = array( + $project_expected = [ 'nbuilderror' => 1, 'nbuildwarning' => 1, 'nbuildpass' => 0, @@ -644,7 +644,7 @@ public function testMultipleSubprojects() 'nconfigurepass' => 0, 'ntestpass' => 1, 'ntestfail' => 5, // Total number of tests failed - 'ntestnotrun' => 1); + 'ntestnotrun' => 1]; foreach ($project_expected as $key => $expected) { $found = $project[$key]; if ($found !== $expected) { @@ -653,8 +653,8 @@ public function testMultipleSubprojects() } // Check results for each individual SubProject. - $subprojects_expected = array( - 'MyThirdPartyDependency' => array( + $subprojects_expected = [ + 'MyThirdPartyDependency' => [ 'nbuilderror' => 1, 'nbuildwarning' => 0, 'nbuildpass' => 0, @@ -663,8 +663,8 @@ public function testMultipleSubprojects() 'nconfigurepass' => 0, 'ntestpass' => 0, 'ntestfail' => 0, - 'ntestnotrun' => 1), - 'MyExperimentalFeature' => array( + 'ntestnotrun' => 1], + 'MyExperimentalFeature' => [ 'nbuilderror' => 0, 'nbuildwarning' => 1, 'nbuildpass' => 0, @@ -673,8 +673,8 @@ public function testMultipleSubprojects() 'nconfigurepass' => 0, 'ntestpass' => 0, 'ntestfail' => 5, - 'ntestnotrun' => 0), - 'MyProductionCode' => array( + 'ntestnotrun' => 0], + 'MyProductionCode' => [ 'nbuilderror' => 0, 'nbuildwarning' => 1, 'nbuildpass' => 0, @@ -683,7 +683,7 @@ public function testMultipleSubprojects() 'nconfigurepass' => 0, 'ntestpass' => 1, 'ntestfail' => 0, - 'ntestnotrun' => 0)); + 'ntestnotrun' => 0]]; foreach ($jsonobj['subprojects'] as $subproj) { $subproj_name = $subproj['name']; if (!array_key_exists($subproj_name, $subprojects_expected)) { @@ -783,7 +783,7 @@ public function testMultipleSubprojects() 'viewBuildError.php', 'viewDynamicAnalysis.php', 'viewNotes.php', - 'viewTest.php' + 'viewTest.php', ]; $child_buildid = $builds[0]['id']; diff --git a/app/cdash/tests/test_nobackup.php b/app/cdash/tests/test_nobackup.php index ca6380f4bc..3060af2aa6 100644 --- a/app/cdash/tests/test_nobackup.php +++ b/app/cdash/tests/test_nobackup.php @@ -37,7 +37,7 @@ public function testNoBackup() } // Submit gcov.tar to test the 'PUT' submission path. - $post_result = $this->post($this->url . '/submit.php', array( + $post_result = $this->post($this->url . '/submit.php', [ 'project' => 'InsightExample', 'build' => 'nobackup', 'site' => 'localhost', @@ -46,7 +46,7 @@ public function testNoBackup() 'endtime' => '1475599870', 'track' => 'Nightly', 'type' => 'GcovTar', - 'datafilesmd5[0]=' => '5454e16948a1d58d897e174b75cc5633')); + 'datafilesmd5[0]=' => '5454e16948a1d58d897e174b75cc5633']); $post_json = json_decode($post_result, true); if ($post_json['status'] != 0) { $this->fail( @@ -75,7 +75,7 @@ public function testNoBackup() 'SELECT b.builderrors, cs.loctested FROM build b JOIN coveragesummary cs ON (cs.buildid=b.id) WHERE b.id=?'); - $stmt->execute(array($buildid)); + $stmt->execute([$buildid]); $row = $stmt->fetch(); if ($row['builderrors'] != 0) { $this->fail("Unexpected number of build errors found"); diff --git a/app/cdash/tests/test_notesparsererrormessages.php b/app/cdash/tests/test_notesparsererrormessages.php index bcb974c5db..8a592b5ca3 100644 --- a/app/cdash/tests/test_notesparsererrormessages.php +++ b/app/cdash/tests/test_notesparsererrormessages.php @@ -41,7 +41,7 @@ public function testNotesParserErrorMessages() 'about to query for builds to remove', 'removing old buildids for projectid:', 'removing old buildids for projectid:', - 'Note missing name for build' + 'Note missing name for build', ]; $this->assertLogContains($expected, 5); $this->deleteLog($this->logfilename); diff --git a/app/cdash/tests/test_opencovercoverage.php b/app/cdash/tests/test_opencovercoverage.php index 93cdd18f0c..123c25e06a 100644 --- a/app/cdash/tests/test_opencovercoverage.php +++ b/app/cdash/tests/test_opencovercoverage.php @@ -22,7 +22,7 @@ public function tearDown() public function testOpenCoverCoverage() { // Do the POST submission to get a pending buildid. - $post_result = $this->post($this->url."/submit.php", array( + $post_result = $this->post($this->url."/submit.php", [ "project" => "SubProjectExample", "build" => "opencover_coverage", "site" => "localhost", @@ -31,7 +31,7 @@ public function testOpenCoverCoverage() "endtime" => "1422455768", "track" => "Experimental", "type" => "OpenCoverTar", - "datafilesmd5[0]=" => "c0eeaf6be9838eacc75e652d6c85f925")); + "datafilesmd5[0]=" => "c0eeaf6be9838eacc75e652d6c85f925"]); $post_json = json_decode($post_result, true); if ($post_json["status"] != 0) { @@ -72,7 +72,7 @@ public function testOpenCoverCoverage() public function testOpenCoverCoverageWithDataJson() { // Do the POST submission to get a pending buildid. - $post_result = $this->post($this->url."/submit.php", array( + $post_result = $this->post($this->url."/submit.php", [ "project" => "SubProjectExample", "build" => "opencover_coverage", "site" => "localhost", @@ -81,7 +81,7 @@ public function testOpenCoverCoverageWithDataJson() "endtime" => "1422455768", "track" => "Experimental", "type" => "OpenCoverTar", - "datafilesmd5[0]=" => "21eb5dff198d703652f8a7c93a290140")); + "datafilesmd5[0]=" => "21eb5dff198d703652f8a7c93a290140"]); $post_json = json_decode($post_result, true); if ($post_json["status"] != 0) { diff --git a/app/cdash/tests/test_outputcolor.php b/app/cdash/tests/test_outputcolor.php index a0380085c8..0d694c1192 100644 --- a/app/cdash/tests/test_outputcolor.php +++ b/app/cdash/tests/test_outputcolor.php @@ -27,9 +27,9 @@ public function testOutputColor() $project->Delete(); } - $settings = array( + $settings = [ 'Name' => 'OutputColor', - 'Description' => 'Test to make sure test output uses terminal colors'); + 'Description' => 'Test to make sure test output uses terminal colors']; $projectid = $this->createProject($settings); if ($projectid < 1) { $this->fail('Failed to create project'); diff --git a/app/cdash/tests/test_projectindb.php b/app/cdash/tests/test_projectindb.php index afdf8ca83f..584214612b 100644 --- a/app/cdash/tests/test_projectindb.php +++ b/app/cdash/tests/test_projectindb.php @@ -22,7 +22,7 @@ public function testProjectTest4DbInDatabase() $expected = [ 'name' => 'ProjectTest4Db', 'description' => 'This is a project test for cdash', - 'public' => 0 + 'public' => 0, ]; $this->assertEqual($result[0], $expected); } @@ -34,18 +34,18 @@ public function testProjectInBuildGroup() $this->projecttestid = $result[0]['id']; $query = "SELECT name,starttime,endtime,description FROM buildgroup WHERE projectid = '" . $this->projecttestid . "' order by name desc"; $result = $this->db->query($query); - $expected = array('0' => array('name' => 'Nightly', + $expected = ['0' => ['name' => 'Nightly', 'starttime' => '1980-01-01 00:00:00', 'endtime' => '1980-01-01 00:00:00', - 'description' => 'Nightly builds'), - '1' => array('name' => 'Experimental', + 'description' => 'Nightly builds'], + '1' => ['name' => 'Experimental', 'starttime' => '1980-01-01 00:00:00', 'endtime' => '1980-01-01 00:00:00', - 'description' => 'Experimental builds'), - '2' => array('name' => 'Continuous', + 'description' => 'Experimental builds'], + '2' => ['name' => 'Continuous', 'starttime' => '1980-01-01 00:00:00', 'endtime' => '1980-01-01 00:00:00', - 'description' => 'Continuous builds')); + 'description' => 'Continuous builds']]; $this->assertEqual($result, $expected); } @@ -65,19 +65,19 @@ public function testUser2Project() { $query = 'SELECT userid, role, emailtype, emailcategory FROM user2project WHERE projectid=' . $this->projecttestid; $result = $this->db->query($query); - $expected = array('userid' => 1, + $expected = ['userid' => 1, 'role' => 2, 'emailtype' => 3, - 'emailcategory' => 126); + 'emailcategory' => 126]; $this->assertEqual($result[0], $expected); } public function createProjectTest4Db() { - $settings = array( + $settings = [ 'Name' => 'ProjectTest4Db', 'Description' => 'This is a project test for cdash', - 'Public' => 0); + 'Public' => 0]; $this->createProject($settings); } } diff --git a/app/cdash/tests/test_projectwebpage.php b/app/cdash/tests/test_projectwebpage.php index f61f213059..2c5bc92698 100644 --- a/app/cdash/tests/test_projectwebpage.php +++ b/app/cdash/tests/test_projectwebpage.php @@ -14,14 +14,14 @@ public function __construct() public function testAccessToWebPageProjectTest() { - $settings = array( + $settings = [ 'Name' => 'BatchmakeExample', - 'Description' => "Project Batchmake's test for cdash testing"); + 'Description' => "Project Batchmake's test for cdash testing"]; $this->createProject($settings); - $settings = array( + $settings = [ 'Name' => 'InsightExample', - 'Description' => 'Project Insight test for cdash testing'); + 'Description' => 'Project Insight test for cdash testing']; $this->createProject($settings); } @@ -168,13 +168,13 @@ public function testSubmissionInDb() // TODO: (williamjallen) This is a terrible test with hardcoded values. The ID should be determined dynamically. $query = 'SELECT id, stamp, name, type, generator, command FROM build WHERE id=7'; $result = $this->db->query($query); - $expected = array('id' => '7', + $expected = ['id' => '7', 'stamp' => '20090223-0100-Nightly', 'name' => 'Win32-MSVC2009', 'type' => 'Nightly', 'generator' => 'ctest2.6-patch 0', - 'command' => 'F:\PROGRA~1\MICROS~1.0\Common7\IDE\VCExpress.exe BatchMake.sln /build Release /project ALL_BUILD' - ); + 'command' => 'F:\PROGRA~1\MICROS~1.0\Common7\IDE\VCExpress.exe BatchMake.sln /build Release /project ALL_BUILD', + ]; $this->assertEqual($result[0], $expected); } diff --git a/app/cdash/tests/test_projectxmlsequence.php b/app/cdash/tests/test_projectxmlsequence.php index 01bd17b0fd..59b48d58dc 100644 --- a/app/cdash/tests/test_projectxmlsequence.php +++ b/app/cdash/tests/test_projectxmlsequence.php @@ -27,13 +27,13 @@ public function submitFile($filename) public function testProjectXmlSequence() { - $filenames = array( + $filenames = [ 'Trilinos_129273760744.57_Project.xml', 'Trilinos_129273770005.15_Project.xml', 'Trilinos_129273771745.07_Project.xml', 'Trilinos_129273989317.97_Project.xml', 'Trilinos_129274192973.58_Project.xml', - ); + ]; foreach ($filenames as $filename) { echo "submitting $filename\n"; diff --git a/app/cdash/tests/test_pubproject.php b/app/cdash/tests/test_pubproject.php index 535fc8c594..f88e31869e 100644 --- a/app/cdash/tests/test_pubproject.php +++ b/app/cdash/tests/test_pubproject.php @@ -17,10 +17,10 @@ public function __construct() public function testCreateProject() { - $settings = array( + $settings = [ 'Name' => 'ProjectTest', 'Description' => 'This is a project test for cdash', - 'EmailAdministrator' => 1); + 'EmailAdministrator' => 1]; $this->ProjectId = $this->createProject($settings); } @@ -31,10 +31,10 @@ public function testProjectTestInDatabase() $nameexpected = 'ProjectTest'; $descriptionexpected = 'This is a project test for cdash'; $publicexpected = 1; - $expected = array( + $expected = [ 'name' => $nameexpected, 'description' => $descriptionexpected, - 'public' => $publicexpected); + 'public' => $publicexpected]; $this->assertEqual($result[0], $expected); } diff --git a/app/cdash/tests/test_putdynamicbuilds.php b/app/cdash/tests/test_putdynamicbuilds.php index 39578b2b77..db4fe7d97c 100644 --- a/app/cdash/tests/test_putdynamicbuilds.php +++ b/app/cdash/tests/test_putdynamicbuilds.php @@ -31,7 +31,7 @@ public function testPutDynamicBuildsDiff() // Create a project for this test. $settings = [ 'Name' => 'PutDynamicBuildsProject', - 'Description' => 'PutDynamicBuildsProject' + 'Description' => 'PutDynamicBuildsProject', ]; $this->ProjectId = $this->createProject($settings); @@ -80,7 +80,7 @@ public function testPutDynamicBuildsDiff() foreach (['%bar%', '%baz%'] as $match) { $query_params = [ ':buildname' => $match, - ':parentgroupid' => $this->ParentGroupId + ':parentgroupid' => $this->ParentGroupId, ]; $this->PDO->execute($starttime_stmt, $query_params); $endtime = $starttime_stmt->fetchColumn(); @@ -125,7 +125,7 @@ protected function verifyListGetsCreated($client, $stmt, $build_rules) foreach ($build_rules as $build_rule) { $query_params = [ ':buildname' => "%{$build_rule['match']}%", - ':parentgroupid' => $build_rule['parentgroupid'] + ':parentgroupid' => $build_rule['parentgroupid'], ]; $this->PDO->execute($stmt, $query_params); $starttime = $stmt->fetchColumn(); diff --git a/app/cdash/tests/test_removebuilds.php b/app/cdash/tests/test_removebuilds.php index e98f1496dd..f1e382a41a 100644 --- a/app/cdash/tests/test_removebuilds.php +++ b/app/cdash/tests/test_removebuilds.php @@ -389,7 +389,7 @@ public function testBuildRemovalWorksAsExpected() $this->verify('subproject2build', 'buildid', '=', $build->Id, 1); $this->verify('testdiff', 'buildid', '=', $build->Id, 1); - list($buildfailureid, $detailsid) = + [$buildfailureid, $detailsid] = $this->verify_get_columns('buildfailure', ['id', 'detailsid'], 'buildid', '=', $build->Id, 1); $this->verify('buildfailure2argument', 'buildfailureid', '=', $buildfailureid, 1); $this->verify('buildfailuredetails', 'id', '=', $detailsid, 1); @@ -511,7 +511,7 @@ public function verify_get_columns($table, $columns, $field, $compare, $value, $ $this->fail("Expected $expected for $table, found $num_rows"); } $row = pdo_fetch_array($result); - $retval = array(); + $retval = []; foreach ($columns as $c) { $retval[] = $row[$c]; } @@ -525,7 +525,7 @@ public function verify_get_rows($table, $column, $field, $compare, $value, $expe if ($num_rows !== $expected) { $this->fail("Expected $expected for $table, found $num_rows"); } - $arr = array(); + $arr = []; while ($row = pdo_fetch_array($result)) { $arr[] = $row[$column]; } diff --git a/app/cdash/tests/test_sequenceindependence.php b/app/cdash/tests/test_sequenceindependence.php index 6062926a0d..f566caf258 100644 --- a/app/cdash/tests/test_sequenceindependence.php +++ b/app/cdash/tests/test_sequenceindependence.php @@ -15,7 +15,7 @@ public function __construct() public function testOriginalOrder() { - $file_order = array( + $file_order = [ 'Build', 'Configure', 'Coverage', @@ -24,8 +24,8 @@ public function testOriginalOrder() 'Notes', 'Test', 'Update', - 'Upload' - ); + 'Upload', + ]; if ($this->PerformOrderTest($file_order)) { $this->pass('Passed'); } @@ -33,7 +33,7 @@ public function testOriginalOrder() public function testReverseOrder() { - $file_order = array( + $file_order = [ 'Upload', 'Update', 'Test', @@ -42,7 +42,7 @@ public function testReverseOrder() 'CoverageLog', 'Coverage', 'Configure', - 'Build'); + 'Build']; if ($this->PerformOrderTest($file_order)) { $this->pass('Passed'); } @@ -50,7 +50,7 @@ public function testReverseOrder() public function testConfigureFirst() { - $file_order = array( + $file_order = [ 'Configure', 'Test', 'Notes', @@ -59,7 +59,7 @@ public function testConfigureFirst() 'Build', 'DynamicAnalysis', 'Upload', - 'Update'); + 'Update']; if ($this->PerformOrderTest($file_order)) { $this->pass('Passed'); } @@ -67,7 +67,7 @@ public function testConfigureFirst() public function testCoverageFirst() { - $file_order = array( + $file_order = [ 'Coverage', 'DynamicAnalysis', 'Configure', @@ -76,7 +76,7 @@ public function testCoverageFirst() 'Upload', 'Notes', 'Update', - 'Test'); + 'Test']; if ($this->PerformOrderTest($file_order)) { $this->pass('Passed'); } @@ -84,7 +84,7 @@ public function testCoverageFirst() public function testCoverageLogFirst() { - $file_order = array( + $file_order = [ 'CoverageLog', 'Notes', 'Coverage', @@ -93,7 +93,7 @@ public function testCoverageLogFirst() 'Build', 'DynamicAnalysis', 'Update', - 'Test'); + 'Test']; if ($this->PerformOrderTest($file_order)) { $this->pass('Passed'); } @@ -101,7 +101,7 @@ public function testCoverageLogFirst() public function testDynamicAnalysisFirst() { - $file_order = array( + $file_order = [ 'DynamicAnalysis', 'Notes', 'Configure', @@ -110,7 +110,7 @@ public function testDynamicAnalysisFirst() 'Coverage', 'Update', 'CoverageLog', - 'Build'); + 'Build']; if ($this->PerformOrderTest($file_order)) { $this->pass('Passed'); } @@ -118,7 +118,7 @@ public function testDynamicAnalysisFirst() public function testNotesFirst() { - $file_order = array( + $file_order = [ 'Notes', 'DynamicAnalysis', 'CoverageLog', @@ -127,7 +127,7 @@ public function testNotesFirst() 'Upload', 'Build', 'Test', - 'Coverage'); + 'Coverage']; if ($this->PerformOrderTest($file_order)) { $this->pass('Passed'); } @@ -135,7 +135,7 @@ public function testNotesFirst() public function testTestFirst() { - $file_order = array( + $file_order = [ 'Test', 'CoverageLog', 'DynamicAnalysis', @@ -144,7 +144,7 @@ public function testTestFirst() 'Notes', 'Update', 'Coverage', - 'Upload'); + 'Upload']; if ($this->PerformOrderTest($file_order)) { $this->pass('Passed'); } @@ -152,7 +152,7 @@ public function testTestFirst() public function testUpdateFirst() { - $file_order = array( + $file_order = [ 'Update', 'Notes', 'DynamicAnalysis', @@ -161,7 +161,7 @@ public function testUpdateFirst() 'Test', 'CoverageLog', 'Build', - 'Coverage'); + 'Coverage']; if ($this->PerformOrderTest($file_order)) { $this->pass('Passed'); } diff --git a/app/cdash/tests/test_setup_repositories.php b/app/cdash/tests/test_setup_repositories.php index 26633699aa..ca429773a7 100644 --- a/app/cdash/tests/test_setup_repositories.php +++ b/app/cdash/tests/test_setup_repositories.php @@ -22,7 +22,7 @@ public function testSetupRepositories() $insight->Id = $row['id']; $insight->Fill(); $insight->AddRepositories( - array(':pserver:anoncvs@itk.org:/cvsroot/Insight'), array('anoncvs'), array(''), array('')); + [':pserver:anoncvs@itk.org:/cvsroot/Insight'], ['anoncvs'], [''], ['']); $insight->CTestTemplateScript = 'client testing works'; $insight->Save(); @@ -31,7 +31,7 @@ public function testSetupRepositories() $pub->Id = $row['id']; $pub->Fill(); $pub->AddRepositories( - array('git://cmake.org/cmake.git'), array(''), array(''), array('')); + ['git://cmake.org/cmake.git'], [''], [''], ['']); $pub->CvsViewerType = 'gitweb'; $pub->CvsUrl ='cmake.org/gitweb?p=cmake.git'; $pub->Save(); @@ -41,7 +41,7 @@ public function testSetupRepositories() $email->Id = $row['id']; $email->Fill(); $email->AddRepositories( - array('https://www.kitware.com/svn/CDash/trunk'), array(''), array(''), array('')); + ['https://www.kitware.com/svn/CDash/trunk'], [''], [''], ['']); $pub->CvsViewerType = 'websvn'; $email->CvsUrl = 'https://www.kitware.com/svn/CDash/trunk'; $email->Save(); diff --git a/app/cdash/tests/test_starttimefromnotes.php b/app/cdash/tests/test_starttimefromnotes.php index df6b5ddb61..a14eaae702 100644 --- a/app/cdash/tests/test_starttimefromnotes.php +++ b/app/cdash/tests/test_starttimefromnotes.php @@ -30,7 +30,7 @@ public function testStartTimeFromNotes() $this->project = new Project(); $this->project->Id = $this->createProject([ 'Name' => 'StartTimeFromNotes', - 'NightlyTime' => '18:00:00 America/Denver' + 'NightlyTime' => '18:00:00 America/Denver', ]); $this->project->Fill(); diff --git a/app/cdash/tests/test_submitsortingdata.php b/app/cdash/tests/test_submitsortingdata.php index 07d5a7a62a..dce789a73c 100644 --- a/app/cdash/tests/test_submitsortingdata.php +++ b/app/cdash/tests/test_submitsortingdata.php @@ -24,8 +24,8 @@ public function submitFile($build, $type) public function testSubmitSortingData() { - $builds = array('short', 'medium', 'long'); - $types = array('Build', 'Configure', 'Test', 'Update', 'Notes'); + $builds = ['short', 'medium', 'long']; + $types = ['Build', 'Configure', 'Test', 'Update', 'Notes']; foreach ($builds as $build) { foreach ($types as $type) { $this->submitFile($build, $type); diff --git a/app/cdash/tests/test_subproject.php b/app/cdash/tests/test_subproject.php index a77ab08be2..253629e806 100644 --- a/app/cdash/tests/test_subproject.php +++ b/app/cdash/tests/test_subproject.php @@ -26,11 +26,11 @@ public function __construct() public function testAccessToWebPageProjectTest() { - $settings = array( + $settings = [ 'Name' => 'SubProjectExample', 'Description' => 'Project SubProjectExample test for cdash testing', 'EmailBrokenSubmission' => 1, - 'EmailRedundantFailures' => 1); + 'EmailRedundantFailures' => 1]; $this->createProject($settings); } @@ -59,7 +59,7 @@ public function testSubmissionSubProjectBuild() $url = Config::getInstance()->getBaseUrl(); $expected = [ 'simpletest@localhost', - 'FAILED (w=21): SubProjectExample/NOX - Linux-GCC-4.1.2-SERIAL_RELEASE - Nightly' , + 'FAILED (w=21): SubProjectExample/NOX - Linux-GCC-4.1.2-SERIAL_RELEASE - Nightly', 'A submission to CDash for the project SubProjectExample has warnings.', "Details on the submission can be found at {$url}/build/", 'Project: SubProjectExample', diff --git a/app/cdash/tests/test_subprojectemail.php b/app/cdash/tests/test_subprojectemail.php index 7b03638c09..6d7f7be6c1 100644 --- a/app/cdash/tests/test_subprojectemail.php +++ b/app/cdash/tests/test_subprojectemail.php @@ -45,7 +45,7 @@ public function testSubProjectEmail() 'Name' => 'SubProjectEmails', 'Public' => 1, 'EmailBrokenSubmission' => 1, - 'EmailRedundantFailures' => 0 + 'EmailRedundantFailures' => 0, ]; $projectid = $this->createProject($settings); if ($projectid < 1) { diff --git a/app/cdash/tests/test_subprojectnextprevious.php b/app/cdash/tests/test_subprojectnextprevious.php index e03c76a8df..2044c2010d 100644 --- a/app/cdash/tests/test_subprojectnextprevious.php +++ b/app/cdash/tests/test_subprojectnextprevious.php @@ -51,7 +51,7 @@ public function testSubProjectNextPrevious() return 1; } - $buildids = array(); + $buildids = []; while ($row = pdo_fetch_array($result)) { $buildids[] = $row['id']; } @@ -200,7 +200,7 @@ public function testSubProjectNextPrevious() $checks = [ 'nwarningdiffp' => $build['compilation']['nwarningdiffp'], 'nnotrundiffn' => $build['test']['nnotrundiffn'], - 'npassdiffp' => $build['test']['npassdiffp'] + 'npassdiffp' => $build['test']['npassdiffp'], ]; foreach ($checks as $field => $found) { if ($found != 1) { diff --git a/app/cdash/tests/test_testhistory.php b/app/cdash/tests/test_testhistory.php index 6ee91faa5d..d882f9f1e0 100644 --- a/app/cdash/tests/test_testhistory.php +++ b/app/cdash/tests/test_testhistory.php @@ -31,152 +31,152 @@ private function generateXML($mm, $timestamp, $include_sporadic, $flaky_passed) } $retval = << - - - {$timestamp} - - ./passes - ./fails - ./flaky - ./notrun - - EOT; + + + + {$timestamp} + + ./passes + ./fails + ./flaky + ./notrun + + EOT; if ($include_sporadic) { $retval .= <<./sporadic + ./sporadic - EOT; + EOT; } $retval .= << - - passes - . - ./passes - /bin/true - - - 0 - - - Completed - - - /bin/true - - - - - - - - fails - . - ./fails - /bin/false - - - Failed - - - 0 - - - Completed - - - /bin/false - - - - - - - - flaky - . - ./flaky - /bin/flaky - - - EOT; - if (!$flaky_passed) { - $retval .= << + + passes + . + ./passes + /bin/true + + + 0 + + + Completed + + + /bin/true + + + + + + + + fails + . + ./fails + /bin/false + Failed + + 0 + + + Completed + + + /bin/false + + + + + + + + flaky + . + ./flaky + /bin/flaky + EOT; + if (!$flaky_passed) { + $retval .= << + Failed + + + EOT; } $retval .= << - {$flaky_time} - - - Completed - - - /bin/flaky - - - - - - - - notrun - . - ./notrun - - - - - - - Unable to find executable: /tmp/notrun - - - - - EOT; + + {$flaky_time} + + + Completed + + + /bin/flaky + + + + + + + + notrun + . + ./notrun + + + + + + + Unable to find executable: /tmp/notrun + + + + + EOT; if ($include_sporadic) { $retval .= << - sporadic - . - ./sporadic - /bin/true - - - 0 - - - Completed - - - /bin/true - - - - - - - - EOT; + + sporadic + . + ./sporadic + /bin/true + + + 0 + + + Completed + + + /bin/true + + + + + + + + EOT; } $retval .= <<Nov 16 14:{$mm} EST - {$timestamp} - 0 - - + Nov 16 14:{$mm} EST + {$timestamp} + 0 + + - EOT; + EOT; return $retval; } diff --git a/app/cdash/tests/test_testoverview.php b/app/cdash/tests/test_testoverview.php index c988873770..e84c325e63 100644 --- a/app/cdash/tests/test_testoverview.php +++ b/app/cdash/tests/test_testoverview.php @@ -33,7 +33,7 @@ public function testTestOverview() $content = $this->get($this->url . '/api/v1/testOverview.php?project=InsightExample'); $jsonobj = json_decode($content, true); - if ($jsonobj['tests'] !== array()) { + if ($jsonobj['tests'] !== []) { $this->fail("Empty list of tests not found when expected"); } diff --git a/app/cdash/tests/test_timeline.php b/app/cdash/tests/test_timeline.php index b98a358d09..ce4e455ef0 100644 --- a/app/cdash/tests/test_timeline.php +++ b/app/cdash/tests/test_timeline.php @@ -26,7 +26,7 @@ private function toggle_expected($client, $build, $expected) $payload = [ 'buildid' => $build->Id, 'groupid' => $build->GroupId, - 'expected' => $expected + 'expected' => $expected, ]; try { $response = $client->request('POST', @@ -81,15 +81,15 @@ public function testTimeline() $answer_key = [ 'index.php' => [ - 'Test Failures' => 1 + 'Test Failures' => 1, ], 'testOverview.php' => [ 'Failing Tests' => 1, 'Not Run Tests' => 1, - 'Passing Tests' => 1 + 'Passing Tests' => 1, ], 'viewBuildGroup.php' => [ - 'Test Failures' => 1 + 'Test Failures' => 1, ], ]; foreach ($pages_to_check as $page) { @@ -145,8 +145,8 @@ public function testTimelineWithFilters() [ 'field' => 'buildname', 'compare' => 63, - 'value' => 'vs' - ] + 'value' => 'vs', + ], ], ]; @@ -155,16 +155,16 @@ public function testTimelineWithFilters() $answer_key = [ 'index.php' => [ 'Errors' => 1, - 'Test Failures' => 2 + 'Test Failures' => 2, ], 'testOverview.php' => [ 'Failing Tests' => 2, 'Not Run Tests' => 2, - 'Passing Tests' => 2 + 'Passing Tests' => 2, ], 'viewBuildGroup.php' => [ 'Errors' => 1, - 'Test Failures' => 2 + 'Test Failures' => 2, ], ]; diff --git a/app/cdash/tests/test_timestatus.php b/app/cdash/tests/test_timestatus.php index 2bb81da974..ca6b69e68d 100644 --- a/app/cdash/tests/test_timestatus.php +++ b/app/cdash/tests/test_timestatus.php @@ -34,7 +34,7 @@ public function testTimeStatus() $settings = [ 'Name' => 'TimeStatus', 'Description' => 'Project for test time status', - 'ShowTestTime' => 1 + 'ShowTestTime' => 1, ]; $projectid = $this->createProject($settings); if ($projectid < 1) { @@ -47,7 +47,7 @@ public function testTimeStatus() ->createSite([ 'BuildName' => 'test_timing', 'BuildStamp' => '20180127-1723-Experimental', - 'Name' => 'elysium' + 'Name' => 'elysium', ]) ->setProjectId($projectid) ->setStartTime(1516900999) diff --git a/app/cdash/tests/test_updateappend.php b/app/cdash/tests/test_updateappend.php index e316cdc796..0942d503d3 100644 --- a/app/cdash/tests/test_updateappend.php +++ b/app/cdash/tests/test_updateappend.php @@ -37,7 +37,7 @@ public function testUpdateAppend() } // Get the buildid that we just created so we can delete it later. - $buildids = array(); + $buildids = []; $buildid_results = pdo_query( "SELECT id FROM build WHERE name='test_updateappend'"); while ($buildid_array = pdo_fetch_array($buildid_results)) { diff --git a/app/cdash/tests/test_updateonlyuserstats.php b/app/cdash/tests/test_updateonlyuserstats.php index 5687cbf1f3..effebaa49d 100644 --- a/app/cdash/tests/test_updateonlyuserstats.php +++ b/app/cdash/tests/test_updateonlyuserstats.php @@ -31,7 +31,7 @@ public function __construct() parent::__construct(); $this->DataDir = dirname(__FILE__) . '/data/UpdateOnlyUserStats'; $this->ProjectId = null; - $this->Users = array(); + $this->Users = []; } public function testSetup() @@ -47,25 +47,25 @@ public function testSetup() 'url' => 'https://github.com/Kitware/CDash', 'branch' => 'master', 'username' => '', - 'password' => '' - ]] + 'password' => '', + ]], ]; $this->ProjectId = $this->createProject($settings); // Create some users for the CDash project. - $users_details = array( - array( + $users_details = [ + [ 'email' => 'dan.lamanna@kitware.com', 'firstname' => 'Dan', - 'lastname' => 'LaManna'), - array( + 'lastname' => 'LaManna'], + [ 'email' => 'jamie.snape@kitware.com', 'firstname' => 'Jamie', - 'lastname' => 'Snape'), - array( + 'lastname' => 'Snape'], + [ 'email' => 'zack.galbreath@kitware.com', 'firstname' => 'Zack', - 'lastname' => 'Galbreath')); + 'lastname' => 'Galbreath']]; $userproject = new UserProject(); $userproject->ProjectId = $this->ProjectId; foreach ($users_details as $user_details) { @@ -86,8 +86,8 @@ public function testSetup() public function testUpdateOnlyUserStats() { // Submit testing data. - $dirs = array('1', '2', '3'); - $files = array('Build.xml', 'Test.xml', 'Update.xml'); + $dirs = ['1', '2', '3']; + $files = ['Build.xml', 'Test.xml', 'Update.xml']; foreach ($dirs as $dir) { foreach ($files as $file) { $file_to_submit = "$this->DataDir/$dir/$file"; @@ -109,31 +109,31 @@ public function testUpdateOnlyUserStats() $this->fail("Expected stats for 3 users, found $numusers"); } - $expected_results = array( - 'Dan LaManna' => array( + $expected_results = [ + 'Dan LaManna' => [ 'failed_errors' => 0, 'fixed_errors' => 0, 'failed_warnings' => 0, 'fixed_warnings' => 1, 'failed_tests' => 0, 'fixed_tests' => 0, - 'totalupdatedfiles' => 2), - 'Jamie Snape' => array( + 'totalupdatedfiles' => 2], + 'Jamie Snape' => [ 'failed_errors' => 0, 'fixed_errors' => 1, 'failed_warnings' => 0, 'fixed_warnings' => 0, 'failed_tests' => 0, 'fixed_tests' => 0, - 'totalupdatedfiles' => 7), - 'Zack Galbreath' => array( + 'totalupdatedfiles' => 7], + 'Zack Galbreath' => [ 'failed_errors' => 0, 'fixed_errors' => 0, 'failed_warnings' => 0, 'fixed_warnings' => 0, 'failed_tests' => 2, 'fixed_tests' => 0, - 'totalupdatedfiles' => 3)); + 'totalupdatedfiles' => 3]]; foreach ($jsonobj['users'] as $user) { $name = $user['name']; diff --git a/app/cdash/tests/test_upgrade.php b/app/cdash/tests/test_upgrade.php index 72b0475fc4..5362506cbe 100644 --- a/app/cdash/tests/test_upgrade.php +++ b/app/cdash/tests/test_upgrade.php @@ -111,7 +111,7 @@ public function testGetVendorVersion() $version = pdo_get_vendor_version(); - list($major, $minor, ) = $version? explode(".", $version) : array(null,null,null); + [$major, $minor, ] = $version? explode(".", $version) : [null,null,null]; $this->assertTrue(is_numeric($major)); $this->assertTrue(is_numeric($minor)); @@ -403,8 +403,8 @@ public function testSiteConstraintUpgrade() $row = pdo_single_row_query( 'SELECT id FROM site ORDER BY id DESC LIMIT 1'); $i = $row['id']; - $dupes = array(); - $keepers = array(); + $dupes = []; + $keepers = []; // Insert sites into our testing table that will violate // the unique constraint on the name column. @@ -471,10 +471,10 @@ public function testSiteConstraintUpgrade() // We also need to verify that siteids in other tables get updated // properly as duplicates are removed. - $tables_to_update = array('build', 'build2grouprule', 'site2user', + $tables_to_update = ['build', 'build2grouprule', 'site2user', 'client_job', 'client_site2cmake', 'client_site2compiler', 'client_site2library', 'client_site2program', - 'client_site2project'); + 'client_site2project']; foreach ($tables_to_update as $table_to_update) { foreach ($dupes as $dupe) { if ($table_to_update === 'build') { @@ -669,7 +669,7 @@ public function testBuild2ConfigureUpgrade() // Insert testing data in configure table. // Two rows that duplicate each other - $dupe_buildids = array(1, 2); + $dupe_buildids = [1, 2]; foreach ($dupe_buildids as $buildid) { pdo_query( "INSERT INTO $configure_table_name @@ -692,7 +692,7 @@ public function testBuild2ConfigureUpgrade() VALUES (3, 0, 'unique error')"); // Verify that the right number of testing rows made it into the database. - foreach (array($configure_table_name, $error_table_name) as $table_name) { + foreach ([$configure_table_name, $error_table_name] as $table_name) { $count_query = " SELECT COUNT(*) AS numrows FROM $table_name"; $count_results = pdo_single_row_query($count_query); @@ -832,7 +832,7 @@ public function testPopulateTestDuration() $expected = [ 1 => 1, 2 => 2, - 3 => 0 + 3 => 0, ]; $stmt = $pdo->query( "SELECT id, testduration FROM $build_table_name"); diff --git a/app/cdash/tests/test_usernotes.php b/app/cdash/tests/test_usernotes.php index 5fc31b2468..449ae8c406 100644 --- a/app/cdash/tests/test_usernotes.php +++ b/app/cdash/tests/test_usernotes.php @@ -33,7 +33,7 @@ public function testAddNoteRequiresAuth(): void $buildUserNote = [ 'buildid' => $id, 'AddNote' => 'testAddNoteRequiresAuth', - 'Status' => 1 + 'Status' => 1, ]; $response = $this->post($endpoint, $buildUserNote); diff --git a/app/cdash/tests/test_userstatistics.php b/app/cdash/tests/test_userstatistics.php index ae96bfe667..8ad02ceffd 100644 --- a/app/cdash/tests/test_userstatistics.php +++ b/app/cdash/tests/test_userstatistics.php @@ -21,10 +21,10 @@ public function testUserStatistics() $this->get($this->url . '/userStatistics.php'); // Cover all date ranges - $this->post($this->url . '/userStatistics.php?projectid=1', array('range' => 'lastweek')); - $this->post($this->url . '/userStatistics.php?projectid=1', array('range' => 'thismonth')); - $this->post($this->url . '/userStatistics.php?projectid=1', array('range' => 'lastmonth')); - $this->post($this->url . '/userStatistics.php?projectid=1', array('range' => 'thisyear')); + $this->post($this->url . '/userStatistics.php?projectid=1', ['range' => 'lastweek']); + $this->post($this->url . '/userStatistics.php?projectid=1', ['range' => 'thismonth']); + $this->post($this->url . '/userStatistics.php?projectid=1', ['range' => 'lastmonth']); + $this->post($this->url . '/userStatistics.php?projectid=1', ['range' => 'thisyear']); // Cover no user id case $this->logout(); diff --git a/app/cdash/tests/test_viewsubprojects.php b/app/cdash/tests/test_viewsubprojects.php index 027c09233a..3aca99a6ac 100644 --- a/app/cdash/tests/test_viewsubprojects.php +++ b/app/cdash/tests/test_viewsubprojects.php @@ -28,7 +28,7 @@ public function testViewSubProjects() foreach ($jsonobj['subprojects'] as $subproject) { if ($subproject['name'] === 'TrilinosFramework') { $found_trilinos_framework = true; - $expected_values = array( + $expected_values = [ 'nbuilderror' => 0, 'nbuildwarning' => 0, 'nbuildpass' => 1, @@ -38,7 +38,7 @@ public function testViewSubProjects() 'ntestpass' => 90, 'ntestfail' => 30, 'ntestnotrun' => 0, - 'starttime' => '2011-07-22 11:15:59'); + 'starttime' => '2011-07-22 11:15:59']; foreach ($expected_values as $k => $v) { if ($subproject[$k] !== $v) { $this->fail("Expected $v for TrilinosFramework $k, found " . $subproject[$k]); diff --git a/app/cdash/tests/trilinos_submission_test.php b/app/cdash/tests/trilinos_submission_test.php index a3989fb587..e1bc47eacd 100644 --- a/app/cdash/tests/trilinos_submission_test.php +++ b/app/cdash/tests/trilinos_submission_test.php @@ -88,7 +88,7 @@ public function verifyResults() $this->fail('Expected 36 children, found ' . $parent_build['numchildren']); return false; } - $parent_answers = array( + $parent_answers = [ 'site' => 'hut11.kitware', 'buildname' => 'Windows_NT-MSVC10-SERIAL_DEBUG_DEV', 'uploadfilecount' => 0, @@ -107,7 +107,7 @@ public function verifyResults() 'testnotrun' => 95, 'testfail' => 11, 'testpass' => 303, - 'testtime' => '48s'); + 'testtime' => '48s']; $this->verifyBuild($parent_build, $parent_answers, 'parent'); // Verify details about the children. @@ -121,8 +121,8 @@ public function verifyResults() $this->fail('Expected hut11.kitware, found ' . $jsonobj['site']); } - $subproject_answers = array( - 'Amesos' => array( + $subproject_answers = [ + 'Amesos' => [ 'builddateelapsed' => 'Jul 22, 2011 - 11:29 EDT', 'updatefiles' => '911431', 'updateerror' => 0, @@ -130,9 +130,9 @@ public function verifyResults() 'configureerror' => 1, 'configurewarning' => 1, 'configuretime' => '7s', - 'notes' => 2), + 'notes' => 2], - 'AztecOO' => array( + 'AztecOO' => [ 'builddateelapsed' => 'Jul 22, 2011 - 11:28 EDT', 'updatefiles' => '911431', 'updateerror' => 0, @@ -148,9 +148,9 @@ public function verifyResults() 'testfail' => 0, 'testpass' => 0, 'testtime' => '0s', - 'notes' => 2), + 'notes' => 2], - 'Belos' => array( + 'Belos' => [ 'builddateelapsed' => 'Jul 22, 2011 - 11:31 EDT', 'updatefiles' => '911431', 'updateerror' => 0, @@ -158,9 +158,9 @@ public function verifyResults() 'configureerror' => 1, 'configurewarning' => 1, 'configuretime' => '6s', - 'notes' => 2), + 'notes' => 2], - 'Claps' => array( + 'Claps' => [ 'builddateelapsed' => 'Jul 22, 2011 - 11:27 EDT', 'updatefiles' => '911431', 'updateerror' => 0, @@ -176,9 +176,9 @@ public function verifyResults() 'testfail' => 0, 'testpass' => 0, 'testtime' => '0s', - 'notes' => 2), + 'notes' => 2], - 'CTrilinos' => array( + 'CTrilinos' => [ 'builddateelapsed' => 'Jul 22, 2011 - 11:34 EDT', 'updatefiles' => '911431', 'updateerror' => 0, @@ -186,9 +186,9 @@ public function verifyResults() 'configureerror' => 1, 'configurewarning' => 1, 'configuretime' => '6s', - 'notes' => 2), + 'notes' => 2], - 'Didasko' => array( + 'Didasko' => [ 'builddateelapsed' => 'Jul 22, 2011 - 11:34 EDT', 'updatefiles' => '911431', 'updateerror' => 0, @@ -204,9 +204,9 @@ public function verifyResults() 'testfail' => 0, 'testpass' => 0, 'testtime' => '0s', - 'notes' => 2), + 'notes' => 2], - 'Epetra' => array( + 'Epetra' => [ 'builddateelapsed' => 'Jul 22, 2011 - 11:24 EDT', 'updatefiles' => '911431', 'updateerror' => 0, @@ -222,9 +222,9 @@ public function verifyResults() 'testfail' => 0, 'testpass' => 0, 'testtime' => '0s', - 'notes' => 2), + 'notes' => 2], - 'EpetraExt' => array( + 'EpetraExt' => [ 'builddateelapsed' => 'Jul 22, 2011 - 11:26 EDT', 'updatefiles' => '911431', 'updateerror' => 0, @@ -232,9 +232,9 @@ public function verifyResults() 'configureerror' => 1, 'configurewarning' => 1, 'configuretime' => '7s', - 'notes' => 2), + 'notes' => 2], - 'FEApp' => array( + 'FEApp' => [ 'builddateelapsed' => 'Jul 22, 2011 - 11:37 EDT', 'updatefiles' => '911431', 'updateerror' => 0, @@ -242,9 +242,9 @@ public function verifyResults() 'configureerror' => 1, 'configurewarning' => 1, 'configuretime' => '7s', - 'notes' => 2), + 'notes' => 2], - 'FEI' => array( + 'FEI' => [ 'builddateelapsed' => 'Jul 22, 2011 - 11:31 EDT', 'updatefiles' => '911431', 'updateerror' => 0, @@ -252,9 +252,9 @@ public function verifyResults() 'configureerror' => 1, 'configurewarning' => 1, 'configuretime' => '6s', - 'notes' => 2), + 'notes' => 2], - 'Galeri' => array( + 'Galeri' => [ 'builddateelapsed' => 'Jul 22, 2011 - 11:28 EDT', 'updatefiles' => '911431', 'updateerror' => 0, @@ -262,9 +262,9 @@ public function verifyResults() 'configureerror' => 1, 'configurewarning' => 1, 'configuretime' => '7s', - 'notes' => 2), + 'notes' => 2], - 'GlobiPack' => array( + 'GlobiPack' => [ 'builddateelapsed' => 'Jul 22, 2011 - 11:26 EDT', 'updatefiles' => '911431', 'updateerror' => 0, @@ -272,9 +272,9 @@ public function verifyResults() 'configureerror' => 1, 'configurewarning' => 1, 'configuretime' => '6s', - 'notes' => 2), + 'notes' => 2], - 'Ifpack' => array( + 'Ifpack' => [ 'builddateelapsed' => 'Jul 22, 2011 - 11:29 EDT', 'updatefiles' => '911431', 'updateerror' => 0, @@ -282,9 +282,9 @@ public function verifyResults() 'configureerror' => 1, 'configurewarning' => 1, 'configuretime' => '7s', - 'notes' => 2), + 'notes' => 2], - 'Intrepid' => array( + 'Intrepid' => [ 'builddateelapsed' => 'Jul 22, 2011 - 11:32 EDT', 'updatefiles' => '911431', 'updateerror' => 0, @@ -292,9 +292,9 @@ public function verifyResults() 'configureerror' => 1, 'configurewarning' => 1, 'configuretime' => '6s', - 'notes' => 2), + 'notes' => 2], - 'Kokkos' => array( + 'Kokkos' => [ 'builddateelapsed' => 'Jul 22, 2011 - 11:24 EDT', 'updatefiles' => '911431', 'updateerror' => 0, @@ -302,9 +302,9 @@ public function verifyResults() 'configureerror' => 1, 'configurewarning' => 1, 'configuretime' => '7s', - 'notes' => 2), + 'notes' => 2], - 'Komplex' => array( + 'Komplex' => [ 'builddateelapsed' => 'Jul 22, 2011 - 11:29 EDT', 'updatefiles' => '911431', 'updateerror' => 0, @@ -312,9 +312,9 @@ public function verifyResults() 'configureerror' => 1, 'configurewarning' => 1, 'configuretime' => '7s', - 'notes' => 2), + 'notes' => 2], - 'Mesquite' => array( + 'Mesquite' => [ 'builddateelapsed' => 'Jul 22, 2011 - 11:35 EDT', 'updatefiles' => '911431', 'updateerror' => 0, @@ -326,9 +326,9 @@ public function verifyResults() 'buildwarning' => 1, 'buildtime' => '2m 11s', 'time' => '2m 35s', - 'notes' => 2), + 'notes' => 2], - 'ML' => array( + 'ML' => [ 'builddateelapsed' => 'Jul 22, 2011 - 11:29 EDT', 'updatefiles' => '911431', 'updateerror' => 0, @@ -344,9 +344,9 @@ public function verifyResults() 'testfail' => 0, 'testpass' => 0, 'testtime' => '0s', - 'notes' => 2), + 'notes' => 2], - 'Moertel' => array( + 'Moertel' => [ 'builddateelapsed' => 'Jul 22, 2011 - 11:32 EDT', 'updatefiles' => '911431', 'updateerror' => 0, @@ -354,9 +354,9 @@ public function verifyResults() 'configureerror' => 1, 'configurewarning' => 1, 'configuretime' => '7s', - 'notes' => 2), + 'notes' => 2], - 'NOX' => array( + 'NOX' => [ 'builddateelapsed' => 'Jul 22, 2011 - 11:32 EDT', 'updatefiles' => '911431', 'updateerror' => 0, @@ -364,9 +364,9 @@ public function verifyResults() 'configureerror' => 1, 'configurewarning' => 1, 'configuretime' => '7s', - 'notes' => 2), + 'notes' => 2], - 'OptiPack' => array( + 'OptiPack' => [ 'builddateelapsed' => 'Jul 22, 2011 - 11:27 EDT', 'updatefiles' => '911431', 'updateerror' => 0, @@ -374,9 +374,9 @@ public function verifyResults() 'configureerror' => 1, 'configurewarning' => 1, 'configuretime' => '7s', - 'notes' => 2), + 'notes' => 2], - 'Piro' => array( + 'Piro' => [ 'builddateelapsed' => 'Jul 22, 2011 - 11:34 EDT', 'updatefiles' => '911431', 'updateerror' => 0, @@ -384,9 +384,9 @@ public function verifyResults() 'configureerror' => 1, 'configurewarning' => 1, 'configuretime' => '6s', - 'notes' => 2), + 'notes' => 2], - 'Pliris' => array( + 'Pliris' => [ 'builddateelapsed' => 'Jul 22, 2011 - 11:27 EDT', 'updatefiles' => '911431', 'updateerror' => 0, @@ -402,9 +402,9 @@ public function verifyResults() 'testfail' => 0, 'testpass' => 0, 'testtime' => '0s', - 'notes' => 2), + 'notes' => 2], - 'RBGen' => array( + 'RBGen' => [ 'builddateelapsed' => 'Jul 22, 2011 - 11:31 EDT', 'updatefiles' => '911431', 'updateerror' => 0, @@ -412,9 +412,9 @@ public function verifyResults() 'configureerror' => 1, 'configurewarning' => 1, 'configuretime' => '6s', - 'notes' => 2), + 'notes' => 2], - 'RTOp' => array( + 'RTOp' => [ 'builddateelapsed' => 'Jul 22, 2011 - 11:23 EDT', 'updatefiles' => '911431', 'updateerror' => 0, @@ -422,9 +422,9 @@ public function verifyResults() 'configureerror' => 1, 'configurewarning' => 1, 'configuretime' => '7s', - 'notes' => 2), + 'notes' => 2], - 'Rythmos' => array( + 'Rythmos' => [ 'builddateelapsed' => 'Jul 22, 2011 - 11:33 EDT', 'updatefiles' => '911431', 'updateerror' => 0, @@ -432,9 +432,9 @@ public function verifyResults() 'configureerror' => 1, 'configurewarning' => 1, 'configuretime' => '6s', - 'notes' => 2), + 'notes' => 2], - 'Sacado' => array( + 'Sacado' => [ 'builddateelapsed' => 'Jul 22, 2011 - 11:18 EDT', 'updatefiles' => '911431', 'updateerror' => 0, @@ -450,9 +450,9 @@ public function verifyResults() 'testfail' => 1, 'testpass' => 270, 'testtime' => '4s', - 'notes' => 2), + 'notes' => 2], - 'Shards' => array( + 'Shards' => [ 'builddateelapsed' => 'Jul 22, 2011 - 11:25 EDT', 'updatefiles' => '911431', 'updateerror' => 0, @@ -468,9 +468,9 @@ public function verifyResults() 'testfail' => 0, 'testpass' => 3, 'testtime' => '0s', - 'notes' => 2), + 'notes' => 2], - 'Stokhos' => array( + 'Stokhos' => [ 'builddateelapsed' => 'Jul 22, 2011 - 11:33 EDT', 'updatefiles' => '911431', 'updateerror' => 0, @@ -478,9 +478,9 @@ public function verifyResults() 'configureerror' => 1, 'configurewarning' => 1, 'configuretime' => '6s', - 'notes' => 2), + 'notes' => 2], - 'Stratimikos' => array( + 'Stratimikos' => [ 'builddateelapsed' => 'Jul 22, 2011 - 11:31 EDT', 'updatefiles' => '911431', 'updateerror' => 0, @@ -488,9 +488,9 @@ public function verifyResults() 'configureerror' => 1, 'configurewarning' => 1, 'configuretime' => '7s', - 'notes' => 2), + 'notes' => 2], - 'Teuchos' => array( + 'Teuchos' => [ 'builddateelapsed' => 'Jul 22, 2011 - 11:16 EDT', 'updatefiles' => '911431', 'updateerror' => 0, @@ -502,9 +502,9 @@ public function verifyResults() 'buildwarning' => 3, 'buildtime' => '1m 27s', 'time' => '1m 48s', - 'notes' => 2), + 'notes' => 2], - 'ThreadPool' => array( + 'ThreadPool' => [ 'builddateelapsed' => 'Jul 22, 2011 - 11:18 EDT', 'updatefiles' => '911431', 'updateerror' => 0, @@ -520,9 +520,9 @@ public function verifyResults() 'testfail' => 0, 'testpass' => 0, 'testtime' => '0s', - 'notes' => 2), + 'notes' => 2], - 'Thyra' => array( + 'Thyra' => [ 'builddateelapsed' => 'Jul 22, 2011 - 11:27 EDT', 'updatefiles' => '911431', 'updateerror' => 0, @@ -530,9 +530,9 @@ public function verifyResults() 'configureerror' => 1, 'configurewarning' => 1, 'configuretime' => '7s', - 'notes' => 2), + 'notes' => 2], - 'TrilinosCouplings' => array( + 'TrilinosCouplings' => [ 'builddateelapsed' => 'Jul 22, 2011 - 11:32 EDT', 'updatefiles' => '911431', 'updateerror' => 0, @@ -548,9 +548,9 @@ public function verifyResults() 'testfail' => 0, 'testpass' => 0, 'testtime' => '0s', - 'notes' => 2), + 'notes' => 2], - 'TrilinosFramework' => array( + 'TrilinosFramework' => [ 'builddateelapsed' => 'Jul 22, 2011 - 11:15 EDT', 'updatefiles' => '911431', 'updateerror' => 0, @@ -566,9 +566,9 @@ public function verifyResults() 'testfail' => 10, 'testpass' => 30, 'testtime' => '44s', - 'notes' => 2), + 'notes' => 2], - 'Triutils' => array( + 'Triutils' => [ 'builddateelapsed' => 'Jul 22, 2011 - 11:26 EDT', 'updatefiles' => '911431', 'updateerror' => 0, @@ -584,7 +584,7 @@ public function verifyResults() 'testfail' => 0, 'testpass' => 0, 'testtime' => '0s', - 'notes' => 2)); + 'notes' => 2]]; foreach ($subproject_answers as $subproject_name => $answer) { foreach ($builds as $index => $build) { diff --git a/app/cdash/xml_handlers/GcovTar_handler.php b/app/cdash/xml_handlers/GcovTar_handler.php index 8cb241004f..5f4a9aedc3 100644 --- a/app/cdash/xml_handlers/GcovTar_handler.php +++ b/app/cdash/xml_handlers/GcovTar_handler.php @@ -47,7 +47,7 @@ public function __construct($buildid) $this->CoverageSummary->BuildId = $this->Build->Id; $this->SourceDirectory = ''; $this->BinaryDirectory = ''; - $this->Labels = array(); + $this->Labels = []; $this->SubProjectPath = ''; @@ -60,7 +60,7 @@ public function __construct($buildid) $this->SubProjectPath = $path; } } - $this->SubProjectSummaries = array(); + $this->SubProjectSummaries = []; $this->PreviousAggregateParentId = null; } @@ -412,7 +412,7 @@ public function ParseLabelsFile($fileinfo) // Parse out any target-wide labels first. These apply to // every source file found below. - $target_labels = array(); + $target_labels = []; if (array_key_exists('target', $jsonDecoded)) { $target = $jsonDecoded['target']; if (array_key_exists('labels', $target)) { diff --git a/app/cdash/xml_handlers/JSCoverTar_handler.php b/app/cdash/xml_handlers/JSCoverTar_handler.php index 8b7b23b64d..f7ea1daa3f 100644 --- a/app/cdash/xml_handlers/JSCoverTar_handler.php +++ b/app/cdash/xml_handlers/JSCoverTar_handler.php @@ -34,14 +34,14 @@ public function __construct($buildid) $this->Build->Id = $buildid; $this->Build->FillFromId($this->Build->Id); - $this->CoverageSummaries = array(); + $this->CoverageSummaries = []; $coverageSummary = new CoverageSummary(); $coverageSummary->BuildId = $this->Build->Id; $this->CoverageSummaries['default'] = $coverageSummary; - $this->Coverages = array(); - $this->CoverageFiles = array(); - $this->CoverageFileLogs = array(); + $this->Coverages = []; + $this->CoverageFiles = []; + $this->CoverageFileLogs = []; } /** @@ -102,7 +102,7 @@ public function Parse($filename) } // Insert coverage summaries - $completedSummaries = array(); + $completedSummaries = []; foreach ($this->CoverageSummaries as $coverageSummary) { if (in_array($coverageSummary->BuildId, $completedSummaries)) { continue; diff --git a/app/cdash/xml_handlers/JavaJSONTar_handler.php b/app/cdash/xml_handlers/JavaJSONTar_handler.php index 9c5a35c550..6dc5ca9e98 100644 --- a/app/cdash/xml_handlers/JavaJSONTar_handler.php +++ b/app/cdash/xml_handlers/JavaJSONTar_handler.php @@ -34,7 +34,7 @@ public function __construct($buildid) $this->Build->Id = $buildid; $this->Build->FillFromId($this->Build->Id); - $this->CoverageSummaries = array(); + $this->CoverageSummaries = []; $coverageSummary = new CoverageSummary(); $coverageSummary->BuildId = $this->Build->Id; $this->CoverageSummaries['default'] = $coverageSummary; @@ -79,7 +79,7 @@ public function Parse($filename) } // Insert coverage summaries - $completedSummaries = array(); + $completedSummaries = []; foreach ($this->CoverageSummaries as $coverageSummary) { if (in_array($coverageSummary->BuildId, $completedSummaries)) { continue; diff --git a/app/cdash/xml_handlers/OpenCoverTar_handler.php b/app/cdash/xml_handlers/OpenCoverTar_handler.php index e7e7f25ed1..6fdb572695 100644 --- a/app/cdash/xml_handlers/OpenCoverTar_handler.php +++ b/app/cdash/xml_handlers/OpenCoverTar_handler.php @@ -36,14 +36,14 @@ public function __construct($buildid) $this->Build->Id = $buildid; $this->Build->FillFromId($this->Build->Id); - $this->CoverageSummaries = array(); + $this->CoverageSummaries = []; $coverageSummary = new CoverageSummary(); $coverageSummary->BuildId = $this->Build->Id; $this->CoverageSummaries['default'] = $coverageSummary; - $this->Coverages = array(); - $this->CoverageFiles = array(); - $this->CoverageFileLogs = array(); + $this->Coverages = []; + $this->CoverageFiles = []; + $this->CoverageFileLogs = []; $this->ParseCSFiles = true; } @@ -130,7 +130,7 @@ public function text($parser, $data) } // MODULENAME gives the folder structure that the .cs file belongs in if ($element == 'MODULENAME' && (strlen($data))) { - $this->currentModule = array($data, strtolower($data)); + $this->currentModule = [$data, strtolower($data)]; } } @@ -212,7 +212,7 @@ public function Parse($filename) } // Insert coverage summaries - $completedSummaries = array(); + $completedSummaries = []; foreach ($this->CoverageSummaries as $coverageSummary) { if (in_array($coverageSummary->BuildId, $completedSummaries)) { continue; @@ -283,8 +283,8 @@ public function ParseOpenCoverFile($buildid, $fileinfo) $parser = xml_parser_create(); $fileContents = file_get_contents($fileinfo->getPath() . DIRECTORY_SEPARATOR . $fileinfo->getFilename()); $parser = xml_parser_create(); - xml_set_element_handler($parser, array($this,"startElement"), array($this,'endElement')); - xml_set_character_data_handler($parser, array($this, 'text')); + xml_set_element_handler($parser, [$this,"startElement"], [$this,'endElement']); + xml_set_character_data_handler($parser, [$this, 'text']); xml_parse($parser, $fileContents, false); } } diff --git a/app/cdash/xml_handlers/build_handler.php b/app/cdash/xml_handlers/build_handler.php index 75b351d06c..f6e76abfc1 100644 --- a/app/cdash/xml_handlers/build_handler.php +++ b/app/cdash/xml_handlers/build_handler.php @@ -117,7 +117,7 @@ public function startElement($parser, $name, $attributes) } elseif ($name == 'SUBPROJECT') { $this->SubProjectName = $attributes['NAME']; if (!array_key_exists($this->SubProjectName, $this->SubProjects)) { - $this->SubProjects[$this->SubProjectName] = array(); + $this->SubProjects[$this->SubProjectName] = []; } if (!array_key_exists($this->SubProjectName, $this->Builds)) { $build = $factory->create(Build::class); diff --git a/app/cdash/xml_handlers/coverage_log_handler.php b/app/cdash/xml_handlers/coverage_log_handler.php index 64e06597b2..a59de57d74 100644 --- a/app/cdash/xml_handlers/coverage_log_handler.php +++ b/app/cdash/xml_handlers/coverage_log_handler.php @@ -42,7 +42,7 @@ public function __construct($projectID) $this->Build = new Build(); $this->Site = new Site(); $this->UpdateEndTime = false; - $this->CoverageFiles = array(); + $this->CoverageFiles = []; $this->CurrentLine = ""; } @@ -149,13 +149,13 @@ public function endElement($parser, $name) } elseif ($name == 'FILE') { // Store these objects to be inserted after we're guaranteed // to have a valid buildid. - $this->CoverageFiles[] = array($this->CurrentCoverageFile, - $this->CurrentCoverageFileLog); + $this->CoverageFiles[] = [$this->CurrentCoverageFile, + $this->CurrentCoverageFileLog]; } elseif ($name == 'COVERAGELOG') { if (empty($this->CoverageFiles)) { // Store these objects to be inserted after we're guaranteed // to have a valid buildid. - $this->CoverageFiles[] = array(new CoverageFile(), new CoverageFileLog()); + $this->CoverageFiles[] = [new CoverageFile(), new CoverageFileLog()]; } } } diff --git a/app/cdash/xml_handlers/dynamic_analysis_handler.php b/app/cdash/xml_handlers/dynamic_analysis_handler.php index 0f21363eb6..23e1a5e06c 100644 --- a/app/cdash/xml_handlers/dynamic_analysis_handler.php +++ b/app/cdash/xml_handlers/dynamic_analysis_handler.php @@ -122,8 +122,8 @@ public function startElement($parser, $name, $attributes) } elseif ($name == 'LABEL') { $this->Label = $factory->create(Label::class); } elseif ($name == 'LOG') { - $this->DynamicAnalysis->LogCompression = isset($attributes['COMPRESSION']) ? $attributes['COMPRESSION'] : ''; - $this->DynamicAnalysis->LogEncoding = isset($attributes['ENCODING']) ? $attributes['ENCODING'] : ''; + $this->DynamicAnalysis->LogCompression = $attributes['COMPRESSION'] ?? ''; + $this->DynamicAnalysis->LogEncoding = $attributes['ENCODING'] ?? ''; } } diff --git a/app/cdash/xml_handlers/note_handler.php b/app/cdash/xml_handlers/note_handler.php index 3b179714a6..8d8138bb96 100644 --- a/app/cdash/xml_handlers/note_handler.php +++ b/app/cdash/xml_handlers/note_handler.php @@ -74,7 +74,7 @@ public function startElement($parser, $name, $attributes) } elseif ($name == 'NOTE') { $this->NoteCreator = new NoteCreator; $this->NoteCreator->name = - isset($attributes['NAME']) ? $attributes['NAME'] : ''; + $attributes['NAME'] ?? ''; $this->Timestamp = 0; } } diff --git a/app/cdash/xml_handlers/project_handler.php b/app/cdash/xml_handlers/project_handler.php index ec2bc4bc6b..fded36588c 100644 --- a/app/cdash/xml_handlers/project_handler.php +++ b/app/cdash/xml_handlers/project_handler.php @@ -71,10 +71,10 @@ public function startElement($parser, $name, $attributes) } if ($name == 'PROJECT') { - $this->SubProjects = array(); - $this->Dependencies = array(); + $this->SubProjects = []; + $this->Dependencies = []; } elseif ($name == 'SUBPROJECT') { - $this->CurrentDependencies = array(); + $this->CurrentDependencies = []; $this->SubProject = new SubProject(); $this->SubProject->SetProjectId($this->projectid); $this->SubProject->SetName($attributes['NAME']); @@ -184,7 +184,7 @@ public function endElement($parser, $name) $this->SubProjects[$this->SubProject->GetId()] = $this->SubProject; // Handle dependencies here too. - $this->Dependencies[$this->SubProject->GetId()] = array(); + $this->Dependencies[$this->SubProject->GetId()] = []; foreach ($this->CurrentDependencies as $dependencyid) { $added = false; diff --git a/app/cdash/xml_handlers/stack.php b/app/cdash/xml_handlers/stack.php index 84eb4269c3..fca1dbd001 100644 --- a/app/cdash/xml_handlers/stack.php +++ b/app/cdash/xml_handlers/stack.php @@ -16,7 +16,7 @@ class stack { - private $stack = array(); + private $stack = []; public function __construct() { diff --git a/app/cdash/xml_handlers/upload_handler.php b/app/cdash/xml_handlers/upload_handler.php index f0176a9cac..0bdc6eb3f7 100644 --- a/app/cdash/xml_handlers/upload_handler.php +++ b/app/cdash/xml_handlers/upload_handler.php @@ -125,7 +125,7 @@ public function startElement($parser, $name, $attributes) $build_date = extract_date_from_buildstamp($this->Build->GetStamp()); - list($prev, $nightly_start_time, $next) = + [$prev, $nightly_start_time, $next] = get_dates($build_date, $nightly_time); // If the nightly start time is after noon (server time) @@ -183,7 +183,7 @@ public function startElement($parser, $name, $attributes) $this->UploadFile = new UploadFile(); $this->UploadFile->Filename = $attributes['FILENAME']; } elseif ($name == 'CONTENT') { - $fileEncoding = isset($attributes['ENCODING']) ? $attributes['ENCODING'] : 'base64'; + $fileEncoding = $attributes['ENCODING'] ?? 'base64'; if (strcmp($fileEncoding, 'base64') != 0) { // Only base64 encoding is supported for file upload @@ -194,7 +194,7 @@ public function startElement($parser, $name, $attributes) // Create tmp file $this->TmpFilename = tempnam($config->get('CDASH_UPLOAD_DIRECTORY'), 'tmp'); // TODO Handle error - chmod($this->TmpFilename, 0644); + chmod($this->TmpFilename, 0o644); if (empty($this->TmpFilename)) { add_log('Failed to create temporary filename', __FILE__ . ':' . __LINE__ . ' - ' . __FUNCTION__, LOG_ERR); @@ -390,7 +390,7 @@ public function text($parser, $data) switch ($element) { case 'CONTENT': // Write base64 encoded chunch to temporary file - $charsToReplace = array("\r\n", "\n", "\r"); + $charsToReplace = ["\r\n", "\n", "\r"]; fwrite($this->Base64TmpFileWriteHandle, str_replace($charsToReplace, '', $data)); break; } diff --git a/config/cdash.php b/config/cdash.php index bbe1562070..f012ee46ba 100755 --- a/config/cdash.php +++ b/config/cdash.php @@ -26,7 +26,7 @@ 'registration' => [ 'email' => [ 'verify' => env('REGISTRATION_EMAIL_VERIFY', true), - ] + ], ], 'file' => [ 'path' => [ diff --git a/config/filesystems.php b/config/filesystems.php index ebebfe8fb0..62652047b4 100755 --- a/config/filesystems.php +++ b/config/filesystems.php @@ -68,7 +68,7 @@ 'driver' => 'local', 'root' => app_path('cdash/public'), 'visibility' => 'private', - ] + ], ], ]; diff --git a/config/ldap.php b/config/ldap.php index 921caeb587..0c7d540157 100644 --- a/config/ldap.php +++ b/config/ldap.php @@ -5,7 +5,7 @@ 'activedirectory' => Adldap\Schemas\ActiveDirectory::class, 'openldap' => \App\Schemas\OpenLDAP::class, 'freeipa' => Adldap\Schemas\FreeIPA::class, - '' => null + '' => null, ]; return [ diff --git a/config/ldap_auth.php b/config/ldap_auth.php index 9fcddeae6c..9e1be62391 100644 --- a/config/ldap_auth.php +++ b/config/ldap_auth.php @@ -10,12 +10,12 @@ 'database' => [ 'guid_column' => 'email', 'username_column' => 'email', - ] + ], ], 'sync_attributes' => [ 'email' => env('LDAP_EMAIL_ATTRIBUTE', 'mail'), 'firstname' => 'givenName', - 'lastname' => 'sn' + 'lastname' => 'sn', ], 'logging' => [ 'enabled' => env('LDAP_LOGGING', true), @@ -34,6 +34,6 @@ ], ], 'rules' => [ - App\Rules\LdapFilterRules::class - ] + App\Rules\LdapFilterRules::class, + ], ]; diff --git a/config/logging.php b/config/logging.php index 42c2d9bfda..2acb9195c0 100755 --- a/config/logging.php +++ b/config/logging.php @@ -50,7 +50,7 @@ 'path' => storage_path('logs/cdash.log'), 'level' => 'debug', 'days' => 14, - 'permission' => 0664, + 'permission' => 0o664, ], 'slack' => [ diff --git a/config/oauth2.php b/config/oauth2.php index 041f7dfedf..21e99639ce 100644 --- a/config/oauth2.php +++ b/config/oauth2.php @@ -24,5 +24,5 @@ 'hostedDomain' => '*', 'className' => Google::class, 'enable' => env('GOOGLE_ENABLE', false), - ] + ], ]; diff --git a/config/saml2.php b/config/saml2.php index 7ac18bdc7c..fbce02bf23 100644 --- a/config/saml2.php +++ b/config/saml2.php @@ -210,7 +210,7 @@ */ 'singleLogoutService' => [ - 'url' => '' + 'url' => '', ], ], @@ -358,11 +358,11 @@ 'contactPerson' => [ 'technical' => [ 'givenName' => env('SAML2_CONTACT_TECHNICAL_NAME', 'name'), - 'emailAddress' => env('SAML2_CONTACT_TECHNICAL_EMAIL', 'no@reply.com') + 'emailAddress' => env('SAML2_CONTACT_TECHNICAL_EMAIL', 'no@reply.com'), ], 'support' => [ 'givenName' => env('SAML2_CONTACT_SUPPORT_NAME', 'Support'), - 'emailAddress' => env('SAML2_CONTACT_SUPPORT_EMAIL', 'no@reply.com') + 'emailAddress' => env('SAML2_CONTACT_SUPPORT_EMAIL', 'no@reply.com'), ], ], @@ -379,7 +379,7 @@ 'en-US' => [ 'name' => env('SAML2_ORGANIZATION_NAME', 'Name'), 'displayname' => env('SAML2_ORGANIZATION_NAME', 'Display Name'), - 'url' => env('SAML2_ORGANIZATION_URL', 'http://url') + 'url' => env('SAML2_ORGANIZATION_URL', 'http://url'), ], ], diff --git a/database/factories/UserFactory.php b/database/factories/UserFactory.php index 9ac24726bc..b24decb9d1 100755 --- a/database/factories/UserFactory.php +++ b/database/factories/UserFactory.php @@ -33,6 +33,6 @@ $user->passwords()->insert([ 'userid' => $user->id, 'date' => now(), - 'password' => $user->password + 'password' => $user->password, ]); }); diff --git a/routes/web.php b/routes/web.php index e111994ec6..9875d28fdb 100755 --- a/routes/web.php +++ b/routes/web.php @@ -17,7 +17,7 @@ use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Route; -$routeList = array('verify' => true); +$routeList = ['verify' => true]; if(config('auth.user_registration_form_enabled') === false) { $routeList['register'] = false; diff --git a/tests/Feature/CDashTest.php b/tests/Feature/CDashTest.php index 4d6733f20c..5585a01783 100755 --- a/tests/Feature/CDashTest.php +++ b/tests/Feature/CDashTest.php @@ -24,7 +24,7 @@ public function testCDashFilesystemConfigExists() $expected = [ 'driver' => 'local', 'root' => app_path('cdash/public'), - 'visibility' => 'private' + 'visibility' => 'private', ]; $actual = Config::get('filesystems.disks.cdash'); diff --git a/tests/Feature/LdapAuthWithRulesTest.php b/tests/Feature/LdapAuthWithRulesTest.php index 9d994047ac..287a6b1d91 100644 --- a/tests/Feature/LdapAuthWithRulesTest.php +++ b/tests/Feature/LdapAuthWithRulesTest.php @@ -30,7 +30,7 @@ public function testLdapAuthentication() 'userprinciplename' => [$email], 'mail' => $email, 'sn' => 'Bobby', - 'givenName' => 'Ricky' + 'givenName' => 'Ricky', ]); Resolver::shouldReceive('byCredentials') @@ -70,7 +70,7 @@ public function testLdapAuthenticationRulesGivenDnDoesNotMatch() 'userprinciplename' => [$email], 'mail' => $email, 'sn' => 'Bobby', - 'givenName' => 'Ricky' + 'givenName' => 'Ricky', ]); $mock_ldap_resource = fopen(__FILE__, 'r'); diff --git a/tests/Feature/LoginAndRegistration.php b/tests/Feature/LoginAndRegistration.php index 3dc2a9e612..b512d5c81a 100644 --- a/tests/Feature/LoginAndRegistration.php +++ b/tests/Feature/LoginAndRegistration.php @@ -174,7 +174,7 @@ public function testSaml2() : void 'idp_logout_url' => "$saml2_tenant_uri/logout", 'idp_x509_cert' => base64_encode('asdf'), 'metadata' => '{}', - 'name_id_format' => 'persistent' + 'name_id_format' => 'persistent', ]; $saml2_tenant_id = DB::table('saml2_tenants')->insertGetId($params); diff --git a/tests/Feature/MeasurementPositionMigration.php b/tests/Feature/MeasurementPositionMigration.php index 84ba7f8f8a..adced6a0a2 100644 --- a/tests/Feature/MeasurementPositionMigration.php +++ b/tests/Feature/MeasurementPositionMigration.php @@ -40,7 +40,7 @@ public function testMeasurementPositionMigration() // Populate some data to migrate. $base_measurement = [ 'projectid' => $project1->Id, - 'name' => 'a' + 'name' => 'a', ]; $measurement1 = $base_measurement; diff --git a/tests/Feature/MigrateConfigCommand.php b/tests/Feature/MigrateConfigCommand.php index f2fdf25c5e..818d35f36a 100644 --- a/tests/Feature/MigrateConfigCommand.php +++ b/tests/Feature/MigrateConfigCommand.php @@ -31,42 +31,42 @@ public function testMigrateConfigCommand() // Write an example config.local.php file. $config_contents = <<<'EOT' - 'github_client_id', - 'clientSecret' => 'github_client_secret' -]; -$OAUTH2_PROVIDERS['GitLab'] = [ - 'clientId' => 'gitlab_client_id', - 'clientSecret' => 'gitlab_client_secret', - 'domain' => 'https://gitlab.kitware.com' -]; -$OAUTH2_PROVIDERS['Google'] = [ - 'clientId' => 'google_client_id', - 'clientSecret' => 'google_client_secret' -]; + 'github_client_id', + 'clientSecret' => 'github_client_secret' + ]; + $OAUTH2_PROVIDERS['GitLab'] = [ + 'clientId' => 'gitlab_client_id', + 'clientSecret' => 'gitlab_client_secret', + 'domain' => 'https://gitlab.kitware.com' + ]; + $OAUTH2_PROVIDERS['Google'] = [ + 'clientId' => 'google_client_id', + 'clientSecret' => 'google_client_secret' + ]; -EOT; + EOT; file_put_contents($this->config_file, $config_contents); file_put_contents($this->test_file, <<<'EOT' -MIX_APP_URL="${APP_URL}" -DB_PASSWORD=my_db_password -EOT, FILE_APPEND); + MIX_APP_URL="${APP_URL}" + DB_PASSWORD=my_db_password + EOT, FILE_APPEND); // Run the migration command. $this->artisan('config:migrate', ['output' => $this->test_file]); @@ -77,8 +77,8 @@ public function testMigrateConfigCommand() $this::assertStringContainsString('APP_URL=https://localhost/CDash', $actual); $this::assertStringContainsString('APP_ENV=production', $actual); $expected = <<<'EOT' -MIX_APP_URL="${APP_URL}" -EOT; + MIX_APP_URL="${APP_URL}" + EOT; $this::assertStringContainsString($expected, $actual); $this::assertStringContainsString('SESSION_LIFETIME=120', $actual); $this::assertStringContainsString('MAIL_HOST=cdash_smtp_host', $actual); diff --git a/tests/Feature/Monitor.php b/tests/Feature/Monitor.php index 1aca3f9953..fc2f6ff286 100644 --- a/tests/Feature/Monitor.php +++ b/tests/Feature/Monitor.php @@ -72,7 +72,7 @@ public function testMonitorAPI() : void // Verify default (empty) JSON result. $this->actingAs($this->admin_user)->get('/api/monitor')->assertJsonFragment([ 'backlog_length' => 0, - 'backlog_time' => null + 'backlog_time' => null, ]); // Populate some testing data. @@ -82,14 +82,14 @@ public function testMonitorAPI() : void 'payload' => '1', 'attempts' => 0, 'available_at' => $now, - 'created_at' => $now + 'created_at' => $now, ]); DB::table('failed_jobs')->insert([ 'connection' => 'database', 'queue' => 'default', 'payload' => '2', - 'exception' => 'problem' + 'exception' => 'problem', ]); DB::table('successful_jobs')->insert(['filename' => 'Build.xml']); @@ -101,7 +101,7 @@ public function testMonitorAPI() : void $response = $this->actingAs($this->admin_user)->getJson('/api/monitor'); $response->assertJsonFragment([ 'backlog_length' => 1, - 'backlog_time' => 'just now' + 'backlog_time' => 'just now', ]); $response_json = $response->json(); $this::assertTrue(array_key_exists('time_chart_data', $response_json)); diff --git a/tests/Feature/OpenLdapAuthWithOverrides.php b/tests/Feature/OpenLdapAuthWithOverrides.php index 5dcd275ba7..8be4903b3d 100644 --- a/tests/Feature/OpenLdapAuthWithOverrides.php +++ b/tests/Feature/OpenLdapAuthWithOverrides.php @@ -32,7 +32,7 @@ public function testLdapAuthenticationCustomLocater() 'uid' => [$uid], 'mail' => $email, 'sn' => 'Bobby', - 'givenName' => 'Ricky' + 'givenName' => 'Ricky', ]); Resolver::shouldReceive('byCredentials') @@ -71,7 +71,7 @@ public function testOpenLdapUnmodifiedGuid() 'uid' => [$uid], 'mail' => $email, 'sn' => 'Bobby', - 'givenName' => 'Ricky' + 'givenName' => 'Ricky', ]); $this::assertEquals($email, $user->getConvertedGuid()); diff --git a/tests/Feature/ProjectPermissions.php b/tests/Feature/ProjectPermissions.php index 8bf5905b08..cf3ff63ee9 100644 --- a/tests/Feature/ProjectPermissions.php +++ b/tests/Feature/ProjectPermissions.php @@ -102,7 +102,7 @@ public function testProjectPermissions() $response = $this->get('/api/v1/index.php'); $response->assertJson([ 'projectname' => 'PublicProject', - 'public' => Project::ACCESS_PUBLIC + 'public' => Project::ACCESS_PUBLIC, ]); // Verify that viewProjects.php only lists the public project. @@ -138,7 +138,7 @@ public function testProjectPermissions() $response = $this->actingAs($this->normal_user)->get('/api/v1/index.php'); $response->assertJson([ 'projectname' => 'PublicProject', - 'public' => Project::ACCESS_PUBLIC + 'public' => Project::ACCESS_PUBLIC, ]); // Verify that we can access the protected project when logged in @@ -147,7 +147,7 @@ public function testProjectPermissions() $response = $this->actingAs($this->normal_user)->get('/api/v1/index.php'); $response->assertJson([ 'projectname' => 'ProtectedProject', - 'public' => Project::ACCESS_PROTECTED + 'public' => Project::ACCESS_PROTECTED, ]); // Add the user to PrivateProject1. @@ -167,7 +167,7 @@ public function testProjectPermissions() $response = $this->actingAs($this->normal_user)->get('/api/v1/index.php'); $response->assertJson([ 'projectname' => 'PrivateProject1', - 'public' => Project::ACCESS_PRIVATE + 'public' => Project::ACCESS_PRIVATE, ]); // Verify that she cannot access PrivateProject2. @@ -198,25 +198,25 @@ public function testProjectPermissions() $response = $this->actingAs($this->admin_user)->get('/api/v1/index.php'); $response->assertJson([ 'projectname' => 'PublicProject', - 'public' => Project::ACCESS_PUBLIC + 'public' => Project::ACCESS_PUBLIC, ]); $_GET['project'] = 'ProtectedProject'; $response = $this->actingAs($this->admin_user)->get('/api/v1/index.php'); $response->assertJson([ 'projectname' => 'ProtectedProject', - 'public' => Project::ACCESS_PROTECTED + 'public' => Project::ACCESS_PROTECTED, ]); $_GET['project'] = 'PrivateProject1'; $response = $this->actingAs($this->admin_user)->get('/api/v1/index.php'); $response->assertJson([ 'projectname' => 'PrivateProject1', - 'public' => Project::ACCESS_PRIVATE + 'public' => Project::ACCESS_PRIVATE, ]); $_GET['project'] = 'PrivateProject2'; $response = $this->actingAs($this->admin_user)->get('/api/v1/index.php'); $response->assertJson([ 'projectname' => 'PrivateProject2', - 'public' => Project::ACCESS_PRIVATE + 'public' => Project::ACCESS_PRIVATE, ]); // Verify that admin sees all four projects on viewProjects.php diff --git a/tests/Feature/TestSchemaMigration.php b/tests/Feature/TestSchemaMigration.php index 2863345d18..3ab4dba606 100644 --- a/tests/Feature/TestSchemaMigration.php +++ b/tests/Feature/TestSchemaMigration.php @@ -82,7 +82,7 @@ public function testMigrationOfTestTables() 'path' => '/tmp', 'command' => 'ls', 'details' => 'Completed', - 'output' => '0' + 'output' => '0', ]; $test1 = $base_test; @@ -108,7 +108,7 @@ public function testMigrationOfTestTables() 'timemean' => 0.00, 'timestd' => 0.00, 'timestatus' => 0, - 'newstatus' => 1 + 'newstatus' => 1, ]; $buildtest1 = $base_buildtest; @@ -123,7 +123,7 @@ public function testMigrationOfTestTables() $base_testlabel = [ 'labelid' => 1, 'buildid' => 1, - 'testid' => 1 + 'testid' => 1, ]; $testlabel1 = $base_testlabel; $testlabel2 = $base_testlabel; @@ -137,7 +137,7 @@ public function testMigrationOfTestTables() $base_testimage = [ 'imgid' => 1, 'testid' => 1, - 'role' => 'BaseImage' + 'role' => 'BaseImage', ]; $testimage1 = $base_testimage; $testimage2 = $base_testimage; @@ -154,7 +154,7 @@ public function testMigrationOfTestTables() 'testid' => 1, 'name' => 'WallTime', 'type' => 'numeric/double', - 'value' => 0.1 + 'value' => 0.1, ]; $testmeasurement1 = $base_testmeasurement; $testmeasurement2 = $base_testmeasurement; @@ -199,19 +199,19 @@ public function testMigrationOfTestTables() 'crc32' => 123, 'path' => '/tmp', 'command' => 'ls', - 'output' => '0' + 'output' => '0', ], [ 'crc32' => 456, 'path' => '/tmp', 'command' => 'ls', - 'output' => '0 0 0' + 'output' => '0 0 0', ], [ 'crc32' => 789, 'path' => '/tmp', 'command' => 'ls', - 'output' => 'something else' + 'output' => 'something else', ], ]; foreach ($expected_testoutputs as $expected_testoutput) { diff --git a/tests/Unit/app/Validators/PasswordTest.php b/tests/Unit/app/Validators/PasswordTest.php index cc01215248..3d451a1708 100755 --- a/tests/Unit/app/Validators/PasswordTest.php +++ b/tests/Unit/app/Validators/PasswordTest.php @@ -25,11 +25,11 @@ class PasswordTest extends TestCase { - const LOWERCASE = 'abc'; - const UPPERCASE = 'YYZ'; - const DIGITS = '246'; - const SYMBOLS = '+!#'; - const UNDERSCORE = '_'; + public const LOWERCASE = 'abc'; + public const UPPERCASE = 'YYZ'; + public const DIGITS = '246'; + public const SYMBOLS = '+!#'; + public const UNDERSCORE = '_'; public function testGetComplexityConfigurationGivenDefault() {