1 | <?php |
||
10 | trait NGramsTrait |
||
11 | { |
||
12 | /** |
||
13 | * @var \drupol\phpngrams\NGramsInterface |
||
14 | */ |
||
15 | private $ngrams; |
||
16 | |||
17 | /** |
||
18 | * @param \drupol\phpngrams\NGramsInterface $ngrams |
||
19 | */ |
||
20 | public function setNgram(NGramsInterface $ngrams) |
||
24 | |||
25 | /** |
||
26 | * @return \drupol\phpngrams\NGramsInterface |
||
27 | */ |
||
28 | public function getNGrams(): NGramsInterface |
||
32 | |||
33 | /** |
||
34 | * @param \Generator $ngrams |
||
35 | * @param string|array $substring |
||
36 | * |
||
37 | * @return float|int |
||
38 | */ |
||
39 | public function frequency(\Generator $ngrams, $substring) |
||
43 | |||
44 | /** |
||
45 | * @param string|array $data |
||
46 | * @param int $n |
||
47 | * |
||
48 | * @return bool|\Generator |
||
49 | */ |
||
50 | public function ngrams($data, int $n = 1) |
||
54 | } |
||
55 |
This check looks at variables that have been passed in as parameters and are passed out again to other methods.
If the outgoing method call has stricter type requirements than the method itself, an issue is raised.
An additional type check may prevent trouble.