-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Introduce Zend\I18n\Filter\NumberParse based on Zend\I18n\Filter\NumberFormat #4510
Conversation
Credits for the code and tests should go to @cgmartin because everything is just based on |
Actually, @denixport gets the credit as original author. I'm just a curious bystander. :) Also, see my comments in #4495 . Thanks! |
I think that initially dual behavior of the filter was bad Idea of mine. But no way to change it because of BC. So separate filter seems like good idea, just few notes:
|
As suggested by @denixport.
@denixport Thanks for your suggestion, I will take care of it! Got a question though: Do you think it will make more sense to change the order of inheritance? The |
@denixport For consistency reasons, either |
|
* @link http://github.com/zendframework/zf2 for the canonical source repository | ||
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
* @package Zend_I18n |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove @Package
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
As suggested by @samsonasik.
public function filter($value) | ||
{ | ||
if (!is_int($value) | ||
|| !is_float($value)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should probably be &&
.
$formatter = $this->getFormatter(); | ||
$type = $this->getType(); | ||
if (!is_int($value) | ||
&& !is_float($value)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
closing paren and opening brace on next line, please:
if (!is_int($value)
&& !is_float($value)
) {
Introduce Zend\I18n\Filter\NumberParse based on Zend\I18n\Filter\NumberFormat
Merged to develop for release with 2.3.0. |
- Move closing paren/opening brace to next line - constructor (multi-line definition) - if statement (multi-line conditional)
Related to zendframework/zf2/#4493 and zendframework/zendframework#4510
…eature/number-filter Introduce Zend\I18n\Filter\NumberParse based on Zend\I18n\Filter\NumberFormat
- Move closing paren/opening brace to next line - constructor (multi-line definition) - if statement (multi-line conditional)
…eature/number-filter Introduce Zend\I18n\Filter\NumberParse based on Zend\I18n\Filter\NumberFormat
This PR is related to #4493 and replaces #4495 and introduces
Zend\I18n\Filter\NumberParse
which filters a string parseable byNumberFormatter
to a number.Ping @cgmartin.