propelorm / Propel2

Propel2 is an open-source high-performance Object-Relational Mapping (ORM) for modern PHP
http://propelorm.org/
MIT License
1.26k stars 399 forks source link

Fix php8.2 deprecation - Use of "parent" in callables is deprecated #2015

Open ldaspt opened 2 months ago

ldaspt commented 2 months ago

@see https://3v4l.org/dbOp6 when using is_callable('parent::preSave')

Output for 8.2.0 - 8.2.23, 8.3.0 - 8.3.11
    Deprecated: Use of "parent" in callables is deprecated in /in/dbOp6 on line 15
    Foo::preSave
    Bar::preSave
Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.34, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.29
    Foo::preSave
    Bar::preSave

@see https://3v4l.org/OrSnV when using is_callable([parent::class, 'preSave']), the syntax is also compatible with PHP 7.4, minimal version of the Propel library

Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.34, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.29, 8.2.0 - 8.2.23, 8.3.0 - 8.3.11
    Foo::preSave
    Bar::preSave
Output for 5.4.0 - 5.4.45
    Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /in/OrSnV on line 15

    Process exited with code 255.