Skip to content

feat: correct eloquent types #191

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

feat: correct eloquent types #191

wants to merge 6 commits into from

Conversation

storyn26383
Copy link
Contributor

No description provided.

@albertcht albertcht requested a review from Copilot August 16, 2025 04:56
@albertcht albertcht added the enhancement Improved feature or adjustments. label Aug 16, 2025
Copy link

@Copilot 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 pull request corrects and improves Eloquent types throughout the codebase by adding comprehensive type annotations for the database layer, collection classes, and relationship definitions. The primary goal is to enhance type safety and improve IDE support for Eloquent models and their relationships.

  • Adds generic type annotations for Eloquent models, builders, collections, and relationships
  • Implements proper type safety for query operations and relationship methods
  • Updates PHPStan configuration to support new type checking requirements

Reviewed Changes

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

Show a summary per file
File Description
types/* New type test files verifying Eloquent model, builder, and relationship type annotations
src/core/src/Database/Eloquent/* Enhanced Eloquent classes with comprehensive generic type annotations
src/support/src/* Updated support classes with proper generic type templates
phpstan.neon.dist Updated PHPStan configuration and version requirement
composer.json Upgraded PHPStan dependency to version 2.0

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

@@ -19,7 +19,7 @@ abstract class DataObject implements ArrayAccess, JsonSerializable
/**
* Property map cache (class name => [snake_case key => camelCase property]).
*
* @var array<string,string>>
* @var array<string,string>
Copy link
Preview

Copilot AI Aug 16, 2025

Choose a reason for hiding this comment

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

[nitpick] The type annotation is missing a space after the comma for consistency. It should be @var array<string, string> to follow standard PHPDoc formatting conventions.

Suggested change
* @var array<string,string>
* @var array<string, string>

Copilot uses AI. Check for mistakes.

@@ -9,8 +9,7 @@
class ListenerData extends BaseListenerData
{
/**
* @phpstan-ignore-next-line
* @var array|callable|string
* @var callable(): mixed
Copy link
Preview

Copilot AI Aug 16, 2025

Choose a reason for hiding this comment

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

The type annotation callable(): mixed is overly restrictive. Based on the comment that was removed, this property can accept array|callable|string, so the type should be @var array|callable|string to accurately reflect the possible values.

Suggested change
* @var callable(): mixed
* @var array|callable|string

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improved feature or adjustments.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants