46
46
use function ltrim ;
47
47
use function mb_strlen ;
48
48
use function mb_strpos ;
49
- use function self ;
50
49
use function sprintf ;
51
50
use function str_replace ;
52
51
use function strlen ;
@@ -531,7 +530,7 @@ protected static function printTypeDirectives($type, array $options, string $ind
531
530
// Enabled?
532
531
$ filter = $ options ['printDirectives ' ] ?? null ;
533
532
534
- if (!$ filter || ! is_callable ($ filter )) {
533
+ if (!is_callable ($ filter )) {
535
534
if ($ type instanceof EnumValueDefinition || $ type instanceof FieldDefinition) {
536
535
return static ::printDeprecated ($ type );
537
536
}
@@ -542,12 +541,11 @@ protected static function printTypeDirectives($type, array $options, string $ind
542
541
// AST Node available and has directives?
543
542
$ node = $ type ->astNode ;
544
543
545
- if (! $ node ) {
544
+ if ($ node === null ) {
546
545
return '' ;
547
546
}
548
547
549
548
// Print
550
- /** @var array<string> $directives */
551
549
$ length = 0 ;
552
550
$ directives = [];
553
551
@@ -562,7 +560,7 @@ protected static function printTypeDirectives($type, array $options, string $ind
562
560
// empty
563
561
}
564
562
565
- if ($ string ) {
563
+ if ($ string !== null ) {
566
564
$ length = $ length + mb_strlen ($ string );
567
565
$ directives [] = $ string ;
568
566
}
@@ -571,7 +569,7 @@ protected static function printTypeDirectives($type, array $options, string $ind
571
569
// Multiline?
572
570
$ serialized = '' ;
573
571
574
- if ($ directives ) {
572
+ if (count ( $ directives) > 0 ) {
575
573
$ delimiter = static ::isLineTooLong ($ length ) ? "\n{$ indentation }" : ' ' ;
576
574
$ serialized = $ delimiter .implode ($ delimiter , $ directives );
577
575
}
@@ -632,7 +630,7 @@ protected static function printLines(array $lines, string $begin, string $end, b
632
630
{
633
631
$ block = '' ;
634
632
635
- if ($ lines ) {
633
+ if (count ( $ lines) > 0 ) {
636
634
$ forceMultiline = $ forceMultiline || static ::isLineTooLong (array_sum (array_map ('mb_strlen ' , $ lines )));
637
635
638
636
if ($ forceMultiline ) {
0 commit comments