Browse Source

Try to get travis to pass again.

mark_story 7 years ago
parent
commit
37d4e37f4c

+ 3 - 3
src/Collection/CollectionInterface.php

@@ -257,7 +257,7 @@ interface CollectionInterface extends Iterator, JsonSerializable
      * @see \Cake\Collection\CollectionIterface::sortBy()
      * @return mixed The value of the top element in the collection
      */
-    public function max($callback, $type = SORT_NUMERIC);
+    public function max($callback, $type = \SORT_NUMERIC);
 
     /**
      * Returns the bottom element in this collection after being sorted by a property.
@@ -283,7 +283,7 @@ interface CollectionInterface extends Iterator, JsonSerializable
      * @see \Cake\Collection\CollectionInterface::sortBy()
      * @return mixed The value of the bottom element in the collection
      */
-    public function min($callback, $type = SORT_NUMERIC);
+    public function min($callback, $type = \SORT_NUMERIC);
 
     /**
      * Returns the average of all the values extracted with $matcher
@@ -378,7 +378,7 @@ interface CollectionInterface extends Iterator, JsonSerializable
      * SORT_NUMERIC or SORT_NATURAL
      * @return \Cake\Collection\CollectionInterface
      */
-    public function sortBy($callback, $dir = SORT_DESC, $type = SORT_NUMERIC);
+    public function sortBy($callback, $dir = SORT_DESC, $type = \SORT_NUMERIC);
 
     /**
      * Splits a collection into sets, grouped by the result of running each value

+ 5 - 5
src/Collection/CollectionTrait.php

@@ -177,17 +177,17 @@ trait CollectionTrait
     /**
      * {@inheritDoc}
      */
-    public function max($callback, $type = SORT_NUMERIC)
+    public function max($callback, $type = \SORT_NUMERIC)
     {
-        return (new SortIterator($this->unwrap(), $callback, SORT_DESC, $type))->first();
+        return (new SortIterator($this->unwrap(), $callback, \SORT_DESC, $type))->first();
     }
 
     /**
      * {@inheritDoc}
      */
-    public function min($callback, $type = SORT_NUMERIC)
+    public function min($callback, $type = \SORT_NUMERIC)
     {
-        return (new SortIterator($this->unwrap(), $callback, SORT_ASC, $type))->first();
+        return (new SortIterator($this->unwrap(), $callback, \SORT_ASC, $type))->first();
     }
 
     /**
@@ -242,7 +242,7 @@ trait CollectionTrait
     /**
      * {@inheritDoc}
      */
-    public function sortBy($callback, $dir = SORT_DESC, $type = SORT_NUMERIC)
+    public function sortBy($callback, $dir = \SORT_DESC, $type = \SORT_NUMERIC)
     {
         return new SortIterator($this->unwrap(), $callback, $dir, $type);
     }

+ 2 - 2
src/Collection/Iterator/SortIterator.php

@@ -57,7 +57,7 @@ class SortIterator extends Collection
      * @param int $type the type of comparison to perform, either SORT_STRING
      * SORT_NUMERIC or SORT_NATURAL
      */
-    public function __construct($items, $callback, $dir = SORT_DESC, $type = SORT_NUMERIC)
+    public function __construct($items, $callback, $dir = \SORT_DESC, $type = \SORT_NUMERIC)
     {
         if (!is_array($items)) {
             $items = iterator_to_array((new Collection($items))->unwrap(), false);
@@ -67,7 +67,7 @@ class SortIterator extends Collection
         $results = [];
         foreach ($items as $key => $val) {
             $val = $callback($val);
-            if ($val instanceof DateTimeInterface && $type === SORT_NUMERIC) {
+            if ($val instanceof DateTimeInterface && $type === \SORT_NUMERIC) {
                 $val = $val->format('U');
             }
             $results[$key] = $val;

+ 5 - 5
src/Utility/Hash.php

@@ -1002,15 +1002,15 @@ class Hash
             $dir = SORT_DESC;
         }
         if ($type === 'numeric') {
-            $type = SORT_NUMERIC;
+            $type = \SORT_NUMERIC;
         } elseif ($type === 'string') {
-            $type = SORT_STRING;
+            $type = \SORT_STRING;
         } elseif ($type === 'natural') {
-            $type = SORT_NATURAL;
+            $type = \SORT_NATURAL;
         } elseif ($type === 'locale') {
-            $type = SORT_LOCALE_STRING;
+            $type = \SORT_LOCALE_STRING;
         } else {
-            $type = SORT_REGULAR;
+            $type = \SORT_REGULAR;
         }
         if ($ignoreCase) {
             $values = array_map('mb_strtolower', $values);

+ 2 - 2
tests/TestCase/Collection/Iterator/SortIteratorTest.php

@@ -80,7 +80,7 @@ class SortIteratorTest extends TestCase
         $callback = function ($a) {
             return $a['foo'];
         };
-        $sorted = new SortIterator($items, $callback, SORT_DESC, SORT_NUMERIC);
+        $sorted = new SortIterator($items, $callback, \SORT_DESC, \SORT_NUMERIC);
         $expected = [
             ['foo' => 13, 'bar' => 'a'],
             ['foo' => 10, 'bar' => 'a'],
@@ -89,7 +89,7 @@ class SortIteratorTest extends TestCase
         ];
         $this->assertEquals($expected, $sorted->toList());
 
-        $sorted = new SortIterator($items, $callback, SORT_ASC, SORT_NUMERIC);
+        $sorted = new SortIterator($items, $callback, \SORT_ASC, \SORT_NUMERIC);
         $expected = [
             ['foo' => 1, 'bar' => 'a'],
             ['foo' => 2, 'bar' => 'a'],