From 405d086ef32968fd67b36ee36ebae4d9066d7129 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Tue, 25 Jan 2022 21:10:34 -0500 Subject: [PATCH] APIv4 - Rename 'ReadOnly' trait to 'ReadOnlyEntity' to avoid PHP fatal error Fixes dev/core#3043 The word 'readonly' is reserved as of php 8.1 --- Civi/Api4/EntityFinancialTrxn.php | 2 +- Civi/Api4/FinancialItem.php | 2 +- Civi/Api4/FinancialTrxn.php | 2 +- Civi/Api4/Generic/Traits/{ReadOnly.php => ReadOnlyEntity.php} | 2 +- Civi/Api4/LineItem.php | 2 +- tests/phpunit/api/v4/Entity/ConformanceTest.php | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) rename Civi/Api4/Generic/Traits/{ReadOnly.php => ReadOnlyEntity.php} (98%) diff --git a/Civi/Api4/EntityFinancialTrxn.php b/Civi/Api4/EntityFinancialTrxn.php index 091c858c33..ba4cdb89a4 100644 --- a/Civi/Api4/EntityFinancialTrxn.php +++ b/Civi/Api4/EntityFinancialTrxn.php @@ -22,7 +22,7 @@ namespace Civi\Api4; */ class EntityFinancialTrxn extends Generic\DAOEntity { use Generic\Traits\EntityBridge; - use Generic\Traits\ReadOnly; + use Generic\Traits\ReadOnlyEntity; /** * @return array diff --git a/Civi/Api4/FinancialItem.php b/Civi/Api4/FinancialItem.php index 9ca7131a92..7c73c78d0f 100644 --- a/Civi/Api4/FinancialItem.php +++ b/Civi/Api4/FinancialItem.php @@ -22,6 +22,6 @@ namespace Civi\Api4; * @package Civi\Api4 */ class FinancialItem extends Generic\DAOEntity { - use Generic\Traits\ReadOnly; + use Generic\Traits\ReadOnlyEntity; } diff --git a/Civi/Api4/FinancialTrxn.php b/Civi/Api4/FinancialTrxn.php index e91fa7c799..15a3657dac 100644 --- a/Civi/Api4/FinancialTrxn.php +++ b/Civi/Api4/FinancialTrxn.php @@ -25,6 +25,6 @@ namespace Civi\Api4; * @package Civi\Api4 */ class FinancialTrxn extends Generic\DAOEntity { - use Generic\Traits\ReadOnly; + use Generic\Traits\ReadOnlyEntity; } diff --git a/Civi/Api4/Generic/Traits/ReadOnly.php b/Civi/Api4/Generic/Traits/ReadOnlyEntity.php similarity index 98% rename from Civi/Api4/Generic/Traits/ReadOnly.php rename to Civi/Api4/Generic/Traits/ReadOnlyEntity.php index 5c9abe2ce9..1818ff6aa4 100644 --- a/Civi/Api4/Generic/Traits/ReadOnly.php +++ b/Civi/Api4/Generic/Traits/ReadOnlyEntity.php @@ -14,7 +14,7 @@ namespace Civi\Api4\Generic\Traits; /** * Trait for Entities not intended to be publicly writable. */ -trait ReadOnly { +trait ReadOnlyEntity { /** * Not intended to be used outside CiviCRM core code. diff --git a/Civi/Api4/LineItem.php b/Civi/Api4/LineItem.php index 2cf59426db..fb1ec13b3e 100644 --- a/Civi/Api4/LineItem.php +++ b/Civi/Api4/LineItem.php @@ -18,6 +18,6 @@ namespace Civi\Api4; * @package Civi\Api4 */ class LineItem extends Generic\DAOEntity { - use Generic\Traits\ReadOnly; + use Generic\Traits\ReadOnlyEntity; } diff --git a/tests/phpunit/api/v4/Entity/ConformanceTest.php b/tests/phpunit/api/v4/Entity/ConformanceTest.php index 7194f288ec..4c5e4c6466 100644 --- a/tests/phpunit/api/v4/Entity/ConformanceTest.php +++ b/tests/phpunit/api/v4/Entity/ConformanceTest.php @@ -515,7 +515,7 @@ class ConformanceTest extends UnitTestCase implements HookInterface { * @return bool */ protected function isReadOnly($entityClass) { - return in_array('ReadOnly', $entityClass::getInfo()['type'], TRUE); + return in_array('ReadOnlyEntity', $entityClass::getInfo()['type'], TRUE); } /** -- 2.25.1