Skip to content

Commit

Permalink
Merge pull request #230 from remicollet/issue-php74
Browse files Browse the repository at this point in the history
Fix for PHP 7.4
  • Loading branch information
oscarotero committed Oct 12, 2019
2 parents 739c935 + 15dec68 commit acacf9b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/Extractors/PhpCode.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,11 @@ function ($match) {
case '\\':
return '\\';
case 'x':
return chr(hexdec(substr($match[0], 1)));
return chr(hexdec(substr($match[1], 1)));
case 'u':
return self::unicodeChar(hexdec(substr($match[0], 1)));
return self::unicodeChar(hexdec(substr($match[1], 1)));
default:
return chr(octdec($match[0]));
return chr(octdec($match[1]));
}
},
$value
Expand Down
12 changes: 7 additions & 5 deletions src/Translations.php
Original file line number Diff line number Diff line change
Expand Up @@ -435,11 +435,13 @@ public function find($context, $original = '')
*/
public function countTranslated()
{
$callback = function (Translation $v) {
return ($v->hasTranslation()) ? $v->getTranslation() : null;
};

return count(array_filter(get_object_vars($this), $callback));
$c = 0;
foreach ($this as $v) {
if ($v->hasTranslation()) {
$c++;
}
}
return $c;
}

/**
Expand Down

0 comments on commit acacf9b

Please sign in to comment.