Repository: humbug/php-scoper (php)

Issue:
scoper-autoload.php doesn't support PHP 5.6
## Bug report

| Question    | Answer
| ------------| ---------------
| PHP-Scoper version | 0.18.3
| PHP version | 5.6
| Platform with version | all
| Github Repo | [- <!-- (if public) -->](https://github.com/skaut/skaut-google-drive-gallery/)

Hi,
I am using PHP-scoper for packaging a WordPress plugin, so I don't really get much control over which PHP versions it will be running with. Recently I got reports of ` syntax error, unexpected ‘:’, expecting ‘{‘` in the `scoper-autoload.php` file and was surprised to find that it contains return type annotations, possibly as an artifact from the build process. I tried to look for info about supported runtime php versions in the project, but couldn't find any

I assume composer minimum version is the version of PHP php-scoper runs on, but the output would respect the source code it processes...

Pull request description:
Fixed scoper-autoload.php being incompatible with PHP 5
Closes #842


Patch:
diff --git a/src/Autoload/ScoperAutoloadGenerator.php b/src/Autoload/ScoperAutoloadGenerator.php
index 7afab5c..f2b01aa 100644
--- a/src/Autoload/ScoperAutoloadGenerator.php
+++ b/src/Autoload/ScoperAutoloadGenerator.php
@@ -43,7 +43,7 @@ final class ScoperAutoloadGenerator
 
     private const EXPOSE_CLASS_DECLARATION = <<<'PHP'
         if (!function_exists('humbug_phpscoper_expose_class')) {
-            function humbug_phpscoper_expose_class(string $exposed, string $prefixed): void {
+            function humbug_phpscoper_expose_class($exposed, $prefixed) {
                 if (!class_exists($exposed, false) && !interface_exists($exposed, false) && !trait_exists($exposed, false)) {
                     spl_autoload_call($prefixed);
                 }


Test patch:
diff --git a/tests/Autoload/ScoperAutoloadGeneratorTest.php b/tests/Autoload/ScoperAutoloadGeneratorTest.php
index 346f079..7a6e1a9 100644
--- a/tests/Autoload/ScoperAutoloadGeneratorTest.php
+++ b/tests/Autoload/ScoperAutoloadGeneratorTest.php
@@ -280,7 +280,7 @@ class ScoperAutoloadGeneratorTest extends TestCase
                 // Class aliases. For more information see:
                 // https://github.com/humbug/php-scoper/blob/master/docs/further-reading.md#class-aliases
                 if (!function_exists('humbug_phpscoper_expose_class')) {
-                    function humbug_phpscoper_expose_class(string $exposed, string $prefixed): void {
+                    function humbug_phpscoper_expose_class($exposed, $prefixed) {
                         if (!class_exists($exposed, false) && !interface_exists($exposed, false) && !trait_exists($exposed, false)) {
                             spl_autoload_call($prefixed);
                         }
@@ -326,7 +326,7 @@ class ScoperAutoloadGeneratorTest extends TestCase
                 // Class aliases. For more information see:
                 // https://github.com/humbug/php-scoper/blob/master/docs/further-reading.md#class-aliases
                 if (!function_exists('humbug_phpscoper_expose_class')) {
-                    function humbug_phpscoper_expose_class(string $exposed, string $prefixed): void {
+                    function humbug_phpscoper_expose_class($exposed, $prefixed) {
                         if (!class_exists($exposed, false) && !interface_exists($exposed, false) && !trait_exists($exposed, false)) {
                             spl_autoload_call($prefixed);
                         }
@@ -381,7 +381,7 @@ class ScoperAutoloadGeneratorTest extends TestCase
                 // https://github.com/humbug/php-scoper/blob/master/docs/further-reading.md#class-aliases
                 namespace {
                     if (!function_exists('humbug_phpscoper_expose_class')) {
-                        function humbug_phpscoper_expose_class(string $exposed, string $prefixed): void {
+                        function humbug_phpscoper_expose_class($exposed, $prefixed) {
                             if (!class_exists($exposed, false) && !interface_exists($exposed, false) && !trait_exists($exposed, false)) {
                                 spl_autoload_call($prefixed);
                             }