summaryrefslogtreecommitdiff
path: root/Examples
diff options
context:
space:
mode:
authorOlly Betts <olly@survex.com>2023-04-20 13:40:00 +1200
committerOlly Betts <olly@survex.com>2023-04-20 13:45:30 +1200
commit9873ff107af2f9dea05ddb9a48b9c2d7abbfd5dc (patch)
tree1c58c8e505270638ab329004f50b729305a2b474 /Examples
parenta5e025e22afa8c808349a759fdaba3f23ac6bee4 (diff)
downloadswig-9873ff107af2f9dea05ddb9a48b9c2d7abbfd5dc.tar.gz
Remove remaining traces of PHP7 support
The bulk of this was already removed in e3b112c69ceed5c39cb07fa45a3ba62b27712679.
Diffstat (limited to 'Examples')
-rw-r--r--Examples/test-suite/php/default_args_runme.php26
-rw-r--r--Examples/test-suite/php/director_classes_runme.php75
2 files changed, 34 insertions, 67 deletions
diff --git a/Examples/test-suite/php/default_args_runme.php b/Examples/test-suite/php/default_args_runme.php
index 31cbe0ff4..cf4932209 100644
--- a/Examples/test-suite/php/default_args_runme.php
+++ b/Examples/test-suite/php/default_args_runme.php
@@ -126,19 +126,17 @@ check::equal(chartest5(), "B", "chartest5()");
check::equal(chartest6(), "C", "chartest6()");
-if (PHP_MAJOR_VERSION >= 8) {
- // Regression test for bug in initial implementation of PHP type declarations.
- $p = (new ReflectionMethod('TrickyInPython', 'value_m1'))->getParameters();
- // empty array in buggy version
- check::equal(count($p), 2, "Expected 2 parameters");
- check::equal((string)$p[0]->getType(), 'int', "Expected int parameter");
- check::equal((string)$p[1]->getType(), 'int', "Expected int parameter");
-
- $p = (new ReflectionMethod('EnumClass', 'blah'))->getParameters();
- // empty array in buggy version
- check::equal(count($p), 2, "Expected 2 parameters");
- check::equal((string)$p[0]->getType(), 'int', "Expected int parameter");
- check::equal((string)$p[1]->getType(), 'int', "Expected int parameter");
-}
+// Regression test for bug in initial implementation of PHP type declarations.
+$p = (new ReflectionMethod('TrickyInPython', 'value_m1'))->getParameters();
+// empty array in buggy version
+check::equal(count($p), 2, "Expected 2 parameters");
+check::equal((string)$p[0]->getType(), 'int', "Expected int parameter");
+check::equal((string)$p[1]->getType(), 'int', "Expected int parameter");
+
+$p = (new ReflectionMethod('EnumClass', 'blah'))->getParameters();
+// empty array in buggy version
+check::equal(count($p), 2, "Expected 2 parameters");
+check::equal((string)$p[0]->getType(), 'int', "Expected int parameter");
+check::equal((string)$p[1]->getType(), 'int', "Expected int parameter");
check::done();
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;
}
}