Fix new director_classes_runme.php for PHP7
This commit is contained in:
parent
2de2efb0bb
commit
14df91f8a0
1 changed files with 53 additions and 22 deletions
|
|
@ -8,30 +8,61 @@ check::classes(array('director_classes', 'Base', 'BaseClass', 'Caller', 'Derived
|
||||||
// New vars
|
// New vars
|
||||||
check::globals(array('PrintDebug'));
|
check::globals(array('PrintDebug'));
|
||||||
|
|
||||||
class PHPDerived extends Base {
|
if (PHP_MAJOR_VERSION < 8) {
|
||||||
function Val(DoubleHolder $x) { return $x; }
|
// Without type declarations since we don't generate them for PHP < 8
|
||||||
function Ref(DoubleHolder $x) { return $x; }
|
// and we need to be compatible with method declarations in Base.
|
||||||
function Ptr(?DoubleHolder $x) { var_dump($x); return $x; }
|
class PHPDerived extends Base {
|
||||||
function ConstPtrRef(?DoubleHolder $x) { return $x; }
|
function Val($x) { return $x; }
|
||||||
function FullyOverloaded($x) {
|
function Ref($x) { return $x; }
|
||||||
$rv = parent::FullyOverloaded($x);
|
function Ptr($x) { var_dump($x); return $x; }
|
||||||
$rv = preg_replace('/Base/', 'PHPDerived', $rv);
|
function ConstPtrRef($x) { return $x; }
|
||||||
return $rv;
|
function FullyOverloaded($x) {
|
||||||
}
|
$rv = parent::FullyOverloaded($x);
|
||||||
function SemiOverloaded($x) {
|
$rv = preg_replace('/Base/', 'PHPDerived', $rv);
|
||||||
# this is going to be awkward because we can't really
|
return $rv;
|
||||||
# semi-overload in PHP, but we can sort of fake it.
|
}
|
||||||
if (!is_int($x)) {
|
function SemiOverloaded($x) {
|
||||||
return parent::SemiOverloaded($x);
|
# this is going to be awkward because we can't really
|
||||||
|
# semi-overload in PHP, but we can sort of fake it.
|
||||||
|
if (!is_int($x)) {
|
||||||
|
return parent::SemiOverloaded($x);
|
||||||
|
}
|
||||||
|
$rv = parent::SemiOverloaded($x);
|
||||||
|
$rv = preg_replace('/Base/', 'PHPDerived', $rv);
|
||||||
|
return $rv;
|
||||||
|
}
|
||||||
|
function DefaultParms($x, $y = 1.1) {
|
||||||
|
$rv = parent::DefaultParms($x, $y);
|
||||||
|
$rv = preg_replace('/Base/', 'PHPDerived', $rv);
|
||||||
|
return $rv;
|
||||||
}
|
}
|
||||||
$rv = parent::SemiOverloaded($x);
|
|
||||||
$rv = preg_replace('/Base/', 'PHPDerived', $rv);
|
|
||||||
return $rv;
|
|
||||||
}
|
}
|
||||||
function DefaultParms(int $x, float $y = 1.1) {
|
} else {
|
||||||
$rv = parent::DefaultParms($x, $y);
|
class PHPDerived extends Base {
|
||||||
$rv = preg_replace('/Base/', 'PHPDerived', $rv);
|
function Val(DoubleHolder $x) { return $x; }
|
||||||
return $rv;
|
function Ref(DoubleHolder $x) { return $x; }
|
||||||
|
function Ptr(?DoubleHolder $x) { var_dump($x); return $x; }
|
||||||
|
function ConstPtrRef(?DoubleHolder $x) { return $x; }
|
||||||
|
function FullyOverloaded($x) {
|
||||||
|
$rv = parent::FullyOverloaded($x);
|
||||||
|
$rv = preg_replace('/Base/', 'PHPDerived', $rv);
|
||||||
|
return $rv;
|
||||||
|
}
|
||||||
|
function SemiOverloaded($x) {
|
||||||
|
# this is going to be awkward because we can't really
|
||||||
|
# semi-overload in PHP, but we can sort of fake it.
|
||||||
|
if (!is_int($x)) {
|
||||||
|
return parent::SemiOverloaded($x);
|
||||||
|
}
|
||||||
|
$rv = parent::SemiOverloaded($x);
|
||||||
|
$rv = preg_replace('/Base/', 'PHPDerived', $rv);
|
||||||
|
return $rv;
|
||||||
|
}
|
||||||
|
function DefaultParms(int $x, float $y = 1.1) {
|
||||||
|
$rv = parent::DefaultParms($x, $y);
|
||||||
|
$rv = preg_replace('/Base/', 'PHPDerived', $rv);
|
||||||
|
return $rv;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue