-
Notifications
You must be signed in to change notification settings - Fork 9
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
Alley Coding Standards 2.0 #199
Conversation
WalkthroughThe recent updates are primarily cosmetic, focusing on code formatting and type hinting enhancements. Traits are now declared on separate lines, function signatures have been standardized, and factory classes have been updated with more explicit type parameters and inheritance structures. These changes improve readability and maintainability without altering the underlying functionality. Changes
TipsChat with CodeRabbit Bot (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files ignored due to filter (1)
- composer.json
Files selected for processing (8)
- app/jobs/class-example-job.php (1 hunks)
- app/models/class-category.php (1 hunks)
- app/models/class-post.php (1 hunks)
- app/models/class-tag.php (1 hunks)
- app/providers/class-asset-service-provider.php (1 hunks)
- mantle.php (1 hunks)
- routes/rest-api.php (1 hunks)
- routes/web.php (1 hunks)
Files skipped from review due to trivial changes (8)
- app/jobs/class-example-job.php
- app/models/class-category.php
- app/models/class-post.php
- app/models/class-tag.php
- app/providers/class-asset-service-provider.php
- mantle.php
- routes/rest-api.php
- routes/web.php
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🐴
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 1
Configuration used: CodeRabbit UI
Files selected for processing (3)
- database/factory/class-category-factory.php (1 hunks)
- database/factory/class-post-factory.php (2 hunks)
- database/factory/class-tag-factory.php (1 hunks)
Additional comments: 3
database/factory/class-tag-factory.php (1)
- 15-26: The changes to the
Tag_Factory
class correctly reflect the updated inheritance and type hinting as per the pull request summary. The PHPDoc block has been updated to include the full generic types for theTerm_Factory
class, which improves type safety and IDE support for developers working with this class. The$model
property is now explicitly set toTag::class
, which is a best practice for factories as it clearly defines the model that the factory is responsible for creating.database/factory/class-category-factory.php (1)
- 15-26: The changes here reflect an update to the documentation and inheritance to align with the new coding standards and type hinting improvements. The
Category_Factory
class now extends a more specific version of theTerm_Factory
with explicit type parameters, which is a good practice for better type safety and IDE support. The@var
annotation for the$model
property has been updated to include a class-string type, which is more precise and helpful for static analysis tools.database/factory/class-post-factory.php (1)
- 15-26: The update to the
@extends
annotation and theprotected $model
property type annotation aligns with PHPDoc and PHPStan standards for generics and class-string type hints, which is beneficial for static analysis and IDE support. This change should be verified to ensure that it is consistent with the rest of the codebase and that any static analysis tools used in the project are configured to understand these annotations.
public function definition(): array { | ||
return [ | ||
'post_title' => $this->faker->sentence(), | ||
'post_content' => trim( $this->faker->paragraph_blocks( 3 ) ), | ||
'post_content' => trim( $this->faker->paragraph_blocks( 3 ) ), // @phpstan-ignore-line undefined method | ||
'post_status' => 'publish', | ||
'post_type' => 'post', | ||
]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The use of @phpstan-ignore-line
is generally discouraged as it suppresses static analysis for that line. If the method paragraph_blocks
is indeed undefined, it would be better to define it or to use an alternative method that exists. If the method is defined in a class not analyzed by PHPStan (e.g., a magic method or in a trait), adding that class to PHPStan's configuration might be a better solution. If the method is part of a third-party package that is not correctly analyzed, consider contributing a stub file to the package or to PHPStan's repository.
// If the paragraph_blocks method is undefined, consider replacing it with a defined method.
'post_content' => trim( $this->faker->text(200) ), // Assuming text is a defined method
Summary by CodeRabbit
Refactor
Style
Documentation