28
28
use JMS \TranslationBundle \Logger \LoggerAwareInterface ;
29
29
use JMS \TranslationBundle \Model \Message ;
30
30
use JMS \TranslationBundle \Model \MessageCatalogue ;
31
+ use JMS \TranslationBundle \Model \SourceInterface ;
31
32
use JMS \TranslationBundle \Translation \Extractor \FileVisitorInterface ;
32
33
use JMS \TranslationBundle \Translation \FileSourceFactory ;
33
34
use PhpParser \Comment \Doc ;
@@ -76,7 +77,7 @@ class FormExtractor implements FileVisitorInterface, LoggerAwareInterface, NodeV
76
77
private $ defaultDomain ;
77
78
78
79
/**
79
- * @var string
80
+ * @var array
80
81
*/
81
82
private $ defaultDomainMessages ;
82
83
@@ -203,7 +204,7 @@ public function getDomain(Node $node)
203
204
protected function parseEmptyValueNode (Node $ item , $ domain )
204
205
{
205
206
// Skip empty_value when false
206
- if ($ item ->value instanceof Node \Expr \ConstFetch && $ item ->value ->name instanceof Node \Name && 'false ' === $ item ->value ->name -> parts [0 ]) {
207
+ if ($ item ->value instanceof Node \Expr \ConstFetch && $ item ->value ->name instanceof Node \Name && 'false ' === ( property_exists ( $ item ->value ->name , ' parts ' ) ? $ item -> value -> name -> parts [0 ] : $ item -> value -> name -> getFirst ()) ) {
207
208
return true ;
208
209
}
209
210
@@ -407,6 +408,10 @@ private function parseItem($item, $domain = null)
407
408
$ docComment = $ item ->value ->getDocComment ();
408
409
}
409
410
411
+ if (!$ docComment ) {
412
+ $ docComment = $ item ->getDocComment ();
413
+ }
414
+
410
415
$ docComment = is_object ($ docComment ) ? $ docComment ->getText () : null ;
411
416
412
417
if ($ docComment ) {
@@ -427,7 +432,7 @@ private function parseItem($item, $domain = null)
427
432
// check if the value is explicitly set to false => e.g. for FormField that should be rendered without label
428
433
$ ignore = $ ignore || !$ item ->value instanceof Node \Scalar \String_ || $ item ->value ->value === false ;
429
434
430
- if (!$ item ->value instanceof Node \Scalar \String_ && !$ item ->value instanceof Node \Scalar \LNumber) {
435
+ if (!$ item ->value instanceof Node \Scalar \String_ && !$ item ->value instanceof Node \Scalar \LNumber && ! $ item -> value instanceof Node \ Scalar \Int_ ) {
431
436
if ($ ignore ) {
432
437
return ;
433
438
}
@@ -459,7 +464,7 @@ private function parseItem($item, $domain = null)
459
464
460
465
/**
461
466
* @param string $id
462
- * @param string $source
467
+ * @param SourceInterface $source
463
468
* @param string|null $domain
464
469
* @param string|null $desc
465
470
* @param string|null $meaning
0 commit comments