Issues (964)

src/Grouping/TeacherFirstCharacterStrategy.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace App\Grouping;
4
5
use App\Entity\Teacher;
6
7
class TeacherFirstCharacterStrategy implements GroupingStrategyInterface {
8
9
    /**
10
     * @param Teacher $object
11
     * @return string
12
     */
13
    public function computeKey($object, array $options = [ ]) {
14
        return ucfirst(substr($object->getAcronym(), 0, 1));
0 ignored issues
show
It seems like $object->getAcronym() can also be of type null; however, parameter $string of substr() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

14
        return ucfirst(substr(/** @scrutinizer ignore-type */ $object->getAcronym(), 0, 1));
Loading history...
15
    }
16
17
    /**
18
     * @param string $keyA
19
     * @param string $keyB
20
     */
21
    public function areEqualKeys($keyA, $keyB, array $options = [ ]): bool {
22
        return $keyA === $keyB;
23
    }
24
25
    /**
26
     * @param string $key
27
     */
28
    public function createGroup($key, array $options = [ ]): GroupInterface {
29
        return new TeacherFirstCharacterGroup($key);
30
    }
31
}