Skip to content

Commit

Permalink
Merge pull request #29 from Automattic/workflows
Browse files Browse the repository at this point in the history
Run phpcs on PRs
  • Loading branch information
psrpinto authored Sep 12, 2022
2 parents 1b690ee + 7726ebf commit 01a0fc4
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 5 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: PR checks

on:
pull_request:
types: [ opened, synchronize ]

jobs:
lint-plugin:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install composer dependencies
run: composer install

- name: Run phpcs
run: ./vendor/bin/phpcs
2 changes: 2 additions & 0 deletions src/Http/Handlers/AuthorizeHandler.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

// phpcs:disable WordPress.Security.NonceVerification.Missing

namespace OpenIDConnectServer\Http\Handlers;

use OAuth2\Request;
Expand Down
10 changes: 5 additions & 5 deletions src/Http/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ function () use ( $route, $methods ) {
);
}

private function get_current_route() {
private function get_current_route(): string {
$wp_url = get_site_url();
$installed_dir = parse_url( $wp_url, PHP_URL_PATH );
$installed_dir = wp_parse_url( $wp_url, PHP_URL_PATH );

// requested uri relative to WP install
$request_uri = str_replace( $installed_dir, '', $_SERVER['REQUEST_URI'] );
// Requested URI relative to WP install.
$uri = isset( $_SERVER['REQUEST_URI'] ) ? esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : '';
$uri = str_replace( $installed_dir, '', $uri );

$uri = sanitize_text_field( wp_unslash( $request_uri ) );
$route = strtok( $uri, '?' );

return trim( $route, '/' );
Expand Down
2 changes: 2 additions & 0 deletions src/Storage/UserClaimsStorage.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

//phpcs:disable WordPress.Security.NonceVerification.Recommended

namespace OpenIDConnectServer\Storage;

use OAuth2\OpenID\Storage\UserClaimsInterface;
Expand Down

0 comments on commit 01a0fc4

Please sign in to comment.