|null CheckFinding, or null when nothing was found. */ public static function finding( string $text, array $banned, string $field ): ?array { if ( empty( $banned ) ) { return null; } $found = ( new OutputValidator() )->findBannedPhrases( $text, $banned ); if ( empty( $found ) ) { return null; } $quoted = array_map( static function ( string $phrase ): string { return '"' . $phrase . '"'; }, array_values( array_unique( $found ) ) ); return array( 'code' => 'banned_phrase', 'severity' => 'warning', 'field' => $field, /* translators: %s: comma-separated, quoted banned phrases found in the current text. */ 'message' => sprintf( __( 'This template bans these phrases, and the current text uses: %s.', 'ai-product-tools' ), implode( ', ', $quoted ) ), 'label' => __( 'banned phrase used', 'ai-product-tools' ), ); } }