Completed
Pull Request — master (#156)
by Lucas
02:51
created

None   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A none() 0 10 2
1
<?php
2
3
namespace Spatie\CollectionMacros\Macros;
4
5
6
7
class None
8
{
9
    /**
10
     * Check whether a collection doesn't contain any occurrences of a given
11
     * item, key-value pair, or passing truth test. `none` accepts the same
12
     * parameters as the `contains` collection method.
13
     *
14
     * @see \Illuminate\Support\Collection::contains
15
     *
16
     * @param mixed $key
0 ignored issues
show
Bug introduced by
There is no parameter named $key. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
17
     * @param mixed $value
0 ignored issues
show
Bug introduced by
There is no parameter named $value. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
18
     *
19
     * @return bool
20
     */
21
    public function none()
22
    {
23
        return function ($key, $value = null): bool {
24
            if (func_num_args() === 2) {
25
                return ! $this->contains($key, $value);
0 ignored issues
show
Bug introduced by
The method contains() does not seem to exist on object<Spatie\CollectionMacros\Macros\None>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
26
            }
27
28
            return ! $this->contains($key);
0 ignored issues
show
Bug introduced by
The method contains() does not seem to exist on object<Spatie\CollectionMacros\Macros\None>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
29
        };
30
    }
31
}
32