Skip to content

bug fixes - #28

Closed
ljonesfl wants to merge 1 commit into
developfrom
feature/bugfixes
Closed

ljonesfl wants to merge 1 commit into
developfrom
feature/bugfixes

Conversation

@ljonesfl

@ljonesfl ljonesfl commented Jan 5, 2026 •

Copy link
Copy Markdown
Member

Note

Introduces config-driven exception passthrough and tightens dependency injection across controllers while refining public/admin flows.

  • Add exceptions.passthrough to neuron.yaml (examples/resources); Registry now loads PassthroughExceptions from config
  • Remove hardcoded bubble-exception registration from Bootstrap and add tests verifying config-driven loading
  • Enforce non-null DI in controller constructors (Admin, Member, Auth, Public); update unit tests to expect TypeError instead of InvalidArgumentException
  • Blog: 404 for missing/unpublished posts, increment views only for published, consistent route params (username/slug), and content fallback when Editor.js output is empty
  • Admin Dashboard: pass flash messages (Error/Success) to view
  • Auth/Login: default remember to false when absent
  • Media: validate Cloudinary pagination cursor and harden upload error handling
  • CSRF tests: document and assert POST token precedence; broaden unit coverage

Written by Cursor Bugbot for commit 1aee669. This will update automatically on new commits. Configure here.

Summary by CodeRabbit

  • New Features

    • Added flash message display to admin dashboard for error and success notifications.
  • Bug Fixes

    • Fixed missing post handling to return proper 404 responses instead of errors.
    • Improved fallback content rendering when Editor.js content is empty.
    • Fixed login remember flag handling.
  • Chores

    • Migrated exception handling configuration from code to configuration files.
    • Enhanced constructor dependency requirements across admin and member controllers for improved reliability.

✏️ Tip: You can customize this high-level summary in your review settings.

@codecov

codecov Bot commented Jan 5, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.30769% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/Cms/Controllers/Auth/Login.php 0.00% 1 Missing ⚠️
Flag Coverage Δ Complexity Δ
cms 75.27% <92.30%> (+0.22%) 2036.00 <0.00> (-45.00) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ Complexity Δ
src/Bootstrap.php 92.30% <ø> (-1.25%) 0.00 <0.00> (ø)
src/Cms/Controllers/Admin/Categories.php 44.26% <ø> (-2.01%) 13.00 <0.00> (-3.00)
src/Cms/Controllers/Admin/Dashboard.php 100.00% <100.00%> (ø) 2.00 <0.00> (ø)
src/Cms/Controllers/Admin/EventCategories.php 43.24% <ø> (-0.51%) 16.00 <0.00> (-3.00)
src/Cms/Controllers/Admin/Events.php 36.78% <ø> (-1.12%) 26.00 <0.00> (-4.00)
src/Cms/Controllers/Admin/Media.php 96.29% <ø> (+1.33%) 16.00 <0.00> (-2.00) ⬆️
src/Cms/Controllers/Admin/Pages.php 27.27% <ø> (-1.18%) 29.00 <0.00> (-3.00)
src/Cms/Controllers/Admin/Posts.php 43.01% <ø> (-1.76%) 26.00 <0.00> (-6.00)
src/Cms/Controllers/Admin/Profile.php 9.80% <ø> (-4.24%) 12.00 <0.00> (-3.00)
src/Cms/Controllers/Admin/Tags.php 35.13% <ø> (-0.77%) 17.00 <0.00> (-2.00)
... and 8 more

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread src/Bootstrap.php
@coderabbitai

coderabbitai Bot commented Jan 5, 2026 •

Copy link
Copy Markdown
Contributor

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

📝 Walkthrough

Walkthrough

The PR refactors exception handling from code-based registration to configuration-driven passthrough, and systematically converts nullable optional constructor dependencies to required non-nullable ones across Admin, Member, Auth, and public controllers, along with corresponding test updates.

Changes

