| Conditions | 4 |
| Paths | 8 |
| Total Lines | 16 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 35 | function dp_alternative_products() { |
||
| 36 | |||
| 37 | global $post; |
||
| 38 | $alt_products = get_post_meta( $post->ID, '_alt_products', true ); |
||
| 39 | $alt_products = is_array( $alt_products ) ? $alt_products : array(); |
||
| 40 | $text = _( 'This product has been discontinued.' ); |
||
| 41 | $notice = empty( $alt_products ) ? $text : $text . ' ' . _( 'You may be interested in:' ); |
||
| 42 | ?> |
||
| 43 | <h4><?php echo esc_html( $notice ); ?></h4> |
||
| 44 | <?php |
||
| 45 | foreach ( $alt_products as $alt_product ) { |
||
| 46 | ?> |
||
| 47 | <a href="<?php echo esc_url( get_permalink( $alt_product ) ); ?>" class="button"><?php echo get_the_title( $alt_product ); ?></a> |
||
| 48 | <?php |
||
| 49 | } |
||
| 50 | } |
||
| 51 | } |
||
| 52 |
This check looks for
@paramannotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.