Skip to content

Integrated Rector into Quantum Starter Project#180

Merged
armanist merged 2 commits intosoftberg:masterfrom
armanist:179-Integrate-Rector-into-Quantum-Starter-Projec
Apr 3, 2026
Merged

Integrated Rector into Quantum Starter Project#180
armanist merged 2 commits intosoftberg:masterfrom
armanist:179-Integrate-Rector-into-Quantum-Starter-Projec

Conversation

@armanist
Copy link
Copy Markdown
Member

@armanist armanist commented Apr 3, 2026

Closes #179

Summary by CodeRabbit

  • Chores

    • Added automated code-quality tooling and convenience commands to the project configuration.
    • Updated internal version references to 3.0.0.
  • Refactor

    • Adopted stricter typing and modernized PHP practices across the codebase.
    • Added explicit return types throughout for clearer, more predictable behavior.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 3, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: bcd6008f-7d78-4248-a24e-6e0bef435cef

📥 Commits

Reviewing files that changed from the base of the PR and between cd5994b and cbc3e05.

📒 Files selected for processing (2)
  • helpers/functions.php
  • rector.php
✅ Files skipped from review due to trivial changes (1)
  • helpers/functions.php
🚧 Files skipped from review as they are similar to previous changes (1)
  • rector.php

📝 Walkthrough

Walkthrough

Added Rector to the project (dev dependency, config, and composer scripts) and applied automated modernizations across project-owned PHP files: file-level declare(strict_types=1), added/strengthened return and property types, converted closures to arrow functions, replaced rand() with random_int(), and added : void where appropriate.

Changes

Cohort / File(s) Summary
Composer & Tooling
composer.json, rector.php
Added rector/rector to dev deps; added rector:check and rector:fix scripts; new rector.php config targets project source dirs and enables PHP 8.0/type-declaration sets plus DeclareStrictTypesRector.
Helpers
helpers/functions.php
Updated @since and added explicit return types: create_user_directory(string $uuid): void, textCleanUp(string $text): string.
Migrations
migrations/create_table_*.php
Added explicit : void to up() and down() methods in migrations that create/drop comments, posts, and users tables.
Commands (wide)
shared/Commands/...
Added declare(strict_types=1) to many command files; several private helpers now declare : void; DemoCommand uses random_int, typed arrow functions, and internal runners typed : void.
DTOs
shared/DTOs/CommentDTO.php, shared/DTOs/PostDTO.php, shared/DTOs/UserDTO.php
Added declare(strict_types=1); replaced untyped array_filter callbacks with typed arrow functions (fn (?string $v): bool => ...).
Enums & Models
shared/Enums/Role.php, shared/Models/...
Added declare(strict_types=1) to enums/models; some @since annotations updated to 3.0.0.
Services
shared/Services/AuthService.php, shared/Services/CommentService.php, shared/Services/PostService.php
Added declare(strict_types=1); added/strengthened property and method types (typed transformer property, getCommentsByPost(): ModelCollection, deleteAll*(): void, deleteImage(): void), minor syntax modernizations (??=).
Transformers
shared/Transformers/CommentTransformer.php, shared/Transformers/PostTransformer.php
Added declare(strict_types=1) at file scope.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • andrey-smaelov
  • live-soft
  • hatik92
  • grigoryanmartin20

Poem

"🐰 I hopped through files with rector's light,
Strict types and arrows in clean sight,
Void returns snug like a burrow's room,
Random ints bloom where old rands loomed,
A tiny rabbit cheered: code's in bloom!"

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 79.31% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: integrating Rector into the Quantum Starter Project, which aligns with all the modifications across composer.json, rector.php, and widespread addition of strict types to source files.
Linked Issues check ✅ Passed All primary coding requirements from issue #179 are met: Rector installed as dev dependency, rector.php created with correct paths/skips and rules, composer scripts added, strict types applied throughout scanned files, return types added, closures converted to arrows, and null coalescing simplified.
Out of Scope Changes check ✅ Passed All changes are directly related to Rector integration as specified in issue #179: adding dependency, creating config, updating scripts, and applying type-declaration transformations to in-scope directories only.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
shared/Services/CommentService.php (1)

