Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP 8.4 compatibility updates #16646

Draft
wants to merge 3 commits into
base: 2.x
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:

strategy:
matrix:
php-version: ['5.6', '7.0', '7.1', '7.2', '7.3']
php-version: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4']

steps:
- name: Checkout
Expand Down
6 changes: 4 additions & 2 deletions _build/test/MODxControllerTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ abstract class MODxControllerTestCase extends MODxTestCase {
*/
public $controllerName;

public function setUp() {
public function setUp(): void
{
parent::setUp();

/* load smarty template engine */
Expand All @@ -57,7 +58,8 @@ public function setUp() {
}
}

public function tearDown() {
public function tearDown(): void
{
parent::tearDown();
$this->controller = null;
}
Expand Down
5 changes: 3 additions & 2 deletions _build/test/MODxTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ abstract class MODxTestCase extends \PHPUnit\Framework\TestCase {
/**
* Ensure all tests have a reference to the MODX object
*/
public function setUp() {
public function setUp(): void
{
$this->modx =& MODxTestHarness::getFixture('modX', 'modx');
if ($this->modx->request) {
$this->modx->request->loadErrorHandler();
Expand All @@ -43,7 +44,7 @@ public function setUp() {
/**
* Remove reference at end of test case
*/
public function tearDown() {}
public function tearDown(): void {}

/**
* Check a MODX return result for a success flag
Expand Down
6 changes: 4 additions & 2 deletions _build/test/Tests/Cases/Request/MakeUrlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
* @group MakeUrl
*/
class MakeUrlTest extends MODxTestCase {
public function setUp() {
public function setUp(): void
{
parent::setUp();

/** @var modResource $resource */
Expand Down Expand Up @@ -82,7 +83,8 @@ public function setUp() {
//$this->modx->context->prepare(true);
$this->modx->context->aliasMap = null;
}
public function tearDown() {
public function tearDown(): void
{
parent::tearDown();
/** @var modResource $resource */
$resource = $this->modx->getObject('modResource',array('pagetitle' => 'Unit Test Resource'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ class ContextUpdateControllerTest extends MODxControllerTestCase {
public $controllerName = 'ContextUpdateManagerController';
public $controllerPath = 'context/update';

public function setUp() {
public function setUp(): void
{
parent::setUp();
$this->controller->setProperty('key','web');
}
Expand Down
6 changes: 4 additions & 2 deletions _build/test/Tests/Controllers/DeprecatedControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@ class DeprecatedControllerTest extends MODxTestCase {
*/
public $controller;

public function setUp() {
public function setUp(): void
{
parent::setUp();

$this->controller = new modManagerControllerDeprecated($this->modx);
}
public function tearDown() {
public function tearDown(): void
{
parent::tearDown();
$this->controller = null;
}
Expand Down
6 changes: 4 additions & 2 deletions _build/test/Tests/Controllers/WelcomeControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ class WelcomeControllerTest extends MODxControllerTestCase {
public $controllerName = 'WelcomeManagerController';
public $controllerPath = 'welcome';

public function setUp() {
public function setUp(): void
{
parent::setUp();

/** @var modDashboard $dashboard */
Expand Down Expand Up @@ -71,7 +72,8 @@ public function setUp() {

}

public function tearDown() {
public function tearDown(): void
{
parent::tearDown();
$userGroups = $this->modx->getCollection('modUserGroup',array('name:LIKE' => '%Unit Test%'));
/** @var modUserGroup $userGroup */
Expand Down
3 changes: 2 additions & 1 deletion _build/test/Tests/Model/Dashboard/modDashboardTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ class modDashboardTest extends MODxTestCase {
* Load some utility classes this case uses
* @return void
*/
public function setUp() {
public function setUp(): void
{
parent::setUp();
$this->modx->loadClass('modDashboard');
$this->modx->loadClass('modManagerController',MODX_CORE_PATH.'model/modx/',true,true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ class modDashboardWidgetTest extends MODxTestCase {
* Load some utility classes this case uses
* @return void
*/
public function setUp() {
public function setUp(): void
{
parent::setUp();
$this->modx->loadClass('modDashboard');
$this->modx->loadClass('modDashboardWidget');
Expand Down
6 changes: 4 additions & 2 deletions _build/test/Tests/Model/Element/modChunkTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ class modChunkTest extends MODxTestCase {
/** @var modChunk $chunk */
public $chunk;

public function setUp() {
public function setUp(): void
{
parent::setUp();
$this->chunk = $this->modx->newObject('modChunk');
$this->chunk->fromArray(array(
Expand All @@ -39,7 +40,8 @@ public function setUp() {
$this->chunk->setProperties(array('name' => 'John'));
$this->chunk->setCacheable(false);
}
public function tearDown() {
public function tearDown(): void
{
parent::tearDown();
$this->chunk = null;
}
Expand Down
6 changes: 4 additions & 2 deletions _build/test/Tests/Model/Element/modPluginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ class modPluginTest extends MODxTestCase {
/** @var modPlugin $plugin */
public $plugin;

public function setUp() {
public function setUp(): void
{
parent::setUp();
$this->plugin = $this->modx->newObject('modPlugin');
$this->plugin->fromArray(array(
Expand All @@ -40,7 +41,8 @@ public function setUp() {
$this->plugin->setProperties(array('name' => 'John'));
$this->plugin->setCacheable(false);
}
public function tearDown() {
public function tearDown(): void
{
parent::tearDown();
$this->plugin = null;
}
Expand Down
6 changes: 4 additions & 2 deletions _build/test/Tests/Model/Element/modSnippetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ class modSnippetTest extends MODxTestCase {
/** @var modSnippet $snippet */
public $snippet;

public function setUp() {
public function setUp(): void
{
parent::setUp();
$this->snippet = $this->modx->newObject('modSnippet');
$this->snippet->fromArray(array(
Expand All @@ -40,7 +41,8 @@ public function setUp() {
$this->snippet->save();
$this->modx->event= new modSystemEvent();
}
public function tearDown() {
public function tearDown(): void
{
parent::tearDown();
$this->snippet->remove();
$this->snippet = null;
Expand Down
3 changes: 2 additions & 1 deletion _build/test/Tests/Model/Element/modTagTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
* @group modTag
*/
class modTagTest extends MODxTestCase {
public static function setUpBeforeClass() {
public static function setUpBeforeClass(): void
{
$modx =& MODxTestHarness::getFixture('modX', 'modx');
include dirname(__FILE__) . '/modtagelement.mock.php';
}
Expand Down
6 changes: 4 additions & 2 deletions _build/test/Tests/Model/Element/modTemplateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ class modTemplateTest extends MODxTestCase {
/** @var modTemplate $template */
public $template;

public function setUp() {
public function setUp(): void
{
parent::setUp();
$this->template = $this->modx->newObject('modTemplate');
$this->template->fromArray(array(
Expand All @@ -38,7 +39,8 @@ public function setUp() {
$this->template->setProperties(array('name' => 'John'));
$this->template->setCacheable(false);
}
public function tearDown() {
public function tearDown(): void
{
parent::tearDown();
$this->template = null;
}
Expand Down
6 changes: 4 additions & 2 deletions _build/test/Tests/Model/Element/modTemplateVarTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ class modTemplateVarTest extends MODxTestCase {
/** @var modTemplateVar $tv */
public $tv;

public function setUp() {
public function setUp(): void
{
parent::setUp();
$this->tv = $this->modx->newObject('modTemplateVar');
$this->tv->fromArray(array(
Expand All @@ -39,7 +40,8 @@ public function setUp() {
$this->tv->setProperties(array('name' => 'John'));
$this->tv->setCacheable(false);
}
public function tearDown() {
public function tearDown(): void
{
parent::tearDown();
$this->tv = null;
}
Expand Down
6 changes: 4 additions & 2 deletions _build/test/Tests/Model/Error/modErrorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,17 @@ class modErrorTest extends MODxTestCase {
/**
* Instantiate the modError instance for each test
*/
public function setUp() {
public function setUp(): void
{
parent::setUp();
$this->error = $this->modx->getService('error','error.modError');
}

/**
* Ensure that the error class is reset on each load
*/
public function tearDown() {
public function tearDown(): void
{
parent::tearDown();
$this->modx->services['error'] = null;
$this->modx->error = null;
Expand Down
3 changes: 2 additions & 1 deletion _build/test/Tests/Model/Filters/modOutputFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ class modOutputFilterTest extends MODxTestCase {
/** @var modPlaceholderTag $tag */
public $tag;

public function setUp() {
public function setUp(): void
{
parent::setUp();
$this->modx->getParser();
$this->tag = new modPlaceholderTag($this->modx);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
* @group modActionDom
*/
class modActionDomTest extends MODxTestCase {
public function setUp() {
public function setUp(): void
{
parent::setUp();
}

Expand Down
6 changes: 4 additions & 2 deletions _build/test/Tests/Model/Lexicon/modLexiconTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ class modLexiconTest extends MODxTestCase {
/** @var modLexicon $lexicon */
public $lexicon;

public function setUp() {
public function setUp(): void
{
parent::setUp();
$this->modx->loadClass('modLexicon',null,true,true);
$this->lexicon = new modLexicon($this->modx);
}

public function tearDown() {
public function tearDown(): void
{
$this->lexicon->clear();
}

Expand Down
3 changes: 2 additions & 1 deletion _build/test/Tests/Model/Mail/modMailTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ class modMailTest extends MODxTestCase {
*/
public $mail;

public function setUp() {
public function setUp(): void
{
parent::setUp();
$this->modx->loadClass('mail.modMail',MODX_CORE_PATH.'model/modx/',true,true);
$this->mail = $this->getMockForAbstractClass('modMail',array(&$this->modx));
Expand Down
6 changes: 4 additions & 2 deletions _build/test/Tests/Model/Registry/modFileRegisterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,16 @@
* @group modFileRegister
*/
class modFileRegisterTest extends MODxTestCase {
public static function setUpBeforeClass() {
public static function setUpBeforeClass(): void
{
/** @var modX $modx */
$modx =& MODxTestHarness::getFixture('modX', 'modx');
$modx->getService('registry', 'registry.modRegistry');
$modx->registry->addRegister('register', 'registry.modFileRegister', array('directory' => 'register'));
}

public static function tearDownAfterClass() {
public static function tearDownAfterClass(): void
{
/** @var modX $modx */
$modx =& MODxTestHarness::getFixture('modX', 'modx');
$modx->getService('registry', 'registry.modRegistry');
Expand Down
6 changes: 4 additions & 2 deletions _build/test/Tests/Model/Registry/modRegisterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
* @group modRegister
*/
class modRegisterTest extends MODxTestCase {
public static function setUpBeforeClass() {
public static function setUpBeforeClass(): void
{
/** @var modX $modx */
$modx =& MODxTestHarness::getFixture('modX', 'modx');
$modx->getService('registry', 'registry.modRegistry');
Expand All @@ -29,7 +30,8 @@ public static function setUpBeforeClass() {
$modx->registry->addRegister('register', 'modMemoryRegister', array('directory' => 'register'));
}

public static function tearDownAfterClass() {
public static function tearDownAfterClass(): void
{
/** @var modX $modx */
$modx =& MODxTestHarness::getFixture('modX', 'modx');
$modx->getService('registry', 'registry.modRegistry');
Expand Down
3 changes: 2 additions & 1 deletion _build/test/Tests/Model/Registry/modRegistryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
* @group modRegistry
*/
class modRegistryTest extends MODxTestCase {
public static function setUpBeforeClass() {
public static function setUpBeforeClass(): void
{
parent::setUpBeforeClass();
$modx =& MODxTestHarness::getFixture('modX', 'modx');
$modx->getService('registry', 'registry.modRegistry');
Expand Down
12 changes: 7 additions & 5 deletions _build/test/Tests/Model/Request/modRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ class modRequestTest extends MODxTestCase {
/**
* @return void
*/
public function setUp() {
public function setUp(): void
{
parent::setUp();
/** @var modNamespace $namespace */
$namespace = $this->modx->newObject('modNamespace');
Expand Down Expand Up @@ -57,7 +58,8 @@ public function setUp() {
/**
* @return void
*/
public function tearDown() {
public function tearDown(): void
{
parent::tearDown();

/** @var modNamespace $namespace */
Expand Down Expand Up @@ -317,9 +319,9 @@ public function providerSanitizeRequest() {
array("MODX [[\$chunk? &property=`test`\n &across=`lines

`&test=1]] Tags",'MODX Tags'),
array("Nested MODX [[test?
&ids = `[[!getids
&field=`id`
array("Nested MODX [[test?
&ids = `[[!getids
&field=`id`
&resource=`[[+resource]]`
]]`
&parents=`2`
Expand Down
Loading
Loading