1. 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

Discussion in 'Resolved Bug Reports' started by guiltar, Sep 20, 2014.

  1. guiltar

    guiltar Well-Known Member

    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.
     
  2. Chris D

    Chris D XenForo Developer Staff Member

  3. guiltar

    guiltar Well-Known Member

    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));
            }
     
  4. Chris D

    Chris D XenForo Developer Staff Member

    That's a warning. It doesn't prevent installation.

    From install/templates/install_index.php:
    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.
     
  5. Chris D

    Chris D XenForo Developer Staff Member

    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));
        }
     
  6. Mike

    Mike XenForo Developer Staff Member

    As mentioned, XenForo only requires PHP 5.2. If we required 5.3, LSB would be one of the least important new features that we could use.
     

Share This Page