From 1c5c5c847d13d071f3c8e6d1ba5bf3e37bb21147 Mon Sep 17 00:00:00 2001 From: Alexander Prokhorov Date: Fri, 22 May 2015 23:22:59 +0300 Subject: [PATCH] Fixed #8 (PHP Fatal error: Cannot redeclare from()): decorated from function with function_exists call. --- YaLinqo/Linq.php | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/YaLinqo/Linq.php b/YaLinqo/Linq.php index f4867db..b2c3ddf 100644 --- a/YaLinqo/Linq.php +++ b/YaLinqo/Linq.php @@ -8,12 +8,14 @@ }); // @codeCoverageIgnoreEnd -/** - * @param array|\Iterator|\IteratorAggregate|\YaLinqo\Enumerable $source - * @throws \InvalidArgumentException If source is not array or Traversible or Enumerable. - * @return \YaLinqo\Enumerable - */ -function from ($source) -{ - return \YaLinqo\Enumerable::from($source); -} +if (!function_exists('from')) { + /** + * @param array|\Iterator|\IteratorAggregate|\YaLinqo\Enumerable $source + * @throws \InvalidArgumentException If source is not array or Traversible or Enumerable. + * @return \YaLinqo\Enumerable + */ + function from ($source) + { + return \YaLinqo\Enumerable::from($source); + } +} \ No newline at end of file