Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Commit

Permalink
[#4380] CS fixes
Browse files Browse the repository at this point in the history
- s/Extensions/Extension/g
- Added explanatory comments
- Alias both exception types in DateTime validator
  • Loading branch information
weierophinney committed May 2, 2013
1 parent b809625 commit fd23bc5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
3 changes: 2 additions & 1 deletion library/Zend/Form/View/Helper/FormDateTimeSelect.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,13 @@ class FormDateTimeSelect extends FormDateSelectHelper
protected $timeType;

/**
* @throws Exception\ExtensionsNotLoadedException if ext/intl is not present
* @throws Exception\ExtensionNotLoadedException if ext/intl is not present
*/
public function __construct()
{
parent::__construct();

// Delaying initialization until we know ext/intl is available
$this->timeType = IntlDateFormatter::LONG;
}

Expand Down
3 changes: 2 additions & 1 deletion library/Zend/Form/View/Helper/FormMonthSelect.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class FormMonthSelect extends AbstractHelper
protected $locale;

/**
* @throws Exception\ExtensionsNotLoadedException if ext/intl is not present
* @throws Exception\ExtensionNotLoadedException if ext/intl is not present
*/
public function __construct()
{
Expand All @@ -58,6 +58,7 @@ public function __construct()
));
}

// Delaying initialization until we know ext/intl is available
$this->dateType = IntlDateFormatter::LONG;
}

Expand Down
9 changes: 5 additions & 4 deletions library/Zend/I18n/Validator/DateTime.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use Traversable;
use Zend\I18n\Exception as I18nException;
use Zend\Validator\AbstractValidator;
use Zend\Validator\Exception;
use Zend\Validator\Exception as ValidatorException;

class DateTime extends AbstractValidator
{
Expand Down Expand Up @@ -81,7 +81,7 @@ class DateTime extends AbstractValidator
* Constructor for the Date validator
*
* @param array|Traversable $options
* @throws Exception\ExtensionNotLoadedException if ext/intl is not present
* @throws I18nException\ExtensionNotLoadedException if ext/intl is not present
*/
public function __construct($options = array())
{
Expand All @@ -92,6 +92,7 @@ public function __construct($options = array())
));
}

// Delaying initialization until we know ext/intl is available
$this->dateType = IntlDateFormatter::NONE;
$this->timeType = IntlDateFormatter::NONE;
$this->calendar = IntlDateFormatter::GREGORIAN;
Expand Down Expand Up @@ -252,7 +253,7 @@ public function getLocale()
*
* @param string $value
* @return bool
* @throws Exception\InvalidArgumentException
* @throws ValidatorException\InvalidArgumentException
*/
public function isValid($value)
{
Expand All @@ -267,7 +268,7 @@ public function isValid($value)
$formatter = $this->getIntlDateFormatter();

if (intl_is_failure($formatter->getErrorCode())) {
throw new Exception\InvalidArgumentException("Invalid locale string given");
throw new ValidatorException\InvalidArgumentException("Invalid locale string given");
}

$position = 0;
Expand Down

0 comments on commit fd23bc5

Please sign in to comment.