4spacesdk / CI4OrmExtension

OrmExtension for CodeIgniter 4
MIT License
50 stars 9 forks source link

PHP 8.2 compatability #28

Closed markkortleverwebavance closed 1 year ago

markkortleverwebavance commented 1 year ago

Hi,

There are 2 issues when i try to run the Orm on CI 4.3.2 and PHP 8.2

Error 1: The ModelDefinitionCache adds a subfolder to the codeigniter (4.3.2) cache directory. This results in an error in PHP 8.2. Subdirectories are not available in the codeigniter cache.

Solution: Please remove this line from the ModelDefinitionCache.php: $this->config->storePath .= self::$directory;

Error 2: During inheritance of IteratorAggregate: Uncaught ErrorException: Return type of OrmExtension\Extensions\Entity::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/vendor/4spacesdk/ci4ormextension/DataMapper/EntityTrait.php:352

Solution: declare the function as public function getIterator(): ArrayIterator {} since it always returns an ArrayIterator

Thanks in advance

Martin-4Spaces commented 1 year ago

Hi,

Thanks for the feedback. I havn’t had time to test with CI 4.3.2 and PHP 8.2 yet, so great to get your input. Would you like to add the solutions as a pull request?

Martin Hansen Backend

Telefon 23 72 02 89 | Website www.4spaces.dk http://www.4spaces.dk/ | Email @. @.>

On 7 Mar 2023, at 08.39, markkortleverwebavance @.***> wrote:

Hi,

There are 2 issues when i try to run the Orm on CI 4.3.2 and PHP 8.2

Error 1: The ModelDefinitionCache adds a subfolder to the codeigniter (4.3.2) cache directory. This results in an error in PHP 8.2. Subdirectories are not available in the codeigniter cache.

Solution: Please remove this line from the ModelDefinitionCache.php: $this->config->storePath .= self::$directory;

Error 2: During inheritance of IteratorAggregate: Uncaught ErrorException: Return type of OrmExtension\Extensions\Entity::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/vendor/4spacesdk/ci4ormextension/DataMapper/EntityTrait.php:352

Solution: declare the function as public function getIterator(): ArrayIterator {} since it always returns an ArrayIterator

Thanks in advance

— Reply to this email directly, view it on GitHub https://github.com/4spacesdk/CI4OrmExtension/issues/28, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACK5H5BXICQKZUHFCX6OZNLW23Q3PANCNFSM6AAAAAAVSDNOF4. You are receiving this because you are subscribed to this thread.

markkortleverwebavance commented 1 year ago

@Martin-4Spaces pull request is created. https://github.com/4spacesdk/CI4OrmExtension/pull/29