Skip to content

Commit 9f3f6b9

Browse files
westonruterclaude
andcommitted
Add PHPStan object shape typing for WP_Post_Type::$cap and WP_Taxonomy::$cap
Document the well-known capability properties via @phpstan-var object{...} so static analysis can verify capability access on these properties. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 1bc006c commit 9f3f6b9

2 files changed

Lines changed: 25 additions & 0 deletions

File tree

src/wp-includes/class-wp-post-type.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,24 @@ final class WP_Post_Type {
339339
*
340340
* @since 4.6.0
341341
* @var stdClass $cap
342+
*
343+
* @phpstan-var object{
344+
* edit_post: string,
345+
* read_post: string,
346+
* delete_post: string,
347+
* edit_posts: string,
348+
* edit_others_posts: string,
349+
* delete_posts: string,
350+
* publish_posts: string,
351+
* read_private_posts: string,
352+
* create_posts: string,
353+
* read?: string,
354+
* delete_private_posts?: string,
355+
* delete_published_posts?: string,
356+
* delete_others_posts?: string,
357+
* edit_private_posts?: string,
358+
* edit_published_posts?: string,
359+
* }
342360
*/
343361
public $cap;
344362

src/wp-includes/class-wp-taxonomy.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,13 @@ final class WP_Taxonomy {
162162
*
163163
* @since 4.7.0
164164
* @var stdClass
165+
*
166+
* @phpstan-var object{
167+
* manage_terms: string,
168+
* edit_terms: string,
169+
* delete_terms: string,
170+
* assign_terms: string,
171+
* }
165172
*/
166173
public $cap;
167174

0 commit comments

Comments
 (0)