Skip to content

Commit 04561aa

Browse files
committed
phpstan fixes.
1 parent bd48680 commit 04561aa

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/Utils/SchemaPrinter.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
use function ltrim;
4747
use function mb_strlen;
4848
use function mb_strpos;
49-
use function self;
5049
use function sprintf;
5150
use function str_replace;
5251
use function strlen;
@@ -531,7 +530,7 @@ protected static function printTypeDirectives($type, array $options, string $ind
531530
// Enabled?
532531
$filter = $options['printDirectives'] ?? null;
533532

534-
if (!$filter || !is_callable($filter)) {
533+
if (!is_callable($filter)) {
535534
if ($type instanceof EnumValueDefinition || $type instanceof FieldDefinition) {
536535
return static::printDeprecated($type);
537536
}
@@ -542,12 +541,11 @@ protected static function printTypeDirectives($type, array $options, string $ind
542541
// AST Node available and has directives?
543542
$node = $type->astNode;
544543

545-
if (!$node) {
544+
if ($node === null) {
546545
return '';
547546
}
548547

549548
// Print
550-
/** @var array<string> $directives */
551549
$length = 0;
552550
$directives = [];
553551

@@ -562,7 +560,7 @@ protected static function printTypeDirectives($type, array $options, string $ind
562560
// empty
563561
}
564562

565-
if ($string) {
563+
if ($string !== null) {
566564
$length = $length + mb_strlen($string);
567565
$directives[] = $string;
568566
}
@@ -571,7 +569,7 @@ protected static function printTypeDirectives($type, array $options, string $ind
571569
// Multiline?
572570
$serialized = '';
573571

574-
if ($directives) {
572+
if (count($directives) > 0) {
575573
$delimiter = static::isLineTooLong($length) ? "\n{$indentation}" : ' ';
576574
$serialized = $delimiter.implode($delimiter, $directives);
577575
}
@@ -632,7 +630,7 @@ protected static function printLines(array $lines, string $begin, string $end, b
632630
{
633631
$block = '';
634632

635-
if ($lines) {
633+
if (count($lines) > 0) {
636634
$forceMultiline = $forceMultiline || static::isLineTooLong(array_sum(array_map('mb_strlen', $lines)));
637635

638636
if ($forceMultiline) {

0 commit comments

Comments
 (0)