1.2.591. Interfaces Usage¶
List of used interfaces.
Interfaces are used when mentioned in a class or another interface, with implements keyword; they are used in instanceof expression, in typehints and class constant.
<?php
// interface definition
interface i {
const I = 2;
}
// interface extension
interface i2 extends i {}
// interface implementation
class foo implements i {}
$foo = new foo();
var_dump($foo instanceof i);
function bar( i $arg) { }
bar($foo);
// in class constant
echo i::I;
?>
1.2.591.1. Connex PHP features¶
1.2.591.1.1. Specs¶
Short name |
Interfaces/InterfaceUsage |
Rulesets |
|
Exakat since |
0.8.4 |
PHP Version |
All |
Severity |
Minor |
Time To Fix |
Quick (30 mins) |
Precision |
Very high |
Available in |