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

Commit

Permalink
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
20 changes: 10 additions & 10 deletions src/Translator/Plural/Rule.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ protected function evaluateAstPart(array $ast, $number)
*/
public static function fromString($string)
{
if (self::$parser === null) {
self::$parser = new Parser();
if (static::$parser === null) {
static::$parser = new Parser();
}

if (!preg_match('(nplurals=(?P<nplurals>\d+))', $string, $match)) {
Expand All @@ -202,8 +202,8 @@ public static function fromString($string)
));
}

$tree = self::$parser->parse($match['plural']);
$ast = self::createAst($tree);
$tree = static::$parser->parse($match['plural']);
$ast = static::createAst($tree);

return new self($numPlurals, $ast);
}
Expand All @@ -230,18 +230,18 @@ protected static function createAst(Symbol $symbol)
break;

case '!':
$ast['arguments'][] = self::createAst($symbol->first);
$ast['arguments'][] = static::createAst($symbol->first);
break;

case '?':
$ast['arguments'][] = self::createAst($symbol->first);
$ast['arguments'][] = self::createAst($symbol->second);
$ast['arguments'][] = self::createAst($symbol->third);
$ast['arguments'][] = static::createAst($symbol->first);
$ast['arguments'][] = static::createAst($symbol->second);
$ast['arguments'][] = static::createAst($symbol->third);
break;

default:
$ast['arguments'][] = self::createAst($symbol->first);
$ast['arguments'][] = self::createAst($symbol->second);
$ast['arguments'][] = static::createAst($symbol->first);
$ast['arguments'][] = static::createAst($symbol->second);
break;
}

Expand Down
8 changes: 4 additions & 4 deletions src/Validator/Alnum.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,13 @@ public function isValid($value)
return false;
}

if (null === self::$filter) {
self::$filter = new AlnumFilter();
if (null === static::$filter) {
static::$filter = new AlnumFilter();
}

self::$filter->setAllowWhiteSpace($this->options['allowWhiteSpace']);
static::$filter->setAllowWhiteSpace($this->options['allowWhiteSpace']);

if ($value != self::$filter->filter($value)) {
if ($value != static::$filter->filter($value)) {
$this->error(self::NOT_ALNUM);
return false;
}
Expand Down
10 changes: 5 additions & 5 deletions src/Validator/Alpha.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,14 @@ public function isValid($value)
return false;
}

if (null === self::$filter) {
self::$filter = new AlphaFilter();
if (null === static::$filter) {
static::$filter = new AlphaFilter();
}

//self::$filter->setAllowWhiteSpace($this->allowWhiteSpace);
self::$filter->setAllowWhiteSpace($this->options['allowWhiteSpace']);
//static::$filter->setAllowWhiteSpace($this->allowWhiteSpace);
static::$filter->setAllowWhiteSpace($this->options['allowWhiteSpace']);

if ($value !== self::$filter->filter($value)) {
if ($value !== static::$filter->filter($value)) {
$this->error(self::NOT_ALPHA);
return false;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Validator/PostCode.php
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,8 @@ public function isValid($value)
if ('' === $region) {
throw new Exception\InvalidArgumentException("Locale must contain a region");
}
if (isset(self::$postCodeRegex[$region])) {
$format = self::$postCodeRegex[$region];
if (isset(static::$postCodeRegex[$region])) {
$format = static::$postCodeRegex[$region];
}
}
if (null === $format || '' === $format) {
Expand Down

0 comments on commit 054f09d

Please sign in to comment.