summaryrefslogtreecommitdiff
path: root/Examples/test-suite/php/director_classes_runme.php
diff options
context:
space:
mode:
Diffstat (limited to 'Examples/test-suite/php/director_classes_runme.php')
-rw-r--r--Examples/test-suite/php/director_classes_runme.php75
1 files changed, 22 insertions, 53 deletions
diff --git a/Examples/test-suite/php/director_classes_runme.php b/Examples/test-suite/php/director_classes_runme.php
index 937d0db3f..170e10f26 100644
--- a/Examples/test-suite/php/director_classes_runme.php
+++ b/Examples/test-suite/php/director_classes_runme.php
@@ -8,61 +8,30 @@ check::classes(array('director_classes', 'Base', 'BaseClass', 'Caller', 'Derived
// New vars
check::globals(array('PrintDebug'));
-if (PHP_MAJOR_VERSION < 8) {
- // Without type declarations since we don't generate them for PHP < 8
- // and we need to be compatible with method declarations in Base.
- class PHPDerived extends Base {
- function Val($x) { return $x; }
- function Ref($x) { return $x; }
- function Ptr($x) { return $x; }
- function ConstPtrRef($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($x, $y = 1.1) {
- $rv = parent::DefaultParms($x, $y);
- $rv = preg_replace('/Base/', 'PHPDerived', $rv);
- return $rv;
- }
+class PHPDerived extends Base {
+ function Val(DoubleHolder $x) { return $x; }
+ function Ref(DoubleHolder $x) { return $x; }
+ function Ptr(?DoubleHolder $x) { return $x; }
+ function ConstPtrRef(?DoubleHolder $x) { return $x; }
+ function FullyOverloaded($x) {
+ $rv = parent::FullyOverloaded($x);
+ $rv = preg_replace('/Base/', 'PHPDerived', $rv);
+ return $rv;
}
-} else {
- class PHPDerived extends Base {
- function Val(DoubleHolder $x) { return $x; }
- function Ref(DoubleHolder $x) { return $x; }
- function Ptr(?DoubleHolder $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;
+ 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;
}
}