bcit-ci / CodeIgniter

Open Source PHP Framework (originally from EllisLab)
https://codeigniter.com/
MIT License
18.27k stars 7.6k forks source link

FIX: Fixes dynamic property deprecation error #6193

Closed zanderwar closed 1 year ago

zanderwar commented 1 year ago

Closes #6192

Let me know if you would prefer a scope other than public (as Mock_Core_URI needs access to it, I'm assuming public is fine.)

ubeljan commented 1 year ago

I think a better way is to implement #[\AllowDynamicProperties] Shorter and easier. I give you my changes.

/system/core/URI.php

#[\AllowDynamicProperties]

class CI_URI {

/system/core/Router.php

#[\AllowDynamicProperties]

class CI_Router {

/system/core/Loader.php

#[\AllowDynamicProperties]

class CI_Loader {

/system/core/Controller.php

#[\AllowDynamicProperties]

class CI_Controller {     

/system/core/DB_driver.php

#[\AllowDynamicProperties]

abstract class CI_DB_driver {
zanderwar commented 1 year ago

I think a better way is to implement #[\AllowDynamicProperties] Shorter and easier. I give you my changes.

/system/core/URI.php

#[\AllowDynamicProperties]

class CI_URI {

/system/core/Router.php

#[\AllowDynamicProperties]

class CI_Router {

/system/core/Loader.php

#[\AllowDynamicProperties]

class CI_Loader {

/system/core/Controller.php

#[\AllowDynamicProperties]

class CI_Controller {     

/system/core/DB_driver.php

#[\AllowDynamicProperties]

abstract class CI_DB_driver {

Thanks, but thats a bit of a hack for lazy people. IDE auto-completion would be more grateful for the explicit declaration of the properties on the class; so will developers...

If that's the route the maintainers want to take then thats up to their discretion, personally never used codeigniter 👍

gxgpet commented 1 year ago

6173

behdadpourtavakoli commented 10 months ago

I think a better way is to implement #[\AllowDynamicProperties] Shorter and easier. I give you my changes.

/system/core/URI.php

#[\AllowDynamicProperties]

class CI_URI {

/system/core/Router.php

#[\AllowDynamicProperties]

class CI_Router {

/system/core/Loader.php

#[\AllowDynamicProperties]

class CI_Loader {

/system/core/Controller.php

#[\AllowDynamicProperties]

class CI_Controller {     

/system/core/DB_driver.php

#[\AllowDynamicProperties]

abstract class CI_DB_driver {

Thanks a lot. It's really working. I needed to use Codeigniter v3.0.6, but the Codeigniter source normally made some errors, until I found this troubleshoot. Thanks a lot again.