| Conditions | 4 |
| Paths | 4 |
| Total Lines | 14 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 13 | public function initializeHTMLFormElement( array $config = [] ) { |
||
| 14 | // Properties |
||
| 15 | $this->hideIf = isset( $config['hideIf'] ) ? $config['hideIf'] : null; |
||
| 16 | |||
| 17 | // Initialization |
||
| 18 | if ( $this->hideIf ) { |
||
| 19 | $this->addClasses( [ 'mw-htmlform-hide-if' ] ); |
||
|
|
|||
| 20 | } |
||
| 21 | $this->registerConfigCallback( function( &$config ) { |
||
| 22 | if ( $this->hideIf !== null ) { |
||
| 23 | $config['hideIf'] = $this->hideIf; |
||
| 24 | } |
||
| 25 | } ); |
||
| 26 | } |
||
| 27 | } |
||
| 58 |
This check looks for methods that are used by a trait but not required by it.
To illustrate, let’s look at the following code example
The trait
Idableprovides a methodequalsIdthat in turn relies on the methodgetId(). If this method does not exist on a class mixing in this trait, the method will fail.Adding the
getId()as an abstract method to the trait will make sure it is available.