Skip to content

chore: refactor code base according to psr4 plus OneDesign#12

Merged
up1512001 merged 20 commits intodevelopfrom
dev/psr4
Dec 10, 2025
Merged

chore: refactor code base according to psr4 plus OneDesign#12
up1512001 merged 20 commits intodevelopfrom
dev/psr4

Conversation

@up1512001
Copy link
Copy Markdown
Member

@up1512001 up1512001 commented Dec 4, 2025

Overview

Major architectural refactoring to align with modern PHP and JavaScript standards, introducing modular design patterns, comprehensive testing infrastructure, and improved developer experience.

Key Changes

Architecture & Code Organization

  • PSR-4 Autoloading: Restructured codebase into inc/Modules/ with proper namespacing (OneAccess\Modules\Core, OneAccess\Modules\Rest, etc.)
  • Interface-based Design: Introduced Registrable interface pattern, replacing singleton implementations for better testability and maintainability
  • Modular Structure: All modules now follow consistent architectural patterns with clear separation of concerns

Build & Tooling

  • Simplified Build Output: Migrated from assets/build/js to flat build/ directory structure
  • TypeScript Support: Added full TypeScript configuration with strict type checking and path aliases
  • Modern Dependencies: Updated package.json with streamlined build scripts and current tooling

Code Quality & Testing

  • PHPUnit Integration: New phpunit.xml.dist configuration for automated testing
  • Static Analysis: Added PHPStan configuration (phpstan.neon.dist) for type safety
  • Enhanced PHPCS: Updated coding standards with VIP, PHPCompatibility, and Slevomat rulesets

Plugin Bootstrap

  • Simplified Entry Point: Refactored oneaccess.php to use modern autoloader and constants approach
  • Improved Multisite Support: Enhanced uninstall.php with proper namespacing and function-based structure

Checklist

  • I have read the Contribution Guidelines.
  • I have read the Development Guidelines.
  • My code is tested to the best of my abilities.
  • My code passes all lints (ESLint etc.).
  • My code has detailed inline documentation.
  • I have updated the project documentation as needed.

@up1512001 up1512001 self-assigned this Dec 4, 2025
@up1512001 up1512001 changed the title [WIP] chore: refactor code base according to psr4 plus OneDesign chore: refactor code base according to psr4 plus OneDesign Dec 4, 2025
@up1512001 up1512001 marked this pull request as ready for review December 4, 2025 08:55
Copilot AI review requested due to automatic review settings December 4, 2025 08:55
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR is a major refactoring of the OneAccess plugin codebase to follow PSR-4 autoloading standards and OneDesign principles. The changes reorganize the directory structure, introduce modern PHP patterns (interfaces, traits), update build tooling, and establish comprehensive testing infrastructure.

Key changes include:

  • Restructuring code into inc/Modules with proper namespacing (OneAccess\Modules\Core, OneAccess\Modules\Rest, etc.)
  • Replacing singleton pattern implementation with interface-based design
  • Moving from assets/build/js to flat build directory structure
  • Adding TypeScript support and modern build configuration
  • Introducing PHPUnit and PHPStan for testing and static analysis
  • Enhanced PHPCS configuration with additional rulesets

Reviewed changes

Copilot reviewed 72 out of 80 changed files in this pull request and generated no comments.

Show a summary per file
File Description
webpack.config.js Simplified build output structure, added TypeScript support with path aliases
uninstall.php Refactored to use functions with proper namespacing and improved multisite support
tsconfig.json New TypeScript configuration with strict type checking
phpunit.xml.dist New PHPUnit configuration for automated testing
phpstan.neon.dist New static analysis configuration
phpcs.xml.dist Enhanced coding standards with VIP, PHPCompatibility, and Slevomat rules
package.json Updated dependencies, simplified scripts, added TypeScript tooling
oneaccess.php Simplified bootstrap with new autoloader and constants approach
inc/Modules/* New modular structure following PSR-4 with Registrable interface pattern

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings December 4, 2025 09:10
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 72 out of 80 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (2)

inc/Modules/Core/DB.php:117

  • Typo in SQL: 'updated_a t' has extra whitespace/tabs and should be 'updated_at'.
    inc/Modules/Core/DB.php:111
  • Typo in SQL: 'U NSIGNED' has extra whitespace/tabs and should be 'UNSIGNED'.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread inc/Modules/Rest/Abstract_REST_Controller.php Outdated
Comment thread webpack.config.js Outdated
Copilot AI review requested due to automatic review settings December 4, 2025 11:18
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 72 out of 81 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (2)

inc/Modules/Core/DB.php:111

  • Fixed typo in SQL statement: 'U NSIGNED' corrected to 'UNSIGNED' (removed extra tab/space characters).
    inc/Modules/Core/DB.php:117
  • Fixed typo in SQL statement: 'updated_a t' corrected to 'updated_at' (removed extra tab/space character).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread webpack.config.js
Comment thread webpack.config.js
@up1512001 up1512001 requested a review from justlevine December 4, 2025 11:30
Copilot AI review requested due to automatic review settings December 4, 2025 12:22
Copilot AI review requested due to automatic review settings December 5, 2025 11:25
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 77 out of 86 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (2)

inc/Modules/Core/DB.php:111

  • Typo in SQL schema definition: 'BIGINT(20) U NSIGNED' has a tab/space character inserted incorrectly. Should be 'BIGINT(20) UNSIGNED'.
    inc/Modules/Core/DB.php:117
  • Typo in SQL schema definition: 'updated_a t' has a tab/space character inserted incorrectly. Should be 'updated_at'.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings December 8, 2025 06:31
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 79 out of 88 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (2)

inc/Modules/Core/DB.php:111

  • Fixed typo in SQL column definition: Changed 'BIGINT(20) U NSIGNED' to 'BIGINT(20) UNSIGNED' (removed tab character in the middle of UNSIGNED).
    inc/Modules/Core/DB.php:117
  • Fixed typo in SQL column definition: Changed 'updated_a t' to 'updated_at' (removed tab character in the middle of the column name).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings December 8, 2025 08:52
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 79 out of 88 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@up1512001 up1512001 requested a review from justlevine December 8, 2025 09:05
Comment thread assets/src/admin/settings/page.tsx Outdated
Comment on lines +26 to +27
id?: string;
name: string;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Tabs again 😅

Comment thread oneaccess.php Outdated
Copy link
Copy Markdown
Collaborator

@justlevine justlevine left a comment

Choose a reason for hiding this comment

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

Last few nits and LGTM.

(Issues with npm run lint:css or shared QA bugs with onedesign can be handled in followups)

Copilot AI review requested due to automatic review settings December 9, 2025 09:07
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 79 out of 88 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (2)

inc/Modules/Core/DB.php:114

  • Fixed typo in SQL CREATE TABLE statement: 'U NSIGNED' has been corrected to 'UNSIGNED'
    inc/Modules/Core/DB.php:120
  • Fixed typo in column name: 'updated_a t' has been corrected to 'updated_at'

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@up1512001 up1512001 requested a review from justlevine December 9, 2025 13:23
Copy link
Copy Markdown
Collaborator

@justlevine justlevine left a comment

Choose a reason for hiding this comment

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

(approving per the diff alone. We anyway need to QA/polish before triggering a new release)

@up1512001 up1512001 merged commit a2835fa into develop Dec 10, 2025
16 checks passed
@up1512001 up1512001 deleted the dev/psr4 branch December 10, 2025 05:42
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.

3 participants