Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 14 additions & 22 deletions generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,23 @@ if [ ! -d vendor ]; then
fi

if [ -r source/wordpress/wp-includes/Requests/Cookie/Jar.php ]; then
# Exclude globals.
"$(dirname "$0")/vendor/bin/generate-stubs" \
--force \
--finder=finder.php \
--visitor=visitor.php \
--header="$HEADER" \
--functions \
--classes \
--interfaces \
--traits \
--out="$FILE"
VISITOR=visitor.php
else
# Exclude globals.
"$(dirname "$0")/vendor/bin/generate-stubs" \
--force \
--finder=finder.php \
--visitor=visitor62.php \
--header="$HEADER" \
--functions \
--classes \
--interfaces \
--traits \
--out="$FILE"
VISITOR=visitor62.php
fi

# Exclude globals.
"$(dirname "$0")/vendor/bin/generate-stubs" \
--force \
--finder=finder.php \
--visitor="$VISITOR" \
--header="$HEADER" \
--functions \
--classes \
--interfaces \
--traits \
--out="$FILE"

# Use literal-string type for wpdb::prepare() query statement parameter.
sed -i -e 's#^.*@param string \+\$query \+Query statement.*$#&\n * @phpstan-param literal-string $query#' "$FILE"

Expand Down
7 changes: 6 additions & 1 deletion visitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,11 @@ public function format(int $level = 1): array
*/
private $functionMap = null;

/**
* @var string
*/
public $functionMapFile = __DIR__ . '/functionMap.php';

/**
* @var array<string, array<int, WordPressTag>>
*/
Expand Down Expand Up @@ -619,7 +624,7 @@ private static function getMatchingInheritedTag(Param $param, array $tags, strin
private function getAdditionalTagsFromMap(string $symbolName): array
{
if (! isset($this->functionMap)) {
$this->functionMap = require __DIR__ . '/functionMap.php';
$this->functionMap = require $this->functionMapFile;
}

if (! isset($this->functionMap[$symbolName])) {
Expand Down
Loading