Repository navigation
fix(phpstan): declare XOOPS core classes via scanFiles so extends res… - #7
Conversation
…olves The baseline referenced stubs/xoops.stub via `stubFiles`, which only refines signatures of classes PHPStan can already discover — it does not register stub-only classes as existing. Any module that extends a core class (e.g. a preload extending XoopsPreloadItem, or an object extending XoopsObject) then hits a non-ignorable class.notFound that cannot be baselined, failing `composer qa`. - phpstan.neon.dist: use `scanFiles` instead of `stubFiles` so the stub's classes are registered as existing and extends/implements resolve. - stubs/xoops.stub: add the XoopsPreloadItem base class, extended by every module preload. Went unnoticed because module-devops itself has no code extending a XOOPS class; it only surfaces once the baseline is applied to a real module.
Reviewer's guide (collapsed on small PRs)Reviewer's GuideAdjusts PHPStan configuration so XOOPS core classes from the stub file are treated as real, discoverable classes, and extends the stub to include the XoopsPreloadItem base class used by module preloads. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Warning Review limit reached
Next review available in: 59 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- Switching from
stubFilestoscanFileswill now register all classes inxoops.stubas real; consider splitting the file so only truly missing classes (likeXoopsPreloadItem) go throughscanFilesand signature refinements for existing classes remain understubFilesto avoid accidental conflicts with real implementations. - With XOOPS core classes now materialized via
scanFiles, review the stubbed class and method signatures to ensure they are minimal and generic enough that they won’t become a maintenance burden or diverge from actual XOOPS versions used across modules.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Switching from `stubFiles` to `scanFiles` will now register all classes in `xoops.stub` as real; consider splitting the file so only truly missing classes (like `XoopsPreloadItem`) go through `scanFiles` and signature refinements for existing classes remain under `stubFiles` to avoid accidental conflicts with real implementations.
- With XOOPS core classes now materialized via `scanFiles`, review the stubbed class and method signatures to ensure they are minimal and generic enough that they won’t become a maintenance burden or diverge from actual XOOPS versions used across modules.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this comment.
Pull request overview
This PR fixes PHPStan analysis failures for XOOPS modules that extend core classes which are not composer-autoloadable during static analysis. It does this by ensuring the XOOPS stub file is discovered as defining classes (not merely refining existing ones) and by adding the missing XoopsPreloadItem base class commonly extended by module preloads.
Changes:
- Switch PHPStan config from
stubFilestoscanFilesso stub-defined XOOPS classes are registered as existing andextends/implementsresolve. - Add a minimal
XoopsPreloadItemclass to the XOOPS stub so preloads can extend it without triggeringclass.notFound.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| stubs/xoops.stub | Adds XoopsPreloadItem to the global-namespace XOOPS core stubs so module preload inheritance resolves. |
| phpstan.neon.dist | Uses scanFiles to register XOOPS stub-defined classes as existing during analysis. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Code Review
This pull request updates the PHPStan configuration to use scanFiles instead of stubFiles for stubs/xoops.stub, which ensures that XOOPS core classes are properly registered as existing to prevent class.notFound errors during analysis. Additionally, a stub for the XoopsPreloadItem class has been added. There are no review comments, so I have no feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.



The baseline referenced
stubs/xoops.stubviastubFiles, which only refines signatures of classes PHPStan can already discover — it does not register stub-only classes as existing. Any module that extends a core class (e.g. a preload extendingXoopsPreloadItem, or an object extendingXoopsObject) then hits a non-ignorableclass.notFoundthat cannot be baselined, failingcomposer qa.phpstan.neon.dist: usescanFilesinstead ofstubFilesso the stub's classes are registered as existing andextends/implementsresolve.stubs/xoops.stub: add theXoopsPreloadItembase class, extended by every module preload.Went unnoticed because module-devops itself has no code extending a XOOPS class; it only surfaces once the baseline is applied to a real module.
Summary by Sourcery
Adjust PHPStan configuration and XOOPS stubs so core XOOPS classes are recognised and module classes extending them can be analysed successfully.
Bug Fixes:
Enhancements:
Build: