It seems like $this->barcodes can also be of type null; however, parameter $haystack of in_array() does only seem to accept array, 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
56
if (in_array($barcode, /** @scrutinizer ignore-type */ $this->barcodes)) {
Loading history...
57
1
throw new \InvalidArgumentException("Barcode: $barcode already exists.");