Skip to content

Commit

Permalink
[Locale] changed method name
Browse files Browse the repository at this point in the history
  • Loading branch information
eriksencosta committed Apr 14, 2012
1 parent bb61e09 commit 663d218
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
Expand Up @@ -155,7 +155,7 @@ public function parse(\DateTime $dateTime, $value)
}

// behave like the intl extension
StubIntl::setErrorCode(StubIntl::U_PARSE_ERROR, 'Date parsing failed');
StubIntl::setError(StubIntl::U_PARSE_ERROR, 'Date parsing failed');

return false;
}
Expand Down Expand Up @@ -292,7 +292,7 @@ protected function calculateUnixTimestamp(\DateTime $dateTime, array $options)

// If month is false, return immediately (intl behavior)
if (false === $month) {
StubIntl::setErrorCode(StubIntl::U_PARSE_ERROR, 'Date parsing failed');
StubIntl::setError(StubIntl::U_PARSE_ERROR, 'Date parsing failed');

return false;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/Locale/Stub/StubIntl.php
Expand Up @@ -102,14 +102,14 @@ static public function getErrorMessage()
}

/**
* Sets the current error code
* Sets the current error
*
* @param integer $code One of the error constants in this class
* @param string $message The ICU class error message
*
* @throws \InvalidArgumentException If the code is not one of the error constants in this class
*/
static public function setErrorCode($code, $message = '')
static public function setError($code, $message = '')
{
if (!isset(self::$errorCodes[$code])) {
throw new \InvalidArgumentException(sprintf('No such error code: "%s"', $code));
Expand Down
Expand Up @@ -180,7 +180,7 @@ public function format($timestamp)

// behave like the intl extension
if (!is_int($timestamp) && version_compare(\PHP_VERSION, '5.3.4', '<')) {
StubIntl::setErrorCode(StubIntl::U_ILLEGAL_ARGUMENT_ERROR);
StubIntl::setError(StubIntl::U_ILLEGAL_ARGUMENT_ERROR, 'datefmt_format: takes either an array or an integer timestamp value ');

return false;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Locale/Stub/StubNumberFormatter.php
Expand Up @@ -501,7 +501,7 @@ public function parse($value, $type = self::TYPE_DOUBLE, &$position = null)

// Any string before the numeric value causes error in the parsing
if (isset($matches[1]) && !empty($matches[1])) {
StubIntl::setErrorCode(StubIntl::U_PARSE_ERROR);
StubIntl::setError(StubIntl::U_PARSE_ERROR);
$this->errorCode = StubIntl::getErrorCode();
$this->errorMessage = StubIntl::getErrorMessage();

Expand Down

0 comments on commit 663d218

Please sign in to comment.