The sonar code health analysis has surfaced a strange piece of code:
if ( count( $matchedTermIndexEntries ) > $limit ) { array_slice( $matchedTermIndexEntries, 0, $limit, true ); }
PHP's array_slice does not mutate its arguments but instead returns a value. That returned value is not used here, so something is wrong.
- Figure out what is going on. Do we actually have a bug here that can be somehow seen in production?
- Try to understand why there are no tests failing (are there none for that feature?)
- Fix it (either remove it if it is not used or fix it and write a test for it if it is an actual bug in prod)