c2ec1c97c9
A poor man's formatter since I didn't like any of the other ones I found. The original C++ source sometimes put newlines and sometimes not.
Codemods:
codemod '([;{}])([^\n])' '\1\n\2'
codemod -m '\s*<\?php\s+' '<?php\n\n'
codemod '\t' ' '
I hand-fixed all the failing tests
39 linhas
757 B
PHP
39 linhas
757 B
PHP
<?php
|
|
|
|
abstract class Parent_ {
|
|
protected function overridden() {
|
|
var_dump(isset($this), __METHOD__);
|
|
}
|
|
protected function calledHere() {
|
|
if (isset($this)) {
|
|
$this->overridden();
|
|
}
|
|
else {
|
|
static::overridden();
|
|
}
|
|
}
|
|
}
|
|
class Child extends Parent_ {
|
|
protected final function overridden() {
|
|
var_dump(isset($this), __METHOD__);
|
|
}
|
|
protected function calledHere() {
|
|
var_dump(__METHOD__);
|
|
}
|
|
public function entry($fun = 'calledHere') {
|
|
self::callParent($fun);
|
|
}
|
|
function callParent($fun) {
|
|
parent::$fun();
|
|
if (isset($this)) {
|
|
$this::$fun();
|
|
}
|
|
}
|
|
}
|
|
$c = new Child;
|
|
$c->entry();
|
|
$c->entry('overridden');
|
|
Child::entry();
|
|
Child::callParent('calledHere');
|
|
Child::callParent('overridden');
|