Skip to content
Merged

PHP 8.1 #1280

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Homestead.yaml
npm-debug.log
*.pem
.php_cs.cache
.php-cs-fixer.cache
.phpunit.result.cache
/public/build/
/public/hot
Expand Down
4 changes: 2 additions & 2 deletions .php_cs.dist → .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
->in(__DIR__)
;

return PhpCsFixer\Config::create()
->setRules([
$config = new PhpCsFixer\Config();
return $config->setRules([
'@PSR2' => true,
'method_argument_space' => ['on_multiline' => 'ignore'],
])
Expand Down
18 changes: 9 additions & 9 deletions app/Console/Commands/AutoRemoveBuilds.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,16 @@ public function handle()
$db->execute($stmt, $args);
while ($project_array = $stmt->fetch()) {
removeFirstBuilds(
$project_array['id'],
$project_array['autoremovetimeframe'],
$project_array['autoremovemaxbuilds'],
true // force the autoremove
);
$project_array['id'],
$project_array['autoremovetimeframe'],
$project_array['autoremovemaxbuilds'],
true // force the autoremove
);
removeBuildsGroupwise(
$project_array['id'],
$project_array['autoremovemaxbuilds'],
true // force the autoremove
);
$project_array['id'],
$project_array['autoremovemaxbuilds'],
true // force the autoremove
);
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace App\Exceptions;

use Exception;
use Throwable;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;

class Handler extends ExceptionHandler
Expand All @@ -29,10 +29,10 @@ class Handler extends ExceptionHandler
/**
* Report or log an exception.
*
* @param \Exception $exception
* @param \Throwable $exception
* @return void
*/
public function report(Exception $exception)
public function report(Throwable $exception)
{
parent::report($exception);
}
Expand All @@ -41,10 +41,10 @@ public function report(Exception $exception)
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Exception $exception
* @param \Throwable $exception
* @return \Illuminate\Http\Response
*/
public function render($request, Exception $exception)
public function render($request, Throwable $exception)
{
return parent::render($request, $exception);
}
Expand Down
3 changes: 2 additions & 1 deletion app/Http/Controllers/Views/EditProjectController.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?php
namespace App\Http\Controllers\Views;

require_once 'include/common.php'; require_once 'include/defines.php';
require_once 'include/common.php';
require_once 'include/defines.php';

use CDash\Model\Project;
use App\Services\ProjectPermissions;
Expand Down
8 changes: 4 additions & 4 deletions app/Jobs/ProcessSubmission.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public function handle()
* @param Exception $exception
* @return void
*/
public function failed(\Exception $exception)
public function failed(\Throwable $exception)
{
\Log::warning("Failed to process {$this->filename}");
$this->renameSubmissionFile("inprogress/{$this->filename}", "failed/{$this->filename}");
Expand Down Expand Up @@ -239,9 +239,9 @@ private function getRemoteSubmissionFileHandle($filename)

$client = new GuzzleHttp\Client();
$response = $client->request('GET',
config('app.url') . '/api/v1/getSubmissionFile.php',
['query' => ['filename' => $filename],
'save_to' => $tmpFilename]);
config('app.url') . '/api/v1/getSubmissionFile.php',
['query' => ['filename' => $filename],
'save_to' => $tmpFilename]);

if ($response->getStatusCode() === 200) {
// @todo I'm sure Guzzle can be used to return a file handle from the stream, but for now
Expand Down
1 change: 0 additions & 1 deletion app/Rules/LdapFilterRules.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

class LdapFilterRules extends Rule
{

/**
* Checks if the rule passes validation.
*
Expand Down
1 change: 1 addition & 0 deletions app/Services/NoteCreator.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public function __construct()
$this->name = '';
$this->time = '';
$this->text = '';
$this->crc32 = '';
}

/** Get the CRC32 */
Expand Down
4 changes: 2 additions & 2 deletions app/Services/TestCreator.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ public function create(Build $build)
$testid = $test_exists_results[0]->id;
} else {
\DB::insert('INSERT INTO test (projectid, name) VALUES (:projectid, :name)',
[':projectid' => $this->projectid,
':name' => $this->testName]);
[':projectid' => $this->projectid,
':name' => $this->testName]);
$testid = \DB::getPdo()->lastInsertId();
}

Expand Down
4 changes: 2 additions & 2 deletions app/Services/TestingDay.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public static function get(Project $project, $date)
// that occurs before it is part of the previous testing day.
if (date(FMT_TIME, $build_start_timestamp) <
date(FMT_TIME, $nightly_start_timestamp)
) {
) {
$build_datetime->sub(new \DateInterval('P1D'));
$build_start_timestamp = $build_datetime->getTimestamp();
}
Expand All @@ -73,7 +73,7 @@ public static function get(Project $project, $date)
// that occurs after it is part of the next testing day.
if (date(FMT_TIME, $build_start_timestamp) >=
date(FMT_TIME, $nightly_start_timestamp)
) {
) {
$build_datetime->add(new \DateInterval('P1D'));
$build_start_timestamp = $build_datetime->getTimestamp();
}
Expand Down
16 changes: 8 additions & 8 deletions app/cdash/app/Controller/Api/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ public function populateBuildRow($build_row)

if (strlen($build_row['updatestatus']) > 0 &&
$build_row['updatestatus'] != '0'
) {
) {
$build_row['countupdateerrors'] = 1;
} else {
$build_row['countupdateerrors'] = 0;
Expand Down Expand Up @@ -466,8 +466,8 @@ public function generateBuildResponseFromRow($build_array)
}
if ($i == -1) {
add_log("BuildGroup '$groupid' not found for build #" . $build_array['id'],
__FILE__ . ':' . __LINE__ . ' - ' . __FUNCTION__,
LOG_WARNING);
__FILE__ . ':' . __LINE__ . ' - ' . __FUNCTION__,
LOG_WARNING);
return false;
}

