From ebca064d878a3dc45c7982fa7dd09ed3cb91d640 Mon Sep 17 00:00:00 2001 From: William Allen <16820599+williamjallen@users.noreply.github.com> Date: Thu, 18 Dec 2025 09:18:11 -0500 Subject: [PATCH 01/31] Enable `array_push` style rule --- .php-cs-fixer.dist.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 03e052c7d3..371b98d510 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -13,7 +13,6 @@ ->exclude('resources') ->exclude('public') ->exclude('app/cdash/tests/kwtest/simpletest') - ->notPath('app/cdash/tests/config.test.local.php') ->in(__DIR__); $config = new Config(); @@ -32,4 +31,6 @@ 'global_namespace_import' => ['import_classes' => true, 'import_constants' => null, 'import_functions' => null], 'phpdoc_align' => ['align' => 'left'], 'declare_strict_types' => false, // TODO: turn this back on. Currently causes errors... + // The following rules are a subset of @Symfony:risky and should eventually be replaced by the full ruleset. + 'array_push' => true, ])->setFinder($finder); From 89036baf6b841c02b8370a251d02762152f94826 Mon Sep 17 00:00:00 2001 From: William Allen <16820599+williamjallen@users.noreply.github.com> Date: Thu, 18 Dec 2025 09:19:54 -0500 Subject: [PATCH 02/31] Apply `array_push` style rule --- app/cdash/include/Collection/BuildEmailCollection.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/cdash/include/Collection/BuildEmailCollection.php b/app/cdash/include/Collection/BuildEmailCollection.php index 606d719003..d14cf9159d 100644 --- a/app/cdash/include/Collection/BuildEmailCollection.php +++ b/app/cdash/include/Collection/BuildEmailCollection.php @@ -28,7 +28,7 @@ public function add(BuildEmail $buildEmail): static { $email = $buildEmail->GetEmail(); if (in_array($email, $this->keys)) { - array_push($this->collection[$email], $buildEmail); + $this->collection[$email][] = $buildEmail; } else { $this->addItem([$buildEmail], $email); } From f63441d50ba706dfae9d3bfae6d7cb77c6e10cb7 Mon Sep 17 00:00:00 2001 From: William Allen <16820599+williamjallen@users.noreply.github.com> Date: Thu, 18 Dec 2025 09:20:59 -0500 Subject: [PATCH 03/31] Enable `combine_nested_dirname` rule --- .php-cs-fixer.dist.php | 1 + 1 file changed, 1 insertion(+) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 371b98d510..2f1e22a084 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -33,4 +33,5 @@ 'declare_strict_types' => false, // TODO: turn this back on. Currently causes errors... // The following rules are a subset of @Symfony:risky and should eventually be replaced by the full ruleset. 'array_push' => true, + 'combine_nested_dirname' => true, ])->setFinder($finder); From 170a0cb41dd6b241c96f85707359532aa55738c3 Mon Sep 17 00:00:00 2001 From: William Allen <16820599+williamjallen@users.noreply.github.com> Date: Thu, 18 Dec 2025 09:21:42 -0500 Subject: [PATCH 04/31] Enable `dir_constant` rule --- .php-cs-fixer.dist.php | 1 + 1 file changed, 1 insertion(+) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 2f1e22a084..4b349c2c75 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -34,4 +34,5 @@ // The following rules are a subset of @Symfony:risky and should eventually be replaced by the full ruleset. 'array_push' => true, 'combine_nested_dirname' => true, + 'dir_constant' => true, ])->setFinder($finder); From 4660b62295d57e4204cbfe3977a204a4ce9157e4 Mon Sep 17 00:00:00 2001 From: William Allen <16820599+williamjallen@users.noreply.github.com> Date: Thu, 18 Dec 2025 09:23:23 -0500 Subject: [PATCH 05/31] Apply `dir_constant` rule --- app/cdash/tests/kwtest/kw_test_manager.php | 10 +++---- app/cdash/tests/kwtest/kw_web_tester.php | 4 +-- app/cdash/tests/sameImage.php | 2 +- app/cdash/tests/simple.php | 2 +- app/cdash/tests/simple2.php | 2 +- app/cdash/tests/singletest.php | 6 ++-- app/cdash/tests/test_actualbranchcoverage.php | 2 +- .../tests/test_actualtrilinossubmission.php | 2 +- app/cdash/tests/test_aggregatecoverage.php | 4 +-- .../test_aggregatesubprojectcoverage.php | 2 +- app/cdash/tests/test_attachedfiles.php | 4 +-- app/cdash/tests/test_authtoken.php | 6 ++-- app/cdash/tests/test_bazeljson.php | 30 +++++++++---------- app/cdash/tests/test_branchcoverage.php | 4 +-- app/cdash/tests/test_buildconfigure.php | 2 +- app/cdash/tests/test_builddetails.php | 4 +-- app/cdash/tests/test_buildfailuredetails.php | 4 +-- app/cdash/tests/test_buildgetdate.php | 2 +- app/cdash/tests/test_buildgrouprule.php | 2 +- app/cdash/tests/test_buildmodel.php | 4 +-- app/cdash/tests/test_buildoverview.php | 2 +- app/cdash/tests/test_buildproperties.php | 4 +-- app/cdash/tests/test_buildrelationship.php | 2 +- app/cdash/tests/test_changeid.php | 4 +-- .../tests/test_commitauthornotification.php | 2 +- app/cdash/tests/test_committerinfo.php | 4 +-- app/cdash/tests/test_compressedtest.php | 6 ++-- app/cdash/tests/test_configureappend.php | 4 +-- app/cdash/tests/test_configurewarnings.php | 4 +-- app/cdash/tests/test_consistenttestingday.php | 4 +-- app/cdash/tests/test_coveragedirectories.php | 4 +-- .../tests/test_createprojectpermissions.php | 2 +- .../tests/test_createpublicdashboard.php | 2 +- .../tests/test_crosssubprojectcoverage.php | 4 +-- app/cdash/tests/test_csvexport.php | 2 +- app/cdash/tests/test_deferredsubmissions.php | 6 ++-- app/cdash/tests/test_deletesubproject.php | 4 +-- app/cdash/tests/test_disabledtests.php | 4 +-- app/cdash/tests/test_displayimage.php | 4 +-- app/cdash/tests/test_donehandler.php | 4 +-- .../test_dynamicanalysisdefectlongtype.php | 4 +-- app/cdash/tests/test_dynamicanalysislogs.php | 4 +-- .../tests/test_dynamicanalysissummary.php | 8 ++--- app/cdash/tests/test_email.php | 14 ++++----- app/cdash/tests/test_enable_async.php | 4 +-- app/cdash/tests/test_excludesubprojects.php | 2 +- app/cdash/tests/test_expectedandmissing.php | 2 +- app/cdash/tests/test_expiredbuildrules.php | 2 +- .../tests/test_externallinksfromtests.php | 4 +-- app/cdash/tests/test_filterblocks.php | 2 +- app/cdash/tests/test_filterbuilderrors.php | 4 +-- app/cdash/tests/test_filtertestlabels.php | 4 +-- app/cdash/tests/test_hidecolumns.php | 4 +-- app/cdash/tests/test_image.php | 4 +-- app/cdash/tests/test_imagecomparison.php | 4 +-- app/cdash/tests/test_indexfilters.php | 2 +- app/cdash/tests/test_indexnextprevious.php | 2 +- app/cdash/tests/test_install.php | 2 +- app/cdash/tests/test_issuecreation.php | 6 ++-- app/cdash/tests/test_javajsoncoverage.php | 4 +-- app/cdash/tests/test_jscovercoverage.php | 4 +-- app/cdash/tests/test_junithandler.php | 4 +-- app/cdash/tests/test_limitedbuilds.php | 4 +-- app/cdash/tests/test_longbuildname.php | 4 +-- app/cdash/tests/test_lotsofsubprojects.php | 6 ++-- app/cdash/tests/test_managemeasurements.php | 8 ++--- app/cdash/tests/test_misassignedconfigure.php | 4 +-- app/cdash/tests/test_multicoverage.php | 6 ++-- .../tests/test_multiplelabelsfortests.php | 4 +-- app/cdash/tests/test_multiplesubprojects.php | 6 ++-- app/cdash/tests/test_namedmeasurements.php | 4 +-- app/cdash/tests/test_nobackup.php | 8 ++--- app/cdash/tests/test_notesapi.php | 2 +- .../tests/test_notesparsererrormessages.php | 4 +-- app/cdash/tests/test_numericupdate.php | 4 +-- app/cdash/tests/test_opencovercoverage.php | 6 ++-- app/cdash/tests/test_outputcolor.php | 8 ++--- app/cdash/tests/test_parallelsubmissions.php | 6 ++-- app/cdash/tests/test_passwordcomplexity.php | 2 +- app/cdash/tests/test_pdoexecutelogserrors.php | 2 +- app/cdash/tests/test_projectindb.php | 2 +- app/cdash/tests/test_projectmodel.php | 2 +- app/cdash/tests/test_projectwebpage.php | 26 ++++++++-------- app/cdash/tests/test_projectxmlsequence.php | 4 +-- app/cdash/tests/test_putdynamicbuilds.php | 2 +- app/cdash/tests/test_querytests.php | 2 +- .../tests/test_querytestsfilterlabels.php | 4 +-- .../tests/test_querytestsrevisionfilter.php | 2 +- app/cdash/tests/test_recoverpassword.php | 2 +- app/cdash/tests/test_redundanttests.php | 4 +-- app/cdash/tests/test_removebuilds.php | 8 ++--- app/cdash/tests/test_replacebuild.php | 4 +-- .../tests/test_revisionfilteracrossdates.php | 2 +- .../tests/test_seconds_from_interval.php | 2 +- app/cdash/tests/test_sequenceindependence.php | 4 +-- app/cdash/tests/test_starttimefromnotes.php | 4 +-- app/cdash/tests/test_starttimefromupload.php | 4 +-- .../tests/test_submission_assign_buildid.php | 4 +-- app/cdash/tests/test_submitsortingdata.php | 4 +-- app/cdash/tests/test_subproject.php | 6 ++-- .../tests/test_subprojectnextprevious.php | 4 +-- app/cdash/tests/test_subprojectorder.php | 4 +-- .../tests/test_subprojecttestfilters.php | 2 +- app/cdash/tests/test_summaryemail.php | 4 +-- app/cdash/tests/test_testgraphpermissions.php | 2 +- app/cdash/tests/test_testhistory.php | 2 +- app/cdash/tests/test_testimages.php | 4 +-- app/cdash/tests/test_testoverview.php | 2 +- app/cdash/tests/test_timeline.php | 2 +- .../tests/test_timeoutsandmissingtests.php | 6 ++-- app/cdash/tests/test_timestatus.php | 2 +- app/cdash/tests/test_timesummary.php | 2 +- app/cdash/tests/test_truncateoutput.php | 6 ++-- app/cdash/tests/test_uniquediffs.php | 2 +- .../test_unparsedsubmissionshonorbuildid.php | 2 +- app/cdash/tests/test_updateappend.php | 4 +-- app/cdash/tests/test_uploadfile.php | 4 +-- app/cdash/tests/test_usernotes.php | 2 +- app/cdash/tests/test_viewconfigure.php | 2 +- app/cdash/tests/test_viewdynamicanalysis.php | 2 +- .../tests/test_viewdynamicanalysisfile.php | 4 +-- app/cdash/tests/test_viewsubprojects.php | 2 +- app/cdash/tests/trilinos_submission_test.php | 4 +-- 123 files changed, 255 insertions(+), 255 deletions(-) diff --git a/app/cdash/tests/kwtest/kw_test_manager.php b/app/cdash/tests/kwtest/kw_test_manager.php index ca753c0a8c..2094e7da5b 100644 --- a/app/cdash/tests/kwtest/kw_test_manager.php +++ b/app/cdash/tests/kwtest/kw_test_manager.php @@ -17,11 +17,11 @@ use Illuminate\Support\Facades\Artisan; -require_once dirname(__FILE__) . '/simpletest/unit_tester.php'; -require_once dirname(__FILE__) . '/simpletest/mock_objects.php'; -require_once dirname(__FILE__) . '/simpletest/web_tester.php'; -require_once dirname(__FILE__) . '/kw_db.php'; -require_once dirname(__FILE__) . '/kw_unlink.php'; +require_once __DIR__ . '/simpletest/unit_tester.php'; +require_once __DIR__ . '/simpletest/mock_objects.php'; +require_once __DIR__ . '/simpletest/web_tester.php'; +require_once __DIR__ . '/kw_db.php'; +require_once __DIR__ . '/kw_unlink.php'; /** * The test manager interface kw tests with simpletest test. diff --git a/app/cdash/tests/kwtest/kw_web_tester.php b/app/cdash/tests/kwtest/kw_web_tester.php index 240dfa9368..19ee78b0e6 100644 --- a/app/cdash/tests/kwtest/kw_web_tester.php +++ b/app/cdash/tests/kwtest/kw_web_tester.php @@ -15,8 +15,8 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -require_once dirname(__FILE__) . '/../../../../vendor/autoload.php'; -require_once dirname(__FILE__) . '/kw_unlink.php'; +require_once __DIR__ . '/../../../../vendor/autoload.php'; +require_once __DIR__ . '/kw_unlink.php'; // This is used by several of the tests, but the Laravel entrypoint is not used for // such tests, meaning that this could be undefined. diff --git a/app/cdash/tests/sameImage.php b/app/cdash/tests/sameImage.php index 9ee78fffcd..22ecaa7559 100644 --- a/app/cdash/tests/sameImage.php +++ b/app/cdash/tests/sameImage.php @@ -4,7 +4,7 @@ // After including cdash_test_case.php, subsequent require_once calls are // relative to the top of the CDash source tree // -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; class EmailTestCase extends KWWebTestCase { diff --git a/app/cdash/tests/simple.php b/app/cdash/tests/simple.php index c49a19d4e6..9b9bf9b111 100644 --- a/app/cdash/tests/simple.php +++ b/app/cdash/tests/simple.php @@ -4,7 +4,7 @@ // After including cdash_test_case.php, subsequent require_once calls are // relative to the top of the CDash source tree // -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; class EmailTestCase extends KWWebTestCase { diff --git a/app/cdash/tests/simple2.php b/app/cdash/tests/simple2.php index c49a19d4e6..9b9bf9b111 100644 --- a/app/cdash/tests/simple2.php +++ b/app/cdash/tests/simple2.php @@ -4,7 +4,7 @@ // After including cdash_test_case.php, subsequent require_once calls are // relative to the top of the CDash source tree // -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; class EmailTestCase extends KWWebTestCase { diff --git a/app/cdash/tests/singletest.php b/app/cdash/tests/singletest.php index 165481498c..3e93e3109f 100644 --- a/app/cdash/tests/singletest.php +++ b/app/cdash/tests/singletest.php @@ -5,12 +5,12 @@ // relative to the top of the CDash source tree // -require_once dirname(__FILE__) . '/../../../vendor/autoload.php'; -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/../../../vendor/autoload.php'; +require_once __DIR__ . '/cdash_test_case.php'; require_once 'tests/kwtest/kw_test_manager.php'; -$env_contents = file_get_contents(dirname(__FILE__) . '/../../../.env'); +$env_contents = file_get_contents(__DIR__ . '/../../../.env'); if (!str_contains($env_contents, 'DB_DATABASE=cdash4simpletest')) { echo "We cannot test cdash because test database is not cdash4simpletest\n"; exit(1); diff --git a/app/cdash/tests/test_actualbranchcoverage.php b/app/cdash/tests/test_actualbranchcoverage.php index a12cd664e1..99a35c1033 100644 --- a/app/cdash/tests/test_actualbranchcoverage.php +++ b/app/cdash/tests/test_actualbranchcoverage.php @@ -4,7 +4,7 @@ // After including cdash_test_case.php, subsequent require_once calls are // relative to the top of the CDash source tree // -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; require_once 'tests/test_branchcoverage.php'; class ActualBranchCoverageTestCase extends BranchCoverageTestCase diff --git a/app/cdash/tests/test_actualtrilinossubmission.php b/app/cdash/tests/test_actualtrilinossubmission.php index 411404fae7..ef06c5f814 100644 --- a/app/cdash/tests/test_actualtrilinossubmission.php +++ b/app/cdash/tests/test_actualtrilinossubmission.php @@ -6,7 +6,7 @@ // After including cdash_test_case.php, subsequent require_once calls are // relative to the top of the CDash source tree // -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; require_once 'tests/trilinos_submission_test.php'; class ActualTrilinosSubmissionTestCase extends TrilinosSubmissionTestCase diff --git a/app/cdash/tests/test_aggregatecoverage.php b/app/cdash/tests/test_aggregatecoverage.php index 081120766b..0835c1e499 100644 --- a/app/cdash/tests/test_aggregatecoverage.php +++ b/app/cdash/tests/test_aggregatecoverage.php @@ -19,7 +19,7 @@ // use Illuminate\Support\Facades\DB; -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; class AggregateCoverageTestCase extends KWWebTestCase { @@ -156,7 +156,7 @@ public function checkCoverage($coverage, $expected_loctested, public function submitTestingFile($filename) { $file_to_submit = - dirname(__FILE__) . '/data/AggregateCoverage/' . $filename; + __DIR__ . '/data/AggregateCoverage/' . $filename; return $this->submission('InsightExample', $file_to_submit); } } diff --git a/app/cdash/tests/test_aggregatesubprojectcoverage.php b/app/cdash/tests/test_aggregatesubprojectcoverage.php index 02317aa4ae..4981dbb82b 100644 --- a/app/cdash/tests/test_aggregatesubprojectcoverage.php +++ b/app/cdash/tests/test_aggregatesubprojectcoverage.php @@ -23,7 +23,7 @@ public function __construct() { parent::__construct(); $this->deleteLog($this->logfilename); - $this->DataDir = dirname(__FILE__) . '/data/AggregateSubProjectCoverage'; + $this->DataDir = __DIR__ . '/data/AggregateSubProjectCoverage'; } public function testSubmitCoverage() diff --git a/app/cdash/tests/test_attachedfiles.php b/app/cdash/tests/test_attachedfiles.php index 49a04ba033..2b95f0f4a6 100644 --- a/app/cdash/tests/test_attachedfiles.php +++ b/app/cdash/tests/test_attachedfiles.php @@ -1,6 +1,6 @@ project->Fill(); // Submit our testing data. - $this->submission('AttachedFiles', dirname(__FILE__) . '/data/AttachedFileTest.xml'); + $this->submission('AttachedFiles', __DIR__ . '/data/AttachedFileTest.xml'); // Get the buildtest we created. $db = Database::getInstance(); diff --git a/app/cdash/tests/test_authtoken.php b/app/cdash/tests/test_authtoken.php index 1664f9e1ae..35d5153d4d 100644 --- a/app/cdash/tests/test_authtoken.php +++ b/app/cdash/tests/test_authtoken.php @@ -1,6 +1,6 @@ url}/submit.php?project=AuthTokenProject"; $result = $this->uploadfile($url, $file, $headers); if (!$result || !str_contains($result, 'OK')) { @@ -196,7 +196,7 @@ public function postSubmit($token) public function putSubmit($headers) { - $file = dirname(__FILE__) . '/data/gcov.tar'; + $file = __DIR__ . '/data/gcov.tar'; $puturl = $this->url . "/submit.php?type=GcovTar&md5=5454e16948a1d58d897e174b75cc5633&filename=gcov.tar&buildid={$this->PostBuildId}"; $put_result = $this->uploadfile($puturl, $file, $headers); if (!str_contains($put_result, '{"status":0}')) { diff --git a/app/cdash/tests/test_bazeljson.php b/app/cdash/tests/test_bazeljson.php index c0c8e99b07..59eed13f6d 100644 --- a/app/cdash/tests/test_bazeljson.php +++ b/app/cdash/tests/test_bazeljson.php @@ -1,6 +1,6 @@ submit_data('InsightExample', 'BazelJSON', '0a9b0aeeb73618cd10d6e1bee221fd71', - dirname(__FILE__) . '/data/Bazel/bazel_BEP.json'); + __DIR__ . '/data/Bazel/bazel_BEP.json'); if (!$buildid) { return false; } @@ -73,7 +73,7 @@ public function testBazelJSON() // Submit the same data again to verify that no testdiff is recorded. $buildid2 = $this->submit_data('InsightExample', 'BazelJSON', '0a9b0aeeb73618cd10d6e1bee221fd71', - dirname(__FILE__) . '/data/Bazel/bazel_BEP.json', + __DIR__ . '/data/Bazel/bazel_BEP.json', '20170824-1835-Experimental', '1503599755'); $this->assertTrue($buildid2 > 1); $testdiff_stmt = $this->PDO->prepare( @@ -105,7 +105,7 @@ public function testFilterBazelJSON() // Submit testing data. $buildid = $this->submit_data('Bazel', 'BazelJSON', '0a9b0aeeb73618cd10d6e1bee221fd71', - dirname(__FILE__) . '/data/Bazel/bazel_BEP.json'); + __DIR__ . '/data/Bazel/bazel_BEP.json'); if (!$buildid) { return false; } @@ -155,7 +155,7 @@ public function testBazelSubProjs() // Setup subprojects. $parentid = $this->submit_data('BazelSubProj', 'SubProjectDirectories', '9e909746b706562eb263262a1496f202', - dirname(__FILE__) . '/data/Bazel/subproj/subproj_list.txt'); + __DIR__ . '/data/Bazel/subproj/subproj_list.txt'); if (!$parentid) { return false; } @@ -163,14 +163,14 @@ public function testBazelSubProjs() // Submit build and test data. $parentid2 = $this->submit_data('BazelSubProj', 'BazelJSON', 'a860786f23529d62472ba363525cd2f3', - dirname(__FILE__) . '/data/Bazel/subproj/subproj_build.json'); + __DIR__ . '/data/Bazel/subproj/subproj_build.json'); if (!$parentid2 || $parentid !== $parentid2) { $this->fail("parentid mismatch $parentid vs $parentid2"); return false; } $parentid3 = $this->submit_data('BazelSubProj', 'BazelJSON', 'c261e5014fddb72b372b85449be3301e', - dirname(__FILE__) . '/data/Bazel/subproj/subproj_test.json'); + __DIR__ . '/data/Bazel/subproj/subproj_test.json'); if (!$parentid3 || $parentid !== $parentid3) { $this->fail("parentid mismatch $parentid vs $parentid3"); return false; @@ -251,7 +251,7 @@ public function testBazelTestFailed() // Submit testing data. $buildid = $this->submit_data('InsightExample', 'BazelJSON', 'abc62be615c3f2a469fe6b6ada556b75', - dirname(__FILE__) . '/data/Bazel/bazel_testFailed.json'); + __DIR__ . '/data/Bazel/bazel_testFailed.json'); if (!$buildid) { return false; } @@ -307,7 +307,7 @@ public function testBazelTimeout() // Submit testing data. $buildid = $this->submit_data('InsightExample', 'BazelJSON', '73817c7f786ff65ce14af7c34a6850ba', - dirname(__FILE__) . '/data/Bazel/bazel_timeout.json'); + __DIR__ . '/data/Bazel/bazel_timeout.json'); if (!$buildid) { return false; } @@ -363,7 +363,7 @@ public function testBazelConfigure() // Submit testing data. $buildid = $this->submit_data('InsightExample', 'BazelJSON', 'e2b864cc0c5308148aea0d143df6d2ba', - dirname(__FILE__) . '/data/Bazel/bazel_configure.json'); + __DIR__ . '/data/Bazel/bazel_configure.json'); if (!$buildid) { return false; } @@ -399,7 +399,7 @@ public function testBazelDuplicateTests() // Submit testing data. $buildid = $this->submit_data('InsightExample', 'BazelJSON', '4a42c09a1751848dc5b806c4bc701fd6', - dirname(__FILE__) . '/data/Bazel/automotive_test.json'); + __DIR__ . '/data/Bazel/automotive_test.json'); if (!$buildid) { return false; } @@ -435,7 +435,7 @@ public function testMultipleLineError() // Submit testing data. $buildid = $this->submit_data('InsightExample', 'BazelJSON', '131eabf91e183359d4b3e1ef24482741', - dirname(__FILE__) . '/data/Bazel/bazel_multiple_line_error.json'); + __DIR__ . '/data/Bazel/bazel_multiple_line_error.json'); if (!$buildid) { return false; } @@ -480,7 +480,7 @@ public function testShardTest() // Submit testing data. $buildid = $this->submit_data('InsightExample', 'BazelJSON', 'cb99fa74feaf55a6777f3087becbce04', - dirname(__FILE__) . '/data/Bazel/bazel_shard_test.json'); + __DIR__ . '/data/Bazel/bazel_shard_test.json'); if (!$buildid) { return false; } @@ -535,7 +535,7 @@ public function testShardTestFailures() // Submit testing data. $buildid = $this->submit_data('InsightExample', 'BazelJSON', '74df5d4af1b22097caf2304b301fe4d0', - dirname(__FILE__) . '/data/Bazel/bazel_shard_test_failures.json'); + __DIR__ . '/data/Bazel/bazel_shard_test_failures.json'); if (!$buildid) { return false; } @@ -630,7 +630,7 @@ public function testShardTestTimeout() // Submit testing data. $buildid = $this->submit_data('InsightExample', 'BazelJSON', 'aa689b38ea361e5ccdc6b59755fbec64', - dirname(__FILE__) . '/data/Bazel/bazel_shard_test_timeout.json'); + __DIR__ . '/data/Bazel/bazel_shard_test_timeout.json'); if (!$buildid) { return false; } diff --git a/app/cdash/tests/test_branchcoverage.php b/app/cdash/tests/test_branchcoverage.php index 9d80dc7065..1c0ed96850 100644 --- a/app/cdash/tests/test_branchcoverage.php +++ b/app/cdash/tests/test_branchcoverage.php @@ -4,7 +4,7 @@ // After including cdash_test_case.php, subsequent require_once calls are // relative to the top of the CDash source tree // -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; use App\Models\PendingSubmissions; use App\Utils\DatabaseCleanupUtils; @@ -99,7 +99,7 @@ protected function putSubmit($token = null) { // Do the PUT submission to actually upload our data. $puturl = $this->url . "/submit.php?type=GcovTar&md5=5454e16948a1d58d897e174b75cc5633&filename=gcov.tar&buildid={$this->buildid}"; - $filename = dirname(__FILE__) . '/data/gcov.tar'; + $filename = __DIR__ . '/data/gcov.tar'; $headers = []; if ($token) { $headers = ["Authorization: Bearer {$token}"]; diff --git a/app/cdash/tests/test_buildconfigure.php b/app/cdash/tests/test_buildconfigure.php index fee30c82b3..140d8149ea 100644 --- a/app/cdash/tests/test_buildconfigure.php +++ b/app/cdash/tests/test_buildconfigure.php @@ -4,7 +4,7 @@ // After including cdash_test_case.php, subsequent require_once calls are // relative to the top of the CDash source tree // -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; use App\Utils\DatabaseCleanupUtils; use CDash\Database; diff --git a/app/cdash/tests/test_builddetails.php b/app/cdash/tests/test_builddetails.php index 39bdc102ef..43188abf8c 100644 --- a/app/cdash/tests/test_builddetails.php +++ b/app/cdash/tests/test_builddetails.php @@ -7,7 +7,7 @@ use App\Utils\DatabaseCleanupUtils; use Illuminate\Support\Facades\DB; -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; class BuildDetailsTestCase extends KWWebTestCase { @@ -19,7 +19,7 @@ public function __construct() { parent::__construct(); - $this->testDataDir = dirname(__FILE__) . '/data/BuildDetails'; + $this->testDataDir = __DIR__ . '/data/BuildDetails'; $this->testDataFiles = ['Subbuild1.xml', 'Subbuild2.xml', 'Subbuild3.xml']; $this->createProject([ diff --git a/app/cdash/tests/test_buildfailuredetails.php b/app/cdash/tests/test_buildfailuredetails.php index a314257f3c..c1ead79ce0 100644 --- a/app/cdash/tests/test_buildfailuredetails.php +++ b/app/cdash/tests/test_buildfailuredetails.php @@ -7,7 +7,7 @@ use App\Utils\DatabaseCleanupUtils; use Illuminate\Support\Facades\DB; -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; class BuildFailureDetailsTestCase extends KWWebTestCase { @@ -24,7 +24,7 @@ public function testBuildFailureDetails() echo "1. testBuildFailureDetails\n"; // Submit our test data. - $rep = dirname(__FILE__) . '/data/BuildFailureDetails'; + $rep = __DIR__ . '/data/BuildFailureDetails'; if (!$this->submission('EmailProjectExample', "$rep/Build_1.xml")) { $this->fail('failed to submit Build_1.xml'); return 1; diff --git a/app/cdash/tests/test_buildgetdate.php b/app/cdash/tests/test_buildgetdate.php index b439f81de9..5d3a9dcd40 100644 --- a/app/cdash/tests/test_buildgetdate.php +++ b/app/cdash/tests/test_buildgetdate.php @@ -4,7 +4,7 @@ // After including cdash_test_case.php, subsequent require_once calls are // relative to the top of the CDash source tree // -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; use CDash\Model\Build; diff --git a/app/cdash/tests/test_buildgrouprule.php b/app/cdash/tests/test_buildgrouprule.php index b6518b1c1f..e6e6298a33 100644 --- a/app/cdash/tests/test_buildgrouprule.php +++ b/app/cdash/tests/test_buildgrouprule.php @@ -4,7 +4,7 @@ // After including cdash_test_case.php, subsequent require_once calls are // relative to the top of the CDash source tree // -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; use App\Utils\DatabaseCleanupUtils; use App\Utils\SubmissionUtils; diff --git a/app/cdash/tests/test_buildmodel.php b/app/cdash/tests/test_buildmodel.php index e7e889182d..db982609f1 100644 --- a/app/cdash/tests/test_buildmodel.php +++ b/app/cdash/tests/test_buildmodel.php @@ -4,7 +4,7 @@ // After including cdash_test_case.php, subsequent require_once calls are // relative to the top of the CDash source tree // -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; use App\Models\Project; use App\Utils\DatabaseCleanupUtils; @@ -26,7 +26,7 @@ public function __construct() $this->deleteLog($this->logfilename); - $this->testDataDir = dirname(__FILE__) . '/data/BuildModel'; + $this->testDataDir = __DIR__ . '/data/BuildModel'; $this->testDataFiles = ['build1.xml', 'build2.xml', 'build3.xml', 'build4.xml', 'build5.xml', 'configure1.xml']; diff --git a/app/cdash/tests/test_buildoverview.php b/app/cdash/tests/test_buildoverview.php index 98d166327b..565e3f05d2 100644 --- a/app/cdash/tests/test_buildoverview.php +++ b/app/cdash/tests/test_buildoverview.php @@ -4,7 +4,7 @@ // After including cdash_test_case.php, subsequent require_once calls are // relative to the top of the CDash source tree // -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; class BuildOverviewTestCase extends KWWebTestCase { diff --git a/app/cdash/tests/test_buildproperties.php b/app/cdash/tests/test_buildproperties.php index 9fd58c0970..8e17299e2f 100644 --- a/app/cdash/tests/test_buildproperties.php +++ b/app/cdash/tests/test_buildproperties.php @@ -1,6 +1,6 @@ url . "/submit.php?type=BuildPropertiesJSON&md5=$md5&filename=$filename&buildid=$build->Id"; - $filepath = dirname(__FILE__) . "/data/BuildProperties/$filename"; + $filepath = __DIR__ . "/data/BuildProperties/$filename"; if (!$this->uploadfile($puturl, $filepath)) { $this->fail("PUT submit failed for $buildname"); } diff --git a/app/cdash/tests/test_buildrelationship.php b/app/cdash/tests/test_buildrelationship.php index 749baae34c..9f98c67424 100644 --- a/app/cdash/tests/test_buildrelationship.php +++ b/app/cdash/tests/test_buildrelationship.php @@ -4,7 +4,7 @@ // After including cdash_test_case.php, subsequent require_once calls are // relative to the top of the CDash source tree // -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; use App\Utils\DatabaseCleanupUtils; use App\Utils\SubmissionUtils; diff --git a/app/cdash/tests/test_changeid.php b/app/cdash/tests/test_changeid.php index 0f3a40b754..12dfd993b4 100644 --- a/app/cdash/tests/test_changeid.php +++ b/app/cdash/tests/test_changeid.php @@ -1,6 +1,6 @@ submission($project->name, "$dir/UpdateBug_Build.xml"); $this->submission($project->name, "$dir/UpdateBug_Test.xml"); $this->submission($project->name, "$dir/Update.xml"); diff --git a/app/cdash/tests/test_commitauthornotification.php b/app/cdash/tests/test_commitauthornotification.php index 957351dc32..f884b57182 100644 --- a/app/cdash/tests/test_commitauthornotification.php +++ b/app/cdash/tests/test_commitauthornotification.php @@ -12,7 +12,7 @@ class CommitAuthorNotificationTestCase extends KWWebTestCase public function __construct() { parent::__construct(); - $this->dataDir = dirname(__FILE__) . "/data/{$this->projectName}"; + $this->dataDir = __DIR__ . "/data/{$this->projectName}"; $this->projectId = $this->createProject([ 'Name' => $this->projectName, 'Description' => "Project {$this->projectName} test for cdash testing", diff --git a/app/cdash/tests/test_committerinfo.php b/app/cdash/tests/test_committerinfo.php index f3b4a007af..cf4fa9aa93 100644 --- a/app/cdash/tests/test_committerinfo.php +++ b/app/cdash/tests/test_committerinfo.php @@ -4,7 +4,7 @@ // After including cdash_test_case.php, subsequent require_once calls are // relative to the top of the CDash source tree // -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; class CommitterInfoTestCase extends KWWebTestCase { @@ -15,7 +15,7 @@ public function __construct() public function testCommitterInfo(): void { - $file = dirname(__FILE__) . '/data/git-Update2.xml'; + $file = __DIR__ . '/data/git-Update2.xml'; if (!$this->submission('TestCompressionExample', $file)) { return; } diff --git a/app/cdash/tests/test_compressedtest.php b/app/cdash/tests/test_compressedtest.php index 431b784d26..7cbd0bdc1d 100644 --- a/app/cdash/tests/test_compressedtest.php +++ b/app/cdash/tests/test_compressedtest.php @@ -4,7 +4,7 @@ // After including cdash_test_case.php, subsequent require_once calls are // relative to the top of the CDash source tree // -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; class CompressedTestCase extends KWWebTestCase { @@ -27,14 +27,14 @@ public function testSubmissionCompressedTest(): void $this->createProject($settings); // Make sure we can submit to it. - $file = dirname(__FILE__) . '/data/CompressedTest.xml'; + $file = __DIR__ . '/data/CompressedTest.xml'; $this->submission('TestCompressionExample', $file); } public function testGITUpdate(): void { echo "4. testGITUpdate\n"; - $file = dirname(__FILE__) . '/data/git-Update.xml'; + $file = __DIR__ . '/data/git-Update.xml'; if (!$this->submission('TestCompressionExample', $file)) { return; } diff --git a/app/cdash/tests/test_configureappend.php b/app/cdash/tests/test_configureappend.php index e0d7d3e990..f709021ce6 100644 --- a/app/cdash/tests/test_configureappend.php +++ b/app/cdash/tests/test_configureappend.php @@ -1,6 +1,6 @@ project->Fill(); // Submit our testing data. - $test_dir = dirname(__FILE__) . '/data/ConfigureAppend/'; + $test_dir = __DIR__ . '/data/ConfigureAppend/'; $files = ['Configure_1.xml', 'Configure_2.xml']; foreach ($files as $file) { if (!$this->submission('ConfigureAppend', "{$test_dir}/{$file}")) { diff --git a/app/cdash/tests/test_configurewarnings.php b/app/cdash/tests/test_configurewarnings.php index 2bf2b4e1cb..b545635831 100644 --- a/app/cdash/tests/test_configurewarnings.php +++ b/app/cdash/tests/test_configurewarnings.php @@ -4,7 +4,7 @@ // After including cdash_test_case.php, subsequent require_once calls are // relative to the top of the CDash source tree // -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; use CDash\Database; use CDash\Model\BuildConfigure; @@ -59,7 +59,7 @@ public function testConfigureWarningDiff(): void } // Submit our testing data. - $dir = dirname(__FILE__) . '/data/ConfigureWarnings'; + $dir = __DIR__ . '/data/ConfigureWarnings'; $this->submission('ConfigureWarningProject', "$dir/1.xml"); $this->submission('ConfigureWarningProject', "$dir/2.xml"); diff --git a/app/cdash/tests/test_consistenttestingday.php b/app/cdash/tests/test_consistenttestingday.php index 05b6b99d2f..af28d9d985 100644 --- a/app/cdash/tests/test_consistenttestingday.php +++ b/app/cdash/tests/test_consistenttestingday.php @@ -1,6 +1,6 @@ project->Save(); // Submit our testing data. - $dir = dirname(__FILE__) . '/data/TestingDay'; + $dir = __DIR__ . '/data/TestingDay'; $this->submission('ConsistentTestingDay', "$dir/Test_1.xml"); $this->submission('ConsistentTestingDay', "$dir/Test_2.xml"); diff --git a/app/cdash/tests/test_coveragedirectories.php b/app/cdash/tests/test_coveragedirectories.php index a039d612ec..b0a76daf30 100644 --- a/app/cdash/tests/test_coveragedirectories.php +++ b/app/cdash/tests/test_coveragedirectories.php @@ -4,7 +4,7 @@ // After including cdash_test_case.php, subsequent require_once calls are // relative to the top of the CDash source tree // -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; use CDash\Model\Project; @@ -34,7 +34,7 @@ public function testCoverageDirectories(): void } $filesToSubmit = ['prefix-Coverage.xml', 'prefix-CoverageLog-0.xml', 'sort-Coverage.xml', 'sort-CoverageLog-0.xml', 'sort-CoverageLog-1.xml']; - $dir = dirname(__FILE__) . '/data/CoverageDirectories'; + $dir = __DIR__ . '/data/CoverageDirectories'; foreach ($filesToSubmit as $file) { if (!$this->submission('CoverageDirectories', "$dir/$file")) { $this->fail("Failed to submit $file"); diff --git a/app/cdash/tests/test_createprojectpermissions.php b/app/cdash/tests/test_createprojectpermissions.php index 725684c6a7..805f6556e6 100644 --- a/app/cdash/tests/test_createprojectpermissions.php +++ b/app/cdash/tests/test_createprojectpermissions.php @@ -7,7 +7,7 @@ use CDash\Database; use Illuminate\Support\Facades\DB; -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; class CreateProjectPermissionsTestCase extends KWWebTestCase { diff --git a/app/cdash/tests/test_createpublicdashboard.php b/app/cdash/tests/test_createpublicdashboard.php index 56679d394c..e01085f4d4 100644 --- a/app/cdash/tests/test_createpublicdashboard.php +++ b/app/cdash/tests/test_createpublicdashboard.php @@ -4,7 +4,7 @@ // After including cdash_test_case.php, subsequent require_once calls are // relative to the top of the CDash source tree // -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; class CreatePublicDashboardTestCase extends KWWebTestCase { diff --git a/app/cdash/tests/test_crosssubprojectcoverage.php b/app/cdash/tests/test_crosssubprojectcoverage.php index 6196ef413a..ff8ce1bf92 100644 --- a/app/cdash/tests/test_crosssubprojectcoverage.php +++ b/app/cdash/tests/test_crosssubprojectcoverage.php @@ -17,7 +17,7 @@ use Illuminate\Support\Facades\DB; -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; class CoverageAcrossSubProjectsTestCase extends KWWebTestCase { @@ -27,7 +27,7 @@ public function __construct() { parent::__construct(); $this->deleteLog($this->logfilename); - $this->DataDir = dirname(__FILE__) . '/data/CoverageAcrossSubProjects'; + $this->DataDir = __DIR__ . '/data/CoverageAcrossSubProjects'; } public function testCreateProjectTest(): void diff --git a/app/cdash/tests/test_csvexport.php b/app/cdash/tests/test_csvexport.php index edf6ae9719..4bb7540677 100644 --- a/app/cdash/tests/test_csvexport.php +++ b/app/cdash/tests/test_csvexport.php @@ -6,7 +6,7 @@ // After including cdash_test_case.php, subsequent require_once calls are // relative to the top of the CDash source tree // -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; class ExportToCSVTestCase extends KWWebTestCase { diff --git a/app/cdash/tests/test_deferredsubmissions.php b/app/cdash/tests/test_deferredsubmissions.php index db550fc810..02808dbdc3 100644 --- a/app/cdash/tests/test_deferredsubmissions.php +++ b/app/cdash/tests/test_deferredsubmissions.php @@ -4,7 +4,7 @@ // After including cdash_test_case.php, subsequent require_once calls are // relative to the top of the CDash source tree // -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; require_once 'tests/test_branchcoverage.php'; use App\Models\AuthToken; @@ -26,7 +26,7 @@ class DeferredSubmissionsTestCase extends BranchCoverageTestCase public function __construct() { parent::__construct(); - $this->ConfigFile = dirname(__FILE__) . '/../../../.env'; + $this->ConfigFile = __DIR__ . '/../../../.env'; $this->Original = file_get_contents($this->ConfigFile); // Make sure we start from scratch each time the test is run. @@ -43,7 +43,7 @@ public function __construct() $this->project->Fill(); $this->token = ''; - $this->dataDir = dirname(__FILE__) . '/data/DeferredSubmission'; + $this->dataDir = __DIR__ . '/data/DeferredSubmission'; } public function __destruct() diff --git a/app/cdash/tests/test_deletesubproject.php b/app/cdash/tests/test_deletesubproject.php index 086a816460..c757272445 100644 --- a/app/cdash/tests/test_deletesubproject.php +++ b/app/cdash/tests/test_deletesubproject.php @@ -4,7 +4,7 @@ // After including cdash_test_case.php, subsequent require_once calls are // relative to the top of the CDash source tree // -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; class DeleteSubProjectTestCase extends KWWebTestCase { @@ -19,7 +19,7 @@ public function testDeleteSubProject() $this->assertText('FEApp'); echo "submitting data/DeleteSubProject/Project.xml\n"; - $file = dirname(__FILE__) . '/data/DeleteSubProject/Project.xml'; + $file = __DIR__ . '/data/DeleteSubProject/Project.xml'; if (!$this->submission('Trilinos', $file)) { return false; diff --git a/app/cdash/tests/test_disabledtests.php b/app/cdash/tests/test_disabledtests.php index e439ef1f80..af7dc4a6e2 100644 --- a/app/cdash/tests/test_disabledtests.php +++ b/app/cdash/tests/test_disabledtests.php @@ -4,7 +4,7 @@ // After including cdash_test_case.php, subsequent require_once calls are // relative to the top of the CDash source tree // -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; use App\Utils\DatabaseCleanupUtils; use CDash\Database; @@ -21,7 +21,7 @@ public function testDisabledTests(): void $this->deleteLog($this->logfilename); // Submit testing data. - $rep = dirname(__FILE__) . '/data/DisabledTests'; + $rep = __DIR__ . '/data/DisabledTests'; $file = "$rep/Test.xml"; if (!$this->submission('EmailProjectExample', $file)) { return; diff --git a/app/cdash/tests/test_displayimage.php b/app/cdash/tests/test_displayimage.php index 4dadd39846..23f4e0a626 100644 --- a/app/cdash/tests/test_displayimage.php +++ b/app/cdash/tests/test_displayimage.php @@ -8,7 +8,7 @@ use CDash\Model\Project; use Illuminate\Support\Facades\DB; -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; class DisplayImageTestCase extends KWWebTestCase { @@ -20,7 +20,7 @@ public function __construct() public function testDisplayImage() { $image = new Image(); - $image->Filename = dirname(__FILE__) . '/data/smile.gif'; + $image->Filename = __DIR__ . '/data/smile.gif'; $image->Extension = 'image/gif'; $image->Checksum = 100; $image->Save(); diff --git a/app/cdash/tests/test_donehandler.php b/app/cdash/tests/test_donehandler.php index c55acfb160..18c01d3f9d 100644 --- a/app/cdash/tests/test_donehandler.php +++ b/app/cdash/tests/test_donehandler.php @@ -1,6 +1,6 @@ ConfigFile = dirname(__FILE__) . '/../../../.env'; + $this->ConfigFile = __DIR__ . '/../../../.env'; $this->Original = file_get_contents($this->ConfigFile); config(['cdash.remote_workers' => 'true']); diff --git a/app/cdash/tests/test_dynamicanalysisdefectlongtype.php b/app/cdash/tests/test_dynamicanalysisdefectlongtype.php index fef3b2e9a5..83e5fd6207 100644 --- a/app/cdash/tests/test_dynamicanalysisdefectlongtype.php +++ b/app/cdash/tests/test_dynamicanalysisdefectlongtype.php @@ -1,6 +1,6 @@ project->Fill(); // Submit our testing data. - $file = dirname(__FILE__) . '/data/DynamicAnalysisDefectLongType/DynamicAnalysis.xml'; + $file = __DIR__ . '/data/DynamicAnalysisDefectLongType/DynamicAnalysis.xml'; if (!$this->submission('DynamicAnalysisDefectLongType', $file)) { $this->fail("Failed to submit {$file}"); } diff --git a/app/cdash/tests/test_dynamicanalysislogs.php b/app/cdash/tests/test_dynamicanalysislogs.php index 92bcb88d4e..e312c8a7a6 100644 --- a/app/cdash/tests/test_dynamicanalysislogs.php +++ b/app/cdash/tests/test_dynamicanalysislogs.php @@ -1,6 +1,6 @@ project->Fill(); // Submit our testing data. - $test_dir = dirname(__FILE__) . '/data/DynamicAnalysisLogs/'; + $test_dir = __DIR__ . '/data/DynamicAnalysisLogs/'; $files = ['Build.xml', 'Configure.xml', 'Test.xml', 'DynamicAnalysis.xml']; foreach ($files as $file) { if (!$this->submission('DynamicAnalysisLogs', "{$test_dir}/{$file}")) { diff --git a/app/cdash/tests/test_dynamicanalysissummary.php b/app/cdash/tests/test_dynamicanalysissummary.php index abdb68ce46..22e1dfd7f4 100644 --- a/app/cdash/tests/test_dynamicanalysissummary.php +++ b/app/cdash/tests/test_dynamicanalysissummary.php @@ -18,7 +18,7 @@ use App\Utils\DatabaseCleanupUtils; use Illuminate\Support\Facades\DB; -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; class DynamicAnalysisSummaryTestCase extends KWWebTestCase { @@ -31,7 +31,7 @@ public function __construct() { parent::__construct(); $this->deleteLog($this->logfilename); - $this->DataDir = dirname(__FILE__) . '/data/DynamicAnalysisSummary'; + $this->DataDir = __DIR__ . '/data/DynamicAnalysisSummary'; $this->ParentId = 0; $this->StandaloneBuildId = 0; $this->ChildIds = []; @@ -41,7 +41,7 @@ public function testDynamicAnalysisSummary() { // Submit our testing file. This should have already been submitted // by an earlier test, but it doesn't hurt to send it up a second time. - $file = dirname(__FILE__) . '/data/InsightExperimentalExample/Insight_Experimental_DynamicAnalysis.xml'; + $file = __DIR__ . '/data/InsightExperimentalExample/Insight_Experimental_DynamicAnalysis.xml'; if (!$this->submission('InsightExample', $file)) { $this->fail("Failed to submit $file"); return 1; @@ -54,7 +54,7 @@ public function testSubProjectDynamicAnalysisSummary() { // Submit our testing files. for ($i = 1; $i < 4; $i++) { - $file = dirname(__FILE__) . "/data/SubProjectDynamicAnalysis/DynamicAnalysis_$i.xml"; + $file = __DIR__ . "/data/SubProjectDynamicAnalysis/DynamicAnalysis_$i.xml"; if (!$this->submission('CrossSubProjectExample', $file)) { $this->fail("Failed to submit $file"); return 1; diff --git a/app/cdash/tests/test_email.php b/app/cdash/tests/test_email.php index 38805f77dc..da25bb307b 100644 --- a/app/cdash/tests/test_email.php +++ b/app/cdash/tests/test_email.php @@ -5,7 +5,7 @@ use App\Models\User; use Illuminate\Support\Facades\DB; -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; class EmailTestCase extends KWWebTestCase { @@ -83,7 +83,7 @@ public function testRegisterNoEmailUser(): void public function testSubmissionFirstBuild(): void { $this->deleteLog($this->logfilename); - $rep = dirname(__FILE__) . '/data/EmailProjectExample'; + $rep = __DIR__ . '/data/EmailProjectExample'; $file = "$rep/1_build.xml"; if (!$this->submission('EmailProjectExample', $file)) { return; @@ -105,7 +105,7 @@ public function testSubmissionFirstBuild(): void public function testSubmissionEmailBuild(): void { $this->deleteLog($this->logfilename); - $rep = dirname(__FILE__) . '/data/EmailProjectExample'; + $rep = __DIR__ . '/data/EmailProjectExample'; $file = "$rep/2_build.xml"; if (!$this->submission('EmailProjectExample', $file)) { return; @@ -137,7 +137,7 @@ public function testSubmissionEmailBuild(): void public function testSubmissionEmailTest(): void { $this->deleteLog($this->logfilename); - $rep = dirname(__FILE__) . '/data/EmailProjectExample'; + $rep = __DIR__ . '/data/EmailProjectExample'; $file = "$rep/2_test.xml"; if (!$this->submission('EmailProjectExample', $file)) { @@ -164,7 +164,7 @@ public function testSubmissionEmailTest(): void public function testSubmissionEmailDynamicAnalysis(): void { $this->deleteLog($this->logfilename); - $rep = dirname(__FILE__) . '/data/EmailProjectExample'; + $rep = __DIR__ . '/data/EmailProjectExample'; $file = "$rep/2_dynamicanalysis.xml"; if (!$this->submission('EmailProjectExample', $file)) { @@ -215,7 +215,7 @@ public function testSubmissionEmailDynamicAnalysis(): void public function testEmailSentToGitCommitter(): void { - $rep = dirname(__FILE__) . '/data/EmailProjectExample'; + $rep = __DIR__ . '/data/EmailProjectExample'; $file = "$rep/3_update.xml"; if (!$this->submission('EmailProjectExample', $file)) { return; @@ -323,7 +323,7 @@ public function testUpdateErrorEmailSentToSiteMaintainer(): void DB::insert('INSERT INTO site2user (siteid, userid) VALUES (?, ?)', [$site->id, 1]); // Submit our testing data. - $rep = dirname(__FILE__) . '/data/EmailProjectExample'; + $rep = __DIR__ . '/data/EmailProjectExample'; $file = "$rep/update_error.xml"; if (!$this->submission('EmailProjectExample', $file)) { $this->fail('Failed to submit update_error.xml'); diff --git a/app/cdash/tests/test_enable_async.php b/app/cdash/tests/test_enable_async.php index eb5e355d56..3d5980626f 100644 --- a/app/cdash/tests/test_enable_async.php +++ b/app/cdash/tests/test_enable_async.php @@ -4,7 +4,7 @@ // After including cdash_test_case.php, subsequent require_once calls are // relative to the top of the CDash source tree // -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; class EnableAsynchronousTestCase extends KWWebTestCase { @@ -15,7 +15,7 @@ public function __construct() public function testEnableAsynchronous(): void { - $filename = dirname(__FILE__) . '/../../../.env'; + $filename = __DIR__ . '/../../../.env'; // Using .env, we no longer have to worry about being inside the closing PHP bracket. $injectedText = "// test config settings injected by file [' . __FILE__ . ']\nCDASH_ASYNCHRONOUS_SUBMISSION = true"; file_put_contents($filename, $injectedText, FILE_APPEND); diff --git a/app/cdash/tests/test_excludesubprojects.php b/app/cdash/tests/test_excludesubprojects.php index baaccbfb7e..d09bf3b6ff 100644 --- a/app/cdash/tests/test_excludesubprojects.php +++ b/app/cdash/tests/test_excludesubprojects.php @@ -4,7 +4,7 @@ // After including cdash_test_case.php, subsequent require_once calls are // relative to the top of the CDash source tree // -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; class ExcludeSubProjectsTestCase extends KWWebTestCase { diff --git a/app/cdash/tests/test_expectedandmissing.php b/app/cdash/tests/test_expectedandmissing.php index 475826a260..23f6fcdfd8 100644 --- a/app/cdash/tests/test_expectedandmissing.php +++ b/app/cdash/tests/test_expectedandmissing.php @@ -4,7 +4,7 @@ // After including cdash_test_case.php, subsequent require_once calls are // relative to the top of the CDash source tree // -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; use CDash\Database; use CDash\Model\Build; diff --git a/app/cdash/tests/test_expiredbuildrules.php b/app/cdash/tests/test_expiredbuildrules.php index c1d5f1dabc..702f95a0ea 100644 --- a/app/cdash/tests/test_expiredbuildrules.php +++ b/app/cdash/tests/test_expiredbuildrules.php @@ -1,6 +1,6 @@ submission('InsightExample', $file_to_submit)) { $this->fail("Failed to submit $file_to_submit"); return 1; diff --git a/app/cdash/tests/test_filterblocks.php b/app/cdash/tests/test_filterblocks.php index 738517e7fa..f65e05abed 100644 --- a/app/cdash/tests/test_filterblocks.php +++ b/app/cdash/tests/test_filterblocks.php @@ -1,6 +1,6 @@ Id = $projectid; // Submit our test data. - $rep = dirname(__FILE__) . '/data/BuildFailureDetails'; + $rep = __DIR__ . '/data/BuildFailureDetails'; if (!$this->submission('FilterErrors', "$rep/Build_1.xml")) { $this->fail('failed to submit Build_1.xml'); return 1; diff --git a/app/cdash/tests/test_filtertestlabels.php b/app/cdash/tests/test_filtertestlabels.php index e70b9b57fe..4ccde08115 100644 --- a/app/cdash/tests/test_filtertestlabels.php +++ b/app/cdash/tests/test_filtertestlabels.php @@ -4,7 +4,7 @@ // After including cdash_test_case.php, subsequent require_once calls are // relative to the top of the CDash source tree // -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; use App\Utils\DatabaseCleanupUtils; @@ -18,7 +18,7 @@ public function __construct() public function testFilterLabels() { // Submit our test data. - $rep = dirname(__FILE__) . '/data/FilterTestLabels'; + $rep = __DIR__ . '/data/FilterTestLabels'; if (!$this->submission('EmailProjectExample', "$rep/Build_1.xml")) { $this->fail('failed to submit Update_1.xml'); return 1; diff --git a/app/cdash/tests/test_hidecolumns.php b/app/cdash/tests/test_hidecolumns.php index 0acdd9d1c2..2f3bb7c982 100644 --- a/app/cdash/tests/test_hidecolumns.php +++ b/app/cdash/tests/test_hidecolumns.php @@ -7,7 +7,7 @@ use App\Utils\DatabaseCleanupUtils; use Illuminate\Support\Facades\DB; -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; class HideColumnsTestCase extends KWWebTestCase { @@ -42,7 +42,7 @@ public function testHideColumns() public function onlyColumn($method) { // Submit our testing file. - $rep = dirname(__FILE__) . '/data/HideColumns'; + $rep = __DIR__ . '/data/HideColumns'; if (!$this->submission('InsightExample', "$rep/$method.xml")) { return false; } diff --git a/app/cdash/tests/test_image.php b/app/cdash/tests/test_image.php index d83180250b..296d261a0b 100644 --- a/app/cdash/tests/test_image.php +++ b/app/cdash/tests/test_image.php @@ -4,7 +4,7 @@ // After including cdash_test_case.php, subsequent require_once calls are // relative to the top of the CDash source tree // -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; use CDash\Model\Image; @@ -19,7 +19,7 @@ public function testImage() { $image = new Image(); - $pathToImage = dirname(__FILE__) . '/data/smile.gif'; + $pathToImage = __DIR__ . '/data/smile.gif'; $image->Filename = $pathToImage; $image->Extension = 'image/gif'; // dummy checksum so we don't break the test on pgSQL diff --git a/app/cdash/tests/test_imagecomparison.php b/app/cdash/tests/test_imagecomparison.php index 5ca775c107..0300d9840d 100644 --- a/app/cdash/tests/test_imagecomparison.php +++ b/app/cdash/tests/test_imagecomparison.php @@ -4,7 +4,7 @@ // After including cdash_test_case.php, subsequent require_once calls are // relative to the top of the CDash source tree // -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; use App\Utils\DatabaseCleanupUtils; use CDash\Database; @@ -23,7 +23,7 @@ public function __construct() public function testImageComparison() { // Submit test data. - if (!$this->submission('InsightExample', dirname(__FILE__) . '/data/ImageComparisonTest.xml')) { + if (!$this->submission('InsightExample', __DIR__ . '/data/ImageComparisonTest.xml')) { $this->fail('Failed to submit test data'); return 1; } diff --git a/app/cdash/tests/test_indexfilters.php b/app/cdash/tests/test_indexfilters.php index bdb109603e..e630972bf5 100644 --- a/app/cdash/tests/test_indexfilters.php +++ b/app/cdash/tests/test_indexfilters.php @@ -4,7 +4,7 @@ // After including cdash_test_case.php, subsequent require_once calls are // relative to the top of the CDash source tree // -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; class IndexFiltersTestCase extends KWWebTestCase { diff --git a/app/cdash/tests/test_indexnextprevious.php b/app/cdash/tests/test_indexnextprevious.php index 9ae92abd53..60206d1c7a 100644 --- a/app/cdash/tests/test_indexnextprevious.php +++ b/app/cdash/tests/test_indexnextprevious.php @@ -1,6 +1,6 @@ submission('IssueCreationProject', $file)) { $this->fail("Failed to submit $file"); } @@ -103,7 +103,7 @@ public function testIssueCreation(): void ]); // Setup subprojects. - $file = dirname(__FILE__) . '/data/GithubPR/Project.xml'; + $file = __DIR__ . '/data/GithubPR/Project.xml'; if (!$this->submission('CDash', $file)) { $this->fail("Failed to submit $file"); } @@ -116,7 +116,7 @@ public function testIssueCreation(): void } // Submit subproject XML file. - $file = dirname(__FILE__) . '/data/GithubPR/Test.xml'; + $file = __DIR__ . '/data/GithubPR/Test.xml'; if (!$this->submission('CDash', $file)) { $this->fail("Failed to submit $file"); } diff --git a/app/cdash/tests/test_javajsoncoverage.php b/app/cdash/tests/test_javajsoncoverage.php index 4601354b99..82e2ccab9e 100644 --- a/app/cdash/tests/test_javajsoncoverage.php +++ b/app/cdash/tests/test_javajsoncoverage.php @@ -4,7 +4,7 @@ // After including cdash_test_case.php, subsequent require_once calls are // relative to the top of the CDash source tree // -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; class JavaJSONCoverageTestCase extends KWWebTestCase { @@ -44,7 +44,7 @@ public function testJavaJSONCoverage() // Do the PUT submission to actually upload our data. $puturl = $this->url . "/submit.php?type=JavaJSONTar&md5=67b5d3cee7b951ff2981c440b4a515ec&filename=JavaJSONTar_example.tar&buildid=$buildid"; - $filename = dirname(__FILE__) . '/data/JavaJSONTar_example.tar'; + $filename = __DIR__ . '/data/JavaJSONTar_example.tar'; $put_result = $this->uploadfile($puturl, $filename); if (!str_contains($put_result, '{"status":0}')) { diff --git a/app/cdash/tests/test_jscovercoverage.php b/app/cdash/tests/test_jscovercoverage.php index 2a96033477..579428d684 100644 --- a/app/cdash/tests/test_jscovercoverage.php +++ b/app/cdash/tests/test_jscovercoverage.php @@ -4,7 +4,7 @@ // After including cdash_test_case.php, subsequent require_once calls are // relative to the top of the CDash source tree // -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; class JSCoverCoverageTestCase extends KWWebTestCase { @@ -44,7 +44,7 @@ public function testJSCoverCoverage() // Do the PUT submission to actually upload our data. $puturl = $this->url . "/submit.php?type=JSCoverTar&md5=e99bdd400ab4643e4fbeef7ec649f04e&filename=JSCoverTest.tar&buildid=$buildid"; - $filename = dirname(__FILE__) . '/data/JSCoverTest.tar'; + $filename = __DIR__ . '/data/JSCoverTest.tar'; $put_result = $this->uploadfile($puturl, $filename); if (!str_contains($put_result, '{"status":0}')) { diff --git a/app/cdash/tests/test_junithandler.php b/app/cdash/tests/test_junithandler.php index a5ce45a8f0..2301feb5d3 100644 --- a/app/cdash/tests/test_junithandler.php +++ b/app/cdash/tests/test_junithandler.php @@ -1,6 +1,6 @@ Project->Id = $projectid; // Submit our test data. - $xml = dirname(__FILE__) . '/data/JUNit_example.xml'; + $xml = __DIR__ . '/data/JUNit_example.xml'; if (!$this->submission('JUnitHandlerProject', $xml)) { $this->fail('Failed to submit test data'); } diff --git a/app/cdash/tests/test_limitedbuilds.php b/app/cdash/tests/test_limitedbuilds.php index 28bc843f3c..af8eea1551 100644 --- a/app/cdash/tests/test_limitedbuilds.php +++ b/app/cdash/tests/test_limitedbuilds.php @@ -4,7 +4,7 @@ // After including cdash_test_case.php, subsequent require_once calls are // relative to the top of the CDash source tree // -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; use CDash\Database; use CDash\Model\Build; @@ -22,7 +22,7 @@ public function __construct() { parent::__construct(); - $this->testDataDir = dirname(__FILE__) . '/data/BuildModel'; + $this->testDataDir = __DIR__ . '/data/BuildModel'; $this->PDO = Database::getInstance(); $this->get_build_stmt = $this->PDO->prepare('SELECT id FROM build WHERE projectid = ?'); $this->Projects = []; diff --git a/app/cdash/tests/test_longbuildname.php b/app/cdash/tests/test_longbuildname.php index 892f71177a..9721a68a20 100644 --- a/app/cdash/tests/test_longbuildname.php +++ b/app/cdash/tests/test_longbuildname.php @@ -1,6 +1,6 @@ deleteLog($this->logfilename); // Submit our testing data. - $test_dir = dirname(__FILE__) . '/data/LongBuildName/'; + $test_dir = __DIR__ . '/data/LongBuildName/'; $filename = "{$test_dir}/Configure.xml"; if (!$this->submission('LongBuildName', $filename)) { $this->fail("Failed to submit {$filename}"); diff --git a/app/cdash/tests/test_lotsofsubprojects.php b/app/cdash/tests/test_lotsofsubprojects.php index 7a3bd108c0..f381dcefb1 100644 --- a/app/cdash/tests/test_lotsofsubprojects.php +++ b/app/cdash/tests/test_lotsofsubprojects.php @@ -1,6 +1,6 @@ " . PHP_EOL); fwrite($handle, " " . PHP_EOL); fwrite($handle, ' ' . PHP_EOL); } - fwrite($handle, file_get_contents(dirname(__FILE__) . '/data/LotsOfSubProjects/After.xml')); + fwrite($handle, file_get_contents(__DIR__ . '/data/LotsOfSubProjects/After.xml')); // Submit our testing data. if (!$this->submission('LotsOfSubProjects', $test_filename)) { diff --git a/app/cdash/tests/test_managemeasurements.php b/app/cdash/tests/test_managemeasurements.php index b15c4f35dc..67e8803ecf 100644 --- a/app/cdash/tests/test_managemeasurements.php +++ b/app/cdash/tests/test_managemeasurements.php @@ -5,7 +5,7 @@ // relative to the top of the CDash source tree // -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; use App\Models\Measurement; use App\Utils\DatabaseCleanupUtils; @@ -116,7 +116,7 @@ private function validate_subproject_test($test_name, $num_procs, $proc_time, $i public function testManageMeasurements() { // Submit a test file with a named measurement. - $testDataFile = dirname(__FILE__) . '/data/TestMeasurements/Test.xml'; + $testDataFile = __DIR__ . '/data/TestMeasurements/Test.xml'; if (!$this->submission('InsightExample', $testDataFile)) { $this->fail('Failed to submit Test.xml'); return false; @@ -131,12 +131,12 @@ public function testManageMeasurements() } // Submit subproject test data too. - $projectFile = dirname(__FILE__) . '/data/MultipleSubprojects/Project.xml'; + $projectFile = __DIR__ . '/data/MultipleSubprojects/Project.xml'; if (!$this->submission('SubProjectExample', $projectFile)) { $this->fail('Failed to submit Project.xml'); return false; } - $testDataFile = dirname(__FILE__) . '/data/TestMeasurements/Test_subproj.xml'; + $testDataFile = __DIR__ . '/data/TestMeasurements/Test_subproj.xml'; if (!$this->submission('SubProjectExample', $testDataFile)) { $this->fail('Failed to submit Test_subproj.xml'); return false; diff --git a/app/cdash/tests/test_misassignedconfigure.php b/app/cdash/tests/test_misassignedconfigure.php index 19a7217a12..628c9d5def 100644 --- a/app/cdash/tests/test_misassignedconfigure.php +++ b/app/cdash/tests/test_misassignedconfigure.php @@ -1,6 +1,6 @@ project->Fill(); $this->deleteLog($this->logfilename); - $data_dir = dirname(__FILE__) . '/data/MultipleSubprojects/'; + $data_dir = __DIR__ . '/data/MultipleSubprojects/'; // Submit some testing data. $this->submission($this->project->Name, "{$data_dir}/Configure_bad.xml"); diff --git a/app/cdash/tests/test_multicoverage.php b/app/cdash/tests/test_multicoverage.php index b8aab3f672..17a3d5f2be 100644 --- a/app/cdash/tests/test_multicoverage.php +++ b/app/cdash/tests/test_multicoverage.php @@ -4,7 +4,7 @@ // After including cdash_test_case.php, subsequent require_once calls are // relative to the top of the CDash source tree // -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; use App\Utils\DatabaseCleanupUtils; @@ -55,7 +55,7 @@ public function testTarFirst() public function submitXML() { $filesToSubmit = ['Coverage.xml', 'CoverageLog-0.xml']; - $dir = dirname(__FILE__) . '/data/MultiCoverage'; + $dir = __DIR__ . '/data/MultiCoverage'; foreach ($filesToSubmit as $file) { if (!$this->submission('TrilinosDriver', "$dir/$file")) { $this->fail("Failed to submit $file"); @@ -94,7 +94,7 @@ public function submitTar() // Do the PUT submission to actually upload our data. $puturl = $this->url . "/submit.php?type=GcovTar&md5=65f385dd8d360e78a35453144c0919ab&filename=gcov.tar&buildid=$this->BuildId"; - $filename = dirname(__FILE__) . '/data/MultiCoverage/gcov.tar'; + $filename = __DIR__ . '/data/MultiCoverage/gcov.tar'; $put_result = $this->uploadfile($puturl, $filename); if (!str_contains($put_result, '{"status":0}')) { diff --git a/app/cdash/tests/test_multiplelabelsfortests.php b/app/cdash/tests/test_multiplelabelsfortests.php index 3fc33c7b34..96546d2285 100644 --- a/app/cdash/tests/test_multiplelabelsfortests.php +++ b/app/cdash/tests/test_multiplelabelsfortests.php @@ -1,6 +1,6 @@ deleteLog($this->logfilename); // Submit our testing data. - $test_dir = dirname(__FILE__) . '/data/MultipleLabelsForTests/'; + $test_dir = __DIR__ . '/data/MultipleLabelsForTests/'; $filename = "{$test_dir}/Test.xml"; if (!$this->submission('MultipleLabelsForTests', $filename)) { $this->fail("Failed to submit {$filename}"); diff --git a/app/cdash/tests/test_multiplesubprojects.php b/app/cdash/tests/test_multiplesubprojects.php index da29aba00c..bcf6669feb 100644 --- a/app/cdash/tests/test_multiplesubprojects.php +++ b/app/cdash/tests/test_multiplesubprojects.php @@ -4,7 +4,7 @@ // After including cdash_test_case.php, subsequent require_once calls are // relative to the top of the CDash source tree // -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; use App\Utils\DatabaseCleanupUtils; use CDash\Database; @@ -24,7 +24,7 @@ class MultipleSubprojectsTestCase extends KWWebTestCase public function __construct() { parent::__construct(); - $this->dataDir = dirname(__FILE__) . '/data/MultipleSubprojects'; + $this->dataDir = __DIR__ . '/data/MultipleSubprojects'; } public function setUp(): void @@ -138,7 +138,7 @@ private function restoreState() $this->restoreEmailPreference(); // Remove extra subprojects - $rep = dirname(__FILE__) . '/data/SubProjectExample'; + $rep = __DIR__ . '/data/SubProjectExample'; $file = "$rep/Project_1.xml"; if (!$this->submission('SubProjectExample', $file)) { $this->fail('failed to submit Project_1.xml'); diff --git a/app/cdash/tests/test_namedmeasurements.php b/app/cdash/tests/test_namedmeasurements.php index 05fa7dc414..f44d11b420 100644 --- a/app/cdash/tests/test_namedmeasurements.php +++ b/app/cdash/tests/test_namedmeasurements.php @@ -1,6 +1,6 @@ project->Fill(); // Submit our testing data. - $test_dir = dirname(__FILE__) . '/data/NamedMeasurements/'; + $test_dir = __DIR__ . '/data/NamedMeasurements/'; $files = ['Test_1.xml', 'Test_2.xml']; foreach ($files as $file) { if (!$this->submission('NamedMeasurements', "{$test_dir}/{$file}")) { diff --git a/app/cdash/tests/test_nobackup.php b/app/cdash/tests/test_nobackup.php index 95e171b653..f572227d64 100644 --- a/app/cdash/tests/test_nobackup.php +++ b/app/cdash/tests/test_nobackup.php @@ -4,7 +4,7 @@ // After including cdash_test_case.php, subsequent require_once calls are // relative to the top of the CDash source tree // -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; use App\Utils\DatabaseCleanupUtils; use CDash\Database; @@ -17,7 +17,7 @@ class NoBackupTestCase extends KWWebTestCase public function __construct() { parent::__construct(); - $this->ConfigFile = dirname(__FILE__) . '/../../../.env'; + $this->ConfigFile = __DIR__ . '/../../../.env'; $this->Original = file_get_contents($this->ConfigFile); } @@ -32,7 +32,7 @@ public function testNoBackup() file_put_contents($this->ConfigFile, "BACKUP_TIMEFRAME=0\n", FILE_APPEND | LOCK_EX); // Submit XML file. - $xml = dirname(__FILE__) . '/data/nobackup/Build.xml'; + $xml = __DIR__ . '/data/nobackup/Build.xml'; if (!$this->submission('InsightExample', $xml)) { $this->fail('failed to submit Build.xml'); return 1; @@ -63,7 +63,7 @@ public function testNoBackup() return 1; } $puturl = $this->url . "/submit.php?type=GcovTar&md5=5454e16948a1d58d897e174b75cc5633&filename=gcov.tar&buildid=$buildid"; - $filename = dirname(__FILE__) . '/data/gcov.tar'; + $filename = __DIR__ . '/data/gcov.tar'; $put_result = $this->uploadfile($puturl, $filename); if (!str_contains($put_result, '{"status":0}')) { $this->fail( diff --git a/app/cdash/tests/test_notesapi.php b/app/cdash/tests/test_notesapi.php index 6cc8ca0292..e89d76370a 100644 --- a/app/cdash/tests/test_notesapi.php +++ b/app/cdash/tests/test_notesapi.php @@ -6,7 +6,7 @@ // use Illuminate\Support\Facades\DB; -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; class NotesAPICase extends KWWebTestCase { diff --git a/app/cdash/tests/test_notesparsererrormessages.php b/app/cdash/tests/test_notesparsererrormessages.php index 0993ed196a..ef543ac103 100644 --- a/app/cdash/tests/test_notesparsererrormessages.php +++ b/app/cdash/tests/test_notesparsererrormessages.php @@ -1,6 +1,6 @@ project->Fill(); $this->deleteLog($this->logfilename); - $test_dir = dirname(__FILE__) . '/data/NotesParserErrorMessages/'; + $test_dir = __DIR__ . '/data/NotesParserErrorMessages/'; $this->submission('NotesParserErrorMessages', "{$test_dir}/NoName.xml"); $expected = [ diff --git a/app/cdash/tests/test_numericupdate.php b/app/cdash/tests/test_numericupdate.php index 1bf217b22a..52f4667f92 100644 --- a/app/cdash/tests/test_numericupdate.php +++ b/app/cdash/tests/test_numericupdate.php @@ -1,6 +1,6 @@ submission($this->project->name, dirname(__FILE__) . '/data/UpdateNumeric.xml'); + $this->submission($this->project->name, __DIR__ . '/data/UpdateNumeric.xml'); // Check index.php, make sure it shows the expected revision. $this->get($this->url . '/api/v1/index.php?project=' . $this->project->name . '&date=2020-06-01'); diff --git a/app/cdash/tests/test_opencovercoverage.php b/app/cdash/tests/test_opencovercoverage.php index c2823ce790..9fecb58292 100644 --- a/app/cdash/tests/test_opencovercoverage.php +++ b/app/cdash/tests/test_opencovercoverage.php @@ -4,7 +4,7 @@ // After including cdash_test_case.php, subsequent require_once calls are // relative to the top of the CDash source tree // -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; use App\Utils\DatabaseCleanupUtils; @@ -54,7 +54,7 @@ public function testOpenCoverCoverage() // Do the PUT submission to actually upload our data. $puturl = $this->url . "/submit.php?type=OpenCoverTar&md5=c0eeaf6be9838eacc75e652d6c85f925&filename=OpenCoverTest.tar&buildid=$buildid"; - $filename = dirname(__FILE__) . '/data/OpenCoverTest.tar'; + $filename = __DIR__ . '/data/OpenCoverTest.tar'; $put_result = $this->uploadfile($puturl, $filename); if (!str_contains($put_result, '{"status":0}')) { $this->fail( @@ -105,7 +105,7 @@ public function testOpenCoverCoverageWithDataJson() // Do the PUT submission to actually upload our data. $puturl = $this->url . "/submit.php?type=OpenCoverTar&md5=21eb5dff198d703652f8a7c93a290140&filename=OpenCoverTestWithDataJson.tar&buildid=$buildid"; - $filename = dirname(__FILE__) . '/data/OpenCoverTestWithDataJson.tar'; + $filename = __DIR__ . '/data/OpenCoverTestWithDataJson.tar'; $put_result = $this->uploadfile($puturl, $filename); if (!str_contains($put_result, '{"status":0}')) { diff --git a/app/cdash/tests/test_outputcolor.php b/app/cdash/tests/test_outputcolor.php index ea33922e83..d277a6be15 100644 --- a/app/cdash/tests/test_outputcolor.php +++ b/app/cdash/tests/test_outputcolor.php @@ -4,7 +4,7 @@ // After including cdash_test_case.php, subsequent require_once calls are // relative to the top of the CDash source tree // -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; use CDash\Model\Project; use Illuminate\Support\Facades\DB; @@ -35,7 +35,7 @@ public function testOutputColor(): void } // Submit testing data. - $file = dirname(__FILE__) . '/data/OutputColor/Test.xml'; + $file = __DIR__ . '/data/OutputColor/Test.xml'; if (!$this->submission('OutputColor', $file)) { $this->fail("Failed to submit $file"); return; @@ -64,7 +64,7 @@ public function testOutputColor(): void } // Verify that color output works as expected for preformatted test measurements too. - $file = dirname(__FILE__) . '/data/OutputColor/Test_2.xml'; + $file = __DIR__ . '/data/OutputColor/Test_2.xml'; if (!$this->submission('OutputColor', $file)) { $this->fail("Failed to submit $file"); return; @@ -82,7 +82,7 @@ public function testOutputColor(): void $this->assertEqual($expected, $measurement['value']); // Submit build data for later check in viewBuildErrors. - $file = dirname(__FILE__) . '/data/OutputColor/Build.xml'; + $file = __DIR__ . '/data/OutputColor/Build.xml'; if (!$this->submission('OutputColor', $file)) { $this->fail("Failed to submit $file"); } diff --git a/app/cdash/tests/test_parallelsubmissions.php b/app/cdash/tests/test_parallelsubmissions.php index 1401659eff..e25bb1701a 100644 --- a/app/cdash/tests/test_parallelsubmissions.php +++ b/app/cdash/tests/test_parallelsubmissions.php @@ -5,7 +5,7 @@ // relative to the top of the CDash source tree // -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; require_once 'tests/trilinos_submission_test.php'; use App\Utils\DatabaseCleanupUtils; @@ -20,7 +20,7 @@ class ParallelSubmissionsTestCase extends TrilinosSubmissionTestCase public function __construct() { parent::__construct(); - $this->ConfigFile = dirname(__FILE__) . '/../../../.env'; + $this->ConfigFile = __DIR__ . '/../../../.env'; $this->Original = file_get_contents($this->ConfigFile); } @@ -64,7 +64,7 @@ public function testParallelSubmissions(): void $this->assertEqual(147, $num_jobs); // Start 4 queue workers. - chdir(dirname(__FILE__) . '/../../../'); + chdir(__DIR__ . '/../../../'); foreach (range(0, 3) as $i) { exec('php artisan queue:work --stop-when-empty > /dev/null 2>&1 &'); } diff --git a/app/cdash/tests/test_passwordcomplexity.php b/app/cdash/tests/test_passwordcomplexity.php index a8e4c6f5dc..1d89cd4af6 100644 --- a/app/cdash/tests/test_passwordcomplexity.php +++ b/app/cdash/tests/test_passwordcomplexity.php @@ -17,7 +17,7 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; class PasswordComplexityTestCase extends KWWebTestCase { diff --git a/app/cdash/tests/test_pdoexecutelogserrors.php b/app/cdash/tests/test_pdoexecutelogserrors.php index 189186d569..60e77ff197 100644 --- a/app/cdash/tests/test_pdoexecutelogserrors.php +++ b/app/cdash/tests/test_pdoexecutelogserrors.php @@ -4,7 +4,7 @@ // After including cdash_test_case.php, subsequent require_once calls are // relative to the top of the CDash source tree // -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; use CDash\Database; diff --git a/app/cdash/tests/test_projectindb.php b/app/cdash/tests/test_projectindb.php index a86928b0a9..d2302b66b5 100644 --- a/app/cdash/tests/test_projectindb.php +++ b/app/cdash/tests/test_projectindb.php @@ -4,7 +4,7 @@ // After including cdash_test_case.php, subsequent require_once calls are // relative to the top of the CDash source tree // -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; class ProjectInDbTestCase extends KWWebTestCase { diff --git a/app/cdash/tests/test_projectmodel.php b/app/cdash/tests/test_projectmodel.php index 10601154ce..fb40c4732b 100644 --- a/app/cdash/tests/test_projectmodel.php +++ b/app/cdash/tests/test_projectmodel.php @@ -4,7 +4,7 @@ // After including cdash_test_case.php, subsequent require_once calls are // relative to the top of the CDash source tree // -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; use CDash\Model\Project; diff --git a/app/cdash/tests/test_projectwebpage.php b/app/cdash/tests/test_projectwebpage.php index 89e54834bf..01c23eb171 100644 --- a/app/cdash/tests/test_projectwebpage.php +++ b/app/cdash/tests/test_projectwebpage.php @@ -5,7 +5,7 @@ // relative to the top of the CDash source tree // -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; class ProjectWebPageTestCase extends KWWebTestCase { @@ -29,63 +29,63 @@ public function testAccessToWebPageProjectTest(): void public function testSubmissionBatchmakeBuild(): void { - $rep = dirname(__FILE__) . '/data/BatchmakeNightlyExample'; + $rep = __DIR__ . '/data/BatchmakeNightlyExample'; $file = "$rep/BatchMake_Nightly_Build.xml"; $this->assertTrue($this->submission('BatchmakeExample', $file), "Submission of $file failed"); } public function testSubmissionBatchmakeConfigure(): void { - $rep = dirname(__FILE__) . '/data/BatchmakeNightlyExample'; + $rep = __DIR__ . '/data/BatchmakeNightlyExample'; $file = "$rep/BatchMake_Nightly_Configure.xml"; $this->assertTrue($this->submission('BatchmakeExample', $file), "Submission of $file failed"); } public function testSubmissionBatchmakeNotes(): void { - $rep = dirname(__FILE__) . '/data/BatchmakeNightlyExample'; + $rep = __DIR__ . '/data/BatchmakeNightlyExample'; $file = "$rep/BatchMake_Nightly_Notes.xml"; $this->assertTrue($this->submission('BatchmakeExample', $file), "Submission of $file failed"); } public function testSubmissionBatchmakeTest(): void { - $rep = dirname(__FILE__) . '/data/BatchmakeNightlyExample'; + $rep = __DIR__ . '/data/BatchmakeNightlyExample'; $file = "$rep/BatchMake_Nightly_Test.xml"; $this->assertTrue($this->submission('BatchmakeExample', $file), "Submission of $file failed"); } public function testSubmissionBatchmakeUpdate(): void { - $rep = dirname(__FILE__) . '/data/BatchmakeNightlyExample'; + $rep = __DIR__ . '/data/BatchmakeNightlyExample'; $file = "$rep/BatchMake_Nightly_Update.xml"; $this->assertTrue($this->submission('BatchmakeExample', $file), "Submission of $file failed"); } public function testSubmissionInsightBuild(): void { - $rep = dirname(__FILE__) . '/data/InsightExperimentalExample'; + $rep = __DIR__ . '/data/InsightExperimentalExample'; $file = "$rep/Insight_Experimental_Build.xml"; $this->assertTrue($this->submission('InsightExample', $file), "Submission of $file failed"); } public function testSubmissionInsightConfigure(): void { - $rep = dirname(__FILE__) . '/data/InsightExperimentalExample'; + $rep = __DIR__ . '/data/InsightExperimentalExample'; $file = "$rep/Insight_Experimental_Configure.xml"; $this->assertTrue($this->submission('InsightExample', $file), "Submission of $file failed"); } public function testSubmissionInsightCoverage(): void { - $rep = dirname(__FILE__) . '/data/InsightExperimentalExample'; + $rep = __DIR__ . '/data/InsightExperimentalExample'; $file = "$rep/Insight_Experimental_Coverage.xml"; $this->assertTrue($this->submission('InsightExample', $file), "Submission of $file failed"); } public function testSubmissionInsightCoverageLog(): void { - $rep = dirname(__FILE__) . '/data/InsightExperimentalExample'; + $rep = __DIR__ . '/data/InsightExperimentalExample'; $file = "$rep/Insight_Experimental_CoverageLog.xml"; if (!$this->submission('InsightExample', $file)) { return; @@ -111,7 +111,7 @@ public function testSubmissionInsightCoverageLog(): void public function testSubmissionInsightDynamicAnalysis(): void { - $rep = dirname(__FILE__) . '/data/InsightExperimentalExample'; + $rep = __DIR__ . '/data/InsightExperimentalExample'; $file = "$rep/Insight_Experimental_DynamicAnalysis.xml"; if (!$this->submission('InsightExample', $file)) { return; @@ -121,7 +121,7 @@ public function testSubmissionInsightDynamicAnalysis(): void public function testSubmissionInsightNotes(): void { - $rep = dirname(__FILE__) . '/data/InsightExperimentalExample'; + $rep = __DIR__ . '/data/InsightExperimentalExample'; $file = "$rep/Insight_Experimental_Notes.xml"; if (!$this->submission('InsightExample', $file)) { return; @@ -131,7 +131,7 @@ public function testSubmissionInsightNotes(): void public function testSubmissionInsightTest(): void { - $rep = dirname(__FILE__) . '/data/InsightExperimentalExample'; + $rep = __DIR__ . '/data/InsightExperimentalExample'; $file = "$rep/Insight_Experimental_Test.xml"; if (!$this->submission('InsightExample', $file)) { return; diff --git a/app/cdash/tests/test_projectxmlsequence.php b/app/cdash/tests/test_projectxmlsequence.php index c2c2d3867e..b981865095 100644 --- a/app/cdash/tests/test_projectxmlsequence.php +++ b/app/cdash/tests/test_projectxmlsequence.php @@ -4,7 +4,7 @@ // After including cdash_test_case.php, subsequent require_once calls are // relative to the top of the CDash source tree // -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; require_once 'tests/kwtest/kw_unlink.php'; @@ -17,7 +17,7 @@ public function __construct() public function submitFile($filename) { - $file = dirname(__FILE__) . "/data/ProjectXmlSequence/$filename"; + $file = __DIR__ . "/data/ProjectXmlSequence/$filename"; if (!$this->submission('SubProjectExample', $file)) { return false; diff --git a/app/cdash/tests/test_putdynamicbuilds.php b/app/cdash/tests/test_putdynamicbuilds.php index 544dbb2a95..9bf1f8d0c0 100644 --- a/app/cdash/tests/test_putdynamicbuilds.php +++ b/app/cdash/tests/test_putdynamicbuilds.php @@ -4,7 +4,7 @@ // After including cdash_test_case.php, subsequent require_once calls are // relative to the top of the CDash source tree // -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; use App\Models\Site; use CDash\Database; diff --git a/app/cdash/tests/test_querytests.php b/app/cdash/tests/test_querytests.php index a796518bc5..7e06edbaed 100644 --- a/app/cdash/tests/test_querytests.php +++ b/app/cdash/tests/test_querytests.php @@ -6,7 +6,7 @@ // use Illuminate\Support\Facades\DB; -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; class QueryTestsTestCase extends KWWebTestCase { diff --git a/app/cdash/tests/test_querytestsfilterlabels.php b/app/cdash/tests/test_querytestsfilterlabels.php index 3b701f8a7b..284d1706ec 100644 --- a/app/cdash/tests/test_querytestsfilterlabels.php +++ b/app/cdash/tests/test_querytestsfilterlabels.php @@ -1,6 +1,6 @@ project->Fill(); // Submit our testing data. - $dir = dirname(__FILE__) . '/data/QueryTestsFilterLabels'; + $dir = __DIR__ . '/data/QueryTestsFilterLabels'; $files = ['Test_1.xml', 'Test_2.xml']; foreach ($files as $file) { if (!$this->submission('QueryTestsFilterLabels', "{$dir}/{$file}")) { diff --git a/app/cdash/tests/test_querytestsrevisionfilter.php b/app/cdash/tests/test_querytestsrevisionfilter.php index b45af6a189..bc236f4e34 100644 --- a/app/cdash/tests/test_querytestsrevisionfilter.php +++ b/app/cdash/tests/test_querytestsrevisionfilter.php @@ -1,6 +1,6 @@ submission('RedundantTests', dirname(__FILE__) . '/data/RedundantTests/Test.xml')) { + if (!$this->submission('RedundantTests', __DIR__ . '/data/RedundantTests/Test.xml')) { $this->fail('Failed to submit'); } diff --git a/app/cdash/tests/test_removebuilds.php b/app/cdash/tests/test_removebuilds.php index 0a084ce132..06a6f887f7 100644 --- a/app/cdash/tests/test_removebuilds.php +++ b/app/cdash/tests/test_removebuilds.php @@ -4,7 +4,7 @@ // After including cdash_test_case.php, subsequent require_once calls are // relative to the top of the CDash source tree // -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; use App\Models\BuildUpdateFile; use App\Models\DynamicAnalysisDefect; @@ -305,7 +305,7 @@ public function testBuildRemovalWorksAsExpected(): void $image2 = new Image(); $image2->Extension = 'image/gif'; $image2->Name = 'smile.gif'; - $image2->Data = base64_encode(file_get_contents(dirname(__FILE__) . '/data/smile.gif')); + $image2->Data = base64_encode(file_get_contents(__DIR__ . '/data/smile.gif')); $test_creator2->images->push($image2); $test_creator2->labels->push($label); @@ -316,7 +316,7 @@ public function testBuildRemovalWorksAsExpected(): void $test_creator2->create($existing_build); // UploadFile - $filename = dirname(__FILE__) . '/data/smile.gif'; + $filename = __DIR__ . '/data/smile.gif'; $upload1 = new UploadFile(); $upload1->filename = $filename; $upload1->isurl = false; @@ -325,7 +325,7 @@ public function testBuildRemovalWorksAsExpected(): void $upload1->save(); $upload1->builds()->attach((int) $build->Id); - $filename = dirname(__FILE__) . '/data/smile2.gif'; + $filename = __DIR__ . '/data/smile2.gif'; $upload2 = new UploadFile(); $upload2->filename = $filename; $upload2->isurl = false; diff --git a/app/cdash/tests/test_replacebuild.php b/app/cdash/tests/test_replacebuild.php index 09a240ea7f..7fbcb23cf4 100644 --- a/app/cdash/tests/test_replacebuild.php +++ b/app/cdash/tests/test_replacebuild.php @@ -7,7 +7,7 @@ use App\Utils\DatabaseCleanupUtils; use Illuminate\Support\Facades\DB; -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; class ReplaceBuildTestCase extends KWWebTestCase { @@ -25,7 +25,7 @@ public function testReplaceBuild() $error_msg = ''; // Submit the first test file. - $rep = dirname(__FILE__) . '/data/ReplaceBuild'; + $rep = __DIR__ . '/data/ReplaceBuild'; if (!$this->submission('EmailProjectExample', "$rep/Build_1.xml")) { $this->fail('failed to submit Build_1.xml'); return 1; diff --git a/app/cdash/tests/test_revisionfilteracrossdates.php b/app/cdash/tests/test_revisionfilteracrossdates.php index 9482e7009b..943a138d38 100644 --- a/app/cdash/tests/test_revisionfilteracrossdates.php +++ b/app/cdash/tests/test_revisionfilteracrossdates.php @@ -4,7 +4,7 @@ // After including cdash_test_case.php, subsequent require_once calls are // relative to the top of the CDash source tree // -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; class RevisionFilterIgnoresDateTestCase extends KWWebTestCase { diff --git a/app/cdash/tests/test_seconds_from_interval.php b/app/cdash/tests/test_seconds_from_interval.php index 2465b1e47d..d267b125b2 100644 --- a/app/cdash/tests/test_seconds_from_interval.php +++ b/app/cdash/tests/test_seconds_from_interval.php @@ -4,7 +4,7 @@ // After including cdash_test_case.php, subsequent require_once calls are // relative to the top of the CDash source tree // -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; class SecondsFromIntervalTestCase extends KWWebTestCase { diff --git a/app/cdash/tests/test_sequenceindependence.php b/app/cdash/tests/test_sequenceindependence.php index c46e190fe7..e4fdc98528 100644 --- a/app/cdash/tests/test_sequenceindependence.php +++ b/app/cdash/tests/test_sequenceindependence.php @@ -6,7 +6,7 @@ // use Illuminate\Support\Facades\DB; -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; class SequenceIndependenceTestCase extends KWWebTestCase { @@ -190,7 +190,7 @@ public function SubmitFiles($file_order) } // Submit the files in the order specified. - $rep = dirname(__FILE__) . '/data/InsightExperimentalExample'; + $rep = __DIR__ . '/data/InsightExperimentalExample'; foreach ($file_order as $type) { $file = "$rep/Insight_Experimental_$type.xml"; if (!$this->submission('InsightExample', $file)) { diff --git a/app/cdash/tests/test_starttimefromnotes.php b/app/cdash/tests/test_starttimefromnotes.php index 5dbaad8283..5584b9de95 100644 --- a/app/cdash/tests/test_starttimefromnotes.php +++ b/app/cdash/tests/test_starttimefromnotes.php @@ -1,6 +1,6 @@ project->Fill(); // Submit our testing data. - $file = dirname(__FILE__) . '/data/StartTimeFromNotes/Notes.xml'; + $file = __DIR__ . '/data/StartTimeFromNotes/Notes.xml'; if (!$this->submission('StartTimeFromNotes', $file)) { $this->fail("Failed to submit {$file}"); } diff --git a/app/cdash/tests/test_starttimefromupload.php b/app/cdash/tests/test_starttimefromupload.php index 15574641ed..a6e3adb3df 100644 --- a/app/cdash/tests/test_starttimefromupload.php +++ b/app/cdash/tests/test_starttimefromupload.php @@ -1,6 +1,6 @@ project->Fill(); // Submit our testing data. - $file = dirname(__FILE__) . '/data/StartTimeFromUpload/Upload.xml'; + $file = __DIR__ . '/data/StartTimeFromUpload/Upload.xml'; if (!$this->submission('StartTimeFromUpload', $file)) { $this->fail("Failed to submit {$file}"); } diff --git a/app/cdash/tests/test_submission_assign_buildid.php b/app/cdash/tests/test_submission_assign_buildid.php index f3edd3556b..4b1b1d907c 100644 --- a/app/cdash/tests/test_submission_assign_buildid.php +++ b/app/cdash/tests/test_submission_assign_buildid.php @@ -1,6 +1,6 @@ submission_assign_buildid( $file_to_submit, 'InsightExample', 'assign_buildid', 'localhost', '20180918-0100-Nightly'); diff --git a/app/cdash/tests/test_submitsortingdata.php b/app/cdash/tests/test_submitsortingdata.php index 383e40c085..ba4e416152 100644 --- a/app/cdash/tests/test_submitsortingdata.php +++ b/app/cdash/tests/test_submitsortingdata.php @@ -4,7 +4,7 @@ // After including cdash_test_case.php, subsequent require_once calls are // relative to the top of the CDash source tree // -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; class SubmitSortingDataTestCase extends KWWebTestCase { @@ -15,7 +15,7 @@ public function __construct() public function submitFile($build, $type) { - $rep = dirname(__FILE__) . '/data/SortingExample'; + $rep = __DIR__ . '/data/SortingExample'; $file = "$rep/$build" . '_' . "$type.xml"; if (!$this->submission('InsightExample', $file)) { return false; diff --git a/app/cdash/tests/test_subproject.php b/app/cdash/tests/test_subproject.php index ffadd66344..224420baf9 100644 --- a/app/cdash/tests/test_subproject.php +++ b/app/cdash/tests/test_subproject.php @@ -36,7 +36,7 @@ public function testAccessToWebPageProjectTest(): void public function testSubmissionProjectDependencies(): void { $this->deleteLog($this->logfilename); - $rep = dirname(__FILE__) . '/data/SubProjectExample'; + $rep = __DIR__ . '/data/SubProjectExample'; $file = "$rep/Project_1.xml"; if (!$this->submission('SubProjectExample', $file)) { return; @@ -50,7 +50,7 @@ public function testSubmissionProjectDependencies(): void public function testSubmissionSubProjectBuild(): void { $this->deleteLog($this->logfilename); - $rep = dirname(__FILE__) . '/data/SubProjectExample'; + $rep = __DIR__ . '/data/SubProjectExample'; $file = "$rep/Build_1.xml"; if (!$this->submission('SubProjectExample', $file)) { return; @@ -92,7 +92,7 @@ public function testSubmissionSubProjectBuild(): void public function testSubmissionSubProjectTest(): void { $this->deleteLog($this->logfilename); - $rep = dirname(__FILE__) . '/data/SubProjectExample'; + $rep = __DIR__ . '/data/SubProjectExample'; $file = "$rep/Test_1.xml"; if (!$this->submission('SubProjectExample', $file)) { return; diff --git a/app/cdash/tests/test_subprojectnextprevious.php b/app/cdash/tests/test_subprojectnextprevious.php index c3bc9ebe6d..baa5d15a12 100644 --- a/app/cdash/tests/test_subprojectnextprevious.php +++ b/app/cdash/tests/test_subprojectnextprevious.php @@ -7,7 +7,7 @@ use App\Utils\DatabaseCleanupUtils; use Illuminate\Support\Facades\DB; -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; class SubProjectNextPreviousTestCase extends KWWebTestCase { @@ -31,7 +31,7 @@ public function testSubProjectNextPrevious() ['Build_1.xml', 'Configure_1.xml', 'Notes_1.xml', 'Test_1.xml', 'Build_3.xml', 'Build_2.xml', 'Configure_2.xml', 'Notes_2.xml', 'Test_2.xml']; - $dir = dirname(__FILE__) . '/data/SubProjectNextPrevious'; + $dir = __DIR__ . '/data/SubProjectNextPrevious'; foreach ($filesToSubmit as $file) { if (!$this->submission('Trilinos', "$dir/$file")) { $this->fail("Failed to submit $file"); diff --git a/app/cdash/tests/test_subprojectorder.php b/app/cdash/tests/test_subprojectorder.php index bad92c99ed..ebd166b9da 100644 --- a/app/cdash/tests/test_subprojectorder.php +++ b/app/cdash/tests/test_subprojectorder.php @@ -1,6 +1,6 @@ project->Fill(); // Submit our testing data. - $test_data = dirname(__FILE__) . '/data/MultipleSubprojects/Build.xml'; + $test_data = __DIR__ . '/data/MultipleSubprojects/Build.xml'; if (!$this->submission('SubProjectOrder', $test_data)) { $this->fail('failed to submit Build.xml'); } diff --git a/app/cdash/tests/test_subprojecttestfilters.php b/app/cdash/tests/test_subprojecttestfilters.php index 00e5208471..4e38d7f689 100644 --- a/app/cdash/tests/test_subprojecttestfilters.php +++ b/app/cdash/tests/test_subprojecttestfilters.php @@ -1,6 +1,6 @@ submission('SummaryEmailProject', $file); } diff --git a/app/cdash/tests/test_testgraphpermissions.php b/app/cdash/tests/test_testgraphpermissions.php index a439b5bf6b..6613d7f10e 100644 --- a/app/cdash/tests/test_testgraphpermissions.php +++ b/app/cdash/tests/test_testgraphpermissions.php @@ -6,7 +6,7 @@ // After including cdash_test_case.php, subsequent require_once calls are // relative to the top of the CDash source tree // -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; class TestGraphPermissionsTestCase extends KWWebTestCase { diff --git a/app/cdash/tests/test_testhistory.php b/app/cdash/tests/test_testhistory.php index 92327d903d..0284865810 100644 --- a/app/cdash/tests/test_testhistory.php +++ b/app/cdash/tests/test_testhistory.php @@ -4,7 +4,7 @@ // After including cdash_test_case.php, subsequent require_once calls are // relative to the top of the CDash source tree // -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; use CDash\Model\Project; use Illuminate\Support\Facades\DB; diff --git a/app/cdash/tests/test_testimages.php b/app/cdash/tests/test_testimages.php index 1567b21c95..26b7de4c78 100644 --- a/app/cdash/tests/test_testimages.php +++ b/app/cdash/tests/test_testimages.php @@ -1,6 +1,6 @@ project->Fill(); // Submit our testing data. - $test_dir = dirname(__FILE__) . '/data/TestImages/'; + $test_dir = __DIR__ . '/data/TestImages/'; for ($i = 1; $i < 3; $i++) { if (!$this->submission('TestImages', "{$test_dir}/Test_{$i}.xml")) { $this->fail("Failed to submit Test_{$i}.xml"); diff --git a/app/cdash/tests/test_testoverview.php b/app/cdash/tests/test_testoverview.php index 11be17c345..4c64458173 100644 --- a/app/cdash/tests/test_testoverview.php +++ b/app/cdash/tests/test_testoverview.php @@ -4,7 +4,7 @@ // After including cdash_test_case.php, subsequent require_once calls are // relative to the top of the CDash source tree // -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; use CDash\Database; diff --git a/app/cdash/tests/test_timeline.php b/app/cdash/tests/test_timeline.php index fc8f8c485e..f223342d2a 100644 --- a/app/cdash/tests/test_timeline.php +++ b/app/cdash/tests/test_timeline.php @@ -4,7 +4,7 @@ // After including cdash_test_case.php, subsequent require_once calls are // relative to the top of the CDash source tree // -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; use CDash\Database; use CDash\Model\Build; diff --git a/app/cdash/tests/test_timeoutsandmissingtests.php b/app/cdash/tests/test_timeoutsandmissingtests.php index e737a5e386..dabc1696f9 100644 --- a/app/cdash/tests/test_timeoutsandmissingtests.php +++ b/app/cdash/tests/test_timeoutsandmissingtests.php @@ -2,7 +2,7 @@ use Illuminate\Support\Facades\DB; -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; class TimeoutsAndMissingTestsTestCase extends KWWebTestCase { @@ -31,7 +31,7 @@ private function getLastBuildId() public function testMissingTestsSummarizedInEmail(): void { $this->deleteLog($this->logfilename); - $rep = dirname(__FILE__) . '/data/TimeoutsAndMissingTests'; + $rep = __DIR__ . '/data/TimeoutsAndMissingTests'; $file = "{$rep}/5_test.xml"; if (!$this->submission('EmailProjectExample', $file)) { @@ -96,7 +96,7 @@ public function testMissingTestsSummarizedInViewTestAPI(): void public function testTimeoutFailuresDifferentiatedInEmail(): void { $this->deleteLog($this->logfilename); - $rep = dirname(__FILE__) . '/data/TimeoutsAndMissingTests'; + $rep = __DIR__ . '/data/TimeoutsAndMissingTests'; $file = "{$rep}/4_test.xml"; if (!$this->submission('EmailProjectExample', $file)) { diff --git a/app/cdash/tests/test_timestatus.php b/app/cdash/tests/test_timestatus.php index 2280e3b592..81707acb21 100644 --- a/app/cdash/tests/test_timestatus.php +++ b/app/cdash/tests/test_timestatus.php @@ -4,7 +4,7 @@ // After including cdash_test_case.php, subsequent require_once calls are // relative to the top of the CDash source tree // -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; use CDash\Database; use CDash\Model\Project; diff --git a/app/cdash/tests/test_timesummary.php b/app/cdash/tests/test_timesummary.php index f5fcf48fb1..76f74c5219 100644 --- a/app/cdash/tests/test_timesummary.php +++ b/app/cdash/tests/test_timesummary.php @@ -4,7 +4,7 @@ // After including cdash_test_case.php, subsequent require_once calls are // relative to the top of the CDash source tree // -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; class TimeSummaryTestCase extends KWWebTestCase { diff --git a/app/cdash/tests/test_truncateoutput.php b/app/cdash/tests/test_truncateoutput.php index 95f0c64a14..321b51d8bc 100644 --- a/app/cdash/tests/test_truncateoutput.php +++ b/app/cdash/tests/test_truncateoutput.php @@ -7,7 +7,7 @@ use App\Utils\DatabaseCleanupUtils; use Illuminate\Support\Facades\DB; -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; class TruncateOutputTestCase extends KWWebTestCase { @@ -19,7 +19,7 @@ class TruncateOutputTestCase extends KWWebTestCase public function __construct() { parent::__construct(); - $this->ConfigFile = dirname(__FILE__) . '/../../../.env'; + $this->ConfigFile = __DIR__ . '/../../../.env'; $this->Original = file_get_contents($this->ConfigFile); $this->Expected = "The beginning survives\n...\nCDash truncated output because it exceeded 44 characters.\n...\nThis part is preserved\n"; @@ -53,7 +53,7 @@ public function testTruncateOutput(): void // Set a limit that will cause our test output to be truncated. file_put_contents($this->ConfigFile, "LARGE_TEXT_LIMIT=44\n", FILE_APPEND | LOCK_EX); - $rep = dirname(__FILE__) . '/data/TruncateOutput'; + $rep = __DIR__ . '/data/TruncateOutput'; foreach (['Build_stdout.xml', 'Build_stderr.xml', 'Build_both.xml'] as $file) { // Submit our testing data. if (!$this->submission('InsightExample', "$rep/$file")) { diff --git a/app/cdash/tests/test_uniquediffs.php b/app/cdash/tests/test_uniquediffs.php index 1f1460524b..9a00d02efb 100644 --- a/app/cdash/tests/test_uniquediffs.php +++ b/app/cdash/tests/test_uniquediffs.php @@ -8,7 +8,7 @@ use CDash\Model\Build; use Illuminate\Support\Facades\DB; -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; class UniqueDiffsTestCase extends KWWebTestCase { diff --git a/app/cdash/tests/test_unparsedsubmissionshonorbuildid.php b/app/cdash/tests/test_unparsedsubmissionshonorbuildid.php index 93e4125e3e..91d44addc6 100644 --- a/app/cdash/tests/test_unparsedsubmissionshonorbuildid.php +++ b/app/cdash/tests/test_unparsedsubmissionshonorbuildid.php @@ -4,7 +4,7 @@ // After including cdash_test_case.php, subsequent require_once calls are // relative to the top of the CDash source tree // -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; require_once 'tests/test_branchcoverage.php'; use App\Utils\DatabaseCleanupUtils; diff --git a/app/cdash/tests/test_updateappend.php b/app/cdash/tests/test_updateappend.php index 8140e1b9f0..f86c454eb2 100644 --- a/app/cdash/tests/test_updateappend.php +++ b/app/cdash/tests/test_updateappend.php @@ -4,7 +4,7 @@ // After including cdash_test_case.php, subsequent require_once calls are // relative to the top of the CDash source tree // -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; use App\Utils\DatabaseCleanupUtils; @@ -23,7 +23,7 @@ public function testUpdateAppend() echo "1. testUpdateAppend\n"; // Submit our test data. - $rep = dirname(__FILE__) . '/data/UpdateAppend'; + $rep = __DIR__ . '/data/UpdateAppend'; if (!$this->submission('EmailProjectExample', "$rep/Update_1.xml")) { $this->fail('failed to submit Update_1.xml'); return 1; diff --git a/app/cdash/tests/test_uploadfile.php b/app/cdash/tests/test_uploadfile.php index 7ed2d54648..4cb69d238e 100644 --- a/app/cdash/tests/test_uploadfile.php +++ b/app/cdash/tests/test_uploadfile.php @@ -4,7 +4,7 @@ // After including cdash_test_case.php, subsequent require_once calls are // relative to the top of the CDash source tree // -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; use App\Utils\SubmissionUtils; use Illuminate\Support\Facades\Storage; @@ -24,7 +24,7 @@ public function __construct() public function testSubmitUploadXML(): void { $this->deleteLog($this->logfilename); - $rep = dirname(__FILE__) . '/data/EmailProjectExample'; + $rep = __DIR__ . '/data/EmailProjectExample'; $file = "$rep/1_upload.xml"; if (!$this->submission('EmailProjectExample', $file)) { $this->fail('Failed to submit Upload.xml'); diff --git a/app/cdash/tests/test_usernotes.php b/app/cdash/tests/test_usernotes.php index 54b5fd2085..a4ed4b13a4 100644 --- a/app/cdash/tests/test_usernotes.php +++ b/app/cdash/tests/test_usernotes.php @@ -4,7 +4,7 @@ // After including cdash_test_case.php, subsequent require_once calls are // relative to the top of the CDash source tree // -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; use CDash\Model\Project; use Illuminate\Support\Facades\DB; diff --git a/app/cdash/tests/test_viewconfigure.php b/app/cdash/tests/test_viewconfigure.php index 647f1ef863..52ccaef16d 100644 --- a/app/cdash/tests/test_viewconfigure.php +++ b/app/cdash/tests/test_viewconfigure.php @@ -4,7 +4,7 @@ // After including cdash_test_case.php, subsequent require_once calls are // relative to the top of the CDash source tree // -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; class ViewConfigureTestCase extends KWWebTestCase { diff --git a/app/cdash/tests/test_viewdynamicanalysis.php b/app/cdash/tests/test_viewdynamicanalysis.php index 52d36e52cf..b942681dfb 100644 --- a/app/cdash/tests/test_viewdynamicanalysis.php +++ b/app/cdash/tests/test_viewdynamicanalysis.php @@ -4,7 +4,7 @@ // After including cdash_test_case.php, subsequent require_once calls are // relative to the top of the CDash source tree // -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; class ViewDynamicAnalysisTestCase extends KWWebTestCase { diff --git a/app/cdash/tests/test_viewdynamicanalysisfile.php b/app/cdash/tests/test_viewdynamicanalysisfile.php index 23eec22490..54d0232a7b 100644 --- a/app/cdash/tests/test_viewdynamicanalysisfile.php +++ b/app/cdash/tests/test_viewdynamicanalysisfile.php @@ -4,7 +4,7 @@ // After including cdash_test_case.php, subsequent require_once calls are // relative to the top of the CDash source tree // -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; use App\Utils\DatabaseCleanupUtils; use CDash\Database; @@ -50,7 +50,7 @@ public function testNextPrevious(): void // Submit testing data. $filenames = ['previous', 'next']; - $rep = dirname(__FILE__) . '/data/InsightExperimentalExample'; + $rep = __DIR__ . '/data/InsightExperimentalExample'; foreach ($filenames as $filename) { $file = "$rep/$filename-DA.xml"; if (!$this->submission('InsightExample', $file)) { diff --git a/app/cdash/tests/test_viewsubprojects.php b/app/cdash/tests/test_viewsubprojects.php index 6e6ac177dd..8f8e1335d4 100644 --- a/app/cdash/tests/test_viewsubprojects.php +++ b/app/cdash/tests/test_viewsubprojects.php @@ -4,7 +4,7 @@ // After including cdash_test_case.php, subsequent require_once calls are // relative to the top of the CDash source tree // -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; class ViewSubProjectsTestCase extends KWWebTestCase { diff --git a/app/cdash/tests/trilinos_submission_test.php b/app/cdash/tests/trilinos_submission_test.php index d4c2926cae..40add9ba6b 100644 --- a/app/cdash/tests/trilinos_submission_test.php +++ b/app/cdash/tests/trilinos_submission_test.php @@ -4,7 +4,7 @@ // After including cdash_test_case.php, subsequent require_once calls are // relative to the top of the CDash source tree // -require_once dirname(__FILE__) . '/cdash_test_case.php'; +require_once __DIR__ . '/cdash_test_case.php'; class TrilinosSubmissionTestCase extends KWWebTestCase { @@ -15,7 +15,7 @@ public function __construct() public function submitFiles($test, $trilinosOnly = false) { - $dir = str_replace('\\', '/', dirname(__FILE__) . "/data/$test"); + $dir = str_replace('\\', '/', __DIR__ . "/data/$test"); $listfilename = $dir . '/orderedFileList.txt'; From 97f3807ab0a8c8704c2d17a579efcdc308b1c435 Mon Sep 17 00:00:00 2001 From: William Allen <16820599+williamjallen@users.noreply.github.com> Date: Thu, 18 Dec 2025 09:24:09 -0500 Subject: [PATCH 06/31] Enable `ereg_to_preg` rule --- .php-cs-fixer.dist.php | 1 + 1 file changed, 1 insertion(+) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 4b349c2c75..3db4b139e9 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -35,4 +35,5 @@ 'array_push' => true, 'combine_nested_dirname' => true, 'dir_constant' => true, + 'ereg_to_preg' => true, ])->setFinder($finder); From a2aa90adcd1df3779ece2fce4716966295313247 Mon Sep 17 00:00:00 2001 From: William Allen <16820599+williamjallen@users.noreply.github.com> Date: Thu, 18 Dec 2025 09:25:23 -0500 Subject: [PATCH 07/31] Enable `fopen_flag_order` rule --- .php-cs-fixer.dist.php | 1 + 1 file changed, 1 insertion(+) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 3db4b139e9..9763cccfd6 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -36,4 +36,5 @@ 'combine_nested_dirname' => true, 'dir_constant' => true, 'ereg_to_preg' => true, + 'fopen_flag_order' => true, ])->setFinder($finder); From e7e7fbac2ec0834dd697765c30885abbd6a4fd8b Mon Sep 17 00:00:00 2001 From: William Allen <16820599+williamjallen@users.noreply.github.com> Date: Thu, 18 Dec 2025 09:28:23 -0500 Subject: [PATCH 08/31] Enable `function_to_constant` rule --- .php-cs-fixer.dist.php | 1 + 1 file changed, 1 insertion(+) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 9763cccfd6..914d95646c 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -37,4 +37,5 @@ 'dir_constant' => true, 'ereg_to_preg' => true, 'fopen_flag_order' => true, + 'function_to_constant' => true, ])->setFinder($finder); From 7181860a5f0bfc339826367e41e6069d2176c0bc Mon Sep 17 00:00:00 2001 From: William Allen <16820599+williamjallen@users.noreply.github.com> Date: Thu, 18 Dec 2025 09:29:34 -0500 Subject: [PATCH 09/31] Enable `get_class_to_class_keyword` rule --- .php-cs-fixer.dist.php | 1 + 1 file changed, 1 insertion(+) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 914d95646c..18c425c373 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -38,4 +38,5 @@ 'ereg_to_preg' => true, 'fopen_flag_order' => true, 'function_to_constant' => true, + 'get_class_to_class_keyword' => true, ])->setFinder($finder); From 30dbb3a9e694947d65b52826c8fc907b763bc64a Mon Sep 17 00:00:00 2001 From: William Allen <16820599+williamjallen@users.noreply.github.com> Date: Thu, 18 Dec 2025 09:30:55 -0500 Subject: [PATCH 10/31] Enable `implode_call` rule --- .php-cs-fixer.dist.php | 1 + 1 file changed, 1 insertion(+) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 18c425c373..41a30a3b45 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -39,4 +39,5 @@ 'fopen_flag_order' => true, 'function_to_constant' => true, 'get_class_to_class_keyword' => true, + 'implode_call' => true, ])->setFinder($finder); From 14586e7080060db5825e921c06a8c79e44d72fdd Mon Sep 17 00:00:00 2001 From: William Allen <16820599+williamjallen@users.noreply.github.com> Date: Thu, 18 Dec 2025 09:31:30 -0500 Subject: [PATCH 11/31] Enable `is_null` rule --- .php-cs-fixer.dist.php | 1 + 1 file changed, 1 insertion(+) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 41a30a3b45..144fd858d1 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -40,4 +40,5 @@ 'function_to_constant' => true, 'get_class_to_class_keyword' => true, 'implode_call' => true, + 'is_null' => true, ])->setFinder($finder); From 5c4bcb047c7fa4ceb102296d5d11500a95044ba1 Mon Sep 17 00:00:00 2001 From: William Allen <16820599+williamjallen@users.noreply.github.com> Date: Thu, 18 Dec 2025 09:32:49 -0500 Subject: [PATCH 12/31] Apply `is_null` rule --- app/Console/Commands/RemoveUser.php | 2 +- app/Console/Commands/SaveUser.php | 4 ++-- app/Http/Controllers/Auth/RegisterController.php | 2 +- app/Http/Controllers/BuildController.php | 2 +- app/Http/Controllers/BuildPropertiesController.php | 4 ++-- app/Http/Controllers/CDash.php | 2 +- app/Http/Controllers/CoverageController.php | 2 +- app/Http/Controllers/ProjectOverviewController.php | 4 ++-- app/Http/Controllers/ViewTestController.php | 4 ++-- app/Http/Submission/Handlers/BazelJSONHandler.php | 10 +++++----- app/Http/Submission/Handlers/CoverageHandler.php | 4 ++-- .../Submission/Handlers/CoverageLogHandler.php | 4 ++-- app/Http/Submission/Handlers/GcovTarHandler.php | 8 ++++---- app/Http/Submission/Handlers/JSCoverTarHandler.php | 2 +- .../Submission/Handlers/JavaJSONTarHandler.php | 4 ++-- app/Models/Test.php | 4 ++-- app/Utils/RepositoryUtils.php | 4 ++-- app/Utils/UnparsedSubmissionProcessor.php | 2 +- app/cdash/app/Controller/Api/Index.php | 4 ++-- app/cdash/app/Controller/Api/ResultsApi.php | 2 +- app/cdash/app/Controller/Api/Timeline.php | 6 +++--- app/cdash/app/Lib/Repository/GitHub.php | 14 +++++++------- app/cdash/app/Model/Build.php | 2 +- app/cdash/app/Model/Subscriber.php | 2 +- app/cdash/include/Collection/Collection.php | 4 ++-- .../Messaging/Subscription/Subscription.php | 6 +++--- .../Subscription/UserSubscriptionBuilder.php | 2 +- .../Messaging/Topic/DynamicAnalysisTopic.php | 2 +- .../Messaging/Topic/GroupMembershipTopic.php | 2 +- app/cdash/include/Messaging/Topic/Topic.php | 2 +- app/cdash/include/common.php | 4 ++-- app/cdash/tests/kwtest/kw_web_tester.php | 4 ++-- app/cdash/tests/test_indexfilters.php | 2 +- app/cdash/tests/test_managemeasurements.php | 4 ++-- app/cdash/tests/test_timeline.php | 4 ++-- app/cdash/tests/test_viewsubprojects.php | 2 +- app/cdash/tests/trilinos_submission_test.php | 2 +- 37 files changed, 69 insertions(+), 69 deletions(-) diff --git a/app/Console/Commands/RemoveUser.php b/app/Console/Commands/RemoveUser.php index b8ef8d3f79..168dadb7f4 100644 --- a/app/Console/Commands/RemoveUser.php +++ b/app/Console/Commands/RemoveUser.php @@ -37,7 +37,7 @@ public function __construct() public function handle(): void { $email = $this->option('email'); - if (is_null($email)) { + if (null === $email) { $this->error('You must specify the --email option'); return; } diff --git a/app/Console/Commands/SaveUser.php b/app/Console/Commands/SaveUser.php index 0520f3c736..dd03bf4030 100644 --- a/app/Console/Commands/SaveUser.php +++ b/app/Console/Commands/SaveUser.php @@ -37,7 +37,7 @@ public function __construct() public function handle(): void { $email = $this->option('email'); - if (is_null($email)) { + if (null === $email) { $this->error('You must specify the --email option'); return; } @@ -57,7 +57,7 @@ public function handle(): void $options = ['firstname', 'lastname', 'institution', 'password']; foreach ($options as $option_name) { $option_value = $this->option($option_name); - if (!is_null($option_value)) { + if (null !== $option_value) { if ($option_name === 'password') { $option_value = password_hash($option_value, PASSWORD_DEFAULT); } diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index 524c27c18a..0c8edd3620 100755 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -89,7 +89,7 @@ protected function validator(array $data) */ public function create(array $data): ?User { - if (is_null($data['institution'])) { + if (null === $data['institution']) { $data['institution'] = ''; } return User::create([ diff --git a/app/Http/Controllers/BuildController.php b/app/Http/Controllers/BuildController.php index cbaaf3366c..646c2955d2 100644 --- a/app/Http/Controllers/BuildController.php +++ b/app/Http/Controllers/BuildController.php @@ -1372,7 +1372,7 @@ private function restApiGet(): JsonResponse $gmtdate = strtotime($last_good_submit . ' UTC'); } else { // Find the oldest submission for this build. - if (is_null($first_submit)) { + if (null === $first_submit) { pdo_execute($oldest_build_stmt, $query_params); $first_submit = $oldest_build_stmt->fetchColumn(); } diff --git a/app/Http/Controllers/BuildPropertiesController.php b/app/Http/Controllers/BuildPropertiesController.php index 47db6d24e9..a0a869e833 100644 --- a/app/Http/Controllers/BuildPropertiesController.php +++ b/app/Http/Controllers/BuildPropertiesController.php @@ -54,7 +54,7 @@ public function apiBuildProperties(): JsonResponse // Default to the current date. $date = date(FMT_DATE); } - if (is_null($beginning_timestamp)) { + if (null === $beginning_timestamp) { [$unused, $beginning_timestamp] = get_dates($date, $this->project->NightlyTime); $datetime = new DateTime(); $datetime->setTimestamp($beginning_timestamp); @@ -256,7 +256,7 @@ private function get_defects_for_builds() $stmt = $pdo->prepare($sql); $stmt->execute($_GET['buildid']); - if (!$this->gather_defects($stmt, $prettyname, $defects_response) && !is_null($sql2)) { + if (!$this->gather_defects($stmt, $prettyname, $defects_response) && null !== $sql2) { $stmt = $pdo->prepare($sql2); $stmt->execute($_GET['buildid']); $this->gather_defects($stmt, $prettyname, $defects_response); diff --git a/app/Http/Controllers/CDash.php b/app/Http/Controllers/CDash.php index 1790693c58..14e8296318 100755 --- a/app/Http/Controllers/CDash.php +++ b/app/Http/Controllers/CDash.php @@ -102,7 +102,7 @@ protected function getRequestContents() // Possible values of $redirect are null, 0, 1 and a ResponseRedirect. // Clearly we want to ignore when null or int, otherwise $redirect should // be returned - return is_numeric($redirect) || is_null($redirect) ? $content : $redirect; + return is_numeric($redirect) || null === $redirect ? $content : $redirect; } /** diff --git a/app/Http/Controllers/CoverageController.php b/app/Http/Controllers/CoverageController.php index 293e9cfd4b..13c9a52dc2 100644 --- a/app/Http/Controllers/CoverageController.php +++ b/app/Http/Controllers/CoverageController.php @@ -1528,7 +1528,7 @@ private static function apiCompareCoverage_get_coverage(array $build_data, array $coverage_response['loctested'] = (int) $build_array['loctested']; // Compute the diff - if (!is_null($build_array['loctesteddiff']) || !is_null($build_array['locuntesteddiff'])) { + if (null !== $build_array['loctesteddiff'] || null !== $build_array['locuntesteddiff']) { $loctesteddiff = (int) $build_array['loctesteddiff']; $locuntesteddiff = (int) $build_array['locuntesteddiff']; $previouspercent = diff --git a/app/Http/Controllers/ProjectOverviewController.php b/app/Http/Controllers/ProjectOverviewController.php index 7bf23366af..27982d1b89 100644 --- a/app/Http/Controllers/ProjectOverviewController.php +++ b/app/Http/Controllers/ProjectOverviewController.php @@ -334,7 +334,7 @@ public function apiOverview(): JsonResponse } $subproject_group_id = $child_build_row->subprojectgroupid; - if (is_null($subproject_group_id)) { + if (null === $subproject_group_id) { continue; } @@ -773,7 +773,7 @@ public function apiManageOverview(): JsonResponse // Check if we are saving an overview layout. if (Request::isMethod('post') && request()->has('saveLayout')) { $inputRows = json_decode(request()->input('saveLayout'), true); - if (!is_null($inputRows)) { + if (null !== $inputRows) { // Remove any old overview layout from this project. DB::delete('DELETE FROM overview_components WHERE projectid=?', [intval($this->project->Id)]); diff --git a/app/Http/Controllers/ViewTestController.php b/app/Http/Controllers/ViewTestController.php index aa432f063d..1a95113f40 100644 --- a/app/Http/Controllers/ViewTestController.php +++ b/app/Http/Controllers/ViewTestController.php @@ -72,7 +72,7 @@ public function fetchPageContent(): JsonResponse|StreamedResponse private static function get_request_build($required = true): ?Build { $id = self::get_request_build_id($required); - if (is_null($id)) { + if (null === $id) { return null; } $build = new Build(); @@ -103,7 +103,7 @@ private static function get_request_build_id($required = true): ?int private static function get_int_param($name, $required = true): ?int { $value = get_param($name, $required); - if (is_null($value)) { + if (null === $value) { return null; } diff --git a/app/Http/Submission/Handlers/BazelJSONHandler.php b/app/Http/Submission/Handlers/BazelJSONHandler.php index 8b48631761..896888b7ec 100644 --- a/app/Http/Submission/Handlers/BazelJSONHandler.php +++ b/app/Http/Submission/Handlers/BazelJSONHandler.php @@ -196,7 +196,7 @@ public function Parse($filename) public function ParseLine($line) { $json_array = json_decode($line, true); - if (is_null($json_array)) { + if (null === $json_array) { Log::error('json_decode error: ' . json_last_error_msg(), [ 'function' => 'BazelJSONHandler::ParseLine', ]); @@ -432,7 +432,7 @@ public function ParseLine($line) if ($record_error) { // Record any existing build error before creating // a new one. - if (!is_null($build_error)) { + if (null !== $build_error) { $this->RecordError($build_error, $type, $subproject_name); $subproject_name = ''; $build_error = null; @@ -492,7 +492,7 @@ public function ParseLine($line) } $this->InitializeSubProjectBuild($subproject_name); } - } elseif (!is_null($build_error)) { + } elseif (null !== $build_error) { // Record lines following the error/warning // as post context. $build_error->PostContext .= "$line\n"; @@ -501,7 +501,7 @@ public function ParseLine($line) $log_line_number++; } - if (!is_null($build_error)) { + if (null !== $build_error) { $this->RecordError($build_error, $type, $subproject_name); $build_error = null; } @@ -536,7 +536,7 @@ public function ParseLine($line) break; } $child_build = $this->InitializeSubProjectBuild($subproject_name); - if (!is_null($child_build)) { + if (null !== $child_build) { $child_build->InsertErrors = false; SubmissionUtils::add_build($child_build); $buildid = $child_build->Id; diff --git a/app/Http/Submission/Handlers/CoverageHandler.php b/app/Http/Submission/Handlers/CoverageHandler.php index 77bcf73eeb..ba175ea00d 100644 --- a/app/Http/Submission/Handlers/CoverageHandler.php +++ b/app/Http/Submission/Handlers/CoverageHandler.php @@ -144,11 +144,11 @@ public function endElement($parser, $name): void // Make sure this file gets associated with the correct SubProject. $subproject = SubProject::GetSubProjectFromPath( $coverageFile->FullPath, $this->GetProject()->Id); - if (!is_null($subproject)) { + if (null !== $subproject) { // Find the sibling build that performed this SubProject. $subprojectBuild = Build::GetSubProjectBuild( $this->Build->GetParentId(), $subproject->GetId()); - if (is_null($subprojectBuild)) { + if (null === $subprojectBuild) { // Build doesn't exist yet, add it here. $subprojectBuild = new Build(); $subprojectBuild->Name = $this->Build->Name; diff --git a/app/Http/Submission/Handlers/CoverageLogHandler.php b/app/Http/Submission/Handlers/CoverageLogHandler.php index 2d2d88b151..94e61f9f7c 100644 --- a/app/Http/Submission/Handlers/CoverageLogHandler.php +++ b/app/Http/Submission/Handlers/CoverageLogHandler.php @@ -112,10 +112,10 @@ public function endElement($parser, $name): void // subproject based on its path. $subproject = SubProject::GetSubProjectFromPath( $coverageFile->FullPath, intval($this->GetProject()->Id)); - if (!is_null($subproject)) { + if (null !== $subproject) { $subprojectBuild = Build::GetSubProjectBuild( $this->Build->GetParentId(), $subproject->GetId()); - if (is_null($subprojectBuild)) { + if (null === $subprojectBuild) { // This SubProject build doesn't exist yet, add it here. $subprojectBuild = new Build(); $subprojectBuild->ProjectId = $this->GetProject()->Id; diff --git a/app/Http/Submission/Handlers/GcovTarHandler.php b/app/Http/Submission/Handlers/GcovTarHandler.php index baecf44938..4d82e8fb30 100644 --- a/app/Http/Submission/Handlers/GcovTarHandler.php +++ b/app/Http/Submission/Handlers/GcovTarHandler.php @@ -72,7 +72,7 @@ public function Parse(string $filename): bool if ($fileinfo->getFilename() === 'data.json') { $jsonContents = file_get_contents($fileinfo->getPath() . DIRECTORY_SEPARATOR . $fileinfo->getFilename()); $jsonDecoded = json_decode($jsonContents, true); - if (is_null($jsonDecoded) || !array_key_exists('Source', $jsonDecoded) + if (null === $jsonDecoded || !array_key_exists('Source', $jsonDecoded) || !array_key_exists('Binary', $jsonDecoded) ) { DeleteDirectory($dirName); @@ -197,7 +197,7 @@ public function ParseGcovFile($fileinfo): void ) { // Find the SubProject that corresponds to this path. $subproject = SubProject::GetSubProjectFromPath($path, $this->GetProject()->Id); - if (is_null($subproject)) { + if (null === $subproject) { // Error already logged. return; } @@ -205,7 +205,7 @@ public function ParseGcovFile($fileinfo): void // Find the sibling build that performed this SubProject. $siblingBuild = Build::GetSubProjectBuild($this->Build->GetParentId(), $subprojectid); - if (is_null($siblingBuild)) { + if (null === $siblingBuild) { // Build doesn't exist yet, add it here. $siblingBuild = new Build(); $siblingBuild->Name = $this->Build->Name; @@ -397,7 +397,7 @@ public function ParseLabelsFile($fileinfo): void // read the file & decode the JSON. $jsonContents = file_get_contents($fileinfo->getPath() . DIRECTORY_SEPARATOR . $fileinfo->getFilename()); $jsonDecoded = json_decode($jsonContents, true); - if (is_null($jsonDecoded) || !array_key_exists('sources', $jsonDecoded)) { + if (null === $jsonDecoded || !array_key_exists('sources', $jsonDecoded)) { return; } diff --git a/app/Http/Submission/Handlers/JSCoverTarHandler.php b/app/Http/Submission/Handlers/JSCoverTarHandler.php index 19bf2c9ac5..12a43689e9 100644 --- a/app/Http/Submission/Handlers/JSCoverTarHandler.php +++ b/app/Http/Submission/Handlers/JSCoverTarHandler.php @@ -125,7 +125,7 @@ public function ParseJSCoverFile($fileinfo): void $jsonDecoded = json_decode($jsonContents, true); foreach ($jsonDecoded as $path => $coverageEntry) { // Make sure it has the fields we expect. - if (is_null($coverageEntry) + if (null === $coverageEntry || !array_key_exists('source', $coverageEntry) || !array_key_exists('coverage', $coverageEntry) ) { diff --git a/app/Http/Submission/Handlers/JavaJSONTarHandler.php b/app/Http/Submission/Handlers/JavaJSONTarHandler.php index 17b073d505..76d2700fdd 100644 --- a/app/Http/Submission/Handlers/JavaJSONTarHandler.php +++ b/app/Http/Submission/Handlers/JavaJSONTarHandler.php @@ -101,7 +101,7 @@ public function ParsePackageMap($fileinfo): void { $jsonContents = file_get_contents($fileinfo->getPath() . DIRECTORY_SEPARATOR . $fileinfo->getFilename()); $jsonDecoded = json_decode($jsonContents, true); - if (is_null($jsonDecoded)) { + if (null === $jsonDecoded) { return; } @@ -149,7 +149,7 @@ public function ParseJavaJSONFile($fileinfo): void $jsonDecoded = json_decode($jsonContents, true); // Make sure it has the fields we expect. - if (is_null($jsonDecoded) + if (null === $jsonDecoded || !array_key_exists('file', $jsonDecoded) || !array_key_exists('package', $jsonDecoded) || !array_key_exists('lines', $jsonDecoded) diff --git a/app/Models/Test.php b/app/Models/Test.php index c4af6e3a84..6b58201a6a 100644 --- a/app/Models/Test.php +++ b/app/Models/Test.php @@ -134,7 +134,7 @@ public function testImages(): HasMany **/ public function addLabel(Label $label): void { - if (is_null($this->labels)) { + if (null === $this->labels) { $this->labels = collect(); } $this->labels->put($label->Text, $label); @@ -147,7 +147,7 @@ public function addLabel(Label $label): void **/ public function getLabels(): Collection { - if (is_null($this->labels)) { + if (null === $this->labels) { $this->labels = collect(); foreach ($this->labels()->get() as $eloquent_label) { $label = new Label(); diff --git a/app/Utils/RepositoryUtils.php b/app/Utils/RepositoryUtils.php index d0058e5cf1..e5780fd4c6 100644 --- a/app/Utils/RepositoryUtils.php +++ b/app/Utils/RepositoryUtils.php @@ -25,7 +25,7 @@ public static function get_source_dir($projectid, $projecturl, $file_path) $project = $service->get(Project::class); $project->Id = $projectid; $project->Fill(); - if (is_null($project->CvsViewerType)) { + if (null === $project->CvsViewerType) { return; } $cvsviewertype = strtolower($project->CvsViewerType); @@ -242,7 +242,7 @@ public static function post_github_pull_request_comment(Project $project, $pull_ } } - if (is_null($repo) || !isset($repo['username']) + if (null === $repo || !isset($repo['username']) || !isset($repo['password'])) { Log::warning("Missing repository info for project #$project->Id"); return; diff --git a/app/Utils/UnparsedSubmissionProcessor.php b/app/Utils/UnparsedSubmissionProcessor.php index 344b21967e..c3f9c3c221 100644 --- a/app/Utils/UnparsedSubmissionProcessor.php +++ b/app/Utils/UnparsedSubmissionProcessor.php @@ -276,7 +276,7 @@ public function putSubmitFile(): JsonResponse 'name' => new ProjectNameRule(), ]); - if (is_null($projectname) || $validator->fails()) { + if (null === $projectname || $validator->fails()) { Log::info("Could not find build metadata file for {$this->buildid}"); abort(Response::HTTP_NOT_FOUND, 'Build not found'); } diff --git a/app/cdash/app/Controller/Api/Index.php b/app/cdash/app/Controller/Api/Index.php index af5eeee495..e65e7d08ca 100644 --- a/app/cdash/app/Controller/Api/Index.php +++ b/app/cdash/app/Controller/Api/Index.php @@ -691,7 +691,7 @@ public function generateBuildResponseFromRow(array $build_array): array|false $this->siteResponse['buildname'] = $build_array['name']; $this->siteResponse['buildplatform'] = $buildplatform; $this->siteResponse['generator'] = $build_array['generator']; - if (!is_null($changelink)) { + if (null !== $changelink) { $this->siteResponse['changelink'] = $changelink; $this->siteResponse['changeicon'] = $changeicon; } @@ -703,7 +703,7 @@ public function generateBuildResponseFromRow(array $build_array): array|false $build_response['buildname'] = $build_array['name']; $build_response['buildplatform'] = $buildplatform; $build_response['uploadfilecount'] = $build_array['builduploadfiles']; - if (!is_null($changelink)) { + if (null !== $changelink) { $build_response['changelink'] = $changelink; $build_response['changeicon'] = $changeicon; } diff --git a/app/cdash/app/Controller/Api/ResultsApi.php b/app/cdash/app/Controller/Api/ResultsApi.php index 005db78354..4bc943fb04 100644 --- a/app/cdash/app/Controller/Api/ResultsApi.php +++ b/app/cdash/app/Controller/Api/ResultsApi.php @@ -97,7 +97,7 @@ public function setDate($date): void $this->project->Fill(); [$previousdate, $beginning_timestamp, $nextdate, $d] = get_dates($date, $this->project->NightlyTime); - if (is_null($date)) { + if (null === $date) { $date = $d; } $this->date = $date; diff --git a/app/cdash/app/Controller/Api/Timeline.php b/app/cdash/app/Controller/Api/Timeline.php index 2e22af2303..6cf9e15d91 100644 --- a/app/cdash/app/Controller/Api/Timeline.php +++ b/app/cdash/app/Controller/Api/Timeline.php @@ -308,10 +308,10 @@ private function getTimelineChartData($builds): array $this->initializeDate($start_of_day_ms, $test_date); // Keep track of oldest and newest date. - if (is_null($oldest_time_ms) || $start_of_day_ms < $oldest_time_ms) { + if (null === $oldest_time_ms || $start_of_day_ms < $oldest_time_ms) { $oldest_time_ms = $start_of_day_ms; } - if (is_null($newest_time_ms) || $start_of_day_ms > $newest_time_ms) { + if (null === $newest_time_ms || $start_of_day_ms > $newest_time_ms) { $newest_time_ms = $start_of_day_ms; } @@ -330,7 +330,7 @@ private function getTimelineChartData($builds): array } } - if (is_null($oldest_time_ms)) { + if (null === $oldest_time_ms) { // No builds found. return []; } diff --git a/app/cdash/app/Lib/Repository/GitHub.php b/app/cdash/app/Lib/Repository/GitHub.php index adc7f71dc0..52b0713026 100644 --- a/app/cdash/app/Lib/Repository/GitHub.php +++ b/app/cdash/app/Lib/Repository/GitHub.php @@ -127,7 +127,7 @@ public function authenticate(bool $required = true): bool $pem = 'file://' . $pem; $integrationId = config('cdash.github_app_id'); - if (is_null($integrationId)) { + if (null === $integrationId) { if ($required) { throw new Exception('GITHUB_APP_ID is not set'); } @@ -314,7 +314,7 @@ public function generateCheckPayloadFromBuildRows($build_rows, string $head_sha) $build_summaries = []; foreach ($build_rows as $row) { $build_summary = $this->getCheckSummaryForBuildRow($row); - if (!is_null($build_summary)) { + if (null !== $build_summary) { $build_summaries[] = $build_summary; } } @@ -558,7 +558,7 @@ public function compareCommits(BuildUpdate $update): bool } } - if (is_null($commit)) { + if (null === $commit) { // Next, check the database. $stmt = $this->db->prepare( 'SELECT DISTINCT revision FROM updatefile @@ -571,13 +571,13 @@ public function compareCommits(BuildUpdate $update): bool break; } } - if (!is_null($commit)) { + if (null !== $commit) { break; } } } - if (is_null($commit)) { + if (null === $commit) { // Lastly, use the Github API to find what files this commit changed. // To avoid being rate-limited, we only perform this lookup once // per commit, caching the results as we go. @@ -613,14 +613,14 @@ public function compareCommits(BuildUpdate $update): bool break; } } - if (!is_null($commit)) { + if (null !== $commit) { // Stop examining commits once we find one that matches. break; } } } - if (is_null($commit)) { + if (null === $commit) { // Skip this file if we couldn't find a commit that modified it. continue; } diff --git a/app/cdash/app/Model/Build.php b/app/cdash/app/Model/Build.php index 19bf9b8889..76e8c776f9 100644 --- a/app/cdash/app/Model/Build.php +++ b/app/cdash/app/Model/Build.php @@ -715,7 +715,7 @@ public function GetConfigures(): PDOStatement|false return $stmt; } } - if (is_null($stmt)) { + if (null === $stmt) { $stmt = $this->PDO->prepare(' SELECT c.*, b.configureerrors, b.configurewarnings FROM configure c diff --git a/app/cdash/app/Model/Subscriber.php b/app/cdash/app/Model/Subscriber.php index 3ac19bd0fe..a8ffa782fc 100644 --- a/app/cdash/app/Model/Subscriber.php +++ b/app/cdash/app/Model/Subscriber.php @@ -86,7 +86,7 @@ public function hasBuildTopics(ActionableBuildInterface $submission): bool public function getTopics(): TopicCollection { - if (is_null($this->topics)) { + if (null === $this->topics) { $this->topics = new TopicCollection(); } return $this->topics; diff --git a/app/cdash/include/Collection/Collection.php b/app/cdash/include/Collection/Collection.php index 866e754bdb..d3142cc448 100644 --- a/app/cdash/include/Collection/Collection.php +++ b/app/cdash/include/Collection/Collection.php @@ -90,7 +90,7 @@ public function valid(): bool // a call to key may result in null, e.g. !isset. To prevent endless loop in the event // that collection was set with a key equal to an empty string, we must check for the null // type here. - if (is_null($key)) { + if (null === $key) { return false; } @@ -111,7 +111,7 @@ public function rewind(): void public function addItem($item, $name = null): self { $ptr = count($this->collection); - $key = is_null($name) ? $ptr : $name; + $key = null === $name ? $ptr : $name; if (!in_array($key, $this->keys) && !in_array($key, array_keys($this->collection))) { $this->keys[$ptr] = $key; diff --git a/app/cdash/include/Messaging/Subscription/Subscription.php b/app/cdash/include/Messaging/Subscription/Subscription.php index 70e7c4bbf7..8106821753 100644 --- a/app/cdash/include/Messaging/Subscription/Subscription.php +++ b/app/cdash/include/Messaging/Subscription/Subscription.php @@ -100,7 +100,7 @@ public function getTopicDescriptions($case = null): array $descriptions = []; foreach ($this->subscriber->getTopics() as $topic) { $description = $topic->getTopicDescription(); - if (!is_null($case)) { + if (null !== $case) { $description = $case === CASE_UPPER ? strtoupper($description) : strtolower($description); } $descriptions[] = $description; @@ -169,11 +169,11 @@ public function getBuildSummary(): array $summary['build_type'] = $build->Type; } - if (is_null($summary['build_parent_id'])) { + if (null === $summary['build_parent_id']) { $summary['build_parent_id'] = $build->GetParentId(); } - if (is_null($summary['build_summary_url'])) { + if (null === $summary['build_summary_url']) { $id = (int) $summary['build_parent_id'] ?: $build->Id; $summary['build_summary_url'] = url("/builds/{$id}"); } diff --git a/app/cdash/include/Messaging/Subscription/UserSubscriptionBuilder.php b/app/cdash/include/Messaging/Subscription/UserSubscriptionBuilder.php index d74b21b9e6..a5b1d7b6a0 100644 --- a/app/cdash/include/Messaging/Subscription/UserSubscriptionBuilder.php +++ b/app/cdash/include/Messaging/Subscription/UserSubscriptionBuilder.php @@ -52,7 +52,7 @@ public function build(SubscriptionCollection $subscriptions): void */ protected function getSubscriptionFactory(): SubscriptionFactory { - if (is_null($this->subscriptionFactory)) { + if (null === $this->subscriptionFactory) { $this->subscriptionFactory = new SubscriptionFactory(); } return $this->subscriptionFactory; diff --git a/app/cdash/include/Messaging/Topic/DynamicAnalysisTopic.php b/app/cdash/include/Messaging/Topic/DynamicAnalysisTopic.php index d6ca76f416..7dfefd5052 100644 --- a/app/cdash/include/Messaging/Topic/DynamicAnalysisTopic.php +++ b/app/cdash/include/Messaging/Topic/DynamicAnalysisTopic.php @@ -34,7 +34,7 @@ class DynamicAnalysisTopic extends Topic implements Decoratable public function subscribesToBuild(Build $build): bool { - $ancestorSubscribe = is_null($this->topic) ? true : $this->topic->subscribesToBuild($build); + $ancestorSubscribe = null === $this->topic ? true : $this->topic->subscribesToBuild($build); $collection = $build->GetDynamicAnalysisCollection(); $subscribe = false; if ($ancestorSubscribe) { diff --git a/app/cdash/include/Messaging/Topic/GroupMembershipTopic.php b/app/cdash/include/Messaging/Topic/GroupMembershipTopic.php index 0d5dfd5e97..697a3cf400 100644 --- a/app/cdash/include/Messaging/Topic/GroupMembershipTopic.php +++ b/app/cdash/include/Messaging/Topic/GroupMembershipTopic.php @@ -13,7 +13,7 @@ class GroupMembershipTopic extends Topic public function subscribesToBuild(Build $build): bool { - $parentTopic = is_null($this->topic) ? true : $this->topic->subscribesToBuild($build); + $parentTopic = null === $this->topic ? true : $this->topic->subscribesToBuild($build); $subscribe = $parentTopic && $this->group === $build->GetBuildType(); return $subscribe; } diff --git a/app/cdash/include/Messaging/Topic/Topic.php b/app/cdash/include/Messaging/Topic/Topic.php index 21555d5187..d74382e951 100644 --- a/app/cdash/include/Messaging/Topic/Topic.php +++ b/app/cdash/include/Messaging/Topic/Topic.php @@ -144,7 +144,7 @@ public function hasSubscriberAlreadyBeenNotified(Build $build, $category = null) $collection = $build->GetBuildEmailCollection(); $address = $this->subscriber->getAddress(); - if (!is_null($category)) { + if (null !== $category) { $collection = $collection ->sortByCategory() ->get($category); diff --git a/app/cdash/include/common.php b/app/cdash/include/common.php index eb44494ec9..14d32dceda 100644 --- a/app/cdash/include/common.php +++ b/app/cdash/include/common.php @@ -582,7 +582,7 @@ function get_dashboard_JSON($projectname, $date, &$response): void $project_array['name'] = $projectname; $project_array['nightlytime'] = $project->Id ? $project->NightlyTime : '00:00:00'; - if (is_null($date)) { + if (null === $date) { $date = date(FMT_DATE); } [$previousdate, $currentstarttime, $nextdate] = get_dates($date, $project_array['nightlytime']); @@ -785,7 +785,7 @@ function get_aggregate_build(Build $build): Build function create_aggregate_build($build, $siteid = null): Build { - if (is_null($siteid)) { + if (null === $siteid) { $siteid = get_server_siteid(); } diff --git a/app/cdash/tests/kwtest/kw_web_tester.php b/app/cdash/tests/kwtest/kw_web_tester.php index 19ee78b0e6..3e15aed0f8 100644 --- a/app/cdash/tests/kwtest/kw_web_tester.php +++ b/app/cdash/tests/kwtest/kw_web_tester.php @@ -334,7 +334,7 @@ public function submission_assign_buildid($file, $project, $build, $site, $stamp, $subproject = null, $header = null) { $url = $this->url . "/submit.php?project=$project&build=$build&site=$site&stamp=$stamp"; - if (!is_null($subproject)) { + if (null !== $subproject) { $url .= "&subproject=$subproject"; } @@ -378,7 +378,7 @@ public function uploadfile($url, $filename, $header = null) curl_setopt($ch, CURLOPT_INFILE, $fp); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_INFILESIZE, filesize($filename)); - if (!is_null($header)) { + if (null !== $header) { curl_setopt($ch, CURLOPT_HTTPHEADER, $header); } curl_setopt($ch, CURLOPT_HEADER, true); diff --git a/app/cdash/tests/test_indexfilters.php b/app/cdash/tests/test_indexfilters.php index e630972bf5..35b7e2504a 100644 --- a/app/cdash/tests/test_indexfilters.php +++ b/app/cdash/tests/test_indexfilters.php @@ -43,7 +43,7 @@ public function testIndexFilters(): void public function filter($field, $compare, $value, $expected, $url = null) { - if (is_null($url)) { + if (null === $url) { $url = $this->InsightUrl; } $filter_string = "filtercount=1&showfilters=1&field1=$field&compare1=$compare&value1=$value"; diff --git a/app/cdash/tests/test_managemeasurements.php b/app/cdash/tests/test_managemeasurements.php index 67e8803ecf..4f9bddaca0 100644 --- a/app/cdash/tests/test_managemeasurements.php +++ b/app/cdash/tests/test_managemeasurements.php @@ -34,10 +34,10 @@ public function __construct() public function __destruct() { - if (!is_null($this->BuildId)) { + if (null !== $this->BuildId) { DatabaseCleanupUtils::removeBuild($this->BuildId); } - if (!is_null($this->SubProjectBuildId)) { + if (null !== $this->SubProjectBuildId) { DatabaseCleanupUtils::removeBuild($this->SubProjectBuildId); } diff --git a/app/cdash/tests/test_timeline.php b/app/cdash/tests/test_timeline.php index f223342d2a..0b41c4a103 100644 --- a/app/cdash/tests/test_timeline.php +++ b/app/cdash/tests/test_timeline.php @@ -62,11 +62,11 @@ public function testTimeline(): void break; } } - if (!is_null($build)) { + if (null !== $build) { break; } } - if (is_null($build)) { + if (null === $build) { $this->fail('build lookup failed'); } diff --git a/app/cdash/tests/test_viewsubprojects.php b/app/cdash/tests/test_viewsubprojects.php index 8f8e1335d4..3f6c0d8c38 100644 --- a/app/cdash/tests/test_viewsubprojects.php +++ b/app/cdash/tests/test_viewsubprojects.php @@ -18,7 +18,7 @@ public function testViewSubProjects() $this->get($this->url . '/api/v1/viewSubProjects.php?project=Trilinos&date=2011-07-22'); $content = $this->getBrowser()->getContent(); $jsonobj = json_decode($content, true); - if (is_null($jsonobj)) { + if (null === $jsonobj) { $this->fail("API response could be not be decoded to JSON:\n$content"); return 1; } diff --git a/app/cdash/tests/trilinos_submission_test.php b/app/cdash/tests/trilinos_submission_test.php index 40add9ba6b..18976b8b54 100644 --- a/app/cdash/tests/trilinos_submission_test.php +++ b/app/cdash/tests/trilinos_submission_test.php @@ -80,7 +80,7 @@ public function verifyResults() $parent_build = $build; } } - if (is_null($parent_build)) { + if (null === $parent_build) { $this->fail('Could not find expected parent build'); return false; } From ccfb2d8d60991c1ac77abf77d5084f865ce0b6a9 Mon Sep 17 00:00:00 2001 From: William Allen <16820599+williamjallen@users.noreply.github.com> Date: Thu, 18 Dec 2025 09:33:30 -0500 Subject: [PATCH 13/31] Enable `logical_operators` rule --- .php-cs-fixer.dist.php | 1 + 1 file changed, 1 insertion(+) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 144fd858d1..13e2a19045 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -41,4 +41,5 @@ 'get_class_to_class_keyword' => true, 'implode_call' => true, 'is_null' => true, + 'logical_operators' => true, ])->setFinder($finder); From be8f9caf18bc695b6151fe3c614425d1ed4c86b4 Mon Sep 17 00:00:00 2001 From: William Allen <16820599+williamjallen@users.noreply.github.com> Date: Thu, 18 Dec 2025 09:34:27 -0500 Subject: [PATCH 14/31] Apply `logical_operators` rule --- .../Handlers/OpenCoverTarHandler.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/app/Http/Submission/Handlers/OpenCoverTarHandler.php b/app/Http/Submission/Handlers/OpenCoverTarHandler.php index 34c2775496..5b0677ccd7 100644 --- a/app/Http/Submission/Handlers/OpenCoverTarHandler.php +++ b/app/Http/Submission/Handlers/OpenCoverTarHandler.php @@ -254,15 +254,15 @@ public function readSourceFile($buildid, $fileinfo) $this->coverageFile->File .= $line; if (!(preg_match("/^\/\//", $trimmedLine) - or preg_match('/using /', $trimmedLine) - or preg_match('/^namespace/', $trimmedLine) - or preg_match('/^public/', $trimmedLine) - or preg_match('/^protected/', $trimmedLine) - or preg_match('/^private/', $trimmedLine) - or preg_match("/^\[/", $trimmedLine) - or preg_match('/[{}]/', $trimmedLine) - or ('' == $trimmedLine) - or $inlongComment + || preg_match('/using /', $trimmedLine) + || preg_match('/^namespace/', $trimmedLine) + || preg_match('/^public/', $trimmedLine) + || preg_match('/^protected/', $trimmedLine) + || preg_match('/^private/', $trimmedLine) + || preg_match("/^\[/", $trimmedLine) + || preg_match('/[{}]/', $trimmedLine) + || ('' == $trimmedLine) + || $inlongComment ) && $this->ParseCSFiles) { $this->coverageFileLog->AddLine($key, 0); } From f6ad02b724e64150865262bd3eacc029c0500f7e Mon Sep 17 00:00:00 2001 From: William Allen <16820599+williamjallen@users.noreply.github.com> Date: Thu, 18 Dec 2025 09:34:49 -0500 Subject: [PATCH 15/31] Enable `long_to_shorthand_operator` rule --- .php-cs-fixer.dist.php | 1 + 1 file changed, 1 insertion(+) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 13e2a19045..89e015610e 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -42,4 +42,5 @@ 'implode_call' => true, 'is_null' => true, 'logical_operators' => true, + 'long_to_shorthand_operator' => true, ])->setFinder($finder); From 548262594678a3197072a8cb397f674f5b82162b Mon Sep 17 00:00:00 2001 From: William Allen <16820599+williamjallen@users.noreply.github.com> Date: Thu, 18 Dec 2025 09:35:43 -0500 Subject: [PATCH 16/31] Apply `long_to_shorthand_operator` rule --- app/Utils/DatabaseCleanupUtils.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Utils/DatabaseCleanupUtils.php b/app/Utils/DatabaseCleanupUtils.php index aed4c72a03..4e916cb448 100644 --- a/app/Utils/DatabaseCleanupUtils.php +++ b/app/Utils/DatabaseCleanupUtils.php @@ -326,7 +326,7 @@ public static function deleteUnusedRows(string $table, string $field, string $ta $percent = round(($num_done / $total) * 100, -1); if ($percent > $next_report) { Log::info("Cleaning `{$table}`: {$next_report}%"); - $next_report = $next_report + 10; + $next_report += 10; } } } From 951ff7bffbdfab4d0e85a8613dab9963d4e3e24c Mon Sep 17 00:00:00 2001 From: William Allen <16820599+williamjallen@users.noreply.github.com> Date: Thu, 18 Dec 2025 09:36:20 -0500 Subject: [PATCH 17/31] Enable `modernize_strpos` rule --- .php-cs-fixer.dist.php | 1 + 1 file changed, 1 insertion(+) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 89e015610e..e9bae60611 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -43,4 +43,5 @@ 'is_null' => true, 'logical_operators' => true, 'long_to_shorthand_operator' => true, + 'modernize_strpos' => ['modernize_stripos' => true], ])->setFinder($finder); From 28ba269d03023e6ae464b5c8ab647b2cf4a1007b Mon Sep 17 00:00:00 2001 From: William Allen <16820599+williamjallen@users.noreply.github.com> Date: Thu, 18 Dec 2025 09:37:29 -0500 Subject: [PATCH 18/31] Apply `modernize_strpos` rule --- app/Http/Submission/Handlers/TestingJUnitHandler.php | 2 +- app/cdash/include/common.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Http/Submission/Handlers/TestingJUnitHandler.php b/app/Http/Submission/Handlers/TestingJUnitHandler.php index 3ec6471011..8e185c7ff2 100644 --- a/app/Http/Submission/Handlers/TestingJUnitHandler.php +++ b/app/Http/Submission/Handlers/TestingJUnitHandler.php @@ -148,7 +148,7 @@ public function startElement($parser, $name, $attributes): void $this->TestCreator->testStatus = 'passed'; if (array_key_exists('STATUS', $attributes)) { $status = $attributes['STATUS']; - if (stripos($status, 'fail') !== false) { + if (str_contains(strtolower($status), strtolower('fail'))) { $this->TestCreator->testStatus = 'failed'; } if (strcasecmp($status, 'notrun') === 0) { diff --git a/app/cdash/include/common.php b/app/cdash/include/common.php index 14d32dceda..af8ca18efd 100644 --- a/app/cdash/include/common.php +++ b/app/cdash/include/common.php @@ -699,7 +699,7 @@ function cast_data_for_JSON($value) } // Do not support E notation for numbers (ie 6.02e23). // This can cause checksums (such as git commits) to be converted to 0. - if (is_numeric($value) && stripos($value, 'e') === false) { + if (is_numeric($value) && !str_contains(strtolower($value), strtolower('e'))) { if (is_nan($value) || is_infinite($value)) { // Special handling for values that are not supported by JSON. return 0; From 64947f4d591c9ff01608df59e6db190e067d7e55 Mon Sep 17 00:00:00 2001 From: William Allen <16820599+williamjallen@users.noreply.github.com> Date: Thu, 18 Dec 2025 09:38:00 -0500 Subject: [PATCH 19/31] Enable `modernize_types_casting` rule --- .php-cs-fixer.dist.php | 1 + 1 file changed, 1 insertion(+) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index e9bae60611..8f9a1838fb 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -44,4 +44,5 @@ 'logical_operators' => true, 'long_to_shorthand_operator' => true, 'modernize_strpos' => ['modernize_stripos' => true], + 'modernize_types_casting' => true, ])->setFinder($finder); From b27e4bae4c5e12f9c7332d88ea0717a109068898 Mon Sep 17 00:00:00 2001 From: William Allen <16820599+williamjallen@users.noreply.github.com> Date: Thu, 18 Dec 2025 09:41:25 -0500 Subject: [PATCH 20/31] Apply `modernize_types_casting` rule --- app/Http/Controllers/AdminController.php | 16 +++--- app/Http/Controllers/AuthTokenController.php | 2 +- app/Http/Controllers/BuildController.php | 20 ++++---- app/Http/Controllers/BuildNoteController.php | 2 +- app/Http/Controllers/CoverageController.php | 50 +++++++++---------- .../Controllers/DynamicAnalysisController.php | 2 +- app/Http/Controllers/MonitorController.php | 2 +- app/Http/Controllers/ProjectController.php | 4 +- .../Controllers/ProjectOverviewController.php | 34 ++++++------- app/Http/Controllers/SubProjectController.php | 6 +-- app/Http/Controllers/SubmissionController.php | 2 +- .../SubscribeProjectController.php | 14 +++--- app/Http/Controllers/TestController.php | 14 +++--- app/Http/Controllers/UserController.php | 10 ++-- .../Submission/Handlers/BazelJSONHandler.php | 10 ++-- .../Submission/Handlers/ConfigureHandler.php | 2 +- .../Handlers/CoverageJUnitHandler.php | 20 ++++---- .../Handlers/CoverageLogHandler.php | 2 +- .../Submission/Handlers/JSCoverTarHandler.php | 2 +- .../Submission/Handlers/ProjectHandler.php | 8 +-- app/Http/Submission/Handlers/RetryHandler.php | 2 +- app/Jobs/PerformLegacyDailyUpdates.php | 2 +- app/Jobs/ProcessSubmission.php | 4 +- app/Utils/AuthTokenUtil.php | 4 +- app/Utils/DatabaseCleanupUtils.php | 14 +++--- app/Utils/RepositoryUtils.php | 6 +-- app/Utils/SubmissionUtils.php | 2 +- app/Utils/TestingDay.php | 12 ++--- app/cdash/app/Controller/Api/Index.php | 2 +- app/cdash/app/Controller/Api/TestOverview.php | 2 +- app/cdash/app/Controller/Api/ViewTest.php | 2 +- app/cdash/app/Model/Build.php | 2 +- app/cdash/app/Model/BuildError.php | 2 +- app/cdash/app/Model/BuildFailure.php | 12 ++--- app/cdash/app/Model/CoverageFileLog.php | 14 +++--- app/cdash/app/Model/CoverageSummary.php | 24 ++++----- app/cdash/app/Model/DynamicAnalysis.php | 2 +- app/cdash/app/Model/Project.php | 2 +- app/cdash/app/Model/SubProject.php | 6 +-- app/cdash/include/common.php | 22 ++++---- app/cdash/include/filterdataFunctions.php | 10 ++-- app/cdash/tests/test_testhistory.php | 2 +- 42 files changed, 186 insertions(+), 186 deletions(-) diff --git a/app/Http/Controllers/AdminController.php b/app/Http/Controllers/AdminController.php index d8e7246a22..c644c76023 100644 --- a/app/Http/Controllers/AdminController.php +++ b/app/Http/Controllers/AdminController.php @@ -14,12 +14,12 @@ public function removeBuilds(): View|RedirectResponse { @set_time_limit(0); - $projectid = intval($_GET['projectid'] ?? 0); + $projectid = (int) ($_GET['projectid'] ?? 0); $alert = ''; // get date info here - @$dayTo = intval($_POST['dayFrom']); + @$dayTo = (int) $_POST['dayFrom']; if (empty($dayTo)) { $time = strtotime('2000-01-01 00:00:00'); @@ -43,12 +43,12 @@ public function removeBuilds(): View|RedirectResponse $yearTo = date('Y'); $monthTo = date('m'); } else { - $dayFrom = intval($_POST['dayFrom']); - $monthFrom = intval($_POST['monthFrom']); - $yearFrom = intval($_POST['yearFrom']); - $dayTo = intval($_POST['dayTo']); - $monthTo = intval($_POST['monthTo']); - $yearTo = intval($_POST['yearTo']); + $dayFrom = (int) $_POST['dayFrom']; + $monthFrom = (int) $_POST['monthFrom']; + $yearFrom = (int) $_POST['yearFrom']; + $dayTo = (int) $_POST['dayTo']; + $monthTo = (int) $_POST['monthTo']; + $yearTo = (int) $_POST['yearTo']; } // List the available projects diff --git a/app/Http/Controllers/AuthTokenController.php b/app/Http/Controllers/AuthTokenController.php index f359074773..6b3e99108d 100644 --- a/app/Http/Controllers/AuthTokenController.php +++ b/app/Http/Controllers/AuthTokenController.php @@ -47,7 +47,7 @@ public function createToken(Request $request): JsonResponse } if ($request->input('scope') !== AuthToken::SCOPE_FULL_ACCESS) { - $projectid = intval($request->input('projectid')); + $projectid = (int) $request->input('projectid'); if (!is_numeric($projectid)) { return response()->json(['error' => 'Invalid projectid'], Response::HTTP_BAD_REQUEST); } diff --git a/app/Http/Controllers/BuildController.php b/app/Http/Controllers/BuildController.php index 646c2955d2..b6985431e7 100644 --- a/app/Http/Controllers/BuildController.php +++ b/app/Http/Controllers/BuildController.php @@ -114,7 +114,7 @@ public function apiBuildSummary(): JsonResponse { $pageTimer = new PageTimer(); - $this->setBuildById(intval($_GET['buildid'] ?? -1)); + $this->setBuildById((int) ($_GET['buildid'] ?? -1)); $date = TestingDay::get($this->project, $this->build->StartTime); @@ -504,7 +504,7 @@ public function buildOverview(): View|RedirectResponse $currentstarttime = get_dates($date, $this->project->NightlyTime)[1]; // Return the available groups - $selected_group = intval($_POST['groupSelection'] ?? 0); + $selected_group = (int) ($_POST['groupSelection'] ?? 0); // Check the builds $beginning_timestamp = $currentstarttime; @@ -580,7 +580,7 @@ public function viewUpdatePageContent(): JsonResponse { $pageTimer = new PageTimer(); - $this->setBuildById(intval($_GET['buildid'] ?? -1)); + $this->setBuildById((int) ($_GET['buildid'] ?? -1)); $date = TestingDay::get($this->project, $this->build->StartTime); $response = begin_JSON_response(); @@ -821,13 +821,13 @@ public function build_file(int $build_id, int $file_id): StreamedResponse public function ajaxBuildNote(): View { - $this->setBuildById(intval($_GET['buildid'] ?? -1)); + $this->setBuildById((int) ($_GET['buildid'] ?? -1)); Gate::authorize('edit-project', $this->project); $notes = DB::select('SELECT * FROM comments WHERE buildid=? ORDER BY timestamp ASC', [$this->build->Id]); foreach ($notes as $note) { /** @var User $user */ - $user = User::where('id', intval($note->userid))->first(); + $user = User::where('id', (int) $note->userid)->first(); $note->user = $user; } @@ -851,7 +851,7 @@ public function apiViewBuildError(): JsonResponse $response = begin_JSON_response(); $response['title'] = $this->project->Name; - $type = intval($_GET['type'] ?? 0); + $type = (int) ($_GET['type'] ?? 0); $date = TestingDay::get($this->project, $this->build->StartTime); get_dashboard_JSON($this->project->Name, $date, $response); @@ -928,7 +928,7 @@ public function apiViewBuildError(): JsonResponse label.id=label2buildfailure.labelid AND label2buildfailure.buildfailureid=? ORDER BY text ASC - ', [intval($resolvedBuildFailure['id'])], $marshaledResolvedBuildFailure); + ', [(int) $resolvedBuildFailure['id']], $marshaledResolvedBuildFailure); } $marshaledResolvedBuildFailure = array_merge($marshaledResolvedBuildFailure, [ @@ -1077,7 +1077,7 @@ public function apiViewConfigure(): JsonResponse public function apiBuildUpdateGraph(): JsonResponse { - $this->setBuildById(intval($_GET['buildid'] ?? -1)); + $this->setBuildById((int) ($_GET['buildid'] ?? -1)); // Find previous submissions from this build. $query_result = DB::select(' @@ -1118,7 +1118,7 @@ public function apiBuildUpdateGraph(): JsonResponse public function apiGetPreviousBuilds(): JsonResponse { - $this->setBuildById(intval($_GET['buildid'] ?? -1)); + $this->setBuildById((int) ($_GET['buildid'] ?? -1)); // Take subproject into account, such that if there is one, then the // previous builds must be associated with the same subproject. @@ -1190,7 +1190,7 @@ public function apiGetPreviousBuilds(): JsonResponse */ public function apiBuildExpected(): JsonResponse { - $this->setBuildById(intval($_GET['buildid'] ?? -1)); + $this->setBuildById((int) ($_GET['buildid'] ?? -1)); $rule = new BuildGroupRule($this->build); return response()->json([ 'expected' => $rule->GetExpected(), diff --git a/app/Http/Controllers/BuildNoteController.php b/app/Http/Controllers/BuildNoteController.php index 9017744d2a..7a55b72834 100644 --- a/app/Http/Controllers/BuildNoteController.php +++ b/app/Http/Controllers/BuildNoteController.php @@ -16,7 +16,7 @@ final class BuildNoteController extends AbstractBuildController { public function apiViewNotes(): JsonResponse { - $this->setBuildById(intval($_GET['buildid'] ?? 0)); + $this->setBuildById((int) ($_GET['buildid'] ?? 0)); $pageTimer = new PageTimer(); diff --git a/app/Http/Controllers/CoverageController.php b/app/Http/Controllers/CoverageController.php index 13c9a52dc2..40ece91fe6 100644 --- a/app/Http/Controllers/CoverageController.php +++ b/app/Http/Controllers/CoverageController.php @@ -31,7 +31,7 @@ public function viewCoverage(): View|RedirectResponse { @set_time_limit(0); - $this->setBuildById(intval($_GET['buildid'] ?? -1)); + $this->setBuildById((int) ($_GET['buildid'] ?? -1)); @$date = $_GET['date']; if ($date != null) { @@ -56,7 +56,7 @@ public function viewCoverage(): View|RedirectResponse SELECT role FROM user2project WHERE userid=? AND projectid=? - ', [intval($userid), intval($this->project->Id)]); + ', [(int) $userid, (int) $this->project->Id]); if (!empty($user2project)) { $role = $user2project['role']; } @@ -75,9 +75,9 @@ public function viewCoverage(): View|RedirectResponse SELECT coveragethreshold FROM subprojectgroup WHERE projectid=? AND id=? - ', [intval($this->project->Id), intval($this->build->GroupId)]); + ', [(int) $this->project->Id, (int) $this->build->GroupId]); if (!empty($row) && isset($row['coveragethreshold'])) { - $threshold = intval($row['coveragethreshold']); + $threshold = (int) $row['coveragethreshold']; } } @@ -97,7 +97,7 @@ public function viewCoverage(): View|RedirectResponse FROM coverage WHERE buildid=? GROUP BY buildid - ', [intval($this->build->Id)]); + ', [(int) $this->build->Id]); $xml .= add_XML_value('starttime', date('l, F d Y', strtotime($this->build->StartTime))); $xml .= add_XML_value('loctested', $coverage_array['loctested']); @@ -133,7 +133,7 @@ public function viewCoverage(): View|RedirectResponse label.id=label2coverage.labelid AND label2coverage.coverageid=coverage.id AND coverage.buildid=? - ', [intval($this->build->Id)]); + ', [(int) $this->build->Id]); foreach ($covlabels as $row) { $labels[$row['id']] = $row['text']; } @@ -154,10 +154,10 @@ public function viewCoverage(): View|RedirectResponse label2coverage.labelid=? AND coverage.buildid=? AND coverage.id=label2coverage.coverageid - ', [intval($id), intval($this->build->Id)]); + ', [(int) $id, (int) $this->build->Id]); - $loctested = intval($row['loctested']); - $locuntested = intval($row['locuntested']); + $loctested = (int) $row['loctested']; + $locuntested = (int) $row['locuntested']; $percentcoverage = compute_percentcoverage($loctested, $locuntested); $xml .= '