Cohort / File(s) Summary
Configuration & Exception Handling
examples/config/neuron.yaml, resources/config/neuron.yaml
Added exceptions.passthrough section with three CMS exceptions (UnauthenticatedException, EmailVerificationRequiredException, CsrfValidationException); removed system.routes_path from resources config.
Bootstrap Exception Setup
src/Bootstrap.php
Removed manual BubbleExceptions registration for the three CMS exceptions, delegating to configuration-based passthrough.
Admin Controllers — Dependency Injection
src/Cms/Controllers/Admin/{Categories, EventCategories, Events, Media, Pages, Posts, Profile, Tags, Users}.php
Converted constructor parameters from nullable with defaults to required non-nullable; removed runtime null checks and InvalidArgumentException throws for repository, creator, updater, and utility dependencies.
Admin Dashboard — Flash Messages
src/Cms/Controllers/Admin/Dashboard.php
Added FlashMessageType import and injected Error and Success flash messages into view via session manager.
Member & Auth Controllers — Dependency Injection
src/Cms/Controllers/Member/{Profile, Registration}.php, src/Cms/Controllers/Auth/{PasswordReset, Login}.php
Converted constructor parameters from nullable to required non-nullable; removed null checks and InvalidArgumentException throws; added null coalescing default for remember flag in Login.
Public Controllers — DI & Behavioral Changes
src/Cms/Controllers/{Blog, Calendar, Pages}.php
Made dependencies non-nullable; Blog additionally changed route parameter mappings (author→username, tag→slug, category→slug), added conditional NOT_FOUND response status, and fallback HTML rendering for empty Editor.js content.
Unit Tests — Bootstrap & Exception Handling
tests/Unit/BootstrapTest.php
Renamed and rewrote tests to verify passthrough exceptions loaded from YAML config via isolated PHP process instead of inspecting BubbleExceptions in Registry.
Unit Tests — Controller Constructor Expectations
tests/Unit/Cms/Controllers/Admin/{CategoriesTest, PostsTest, UsersTest}.php, tests/Unit/Cms/Controllers/Auth/PasswordResetTest.php, tests/Unit/Cms/Controllers/Member/RegistrationTest.php
Changed expected exception type from InvalidArgumentException to TypeError in constructor null-dependency tests, reflecting type-hinted parameters.
Unit Tests — Filter & Controller Behavior
tests/Unit/Cms/Auth/CsrfFilterTest.php, tests/Unit/Cms/BlogControllerTest.php
Updated token precedence assertion in CSRF test and adjusted route parameter keys in Blog tests (slug instead of tag/category, username instead of author).

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • Feature/service architecture #6: Both PRs modify src/Bootstrap.php's boot function; this PR removes BubbleExceptions registration while the referenced PR involves parameter/casing adjustments to the same function.

Poem

🐰 Hop along, controllers now march in line,
Dependencies required—no more null design,
Config whispers exceptions through the air,
TypeErrors catch the careless, fair and square!

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Title check ⚠️ Warning The title 'bug fixes' is too vague and generic. It does not clearly describe the specific changes made, which primarily involve refactoring dependency injection to require non-nullable parameters across multiple controllers and updating exception handling configuration. Provide a more specific title that captures the main change, such as 'Enforce required dependencies via non-nullable constructor parameters' or 'Refactor dependency injection to require non-null parameters and update exception passthrough configuration'.
Docstring Coverage ⚠️ Warning Docstring coverage is 69.44% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (3)
tests/Unit/BootstrapTest.php (2)

179-202: Add error handling for shell_exec and consider PHPUnit's process isolation.

The shell_exec approach for process isolation has several reliability concerns:

  • No error handling if shell_exec returns null/empty (e.g., in environments without shell access)
  • Depends on php binary being in PATH
  • Could fail silently in restricted CI/CD environments

Consider using PHPUnit's @runInSeparateProcess annotation or add error handling:

🔎 Recommended error handling
 	$output = shell_exec("php -r " . escapeshellarg($code));
+	$this->assertNotNull($output, 'Failed to execute PHP in separate process. Shell access may be restricted.');
+	$this->assertNotEmpty($output, 'PHP process returned empty output');
+	
 	$passthroughExceptions = json_decode($output, true);
+	$this->assertNotNull($passthroughExceptions, 'Failed to decode JSON output: ' . $output);

Alternatively, consider PHPUnit's built-in process isolation:

/**
 * @runInSeparateProcess
 * @preserveGlobalState disabled
 */
public function testBootLoadsPassthroughExceptionsFromConfig()
{
    $app = Boot('examples/config');
    $passthroughExceptions = Registry::getInstance()->get('PassthroughExceptions');
    // ... assertions
}

207-230: Apply same error handling improvements.

This test has the same reliability concerns as testBootLoadsPassthroughExceptionsFromConfig. Please apply similar error handling for shell_exec and json_decode, or consider using PHPUnit's @runInSeparateProcess annotation.

