Skip to content

Commit a554256

Browse files
committed
Adapt to gettext 5.5.0
1 parent 36f7689 commit a554256

File tree

3 files changed

+29
-2
lines changed

3 files changed

+29
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,16 @@
22

33
All notable changes to this project will be documented in this file.
44

5-
The format is based on [Keep a Changelog](http://keepachangelog.com/)
5+
The format is based on [Keep a Changelog](http://keepachangelog.com/)
66
and this project adheres to [Semantic Versioning](http://semver.org/).
77

88
## [1.2.0] - Unreleased
99
### Added
1010
- Function scanner extracts not only functions calls but also class methods calls.
1111

12+
### Fixed
13+
- Support for `gettext/gettext v5.5.0`
14+
1215
## [1.1.1] - 2019-11-25
1316
### Fixed
1417
- Extract comments of functions prepended with echo, print or return [#6]

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"require": {
2121
"php": "^7.2",
2222
"nikic/php-parser": "^4.2",
23-
"gettext/gettext": "^5.2.0"
23+
"gettext/gettext": "dev-feature/functions-handlers-trait"
2424
},
2525
"require-dev": {
2626
"phpunit/phpunit": "^8.0",

src/PhpScanner.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,30 @@
1010
*/
1111
class PhpScanner extends CodeScanner
1212
{
13+
use FunctionsHandlersTrait;
14+
15+
protected $functions = [
16+
'gettext' => 'gettext',
17+
'_' => 'gettext',
18+
'__' => 'gettext',
19+
'ngettext' => 'ngettext',
20+
'n__' => 'ngettext',
21+
'pgettext' => 'pgettext',
22+
'p__' => 'pgettext',
23+
'dgettext' => 'dgettext',
24+
'd__' => 'dgettext',
25+
'dngettext' => 'dngettext',
26+
'dn__' => 'dngettext',
27+
'dpgettext' => 'dpgettext',
28+
'dp__' => 'dpgettext',
29+
'npgettext' => 'npgettext',
30+
'np__' => 'npgettext',
31+
'dnpgettext' => 'dnpgettext',
32+
'dnp__' => 'dnpgettext',
33+
'noop' => 'gettext',
34+
'noop__' => 'gettext',
35+
];
36+
1337
public function getFunctionsScanner(): FunctionsScannerInterface
1438
{
1539
return new PhpFunctionsScanner(array_keys($this->functions));

0 commit comments

Comments
 (0)