From b7f82d78e924d24aa79b27bbdba51c88c7f596ca Mon Sep 17 00:00:00 2001 From: Olly Betts Date: Fri, 10 Jun 2022 13:38:00 +1200 Subject: [PATCH] Fix director_classes_runme.php for PHP 7.0 PHP 7.0 fails to parse `?` before a parameter type (meaning Nullable in newer versions), so just omit these parameter type declarations in the testcase until we drop PHP 7.0 support. Also drop some `var_dump($x);` left over from debugging this testcase. --- Examples/test-suite/php/director_classes_runme.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Examples/test-suite/php/director_classes_runme.php b/Examples/test-suite/php/director_classes_runme.php index 0901107f7..f50544024 100644 --- a/Examples/test-suite/php/director_classes_runme.php +++ b/Examples/test-suite/php/director_classes_runme.php @@ -14,7 +14,7 @@ if (PHP_MAJOR_VERSION < 8) { class PHPDerived extends Base { function Val($x) { return $x; } function Ref($x) { return $x; } - function Ptr($x) { var_dump($x); return $x; } + function Ptr($x) { return $x; } function ConstPtrRef($x) { return $x; } function FullyOverloaded($x) { $rv = parent::FullyOverloaded($x); @@ -41,8 +41,12 @@ if (PHP_MAJOR_VERSION < 8) { class PHPDerived extends Base { function Val(DoubleHolder $x) { return $x; } function Ref(DoubleHolder $x) { return $x; } - function Ptr(?DoubleHolder $x) { var_dump($x); return $x; } - function ConstPtrRef(?DoubleHolder $x) { return $x; } + // PHP 7.0 fails to parse the `?` - revert once we drop 7.0 support: + // function Ptr(?DoubleHolder $x) { return $x; } + function Ptr($x) { return $x; } + // PHP 7.0 fails to parse the `?` - revert once we drop 7.0 support: + // function ConstPtrRef(?DoubleHolder $x) { return $x; } + function ConstPtrRef($x) { return $x; } function FullyOverloaded($x) { $rv = parent::FullyOverloaded($x); $rv = preg_replace('/Base/', 'PHPDerived', $rv);