Skip to content

Fix code review issues: factory calls, debug statements, and type hints#287

Merged
nielsdrost7 merged 2 commits into
developfrom
copilot/sub-pr-282
Dec 29, 2025
Merged

Fix code review issues: factory calls, debug statements, and type hints#287
nielsdrost7 merged 2 commits into
developfrom
copilot/sub-pr-282

Conversation

Copilot AI commented Dec 29, 2025

Copy link
Copy Markdown
Contributor

Addresses 8 code review findings from PR #282 covering incorrect factory usage, debug statements left in production code, missing test attributes, and type safety improvements.

Factory Fixes

  • InvoiceFactory.php - Changed Product::factory() to TaxRate::factory() when creating tax rates
  • ExpenseItemFactory.php - Replaced 4 dd('die early') statements with proper factory fallbacks for Product, ProductUnit, and TaxRate creation

Test Consistency

  • UsersTest.php - Added missing #[Test] and #[Group('crud')] attributes to it_deletes_a_user method

Code Quality

  • NumberFormatter.php - Changed mb_rtrim() to rtrim() for ASCII character trimming (better performance)
  • AbstractAdminPanelTestCase.php - Added ?User type hint to $superAdmin property
// Before: Debug statements halt execution
if (!$taxRate) {
    dd('die early');
}

// After: Factory creates missing records on-the-fly
if (!$taxRate) {
    $taxRate = TaxRate::factory()
        ->state(['company_id' => $company->id])
        ->create();
}

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: nielsdrost7 <47660417+nielsdrost7@users.noreply.github.com>
Copilot AI changed the title [WIP] Merge development branch into master Fix code review issues: factory calls, debug statements, and type hints Dec 29, 2025
Copilot AI requested a review from nielsdrost7 December 29, 2025 13:21
@InvoicePlane InvoicePlane deleted a comment from Copilot AI Dec 29, 2025
@InvoicePlane InvoicePlane deleted a comment from coderabbitai Bot Dec 29, 2025
@nielsdrost7 nielsdrost7 marked this pull request as ready for review December 29, 2025 13:25
@nielsdrost7 nielsdrost7 merged commit 8d446e2 into develop Dec 29, 2025
1 check passed
@nielsdrost7 nielsdrost7 deleted the copilot/sub-pr-282 branch December 29, 2025 13:25
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.

2 participants