Skip to content

Commit

Permalink
Book module support: keys optional; bid can be new or FALSE; add orig…
Browse files Browse the repository at this point in the history
…inal_bid, parent_depth_limit. (#593)

Co-authored-by: M Parker <mparker17@users.noreply.github.com>
  • Loading branch information
mparker17 and mparker17 authored Jul 25, 2023
1 parent 04ad273 commit 0b93022
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 18 deletions.
36 changes: 19 additions & 17 deletions stubs/Drupal/node/NodeInterface.stub
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/src/Type/data/book-module.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

0 comments on commit 0b93022

Please sign in to comment.