src/Cms/Controllers/Blog.php (1)

126-126: Redundant null-safe operator on non-nullable property.

Since $_renderer is now a required non-nullable dependency, the null-safe operator (?->) is unnecessary. Consider simplifying to a direct method call.

🔎 Suggested fix
-		$renderedContent = $this->_renderer?->render( $content ) ?? (is_array($content) ? json_encode($content) : $content);
+		$renderedContent = $this->_renderer->render( $content );
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9dd3953 and 1aee669.

📒 Files selected for processing (28)
  • examples/config/neuron.yaml
  • resources/config/neuron.yaml
  • src/Bootstrap.php
  • src/Cms/Controllers/Admin/Categories.php
  • src/Cms/Controllers/Admin/Dashboard.php
  • src/Cms/Controllers/Admin/EventCategories.php
  • src/Cms/Controllers/Admin/Events.php
  • src/Cms/Controllers/Admin/Media.php
  • src/Cms/Controllers/Admin/Pages.php
  • src/Cms/Controllers/Admin/Posts.php
  • src/Cms/Controllers/Admin/Profile.php
  • src/Cms/Controllers/Admin/Tags.php
  • src/Cms/Controllers/Admin/Users.php
  • src/Cms/Controllers/Auth/Login.php
  • src/Cms/Controllers/Auth/PasswordReset.php
  • src/Cms/Controllers/Blog.php
  • src/Cms/Controllers/Calendar.php
  • src/Cms/Controllers/Member/Profile.php
  • src/Cms/Controllers/Member/Registration.php
  • src/Cms/Controllers/Pages.php
  • tests/Unit/BootstrapTest.php
  • tests/Unit/Cms/Auth/CsrfFilterTest.php
  • tests/Unit/Cms/BlogControllerTest.php
  • tests/Unit/Cms/Controllers/Admin/CategoriesTest.php
  • tests/Unit/Cms/Controllers/Admin/PostsTest.php
  • tests/Unit/Cms/Controllers/Admin/UsersTest.php
  • tests/Unit/Cms/Controllers/Auth/PasswordResetTest.php
  • tests/Unit/Cms/Controllers/Member/RegistrationTest.php
💤 Files with no reviewable changes (1)
  • src/Bootstrap.php
🧰 Additional context used
🧬 Code graph analysis (12)
tests/Unit/Cms/BlogControllerTest.php (1)
src/Cms/Models/Post.php (1)
  • getSlug (96-99)
src/Cms/Controllers/Admin/Dashboard.php (2)
src/Cms/Controllers/Content.php (1)
  • getSessionManager (233-247)
src/Cms/Auth/SessionManager.php (1)
  • getFlash (170-176)
src/Cms/Controllers/Admin/Posts.php (8)
src/Cms/Controllers/Admin/Categories.php (1)
  • __construct (42-56)
src/Cms/Controllers/Admin/Dashboard.php (1)
  • __construct (31-38)
src/Cms/Controllers/Admin/EventCategories.php (1)
  • __construct (43-57)
src/Cms/Controllers/Admin/Media.php (1)
  • __construct (42-54)
src/Cms/Controllers/Admin/Pages.php (1)
  • __construct (46-60)
src/Cms/Controllers/Admin/Tags.php (1)
  • __construct (40-52)
src/Cms/Controllers/Auth/Login.php (1)
  • __construct (35-45)
src/Cms/Controllers/Blog.php (1)
  • __construct (43-61)
src/Cms/Controllers/Admin/Profile.php (2)
src/Cms/Controllers/Admin/Users.php (1)
  • __construct (44-60)
src/Cms/Controllers/Member/Profile.php (1)
  • __construct (39-53)
src/Cms/Controllers/Auth/Login.php (1)
src/Cms/Services/Auth/Authentication.php (1)
  • attempt (42-133)
src/Cms/Controllers/Calendar.php (2)
src/Cms/Controllers/Admin/Events.php (1)
  • __construct (47-63)
src/Cms/Controllers/Pages.php (1)
  • __construct (41-53)
src/Cms/Controllers/Admin/Users.php (6)
src/Cms/Controllers/Admin/Dashboard.php (1)
  • __construct (31-38)
src/Cms/Controllers/Admin/Media.php (1)
  • __construct (42-54)
