chore(Controllers): Modernize controller code - #2351
Merged
Conversation
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request modernizes the controller code in the Bookmarks application by migrating from legacy docblock annotations to PHP 8 attributes and implementing other modern PHP patterns. The changes improve code maintainability and align with current Nextcloud development practices.
Changes:
- Migrated controller method metadata from docblock annotations (e.g.,
@NoAdminRequired) to PHP 8 attributes (e.g.,#[NoAdminRequired]) - Moved route definitions from
appinfo/routes.phpto#[FrontpageRoute]attributes on controller methods - Applied constructor property promotion across controllers to reduce boilerplate code
- Enhanced type hints throughout controller methods and constructors
- Added improved exception handling with proper try-catch blocks for database operations
- Removed unused dependencies (e.g.,
IURLGeneratorfromBookmarkController)
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| lib/Controller/WebViewController.php | Migrated annotations to attributes and added route attributes for all public-facing web views |
| lib/Controller/TagsController.php | Modernized constructor with property promotion, added route attributes, improved exception handling and authorization checks |
| lib/Controller/SettingsController.php | Applied constructor property promotion and migrated to route attributes |
| lib/Controller/InternalTagsController.php | Updated constructor and added route attributes for internal tag operations |
| lib/Controller/InternalFoldersController.php | Modernized with property promotion and route attributes |
| lib/Controller/InternalBookmarkController.php | Converted to use attributes and updated route definitions |
| lib/Controller/FoldersController.php | Comprehensive migration to attributes with route definitions for all folder operations |
| lib/Controller/BookmarkController.php | Major refactoring with constructor property promotion, removed unused IURLGenerator, added route attributes, improved exception handling |
| lib/Controller/AdminController.php | Migrated to route attributes for admin settings |
| lib/Db/FolderMapper.php | Added @throws Exception documentation |
| lib/AppInfo/Application.php | Removed unused service registrations for 'UserId' and 'request' |
| appinfo/routes.php | Removed legacy route definitions (now defined as attributes) |
| tests/BookmarkControllerTest.php | Updated test setup to match new constructor signature |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Signed-off-by: Marcel Klehr <mklehr@gmx.net> # Conflicts: # lib/Controller/InternalTagsController.php
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
marcelklehr
force-pushed
the
chore/modernize2
branch
from
February 13, 2026 17:23
ba5ddf0 to
b3bb7e5
Compare
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 19 out of 19 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.