| Conditions | 6 |
| Paths | 24 |
| Total Lines | 31 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php //phpcs:ignore WordPress.Files.FileName.InvalidClassFileName |
||
| 24 | public static function callback( Event $event ) { |
||
| 25 | $arguments = $event->getArguments(); |
||
| 26 | $scan_path = isset( $arguments[0] ) ? $arguments[0] : null; |
||
| 27 | $io = $event->getIO(); |
||
| 28 | |||
| 29 | if ( is_null( $scan_path ) ) { |
||
| 30 | $io->writeError( 'Scan path is required for this script to work. Pass it as the argument.' ); |
||
| 31 | return; |
||
| 32 | } |
||
| 33 | |||
| 34 | $io->write( "Find invocations\n" ); |
||
| 35 | try { |
||
| 36 | $invocations = new Invocations(); |
||
| 37 | $invocations->scan( $scan_path ); |
||
| 38 | foreach ( $invocations->get() as $invocation ) { |
||
| 39 | |||
| 40 | // TODO: Need a way to separate Core calls from others. |
||
| 41 | if ( $invocation instanceof Invocations\Function_Call ) { |
||
| 42 | $io->write( |
||
| 43 | $invocation->func_name . ', ' . |
||
| 44 | $invocation->path . ', ' . |
||
| 45 | $invocation->line |
||
| 46 | ); |
||
| 47 | } |
||
| 48 | } |
||
| 49 | } catch ( Exception $e ) { |
||
| 50 | $io->writeError( 'Exception caught' ); |
||
| 51 | $io->writeError( $e->getMessage() ); |
||
| 52 | return; |
||
| 53 | } |
||
| 54 | } |
||
| 55 | } |
||
| 56 |
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.