src/Cms/Controllers/Admin/Profile.php (1)
  • __construct (40-54)
src/Cms/Controllers/Admin/Tags.php (1)
  • __construct (40-52)
src/Cms/Controllers/Auth/Login.php (1)
  • __construct (35-45)
src/Cms/Controllers/Member/Profile.php (1)
  • __construct (39-53)
src/Cms/Controllers/Member/Profile.php (2)
src/Cms/Controllers/Admin/Profile.php (1)
  • __construct (40-54)
src/Cms/Controllers/Admin/Users.php (1)
  • __construct (44-60)
src/Cms/Controllers/Admin/EventCategories.php (3)
src/Cms/Controllers/Admin/Dashboard.php (1)
  • __construct (31-38)
src/Cms/Controllers/Admin/Events.php (1)
  • __construct (47-63)
src/Cms/Controllers/Admin/Pages.php (1)
  • __construct (46-60)
src/Cms/Controllers/Member/Registration.php (18)
src/Cms/Controllers/Admin/Categories.php (1)
  • __construct (42-56)
src/Cms/Controllers/Admin/Dashboard.php (1)
  • __construct (31-38)
src/Cms/Controllers/Admin/EventCategories.php (1)
  • __construct (43-57)
src/Cms/Controllers/Admin/Events.php (1)
  • __construct (47-63)
src/Cms/Controllers/Admin/Media.php (1)
  • __construct (42-54)
src/Cms/Controllers/Admin/Pages.php (1)
  • __construct (46-60)
src/Cms/Controllers/Admin/Posts.php (1)
  • __construct (54-74)
src/Cms/Controllers/Admin/Profile.php (1)
  • __construct (40-54)
src/Cms/Controllers/Admin/Tags.php (1)
  • __construct (40-52)
src/Cms/Controllers/Admin/Users.php (1)
  • __construct (44-60)
src/Cms/Controllers/Auth/Login.php (1)
  • __construct (35-45)
src/Cms/Controllers/Auth/PasswordReset.php (1)
  • __construct (37-46)
src/Cms/Controllers/Blog.php (1)
  • __construct (43-61)
src/Cms/Controllers/Member/Profile.php (1)
  • __construct (39-53)
src/Cms/Controllers/Content.php (1)
  • __construct (77-110)
src/Cms/Controllers/Member/Dashboard.php (1)
  • __construct (32-39)
src/Cms/Auth/SessionManager.php (1)
  • SessionManager (13-216)
src/Cms/Services/Security/ResendVerificationThrottle.php (1)
  • ResendVerificationThrottle (19-195)
src/Cms/Controllers/Auth/PasswordReset.php (11)
src/Cms/Controllers/Admin/Categories.php (1)
  • __construct (42-56)
src/Cms/Controllers/Admin/EventCategories.php (1)
  • __construct (43-57)
src/Cms/Controllers/Admin/Events.php (1)
  • __construct (47-63)
src/Cms/Controllers/Admin/Media.php (1)
  • __construct (42-54)
src/Cms/Controllers/Admin/Pages.php (1)
  • __construct (46-60)
src/Cms/Controllers/Admin/Profile.php (1)
  • __construct (40-54)
src/Cms/Controllers/Admin/Tags.php (1)
  • __construct (40-52)
src/Cms/Controllers/Admin/Users.php (1)
  • __construct (44-60)
src/Cms/Controllers/Auth/Login.php (1)
  • __construct (35-45)
src/Cms/Controllers/Member/Profile.php (1)
  • __construct (39-53)
src/Cms/Controllers/Content.php (1)
  • __construct (77-110)
src/Cms/Controllers/Blog.php (3)
src/Cms/Models/Post.php (2)
  • isPublished (268-271)
  • incrementViewCount (326-330)
src/Cms/Models/Page.php (2)
  • isPublished (282-285)
  • incrementViewCount (332-336)
src/Cms/Repositories/DatabasePostRepository.php (1)
  • incrementViewCount (300-310)
🔇 Additional comments (33)
src/Cms/Controllers/Auth/Login.php (1)

105-105: LGTM! Good defensive programming.

The null coalescing operator ensures a boolean value is always passed to the authentication method, even if $dto->remember is null. While the attempt method already has a default parameter, this explicit handling at the call site improves type safety and makes the intent clearer.

examples/config/neuron.yaml (1)

58-72: LGTM! Clear exception passthrough configuration.

