Skip to content

feat: PullRequests Facade#37

Merged
github-actions[bot] merged 1 commit intomasterfrom
feat/facade
Dec 19, 2025
Merged

feat: PullRequests Facade#37
github-actions[bot] merged 1 commit intomasterfrom
feat/facade

Conversation

@jordanpartridge
Copy link
Copy Markdown
Contributor

Summary

Implements #28 by adding a formal Laravel Facade and convenient static shorthand methods for pull request operations.

Changes

Core Implementation

  • Created Facades/PullRequests - Formal Laravel Facade extending Illuminate\Support\Facades\Facade
  • Added static shorthand methods - open(), closed(), merged() for convenient access
  • Renamed instance methods - listOpen(), listClosed() to avoid naming conflicts with static methods
  • Updated ServiceProvider - Registered facade binding for container resolution
  • Added dependency - illuminate/support as dev dependency for facade support

API Examples

// Static shorthand methods (new)
PullRequests::open('owner/repo')->get();
PullRequests::closed('owner/repo')->author('user')->get();
PullRequests::merged('owner/repo')->take(10)->get();

// Existing static methods still work
PullRequests::for('owner/repo')->open()->get();
PullRequests::find('owner/repo', 123);
PullRequests::create('owner/repo', [...]);

// Instance methods (renamed for clarity)
$prs = new PullRequests($connector, 'owner', 'repo');
$prs->listOpen();   // Previously open()
$prs->listClosed(); // Previously closed()

Benefits

  • Ergonomic API following Laravel conventions
  • Full IDE autocomplete support via PHPDoc annotations
  • Improved method discoverability
  • Consistency with Laravel facade patterns
  • Backward compatible (except renamed instance methods)

Test Coverage

  • ✅ All existing tests pass
  • ✅ 100% code coverage maintained
  • ✅ New comprehensive facade tests added
  • ✅ PHPStan static analysis passes
  • ✅ Laravel Pint formatting applied

Quality Gates

composer test           # ✅ 188 tests passing
composer test-coverage  # ✅ 100% coverage
composer analyse        # ✅ No PHPStan errors
composer format         # ✅ Code formatted

Closes #28

This commit implements issue #28 by adding a formal Laravel Facade
and convenient static shorthand methods for pull request operations.

Changes:
- Created `Facades/PullRequests` facade extending Laravel's Facade class
- Added static shorthand methods: `open()`, `closed()`, `merged()`
- Renamed instance methods to avoid conflicts: `listOpen()`, `listClosed()`
- Updated ServiceProvider to register facade binding
- Added comprehensive test coverage for facade functionality
- Added `illuminate/support` as dev dependency for facade support

The facade provides an ergonomic API following Laravel conventions:
```php
// Static query builders
PullRequests::open('owner/repo')->get();
PullRequests::closed('owner/repo')->author('user')->get();
PullRequests::merged('owner/repo')->take(10)->get();

// Existing static methods still work
PullRequests::for('owner/repo')->open()->get();
PullRequests::find('owner/repo', 123);
```

All tests pass with 100% code coverage.
Resolves #28
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Dec 19, 2025

Warning

Rate limit exceeded

@jordanpartridge has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 9 minutes and 36 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 999c734 and 892cfd3.

📒 Files selected for processing (6)
  • composer.json (1 hunks)
  • src/Facades/PullRequests.php (1 hunks)
  • src/PrServiceProvider.php (1 hunks)
  • src/PullRequests.php (2 hunks)
  • tests/Unit/Facades/PullRequestsFacadeTest.php (1 hunks)
  • tests/Unit/PullRequestsFacadeTest.php (1 hunks)
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/facade

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot merged commit dfc8d3e into master Dec 19, 2025
2 checks passed
@github-actions github-actions bot deleted the feat/facade branch December 19, 2025 05:24
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.

Facade: Static PullRequests facade for convenient access

1 participant