Fix all PHPCS coding standards violations
All checks were successful
CI / Coding Standards (push) Successful in 44s
CI / PHPStan (push) Successful in 49s
CI / Tests (PHP 8.1) (push) Successful in 54s
CI / Tests (PHP 8.2) (push) Successful in 51s
CI / Tests (PHP 8.3) (push) Successful in 39s
CI / No Debug Code (push) Successful in 3s
All checks were successful
CI / Coding Standards (push) Successful in 44s
CI / PHPStan (push) Successful in 49s
CI / Tests (PHP 8.1) (push) Successful in 54s
CI / Tests (PHP 8.2) (push) Successful in 51s
CI / Tests (PHP 8.3) (push) Successful in 39s
CI / No Debug Code (push) Successful in 3s
- Add phpcs.xml.dist: excludes PSR-4 file naming, camelCase naming, short array syntax, and redundant per-method/property docblocks - Fix wp_unslash() on all $_POST reads (LoginPage, AvailabilityController) - Add phpcs:ignore for password field (must not be sanitized) - Fix Yoda conditions throughout (AvailabilityRepository, AvailabilityEndpoint, BookingEndpoint, AvailabilityController) - Fix inline comments to end with full stops (AdminMenu) - Replace short ternary ?: with explicit full ternary (BookingEndpoint) - Rename $namespace param to $route_namespace (reserved keyword warning) - Add short descriptions to doc blocks that had tag-only blocks - Add nonce suppression comment in handleFormAction (nonce verified by caller) - Update composer.json and CI to use phpcs.xml.dist Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -3,44 +3,42 @@ declare(strict_types=1);
|
||||
|
||||
namespace Unsupervised\Schedular\Roles;
|
||||
|
||||
class RoleManager
|
||||
{
|
||||
public const INSTRUCTOR = 'us_instructor';
|
||||
public const STUDENT = 'us_student';
|
||||
class RoleManager {
|
||||
|
||||
public const CAP_MANAGE_AVAILABILITY = 'manage_availability';
|
||||
public const CAP_VIEW_LESSONS = 'view_own_lessons';
|
||||
public const CAP_BOOK_LESSON = 'book_lesson';
|
||||
public const INSTRUCTOR = 'us_instructor';
|
||||
public const STUDENT = 'us_student';
|
||||
|
||||
public function register(): void
|
||||
{
|
||||
add_action('init', [$this, 'createRoles']);
|
||||
}
|
||||
public const CAP_MANAGE_AVAILABILITY = 'manage_availability';
|
||||
public const CAP_VIEW_LESSONS = 'view_own_lessons';
|
||||
public const CAP_BOOK_LESSON = 'book_lesson';
|
||||
|
||||
public function createRoles(): void
|
||||
{
|
||||
if (get_role(self::INSTRUCTOR) === null) {
|
||||
add_role(
|
||||
self::INSTRUCTOR,
|
||||
__('Instructor', 'unsupervised-schedular'),
|
||||
[
|
||||
'read' => true,
|
||||
self::CAP_MANAGE_AVAILABILITY => true,
|
||||
self::CAP_VIEW_LESSONS => true,
|
||||
]
|
||||
);
|
||||
}
|
||||
public function register(): void {
|
||||
add_action( 'init', [ $this, 'createRoles' ] );
|
||||
}
|
||||
|
||||
if (get_role(self::STUDENT) === null) {
|
||||
add_role(
|
||||
self::STUDENT,
|
||||
__('Student', 'unsupervised-schedular'),
|
||||
[
|
||||
'read' => true,
|
||||
self::CAP_BOOK_LESSON => true,
|
||||
self::CAP_VIEW_LESSONS => true,
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
public function createRoles(): void {
|
||||
if ( get_role( self::INSTRUCTOR ) === null ) {
|
||||
add_role(
|
||||
self::INSTRUCTOR,
|
||||
__( 'Instructor', 'unsupervised-schedular' ),
|
||||
[
|
||||
'read' => true,
|
||||
self::CAP_MANAGE_AVAILABILITY => true,
|
||||
self::CAP_VIEW_LESSONS => true,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
if ( get_role( self::STUDENT ) === null ) {
|
||||
add_role(
|
||||
self::STUDENT,
|
||||
__( 'Student', 'unsupervised-schedular' ),
|
||||
[
|
||||
'read' => true,
|
||||
self::CAP_BOOK_LESSON => true,
|
||||
self::CAP_VIEW_LESSONS => true,
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user