for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace WPEmerge\Routing\Conditions;
use WPEmerge\Requests\Request;
/**
* Check against a query var value.
*
* @codeCoverageIgnore
*/
class QueryVarCondition implements ConditionInterface {
* Query var name to check against.
* @var string|null
protected $query_var = null;
* Query var value to check against.
* @var string
protected $value = '';
* Constructor.
* @param string $query_var
* @param string $value
$value
string|null
This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.
@param
It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.
public function __construct( $query_var, $value = null ) {
$this->query_var = $query_var;
$this->value = $value;
}
* {@inheritDoc}
public function isSatisfied( Request $request ) {
$query_var_value = get_query_var( $this->query_var, null );
if ( $query_var_value === null ) {
return false;
if ( $this->value === null ) {
return true;
return strval( $this->value ) === $query_var_value;
public function getArguments( Request $request ) {
return [$this->query_var, $this->value];
This check looks for
@paramannotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.