From d3c50195d3b765e63963a5f32e4b5fb9bdf0bc40 Mon Sep 17 00:00:00 2001 From: Alexander Prokhorov Date: Fri, 30 Oct 2015 06:15:48 +0300 Subject: [PATCH] Added SensioLabs config. Fixed tiny issues suggested by SensioLabs. --- .sensiolabs.yml | 3 +++ YaLinqo/Errors.php | 2 -- YaLinqo/OrderedEnumerable.php | 5 +++-- 3 files changed, 6 insertions(+), 4 deletions(-) create mode 100644 .sensiolabs.yml diff --git a/.sensiolabs.yml b/.sensiolabs.yml new file mode 100644 index 0000000..9bff593 --- /dev/null +++ b/.sensiolabs.yml @@ -0,0 +1,3 @@ +rules: + missing_e_o_l: + enabled: false diff --git a/YaLinqo/Errors.php b/YaLinqo/Errors.php index 7d3c5c1..4517363 100644 --- a/YaLinqo/Errors.php +++ b/YaLinqo/Errors.php @@ -2,8 +2,6 @@ namespace YaLinqo; -use YaLinqo; - class Errors { /** Error message: "Sequence contains no elements." */ diff --git a/YaLinqo/OrderedEnumerable.php b/YaLinqo/OrderedEnumerable.php index bc556eb..1708191 100644 --- a/YaLinqo/OrderedEnumerable.php +++ b/YaLinqo/OrderedEnumerable.php @@ -154,7 +154,7 @@ private function trySortBySingleField ($array, $canMultisort) private function sortByMultipleFields ($array, $canMultisort) { $orders = [ ]; - for ($order = $this; $order != null; $order = $order->parent) { + for ($order = $this; $order !== null; $order = $order->parent) { $orders[] = $order; if ($order->sortFlags === null) $canMultisort = false; @@ -240,7 +240,8 @@ private function sortIteratorWithUsort (&$enum, $orders) usort($enum, function ($a, $b) use ($orders) { /** @var $order OrderedEnumerable */ - for ($i = 0; $i < count($orders); $i++) { + $count = count($orders); + for ($i = 0; $i < $count; $i++) { $order = $orders[$i]; $comparer = $order->comparer; $diff = $comparer($a[$i + 2], $b[$i + 2]);