Skip to content

Commit

Permalink
PHPStan fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jdevalk committed Sep 18, 2024
1 parent cfe59f2 commit 18a1245
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion admin/views/config-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ class="regular-text"
<?php if ( isset( $this->options['redirect_page'] ) && $this->options['redirect_page'] !== 0 ) : ?>
<br>
<br>
<a target="_blank" href="<?php echo esc_url( get_permalink( $this->options['redirect_page'] ) ); ?>">
<a target="_blank" href="<?php echo esc_url( get_permalink( (int) $this->options['redirect_page'] ) ); ?>">
<?php esc_html_e( 'Current redirect page', 'comment-hacks' ); ?>
</a>
<?php endif; ?>
Expand Down
2 changes: 1 addition & 1 deletion inc/forms.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function comment_form_fields() {
?>
<label class="agree-comment-policy">
<input type="checkbox" name="comment_policy">
<a href="<?php echo \esc_url( \get_permalink( $this->options['comment_policy_page'] ) ); ?>" target="_blank">
<a href="<?php echo \esc_url( \get_permalink( (int) $this->options['comment_policy_page'] ) ); ?>" target="_blank">
<?php echo \esc_html( $this->options['comment_policy_text'] ); ?>
</a>
</label>
Expand Down
7 changes: 4 additions & 3 deletions inc/hacks.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public function get_remove_comment_url_link( $comment_id ) {
if ( isset( $comment ) && $comment instanceof WP_Comment && ! empty( $comment->comment_author_url ) ) {
return \sprintf(
'<a href="#" class="comment-remove-url" data-comment-id="%d" aria-label="%s">%s</a>',
\esc_attr( $comment_id ),
\esc_attr( (string) $comment_id ),
\esc_attr__( 'Remove URL from this comment', 'comment-hacks' ),
\esc_html__( 'Remove URL', 'comment-hacks' )
);
Expand Down Expand Up @@ -223,7 +223,7 @@ public function comment_redirect( string $url, WP_Comment $comment ): string {
if ( empty( $has_approved_comment ) ) {
// Only change $url when the page option is actually set and not zero.
if ( isset( $this->options['redirect_page'] ) && $this->options['redirect_page'] !== 0 ) {
$url = \get_permalink( $this->options['redirect_page'] );
$url = \get_permalink( (int) $this->options['redirect_page'] );

/**
* Allow other plugins to hook in when the user is being redirected,
Expand All @@ -246,7 +246,8 @@ public function comment_redirect( string $url, WP_Comment $comment ): string {
*
* @param string $option The option to check for.
*
* @return bool|string|int
* @return bool|string
*
* @since 1.3
*/
private function get_option_from_cache( string $option ) {
Expand Down
3 changes: 0 additions & 3 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ parameters:
- vendor
- tests
- node_modules
checkGenericClassInNonGenericObjectType: false
treatPhpDocTypesAsCertain: false
ignoreErrors:
- '#Method [a-zA-Z0-9\\_\:\(\)]+ return type has no value type specified in iterable type array.#'
- '#Method [a-zA-Z0-9\\_\:\(\)]+ has parameter \$[a-zA-Z0-9\\_]+ with no value type specified in iterable type array.#'
- '#Constant EMILIA_COMMENT_HACKS_PATH not found.#'

0 comments on commit 18a1245

Please sign in to comment.