From 88c70b323475cd7879e312637f185ef286e6c589 Mon Sep 17 00:00:00 2001 From: Niklas Forsdahl Date: Fri, 25 Aug 2023 11:07:48 +0300 Subject: [PATCH] Fixed deprecation notices in php 8.2 by using the AllowDynamicProperties annotation on classes that set dynamic properties --- src/Forms/Form.php | 1 + src/ORM/Connect/MySQLDatabase.php | 1 + thirdparty/php-peg/Parser.php | 5 +++++ 3 files changed, 7 insertions(+) diff --git a/src/Forms/Form.php b/src/Forms/Form.php index d4b039d64..2a919a160 100644 --- a/src/Forms/Form.php +++ b/src/Forms/Form.php @@ -65,6 +65,7 @@ use SilverStripe\View\ViewableData; * For example, the "URLSegment" field in a standard CMS form would be * accessible through "admin/EditForm/field/URLSegment/FieldHolder". */ +#[\AllowDynamicProperties] class Form extends ViewableData implements HasRequestHandler { use AttributesHTML; diff --git a/src/ORM/Connect/MySQLDatabase.php b/src/ORM/Connect/MySQLDatabase.php index 6da201f0d..13b4973c3 100644 --- a/src/ORM/Connect/MySQLDatabase.php +++ b/src/ORM/Connect/MySQLDatabase.php @@ -22,6 +22,7 @@ use Exception; * You are advised to backup your tables if changing settings on an existing database * `connection_charset` and `charset` should be equal, similarly so should `connection_collation` and `collation` */ +#[\AllowDynamicProperties] class MySQLDatabase extends Database implements TransactionManager { use Configurable; diff --git a/thirdparty/php-peg/Parser.php b/thirdparty/php-peg/Parser.php index 1ce89193e..d315c7d45 100644 --- a/thirdparty/php-peg/Parser.php +++ b/thirdparty/php-peg/Parser.php @@ -8,6 +8,7 @@ * Of course, the next regex might be outside that bracket - after the bracket if other matches have progressed beyond the match position, or before * the bracket if a failed match + restore has moved the current position backwards - so we have to check that too. */ +#[\AllowDynamicProperties] class ParserRegexp { function __construct( $parser, $rx ) { $this->parser = $parser ; @@ -44,6 +45,7 @@ class ParserRegexp { * - some abstraction of code that would otherwise be repeated many times in a compiled grammer, mostly related to calling user functions * for result construction and building */ +#[\AllowDynamicProperties] class Parser { /** * @var string @@ -202,6 +204,7 @@ class Parser { * * @author Hamish Friedlander */ +#[\AllowDynamicProperties] class Packrat extends Parser { function __construct( $string ) { parent::__construct( $string ) ; @@ -254,6 +257,7 @@ class Packrat extends Parser { * * @author Hamish Friedlander */ +#[\AllowDynamicProperties] class FalseOnlyPackrat extends Parser { function __construct( $string ) { parent::__construct( $string ) ; @@ -288,6 +292,7 @@ class FalseOnlyPackrat extends Parser { * * @author Hamish Friedlander */ +#[\AllowDynamicProperties] class ConservativePackrat extends Parser { function packhas( $key, $pos ) { return isset( $this->packres[$key] ) && $this->packres[$key] !== NULL ;