52-55: ⚠️ Potential issue | 🟡 Minor

Docblock return type is stale for getCommentsByPost().

On Line 54, @return mixed no longer matches the method signature (ModelCollection on Line 58).

🧹 Suggested docblock fix
 /**
  * Get comments by post
  * `@param` string $postUuid
- * `@return` mixed
+ * `@return` ModelCollection
  * `@throws` BaseException
  * `@throws` ModelException
  */
 public function getCommentsByPost(string $postUuid): ModelCollection

Also applies to: 58-58

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@shared/Services/CommentService.php` around lines 52 - 55, The docblock for
getCommentsByPost() is outdated: update the `@return` annotation to match the
method signature by replacing "@return mixed" with "@return ModelCollection" (or
the fully-qualified class name if required) in the
CommentService::getCommentsByPost docblock so the PHPDoc matches the declared
return type ModelCollection.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@helpers/functions.php`:
- Around line 113-117: The PHPDoc for function textCleanUp() incorrectly lists a
union return type; update the docblock so the `@return` annotation reflects the
actual signature (string) and adjust any descriptive text to match the
string-only return; ensure the docblock above the textCleanUp function refers to
`@param` string $text and `@return` string to keep annotations consistent with the
function signature.

In `@rector.php`:
- Around line 11-23: The Rector configuration currently includes __DIR__ .
'/public' in the ->withPaths(...) list which scans the entire public directory;
change that entry to only __DIR__ . '/public/index.php' so Rector's scope
matches the "public entry point only" objective, and keep the ->withSkip(...)
entries (e.g., __DIR__ . '/public/assets', __DIR__ . '/public/uploads')
unchanged.

---

Outside diff comments:
In `@shared/Services/CommentService.php`:
- Around line 52-55: The docblock for getCommentsByPost() is outdated: update
the `@return` annotation to match the method signature by replacing "@return
mixed" with "@return ModelCollection" (or the fully-qualified class name if
required) in the CommentService::getCommentsByPost docblock so the PHPDoc
matches the declared return type ModelCollection.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a1d7a32d-b57c-4e09-a85f-5ae5070f881b

📥 Commits

Reviewing files that changed from the base of the PR and between 44c41b7 and cd5994b.

📒 Files selected for processing (29)
  • composer.json
  • helpers/functions.php
  • migrations/create_table_comments_1698145440.php
  • migrations/create_table_posts_1669639752.php
  • migrations/create_table_users_1669639740.php
  • rector.php
  • shared/Commands/CommandValidationTrait.php
  • shared/Commands/CommentCreateCommand.php
  • shared/Commands/CommentDeleteCommand.php
  • shared/Commands/DemoCommand.php
  • shared/Commands/PostCreateCommand.php
  • shared/Commands/PostDeleteCommand.php
  • shared/Commands/PostShowCommand.php
  • shared/Commands/PostUpdateCommand.php
  • shared/Commands/UserCreateCommand.php
  • shared/Commands/UserDeleteCommand.php
  • shared/Commands/UserShowCommand.php
  • shared/DTOs/CommentDTO.php
  • shared/DTOs/PostDTO.php
  • shared/DTOs/UserDTO.php
  • shared/Enums/Role.php
  • shared/Models/Comment.php
  • shared/Models/Post.php
  • shared/Models/User.php
  • shared/Services/AuthService.php
  • shared/Services/CommentService.php
  • shared/Services/PostService.php
  • shared/Transformers/CommentTransformer.php
  • shared/Transformers/PostTransformer.php

@armanist armanist merged commit 524d742 into softberg:master Apr 3, 2026
5 checks passed
@armanist armanist deleted the 179-Integrate-Rector-into-Quantum-Starter-Projec branch April 3, 2026 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Integrate Rector into Quantum Starter Project

1 participant