WordPress / WordPress/phpdoc-parser

value of 'wp-parser-namespace_children' option incorrect after parsing source with hierarchical nmespaces

Open
#213 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
239
Forks
81
Avg merge
16h 29m
Merged PRs (30d)
8

Description

When parsing code that contains hierarchical namespaces, e.g.,

namespace My\Hierarchical\Namespace;

class MyClass {
...
}

terms are created for each step in the hierarchy (My, Hierarchical and Namespace in the example above), but since cache invalidation is suspended during a parse, the wp-parser-namespace_children option is never updated.

This results in, among other things, only the top-level namespace term showing in the WP_Terms_List_Table in the backend

hierarchical-namespace-terms

WP_Parser\Importer::import() correctly deletes wp-parser-package_children and wp-parser-since_children at the end of the parse (which will result in them being rebuilt at the appropriate time), but it seems that wp-parser-namespace_children was forgotten.

PR coming shortly.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in WP_Parser\Importer::import(), where the parser already removes the wp-parser-package_children and wp-parser-since_children options after parsing. Confirm that hierarchical namespace terms leave wp-parser-namespace_children stale, then ensure it is invalidated at the same point. Verify that all namespace levels appear in the WP_Terms_List_Table after parsing.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
documentation
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.