From d0561b8f77e8ef2ed6d83328860e16c81a5a8649 Mon Sep 17 00:00:00 2001 From: David Grudl Date: Wed, 30 Jan 2019 14:26:05 +0100 Subject: [PATCH] compatibility with nette/php-generator 3.x [Closes #182] --- composer.json | 2 +- src/DI/PhpGenerator.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index cd4c1be65..3904c359b 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ "php": ">=5.6.0", "ext-tokenizer": "*", "nette/neon": "^2.3.3 || ~3.0.0", - "nette/php-generator": "^2.6.1 || ~3.0.0", + "nette/php-generator": "^2.6.1 || ^3.0.0", "nette/utils": "^2.5.0 || ~3.0.0" }, "require-dev": { diff --git a/src/DI/PhpGenerator.php b/src/DI/PhpGenerator.php index 4ec10f3c3..791f6b9f2 100644 --- a/src/DI/PhpGenerator.php +++ b/src/DI/PhpGenerator.php @@ -263,7 +263,8 @@ private function convertParameters(array $parameters) $tmp = explode(' ', is_int($k) ? $v : $k); $param = $res[] = new Nette\PhpGenerator\Parameter(end($tmp)); if (!is_int($k)) { - $param->setOptional(true)->setDefaultValue($v); + @$param->setOptional(true); // @ deprecated in nette/php-generator 3.1 + $param->setDefaultValue($v); } if (isset($tmp[1])) { $param->setTypeHint($tmp[0]);