Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PHP8 linter and fix linter issues #465

Merged
merged 9 commits into from
Oct 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ jobs:
- name: Lint PHP
run: npm run lint:php || true # Ignore for now.

- name: Lint PHP8
run: composer lint-php8

- name: Start the Docker testing environment
run: npm run env start --xdebug=coverage

Expand Down
5 changes: 2 additions & 3 deletions class-two-factor-core.php
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ public static function login_html( $user, $login_nonce, $redirect_to, $error_msg
?>
<li>
<a href="<?php echo esc_url( $login_url ); ?>">
<?php $backup_provider->print_label(); ?>
<?php echo esc_html( $backup_provider->get_label() ); ?>
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Don't trust the provider to return the label escaped.

Choose a reason for hiding this comment

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

Thsnks

</a>
</li>
<?php endforeach; ?>
Expand Down Expand Up @@ -987,8 +987,7 @@ public static function user_two_factor_options( $user ) {
<th scope="row"><input id="enabled-<?php echo esc_attr( $class ); ?>" type="checkbox" name="<?php echo esc_attr( self::ENABLED_PROVIDERS_USER_META_KEY ); ?>[]" value="<?php echo esc_attr( $class ); ?>" <?php checked( in_array( $class, $enabled_providers, true ) ); ?> /></th>
<th scope="row"><input type="radio" name="<?php echo esc_attr( self::PROVIDER_USER_META_KEY ); ?>" value="<?php echo esc_attr( $class ); ?>" <?php checked( $class, $primary_provider_key ); ?> /></th>
<td>
<label for="enabled-<?php echo esc_attr( $class ); ?>"><?php $object->print_label(); ?></label>

<label class="two-factor-method-label" for="enabled-<?php echo esc_attr( $class ); ?>"><?php echo esc_html( $object->get_label() ); ?></label>
<?php
/**
* Fires after user options are shown.
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
},
"scripts": {
"lint": "phpcs",
"lint-php8": "phpcs -p --standard=PHPCompatibilityWP --runtime-set testVersion 8.0- --extensions=php --ignore='vendor/,wordpress/,node_modules/' .",
"test": "phpunit",
"format": "phpcbf"
}
Expand Down
Loading