Expand All @@ -482,7 +482,7 @@ public function generateBuildResponseFromRow($build_array)
$siteid = $build_array['siteid'];

$countChildrenResult = pdo_single_row_query(
'SELECT count(id) AS numchildren
'SELECT count(id) AS numchildren
FROM build WHERE parentid=' . qnum($buildid));
$numchildren = $countChildrenResult['numchildren'];
$build_response['numchildren'] = $numchildren;
Expand Down Expand Up @@ -565,11 +565,11 @@ public function generateBuildResponseFromRow($build_array)
$buildplatform = 'windows';
} elseif (strtolower(substr($build_array['osname'], 0, 8)) == 'mac os x'
|| strtolower(substr($build_array['osname'], 0, 5)) == 'macos'
) {
) {
$buildplatform = 'mac';
} elseif (strtolower(substr($build_array['osname'], 0, 5)) == 'linux'
|| strtolower(substr($build_array['osname'], 0, 3)) == 'aix'
) {
) {
$buildplatform = 'linux';
} elseif (strtolower(substr($build_array['osname'], 0, 7)) == 'freebsd') {
$buildplatform = 'freebsd';
Expand Down Expand Up @@ -625,7 +625,7 @@ public function generateBuildResponseFromRow($build_array)
// Figure out how many labels to report for this build.
if (!array_key_exists('numlabels', $build_array) ||
$build_array['numlabels'] == 0
) {
) {
$num_labels = 0;
} else {
$num_labels = $build_array['numlabels'];
Expand All @@ -648,7 +648,7 @@ public function generateBuildResponseFromRow($build_array)
// Whitelist case
if ($this->includeSubProjects &&
in_array($label_row['text'], $this->includedSubProjects)
) {
) {
$num_labels++;
$build_labels[] = $label_row['text'];
}
Expand Down
6 changes: 3 additions & 3 deletions app/cdash/app/Controller/Api/QueryTests.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ private function rowSurvivesTestOutputFilter($row, &$build)
foreach ($this->testOutputIncludeRegex as $include_regex) {
$include_regex = $this->applySafeDelimiter($include_regex);
if (preg_match($include_regex, $test_output, $matches,
PREG_OFFSET_CAPTURE)) {
PREG_OFFSET_CAPTURE)) {
if (!$first_match_idx) {
$first_match_idx = $matches[0][1];
$match_length = strlen($include_regex);
Expand All @@ -135,8 +135,8 @@ private function rowSurvivesTestOutputFilter($row, &$build)
// Show context surrounding the match.
$build['matchingoutput'] =
substr($test_output,
$first_match_idx - $pre_post_context_size,
$context_size);
$first_match_idx - $pre_post_context_size,
$context_size);
}
} else {
// Showing tests whose output does NOT include some string(s).
Expand Down
14 changes: 7 additions & 7 deletions app/cdash/app/Controller/Api/TestDetails.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function getResponse()
// If we have a fileid we download it.
if (isset($_GET['fileid']) && is_numeric($_GET['fileid'])) {
$stmt = $this->db->prepare(
"SELECT id, value, name FROM testmeasurement
"SELECT id, value, name FROM testmeasurement
WHERE outputid = :outputid AND type = 'file'
ORDER BY id");
$this->db->execute($stmt, [':outputid' => $this->buildtest->outputid]);
Expand Down Expand Up @@ -73,7 +73,7 @@ public function getResponse()
$response['project'] = $project_response;

$stmt = $this->db->prepare(
'SELECT * FROM build2test b2t
'SELECT * FROM build2test b2t
JOIN test t ON t.id = b2t.testid
JOIN testoutput ON testoutput.id = b2t.outputid
WHERE b2t.id = :buildtestid');
Expand Down Expand Up @@ -166,7 +166,7 @@ public function getResponse()
'revisiondiff' => ''
];
$stmt = $this->db->prepare(
'SELECT status, revision, priorrevision, path
'SELECT status, revision, priorrevision, path
FROM buildupdate bu
JOIN build2update b2u ON (b2u.updateid = bu.id)
WHERE b2u.buildid = :buildid');
Expand Down Expand Up @@ -209,7 +209,7 @@ public function getResponse()
// Get any images associated with this test.
$compareimages_response = [];
$stmt = $this->db->prepare(
"SELECT imgid, role FROM test2image
"SELECT imgid, role FROM test2image
WHERE outputid = :outputid AND
(role = 'TestImage' OR role = 'ValidImage' OR role = 'BaselineImage' OR
role ='DifferenceImage2')
Expand All @@ -227,7 +227,7 @@ public function getResponse()

$images_response = [];
$stmt = $this->db->prepare(
"SELECT imgid, role FROM test2image
"SELECT imgid, role FROM test2image
WHERE outputid = :outputid AND
role != 'ValidImage' AND role != 'BaselineImage' AND
role != 'DifferenceImage2'
Expand All @@ -246,7 +246,7 @@ public function getResponse()
// Get any measurements associated with this test.
$measurements_response = [];
$stmt = $this->db->prepare(
'SELECT name, type, value FROM testmeasurement
'SELECT name, type, value FROM testmeasurement
WHERE outputid = :outputid
ORDER BY id');
$this->db->execute($stmt, [':outputid' => $outputid]);
Expand Down Expand Up @@ -293,7 +293,7 @@ public function getResponse()

// Get the list of extra test measurements that have been explicitly added to this project.
$stmt = $this->db->prepare(
'SELECT name FROM measurement WHERE projectid = ? ORDER BY position');
'SELECT name FROM measurement WHERE projectid = ? ORDER BY position');
$this->db->execute($stmt, [$this->project->Id]);
$extra_measurements = [];
while ($row = $stmt->fetch()) {
Expand Down
2 changes: 1 addition & 1 deletion app/cdash/app/Controller/Api/TestOverview.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public function getResponse()

// Main query: find all the requested tests.
$stmt = $this->db->prepare(
"SELECT t.name, b2t.details, b2t.status, b2t.time $sp_select FROM build b
"SELECT t.name, b2t.details, b2t.status, b2t.time $sp_select FROM build b
JOIN build2test b2t ON (b2t.buildid=b.id)
JOIN test t ON (t.id=b2t.testid)
$group_join
Expand Down
2 changes: 1 addition & 1 deletion app/cdash/app/Controller/Api/Timeline.php
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ private function chartForBuildGroup()
Build::ConvertMissingToZero($row['configureerrors']);
if (strlen($row['updatestatus']) > 0 &&
$row['updatestatus'] != '0'
) {
) {
$build['errors'] += 1;
}
$build['testfailed'] = $row['testfailed'];
Expand Down
8 changes: 4 additions & 4 deletions app/cdash/app/Controller/Api/ViewTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ public function getResponse()
$response['hasprocessors'] = false;
$processors_idx = -1;
$extra_measurements_stmt = $this->db->prepare(
'SELECT name FROM measurement
'SELECT name FROM measurement
WHERE projectid = ?
ORDER BY position');
$this->db->execute($extra_measurements_stmt, [$this->project->Id]);
Expand Down Expand Up @@ -327,7 +327,7 @@ public function getResponse()
$etestquery = null;
if ($this->numExtraMeasurements > 0) {
$etestquery = $this->db->prepare(
"SELECT build2test.id, test.projectid, build2test.buildid,
"SELECT build2test.id, test.projectid, build2test.buildid,
build2test.status, build2test.timestatus, test.name, testmeasurement.name,
testmeasurement.value, build.starttime,
build2test.time FROM test
Expand Down Expand Up @@ -364,7 +364,7 @@ public function getResponse()

// Find the time to run all the tests
$time_stmt = $this->db->prepare(
'SELECT SUM(time) FROM build2test WHERE buildid = ?');
'SELECT SUM(time) FROM build2test WHERE buildid = ?');
$this->db->execute($time_stmt, [$buildid]);
$time = $time_stmt->fetchColumn();
$response['totaltime'] = time_difference($time, true, '', true);
Expand Down Expand Up @@ -602,7 +602,7 @@ private function loadTestDetails()

if ($time_begin && $time_end) {
$summary_response = $this->getTestSummary($test, $projectid, $groupid,
$time_begin, $time_end);
$time_begin, $time_end);
if (!empty($summary_response)) {
$test_response = array_merge($test_response, $summary_response);
$data_found = true;
Expand Down
Loading