The new exception handling configuration is well-documented and provides a clear mechanism for routing CMS-specific exceptions to application-level handlers. The chosen exceptions (authentication, email verification, CSRF) are appropriate candidates for custom handling flows.

tests/Unit/Cms/Auth/CsrfFilterTest.php (1)

266-278: LGTM! Test now correctly verifies POST token precedence.

The updated test assertions and comments accurately reflect that the implementation now uses Neuron\Data\Filters\Post to read POST data, which works correctly in both unit tests and real requests. The assertion correctly expects the POST token to take precedence over the header token.

tests/Unit/Cms/Controllers/Admin/PostsTest.php (1)

88-88: LGTM! Correct exception type for non-nullable parameters.

The change to expect TypeError correctly reflects the updated controller constructor that now requires non-nullable dependencies. PHP's type system throws TypeError when null is passed to non-nullable typed parameters.

tests/Unit/Cms/Controllers/Admin/UsersTest.php (1)

81-81: LGTM! Correct exception type for non-nullable parameters.

The change to expect TypeError correctly reflects the updated controller constructor that now requires non-nullable dependencies. This aligns with the broader refactoring to enforce dependency presence at construction time.

tests/Unit/Cms/Controllers/Auth/PasswordResetTest.php (1)

112-120: LGTM!

The test correctly expects TypeError when passing null to a non-nullable constructor parameter. This aligns with PHP's type-hint enforcement and the broader refactoring to non-nullable dependencies.

tests/Unit/Cms/Controllers/Member/RegistrationTest.php (1)

127-185: LGTM!

All four tests correctly expect TypeError when passing null to non-nullable constructor parameters. The changes are consistent and align with the refactoring to enforce required dependencies via type hints.

tests/Unit/Cms/Controllers/Admin/CategoriesTest.php (1)

85-100: LGTM!

The test correctly expects TypeError when passing null to non-nullable constructor parameters. This change is consistent with the refactoring pattern throughout the PR.

src/Cms/Controllers/Admin/Dashboard.php (2)

7-7: LGTM!

The FlashMessageType import is correctly added to support the flash message retrieval below.


58-59: LGTM!

The flash message retrieval implementation is correct. Using FlashMessageType enum values ensures type safety, and the view will receive either the flash message content or null if no message was set.

resources/config/neuron.yaml (1)

85-98: Configuration-driven exception handling is correct.

All three exception classes referenced in the exceptions.passthrough configuration exist and are properly defined:

  • Neuron\Cms\Exceptions\UnauthenticatedException
  • Neuron\Cms\Exceptions\EmailVerificationRequiredException
  • Neuron\Cms\Exceptions\CsrfValidationException

The configuration appropriately centralizes these CMS-specific exceptions for passthrough handling to support custom redirects and error pages.

tests/Unit/Cms/BlogControllerTest.php (3)

389-389: LGTM!

Route parameter correctly updated to use slug key, aligning with the tag model's getSlug() method and the controller's route parameter expectations.


407-407: LGTM!

Route parameter correctly updated to use slug key for category filtering, consistent with the pattern established for tags.


425-430: LGTM!

The mock expectation correctly reflects the renamed route parameter from author to username, which is semantically more accurate for user identification.

src/Cms/Controllers/Auth/PasswordReset.php (1)

35-46: LGTM!

The constructor now requires a non-nullable IPasswordResetter dependency, which is the correct approach when relying on a DI container for dependency resolution. This removes redundant runtime null checks and aligns with the consistent pattern across other controllers in this PR (e.g., Login.php, Media.php, Tags.php).

src/Cms/Controllers/Admin/Pages.php (1)

42-60: LGTM!

The constructor signature correctly requires non-nullable dependencies for IPageRepository, IPageCreator, and IPageUpdater. This approach:

  • Leverages PHP's type system for enforcement (TypeError on null)
  • Reduces boilerplate by removing manual null checks
  • Is consistent with the DI container pattern used throughout the codebase

The implementation aligns with other admin controllers in this PR.

src/Cms/Controllers/Admin/Categories.php (1)

38-56: LGTM!

Constructor correctly updated to require non-nullable ICategoryRepository, ICategoryCreator, and ICategoryUpdater dependencies. This maintains consistency with the DI pattern established across all admin controllers in this PR.

src/Cms/Controllers/Admin/Users.php (1)

39-60: LGTM!

