Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F12585255
D3848.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D3848.diff
View Options
diff --git a/omnitools/src/Collections/TraversableUtilities.php b/omnitools/src/Collections/TraversableUtilities.php
--- a/omnitools/src/Collections/TraversableUtilities.php
+++ b/omnitools/src/Collections/TraversableUtilities.php
@@ -43,20 +43,4 @@
return $defaultValue;
}
- /**
- * @deprecated Use \is_countable
- */
- public static function isCountable ($countable) : bool {
- if (function_exists('is_countable')) {
- // PHP 7.3 has is_countable
- return is_countable($countable);
- }
-
- // https://github.com/Ayesh/is_countable-polyfill/blob/master/src/is_countable.php
- return is_array($countable)
- || $countable instanceof Countable
- || $countable instanceof SimpleXMLElement
- || $countable instanceof ResourceBundle;
- }
-
}
diff --git a/omnitools/src/HTTP/Requests/WithURL.php b/omnitools/src/HTTP/Requests/WithURL.php
--- a/omnitools/src/HTTP/Requests/WithURL.php
+++ b/omnitools/src/HTTP/Requests/WithURL.php
@@ -66,7 +66,7 @@
}
if (isset($_SERVER['HTTP_FORWARDED'])) {
- return StringUtilities::contains($_SERVER['HTTP_FORWARDED'], "proto=https");
+ return str_contains($_SERVER['HTTP_FORWARDED'], "proto=https");
}
return false;
diff --git a/omnitools/src/Strings/Multibyte/StringUtilities.php b/omnitools/src/Strings/Multibyte/StringUtilities.php
--- a/omnitools/src/Strings/Multibyte/StringUtilities.php
+++ b/omnitools/src/Strings/Multibyte/StringUtilities.php
@@ -40,29 +40,6 @@
};
}
- /**
- * @deprecated Since PHP 8.0, we can replace by \str_starts_with
- */
- public static function startsWith (string $string, string $start) : bool {
- $length = mb_strlen($start);
- return mb_substr($string, 0, $length) === $start;
- }
-
- /**
- * @deprecated Since PHP 8.0, we can replace by \str_ends_with
- */
- public static function endsWith (string $string, string $end) : bool {
- $length = mb_strlen($end);
- return $length === 0 || mb_substr($string, -$length) === $end;
- }
-
- /**
- * @deprecated Since PHP 8.0, we can replace by \str_contains
- */
- public static function contains (string $string, string $needle) : bool {
- return str_contains($string, $needle);
- }
-
/**
* Encode a string using a variant of the MIME base64 compatible with URLs.
*
diff --git a/omnitools/tests/Collections/TraversableUtilitiesTest.php b/omnitools/tests/Collections/TraversableUtilitiesTest.php
--- a/omnitools/tests/Collections/TraversableUtilitiesTest.php
+++ b/omnitools/tests/Collections/TraversableUtilitiesTest.php
@@ -28,11 +28,6 @@
TraversableUtilities::count($notCountable);
}
- #[DataProvider('providePureCountables')]
- public function testIsCountable ($countable) {
- $this->assertTrue(TraversableUtilities::isCountable($countable));
- }
-
#[DataProvider('provideIterableAndFirst')]
public function testIsFirst($expected, $iterable) {
$this->assertEquals($expected, TraversableUtilities::first($iterable));
@@ -72,17 +67,6 @@
];
}
- public static function providePureCountables () : iterable {
- yield [[]];
- yield [["a", "b", "c"]];
- yield [new class implements Countable {
- public function count () : int {
- return 42;
- }
- }
- ];
- }
-
public static function provideNotCountables () : iterable {
yield [true];
yield [new \stdClass];
diff --git a/omnitools/tests/Strings/Multibyte/StringUtilitiesTest.php b/omnitools/tests/Strings/Multibyte/StringUtilitiesTest.php
--- a/omnitools/tests/Strings/Multibyte/StringUtilitiesTest.php
+++ b/omnitools/tests/Strings/Multibyte/StringUtilitiesTest.php
@@ -35,23 +35,6 @@
$this->assertFalse(StringUtilities::isSupportedEncoding("notexisting"));
}
- public function testStartsWith () : void {
- $this->assertTrue(StringUtilities::startsWith("foo", "fo"));
- $this->assertTrue(StringUtilities::startsWith("foo", ""));
- $this->assertTrue(StringUtilities::startsWith("foo", "foo"));
-
- $this->assertFalse(StringUtilities::startsWith("foo", "bar"));
- }
-
- public function testEndsWith () : void {
- $this->assertTrue(StringUtilities::endsWith("foo", "oo"));
- $this->assertTrue(StringUtilities::endsWith("foo", ""));
- $this->assertTrue(StringUtilities::endsWith("foo", "foo"));
-
- $this->assertFalse(StringUtilities::endsWith("foo", "oO"));
- $this->assertFalse(StringUtilities::endsWith("foo", "bar"));
- }
-
#[DataProvider('provideBase64')]
public function testEncodeInBase64 (string $decoded, string $encoded) : void {
$actual = StringUtilities::encodeInBase64($decoded);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 12, 14:28 (19 h, 28 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3155357
Default Alt Text
D3848.diff (4 KB)
Attached To
Mode
D3848: Remove features implemented in PHP 8
Attached
Detach File
Event Timeline
Log In to Comment