• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Not a bug Change 'self' to 'static' for late static binding in callbacks

guiltar

Well-known member
#1
Last versions of XenForo require minimal PHP version 5.3.3. It means that it's already possible to use late static binding and it's possible to use static method by 'static'.

That's why it's time to replace self::method() to static::method(). Also it's reasonable to replace self to static in description of callbacks, for example, in XenForo_Template_Helper_Core::$helperCallbacks, etc.

It will make easier extending of static methods in addon development.
 

guiltar

Well-known member
#3
XenForo_Install_Model_Install

PHP:
    public function getRequirementWarnings(Zend_Db_Adapter_Abstract $db = null)
    {
        $warnings = array();

        $phpVersion = phpversion();
        if (version_compare($phpVersion, '5.3.3', '<'))
        {
            $warnings['phpVersion'] = new XenForo_Phrase('php_version_x_outdated_upgrade', array('version' => $phpVersion));
        }
 

Chris D

XenForo developer
Staff member
#4
That's a warning. It doesn't prevent installation.

From install/templates/install_index.php:
These may affect the proper execution of XenForo at times and should be resolved if possible.
However, you may still continue with the installation.
You can install XenForo if you are running PHP 5.2.11 or above.

Therefore this would be a suggestion, more than likely for XF 2 which has already been stated as when the (major) PHP version requirements would change.
 

Chris D

XenForo developer
Staff member
#5
Incidentally, this is the code that would lead to installation being prevented:
PHP:
public function getRequirementErrors(Zend_Db_Adapter_Abstract $db = null)
{
    $errors = array();

    $phpVersion = phpversion();
    if (version_compare($phpVersion, '5.2.11', '<'))
    {
        $errors['phpVersion'] = new XenForo_Phrase('php_version_x_does_not_meet_requirements', array('version' => $phpVersion));
    }