Constructor correctly updated to require non-nullable dependencies for all four user service interfaces (IUserRepository, IUserCreator, IUserUpdater, IUserDeleter). The implementation is consistent with the DI pattern used across other admin controllers.

src/Cms/Controllers/Admin/Events.php (1)

42-63: LGTM!

Constructor correctly updated to require non-nullable dependencies for IEventRepository, IEventCategoryRepository, IEventCreator, and IEventUpdater. This is consistent with the DI pattern established across all admin controllers and aligns with the public Calendar controller which uses the same repository interfaces.

src/Cms/Controllers/Calendar.php (1)

33-49: LGTM!

Constructor correctly updated to require non-nullable IEventRepository and IEventCategoryRepository dependencies. This is consistent with the Admin/Events controller which uses the same repository interfaces, maintaining a unified DI pattern across both public and admin event-related controllers.

src/Cms/Controllers/Admin/Media.php (1)

38-39: LGTM! Constructor dependencies now strictly enforced.

The refactoring from nullable optional dependencies to required non-null parameters is a good practice. This moves validation from runtime (InvalidArgumentException) to type-check time (TypeError), leveraging PHP's type system and ensuring the DI container provides all required dependencies.

Also applies to: 46-47, 52-53

src/Cms/Controllers/Admin/EventCategories.php (1)

38-40: LGTM! Consistent DI enforcement pattern.

The constructor refactoring aligns with the broader PR pattern of requiring non-nullable dependencies. This is consistent with similar changes in Events.php, Pages.php, and other admin controllers (see relevant code snippets), ensuring uniform DI practices across the codebase.

Also applies to: 47-49, 54-56

src/Cms/Controllers/Admin/Tags.php (1)

36-37: LGTM! Dependencies properly enforced via type system.

This refactoring is consistent with the PR-wide pattern of removing nullable defaults and runtime null checks in favor of strict type enforcement. The change ensures the DI container must provide concrete implementations, improving reliability.

Also applies to: 44-45, 50-51

src/Cms/Controllers/Admin/Posts.php (1)

47-52: LGTM! Constructor refactoring consistent across all dependencies.

The Posts controller now requires all six dependencies (repositories, creator, updater, deleter) to be provided via DI, matching the pattern established in Categories.php, Tags.php, Media.php, and other admin controllers. This improves type safety and ensures the DI container handles all dependency provision.

Also applies to: 58-63, 68-73

src/Cms/Controllers/Pages.php (1)

37-52: LGTM!

The constructor now enforces non-nullable dependencies via PHP's type system, delegating validation to the DI container. This aligns with the broader refactoring pattern across the codebase and eliminates redundant runtime null checks.

src/Cms/Controllers/Admin/Profile.php (1)

35-53: LGTM!

The constructor signature now matches the pattern established in Member/Profile.php and other admin controllers, enforcing required dependencies at construction time rather than via runtime guards.

src/Cms/Controllers/Blog.php (5)

36-60: LGTM!

The constructor now enforces all five repository/renderer dependencies as non-nullable, consistent with the PR-wide DI pattern. This ensures the DI container is responsible for providing valid instances.


105-132: Good improvement to HTTP semantics and content rendering.

Returning NOT_FOUND status for missing/unpublished posts is correct HTTP behavior. The fallback rendering for empty Editor.js content (lines 128-132) provides graceful degradation. Moving incrementViewCount to the else branch correctly avoids counting views for non-existent content.


154-157: LGTM!

Route parameter renamed from generic to semantic username, matching the route definition /author/:username.


193-196: LGTM!

Route parameter renamed to slug, matching the route definition /tag/:slug.


234-237: LGTM!

Route parameter renamed to slug, matching the route definition /category/:slug.

src/Cms/Controllers/Member/Profile.php (1)

34-52: LGTM!

The constructor signature mirrors Admin/Profile.php exactly, enforcing consistent non-nullable DI across both member and admin profile controllers.

src/Cms/Controllers/Member/Registration.php (1)

39-60: LGTM!

The constructor now requires all four dependencies (IRegistrationService, IEmailVerifier, ResendVerificationThrottle, IIpResolver) as non-nullable, consistent with the PR-wide pattern. The DI container configuration must provide these services.

@ljonesfl ljonesfl closed this Jan 5, 2026
@ljonesfl
ljonesfl deleted the feature/bugfixes branch January 5, 2026 15:48
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.

1 participant