From a38ed699beb01de58dc7433781a28b11b6dae26a Mon Sep 17 00:00:00 2001 From: Vincent Lechemin Date: Mon, 28 Aug 2017 15:36:45 +0200 Subject: [PATCH] Removed iterable for compatibility with HHVM --- src/Configurator/BundlesConfigurator.php | 6 +++--- src/Configurator/ContainerConfigurator.php | 2 +- src/Configurator/CopyFromPackageConfigurator.php | 4 ++-- src/Configurator/CopyFromRecipeConfigurator.php | 6 +++--- src/Downloader.php | 4 ++-- src/Recipe.php | 2 +- src/Response.php | 6 +++--- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/Configurator/BundlesConfigurator.php b/src/Configurator/BundlesConfigurator.php index 8c582a661..5fa33f94a 100644 --- a/src/Configurator/BundlesConfigurator.php +++ b/src/Configurator/BundlesConfigurator.php @@ -53,7 +53,7 @@ public function unconfigure(Recipe $recipe, $bundles): void $this->dump($file, $registered); } - private function parse(iterable $manifest, iterable $registered): iterable + private function parse($manifest, $registered) { $bundles = []; foreach ($manifest as $class => $envs) { @@ -65,7 +65,7 @@ private function parse(iterable $manifest, iterable $registered): iterable return $bundles; } - private function load(string $file): iterable + private function load(string $file) { $bundles = file_exists($file) ? (require $file) : []; if (!is_array($bundles)) { @@ -75,7 +75,7 @@ private function load(string $file): iterable return $bundles; } - private function dump(string $file, iterable $bundles): void + private function dump(string $file, $bundles): void { $contents = " $envs) { diff --git a/src/Configurator/ContainerConfigurator.php b/src/Configurator/ContainerConfigurator.php index 88569a458..00bb95b52 100644 --- a/src/Configurator/ContainerConfigurator.php +++ b/src/Configurator/ContainerConfigurator.php @@ -40,7 +40,7 @@ public function unconfigure(Recipe $recipe, $parameters): void file_put_contents($target, implode('', $lines)); } - private function addParameters(iterable $parameters): void + private function addParameters($parameters): void { $target = getcwd().'/config/services.yaml'; $lines = []; diff --git a/src/Configurator/CopyFromPackageConfigurator.php b/src/Configurator/CopyFromPackageConfigurator.php index 8e293cb70..39f574c84 100644 --- a/src/Configurator/CopyFromPackageConfigurator.php +++ b/src/Configurator/CopyFromPackageConfigurator.php @@ -32,7 +32,7 @@ public function unconfigure(Recipe $recipe, $config): void $this->removeFiles($config, $packageDir, getcwd()); } - private function copyFiles(iterable $manifest, string $from, string $to): void + private function copyFiles($manifest, string $from, string $to): void { foreach ($manifest as $source => $target) { $target = $this->options->expandTargetDir($target); @@ -50,7 +50,7 @@ private function copyFiles(iterable $manifest, string $from, string $to): void } } - private function removeFiles(iterable $manifest, string $from, string $to): void + private function removeFiles($manifest, string $from, string $to): void { foreach ($manifest as $source => $target) { $target = $this->options->expandTargetDir($target); diff --git a/src/Configurator/CopyFromRecipeConfigurator.php b/src/Configurator/CopyFromRecipeConfigurator.php index 5e6fb95ca..2845d76b4 100644 --- a/src/Configurator/CopyFromRecipeConfigurator.php +++ b/src/Configurator/CopyFromRecipeConfigurator.php @@ -30,7 +30,7 @@ public function unconfigure(Recipe $recipe, $config): void $this->removeFiles($config, $recipe->getFiles(), getcwd()); } - private function copyFiles(iterable $manifest, iterable $files, string $to): void + private function copyFiles($manifest, $files, string $to): void { foreach ($manifest as $source => $target) { $target = $this->options->expandTargetDir($target); @@ -42,7 +42,7 @@ private function copyFiles(iterable $manifest, iterable $files, string $to): voi } } - private function copyDir(string $source, string $target, iterable $files): void + private function copyDir(string $source, string $target, $files): void { foreach ($files as $file => $data) { if (0 === strpos($file, $source)) { @@ -68,7 +68,7 @@ private function copyFile(string $to, string $contents, bool $executable): void } } - private function removeFiles(iterable $manifest, iterable $files, string $to): void + private function removeFiles($manifest, $files, string $to): void { foreach ($manifest as $source => $target) { $target = $this->options->expandTargetDir($target); diff --git a/src/Downloader.php b/src/Downloader.php index cd3690011..f6149545a 100644 --- a/src/Downloader.php +++ b/src/Downloader.php @@ -174,7 +174,7 @@ public function get(string $path, array $headers = [], $cache = true): Response } } - private function fetchFile(string $url, string $cacheKey, iterable $headers): Response + private function fetchFile(string $url, string $cacheKey, $headers): Response { $options = $this->getOptions($headers); $retries = 3; @@ -204,7 +204,7 @@ private function fetchFile(string $url, string $cacheKey, iterable $headers): Re } } - private function fetchFileIfLastModified(string $url, string $cacheKey, string $lastModifiedTime, iterable $headers): Response + private function fetchFileIfLastModified(string $url, string $cacheKey, string $lastModifiedTime, $headers): Response { $headers[] = 'If-Modified-Since: '.$lastModifiedTime; $options = $this->getOptions($headers); diff --git a/src/Recipe.php b/src/Recipe.php index b87872898..6759fa6da 100644 --- a/src/Recipe.php +++ b/src/Recipe.php @@ -55,7 +55,7 @@ public function getManifest(): array return $this->data['manifest']; } - public function getFiles(): iterable + public function getFiles() { return $this->data['files'] ?? []; } diff --git a/src/Response.php b/src/Response.php index af7679c2a..03019c871 100644 --- a/src/Response.php +++ b/src/Response.php @@ -24,7 +24,7 @@ class Response implements \JsonSerializable /** * @param mixed $body The response as JSON */ - public function __construct($body, iterable $headers = [], int $code = 200) + public function __construct($body, $headers = [], int $code = 200) { $this->body = $body; $this->origHeaders = $headers; @@ -52,7 +52,7 @@ public function getBody() return $this->body; } - public function getOrigHeaders(): iterable + public function getOrigHeaders() { return $this->origHeaders; } @@ -74,7 +74,7 @@ public function jsonSerialize() return ['body' => $this->body, 'headers' => $this->headers]; } - private function parseHeaders(iterable $headers): array + private function parseHeaders($headers): array { $values = []; foreach (array_reverse($headers) as $header) {