Completed
Push — try/capabilities ( 1eedd1...45f305 )
by
unknown
06:43
created

Jetpack_Capabilities   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A init() 0 9 1
1
<?php
2
3
use \Automattic\Jetpack\Capabilities;
4
5
class Jetpack_Capabilities {
6
	static function init() {
7
		Capabilities::build( 'jetpack.recurring-payments.enabled' )
8
			->require_jetpack_is_active()
9
			->require_any( function( $builder ) {
0 ignored issues
show
Documentation introduced by
function ($builder) { ...pgrade_nudge', true); } is of type object<Closure>, but the function expects a object<Automattic\Jetpack\Capabilities\function>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
10
				$builder
11
					->require_jetpack_plan_supports( 'recurring-payments' )
12
					->require_filter( 'jetpack_block_editor_enable_upgrade_nudge', true );
13
			} );
14
	}
15
}
16
17
add_action( 'init', [ 'Jetpack_Capabilities', 'init' ] );