From 396de4cc6a5453e82ed57418ae7b9d1f02daa2f6 Mon Sep 17 00:00:00 2001 From: M Parker Date: Mon, 24 Jul 2023 14:51:59 -0400 Subject: [PATCH] Book module: keys optional, bid can be new or FALSE; original_bid, parent_depth_limit. --- stubs/Drupal/node/NodeInterface.stub | 36 +++++++++++++++------------- tests/src/Type/data/book-module.php | 2 +- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/stubs/Drupal/node/NodeInterface.stub b/stubs/Drupal/node/NodeInterface.stub index 6ff734b1..0659b8cf 100644 --- a/stubs/Drupal/node/NodeInterface.stub +++ b/stubs/Drupal/node/NodeInterface.stub @@ -10,23 +10,25 @@ use Drupal\Core\Entity\ContentEntityInterface; /** * @phpstan-type BookData array{ - * nid: int|numeric-string, - * bid: int|numeric-string, - * pid: int|numeric-string, - * has_children: int|numeric-string|bool, - * weight: int|numeric-string, - * depth: int|numeric-string, - * p1: int|numeric-string, - * p2: int|numeric-string, - * p3: int|numeric-string, - * p4: int|numeric-string, - * p5: int|numeric-string, - * p6: int|numeric-string, - * p7: int|numeric-string, - * p8: int|numeric-string, - * p9: int|numeric-string, - * link_path: string, - * link_title: string, + * "nid"?: int|numeric-string, + * "bid"?: int|'new'|numeric-string|false, + * "original_bid"?: int|numeric-string, + * "pid"?: int|numeric-string, + * "parent_depth_limit"?: int|numeric-string, + * "has_children"?: int|numeric-string|bool, + * "weight"?: int|numeric-string, + * "depth"?: int|numeric-string, + * "p1"?: int|numeric-string, + * "p2"?: int|numeric-string, + * "p3"?: int|numeric-string, + * "p4"?: int|numeric-string, + * "p5"?: int|numeric-string, + * "p6"?: int|numeric-string, + * "p7"?: int|numeric-string, + * "p8"?: int|numeric-string, + * "p9"?: int|numeric-string, + * "link_path"?: string, + * "link_title"?: string, * } * * @property BookData $book diff --git a/tests/src/Type/data/book-module.php b/tests/src/Type/data/book-module.php index bac81efd..a09c7422 100644 --- a/tests/src/Type/data/book-module.php +++ b/tests/src/Type/data/book-module.php @@ -6,4 +6,4 @@ use function PHPStan\Testing\assertType; $node = Node::create(['type' => 'book']); -assertType('array{nid: int|numeric-string, bid: int|numeric-string, pid: int|numeric-string, has_children: bool|int|numeric-string, weight: int|numeric-string, depth: int|numeric-string, p1: int|numeric-string, p2: int|numeric-string, p3: int|numeric-string, p4: int|numeric-string, p5: int|numeric-string, p6: int|numeric-string, p7: int|numeric-string, p8: int|numeric-string, p9: int|numeric-string, link_path: string, link_title: string}', $node->book); +assertType('array{nid?: int|numeric-string, bid?: \'new\'|int|numeric-string|false, original_bid?: int|numeric-string, pid?: int|numeric-string, parent_depth_limit?: int|numeric-string, has_children?: bool|int|numeric-string, weight?: int|numeric-string, depth?: int|numeric-string, p1?: int|numeric-string, p2?: int|numeric-string, p3?: int|numeric-string, p4?: int|numeric-string, p5?: int|numeric-string, p6?: int|numeric-string, p7?: int|numeric-string, p8?: int|numeric-string, p9?: int|numeric-string, link_path?: string, link_title?: string}', $node->book);