Conditions | 1 |
Paths | 1 |
Total Lines | 10 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
15 | public function __construct($code, $param) |
||
16 | { |
||
17 | static::$error_messages = [ |
||
|
|||
18 | static::NO_ERROR_TEXT => "Error text could not found for ':param', or Error file could not found", |
||
19 | static::STATIC_METHOD => "The method :param should be static", |
||
20 | static::UNKNOWN_RULE => "Unknown Rule: :param", |
||
21 | static::ARRAY_EXPECTED => "Rules are expected to Array. Input Name: :param" |
||
22 | ]; |
||
23 | parent::__construct(str_replace(":param", $param, static::$error_messages[$code]), $code); |
||
24 | } |
||
25 | |||
27 |
Let’s assume you have a class which uses late-static binding:
The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the
getSomeVariable()
on that sub-class, you will receive a runtime error:In the case above, it makes sense to update
SomeClass
to useself
instead: