Skip to content

Commit

Permalink
Update more few places to use PHP 5.4 code
Browse files Browse the repository at this point in the history
  • Loading branch information
jrbasso committed Oct 7, 2012
1 parent a5739e5 commit 4876517
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 23 deletions.
2 changes: 1 addition & 1 deletion lib/Cake/Cache/Cache.php
Expand Up @@ -264,7 +264,7 @@ public static function set($settings = array(), $value = null, $config = 'defaul
$settings = array($settings => $value);
}

$engine = self::engine($config);
$engine = static::engine($config);
if (!$engine) {
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Console/Command/ServerShell.php
Expand Up @@ -127,7 +127,7 @@ public function main() {
$this->_documentRoot
);

$port = ($this->_port == self::DEFAULT_PORT) ? '' : ':' . $this->_port;
$port = ($this->_port == static::DEFAULT_PORT) ? '' : ':' . $this->_port;
$this->out(__d('cake_console', 'built-in server is running in http://%s%s/', $this->_host, $port));
$ret = system($command);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Controller/Component/AuthComponent.php
Expand Up @@ -349,7 +349,7 @@ public function startup(Controller $controller) {
*/
protected function _unauthorized(Controller $controller) {
if (!$this->unauthorizedRedirect) {
throw new ForbiddenException($this->authError);
throw new Error\ForbiddenException($this->authError);
}

$this->flash($this->authError);
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Core/App.php
Expand Up @@ -536,7 +536,7 @@ public static function location($className) {
* @return void
*/
public static function init() {
register_shutdown_function(array(__CLASS__, 'shutdown'));
register_shutdown_function(array(get_called_class(), 'shutdown'));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Core/Configure.php
Expand Up @@ -122,7 +122,7 @@ public static function check($var = null) {
if (empty($var)) {
return false;
}
return Hash::get(self::$_values, $var) !== null;
return Hash::get(static::$_values, $var) !== null;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Model/Datasource/Session.php
Expand Up @@ -278,7 +278,7 @@ protected static function _error($errorNumber) {
if (!is_array(static::$error) || !array_key_exists($errorNumber, static::$error)) {
return false;
}
return self::$error[$errorNumber];
return static::$error[$errorNumber];
}

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Network/Request.php
Expand Up @@ -764,7 +764,7 @@ public function parseAccept() {
* @return If a $language is provided, a boolean. Otherwise the array of accepted languages.
*/
public static function acceptLanguage($language = null) {
$raw = self::_parseAcceptWithQualifier(self::header('Accept-Language'));
$raw = static::_parseAcceptWithQualifier(static::header('Accept-Language'));
$accept = array();
foreach ($raw as $qualifier => $languages) {
foreach ($languages as &$lang) {
Expand Down
8 changes: 0 additions & 8 deletions lib/Cake/Test/TestCase/Utility/DebuggerTest.php
Expand Up @@ -332,10 +332,6 @@ public function testExportVar() {
elementCacheSettings => array()
int => (int) 2
float => (float) 1.333
TEXT;
if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
$expected .= <<<TEXT
[protected] _passedVars => array(
(int) 0 => 'viewVars',
(int) 1 => 'autoLayout',
Expand All @@ -361,10 +357,6 @@ public function testExportVar() {
[protected] _stack => array()
[protected] _eventManager => object(Cake\Event\EventManager) {}
[protected] _eventManagerConfigured => false
TEXT;
}
$expected .= <<<TEXT
}
TEXT;

Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Utility/Hash.php
Expand Up @@ -720,7 +720,7 @@ public static function apply(array $data, $path, $function) {
* - `numeric` Sort by numeric value.
* - `regular` Sort by numeric value.
* - `string` Sort by numeric value.
* - `natural` Sort by natural order. Requires PHP 5.4 or greater.
* - `natural` Sort by natural order.
*
* @param array $data An array of data to sort
* @param string $path A Set-compatible path to the array value
Expand Down
12 changes: 6 additions & 6 deletions lib/Cake/Utility/Time.php
Expand Up @@ -401,11 +401,11 @@ public static function niceShort($dateString = null, $timezone = null) {
__d('cake', 'Friday'),
__d('cake', 'Saturday')
);
if (self::wasWithinLast('7 days', $dateString, $timezone)) {
return sprintf('%s %s', $day[$d], self::_strftime(self::$niceShortFormat, $date));
if (static::wasWithinLast('7 days', $dateString, $timezone)) {
return sprintf('%s %s', $day[$d], static::_strftime(static::$niceShortFormat, $date));
}
if (self::isWithinNext('7 days', $dateString, $timezone)) {
return __d('cake', 'On %s %s', $day[$d], self::_strftime(self::$niceShortFormat, $date));
if (static::isWithinNext('7 days', $dateString, $timezone)) {
return __d('cake', 'On %s %s', $day[$d], static::_strftime(static::$niceShortFormat, $date));
}

$y = '';
Expand Down Expand Up @@ -978,9 +978,9 @@ public static function i18nFormat($date, $format = null, $default = false, $time
* Get list of timezone identifiers
*
* @param integer|string $filter A regex to filter identifer
* Or one of DateTimeZone class constants (PHP 5.3 and above)
* Or one of DateTimeZone class constants
* @param string $country A two-letter ISO 3166-1 compatible country code.
* This option is only used when $filter is set to DateTimeZone::PER_COUNTRY (available only in PHP 5.3 and above)
* This option is only used when $filter is set to DateTimeZone::PER_COUNTRY
* @param boolean $group If true (default value) groups the identifiers list by primary region
* @return array List of timezone identifiers
* @since 2.2
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Utility/Validation.php
Expand Up @@ -409,7 +409,7 @@ public static function decimal($check, $places = null, $regex = null) {
/**
* Validates for an email address.
*
* Only uses getmxrr() checking for deep validation if PHP 5.3.0+ is used, or
* Only uses getmxrr() checking for deep validation, or
* any PHP version on a non-windows distribution
*
* @param string $check Value to check
Expand Down

0 comments on commit 4876517

Please sign in to comment.