Skip to content

Conversation

@tangrufus
Copy link
Member

No description provided.

Copilot AI review requested due to automatic review settings October 26, 2025 20:00
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the type safety of the CopyrightFactory::make() method by changing its parameter type from mixed to array. The change includes adding proper PHPDoc documentation for the expected array structure and moving the type validation logic upstream to the caller.

Key changes:

  • Added explicit array type hint to CopyrightFactory::make() method
  • Added PHPDoc annotation documenting the expected array structure with optional keys
  • Moved array validation from CopyrightFactory::make() to RecordFactory::makeCopyrights()

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/CopyrightFactory.php Updated make() method signature to accept array instead of mixed, added PHPDoc, removed internal validation
src/RecordFactory.php Added upstream validation to filter non-array elements before calling CopyrightFactory::make()

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

if (! is_array($rawCopyrights)) {
return [];
}
$rawCopyrights = array_filter($rawCopyrights, static fn (mixed $s) => is_array($s));
Copy link

Copilot AI Oct 26, 2025

Choose a reason for hiding this comment

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

The array_filter removes non-array elements but doesn't preserve keys. Consider using array_values() after filtering to reindex the array, or verify that maintaining original keys is intentional for downstream processing.

Suggested change
$rawCopyrights = array_filter($rawCopyrights, static fn (mixed $s) => is_array($s));
$rawCopyrights = array_values(array_filter($rawCopyrights, static fn (mixed $s) => is_array($s)));

Copilot uses AI. Check for mistakes.
Comment on lines +14 to +16
* notice?: mixed,
* license?: mixed,
* license_url?: mixed
Copy link

Copilot AI Oct 26, 2025

Choose a reason for hiding this comment

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

The PHPDoc uses mixed types for all array values, which provides limited type information. Consider documenting the expected types (e.g., string) for these fields to improve type safety and developer understanding.

Suggested change
* notice?: mixed,
* license?: mixed,
* license_url?: mixed
* notice?: string|null,
* license?: string|null,
* license_url?: string|null

Copilot uses AI. Check for mistakes.
@codecov
Copy link

codecov bot commented Oct 26, 2025

Codecov Report

❌ Patch coverage is 85.71429% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 88.11%. Comparing base (a264cd5) to head (790a6a9).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/RecordFactory.php 83.33% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main      #31      +/-   ##
============================================
- Coverage     88.50%   88.11%   -0.39%     
  Complexity       77       77              
============================================
  Files            12       12              
  Lines           200      202       +2     
============================================
+ Hits            177      178       +1     
- Misses           23       24       +1     
Flag Coverage Δ
e2e 81.68% <85.71%> (-0.32%) ⬇️
feature 81.68% <85.71%> (-0.32%) ⬇️
unit 84.15% <85.71%> (+0.15%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@tangrufus tangrufus merged commit 5b3203d into main Oct 26, 2025
17 checks passed
@tangrufus tangrufus deleted the type branch October 26, 2025 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

2 participants