src/Testing/Builder.php
Builder
has 23 functions (exceeds 20 allowed). Consider refactoring. Invalid
Invalid
class Builder
{
/**
* Create a new expectation builder instance.
*
Function is
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Invalid
Invalid
#[Pure]
protected function is(Alert $alert): bool
{
if ($this->message !== null && $this->message !== $alert->getMessage()) {
return false;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method is
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Invalid
Invalid
#[Pure]
protected function is(Alert $alert): bool
{
if ($this->message !== null && $this->message !== $alert->getMessage()) {
return false;
Method __construct
has 8 arguments (exceeds 4 allowed). Consider refactoring. Invalid
Invalid
public BagFake $bag,
protected ?string $message = null,
protected ?array $types = null,
protected ?bool $dismiss = null,
protected array|bool|null|string $persisted = null,
Avoid too many return
statements within this method. Wontfix
Wontfix
return in_array($alert->getPersistKey(), $this->persisted, true);
Avoid too many return
statements within this method. Wontfix
Wontfix
return true;
Avoid too many return
statements within this method. Wontfix
Wontfix
return $this->tags === $alert->getTags();
Avoid too many return
statements within this method. Wontfix
Wontfix
return false;
Avoid too many return
statements within this method. Wontfix
Wontfix
return $this->persisted === $alert->getPersistKey();
Avoid too many return
statements within this method. Wontfix
Wontfix
return $this->persisted === (bool) $alert->getPersistKey();