Skip to content

fix: update url method to check post type visibility - #96

Merged
SimonvanWijhe merged 3 commits into
mainfrom
fix/postdata-url
Aug 18, 2026
Merged

fix: update url method to check post type visibility#96
SimonvanWijhe merged 3 commits into
mainfrom
fix/postdata-url

Conversation

@SimonvanWijhe

Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings August 3, 2026 14:24
@SimonvanWijhe
SimonvanWijhe requested a review from a team as a code owner August 3, 2026 14:24

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates PostData::url() to gate URL generation based on post type visibility (instead of per-post public visibility), aligning unit tests with the new behavior and adjusting PHPStan ignores for the current static analysis findings.

Changes:

  • Switch PostData::url() from is_post_publicly_viewable($id) to is_post_type_viewable($postType).
  • Update PostDataTest to mock is_post_type_viewable() and rename the related expectation.
  • Add a PHPStan ignoreErrors entry for function.alreadyNarrowedType in HasMeta.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
tests/src/PostDataTest.php Updates mocks/expectations to match the new visibility check used by url().
src/PostData.php Changes URL visibility gating and refines typing in dataClass() for PHPStan.
phpstan.neon.dist Adds an ignore rule for newly observed PHPStan warnings in HasMeta.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/PostData.php
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

Coverage report for commit: 90f0803
File: coverage.xml

Cover ┌─────────────────────────┐ Freq.
   0% │ ███████████████████████ │ 75.0%
  10% │ ██░░░░░░░░░░░░░░░░░░░░░ │  6.3%
  20% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  30% │ ██░░░░░░░░░░░░░░░░░░░░░ │  6.3%
  40% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  50% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  60% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  70% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  80% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
  90% │ ░░░░░░░░░░░░░░░░░░░░░░░ │  0.0%
 100% │ ████░░░░░░░░░░░░░░░░░░░ │ 12.5%
      └─────────────────────────┘
 *Legend:* █ = Current Distribution 
Summary - Lines: 9.89% | Methods: 7.27%
FilesLinesMethodsBranches
src/Attributes
   Meta.php--100.00%
   MetaPrefix.php--100.00%
   TaxonomyPrefix.php--100.00%
   Terms.php--100.00%
src
   CommentData.php--100.00%
   ImageData.php--100.00%
   PostData.php8.94%7.41%100.00%
   TermData.php--100.00%
   UserData.php--100.00%
src/Contracts
   PostDataInterface.php100.00%100.00%100.00%
src/Enums
   PostStatus.php--100.00%
src/Mappers
   PostPrefixMapper.php--100.00%
   UserPrefixMapper.php--100.00%
src/Normalizers
   WPPostNormalizer.php--100.00%
src/Providers
   DataServiceProvider.php100.00%100.00%100.00%
src/Traits
   HasMeta.php25.00%-100.00%

🤖 comment via lucassabreu/comment-coverage-clover

@SimonvanWijhe
SimonvanWijhe merged commit aff8ef2 into main Aug 18, 2026
5 checks passed
@SimonvanWijhe
SimonvanWijhe deleted the fix/postdata-url branch August 18, 2026 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants