Skip to content

Commit

Permalink
Merge pull request #113 from gsteel/php-8.4-compatibility
Browse files Browse the repository at this point in the history
Minor PHP 8.4 compatibility improvement, Deprecate `ArrayUtils::inArray()`
  • Loading branch information
Ocramius authored Jan 19, 2024
2 parents de2503a + 2b88fe5 commit 6a192dd
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 21 deletions.
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@
},
"require-dev": {
"laminas/laminas-coding-standard": "^2.5",
"phpbench/phpbench": "^1.2.14",
"phpunit/phpunit": "^10.3.3",
"phpbench/phpbench": "^1.2.15",
"phpunit/phpunit": "^10.5.8",
"psalm/plugin-phpunit": "^0.18.4",
"vimeo/psalm": "^5.15.0"
"vimeo/psalm": "^5.20.0"
},
"autoload": {
"psr-4": {
Expand Down
24 changes: 12 additions & 12 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
displayDetailsOnTestsThatTriggerWarnings="true"
displayDetailsOnIncompleteTests="true"
displayDetailsOnSkippedTests="true"
failOnDeprecation="true"
failOnNotice="true"
failOnWarning="true"
>
<testsuites>
<testsuite name="laminas-stdlib Test Suite">
Expand Down
6 changes: 1 addition & 5 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="5.16.0@2897ba636551a8cb61601cc26f6ccfbba6c36591">
<files psalm-version="5.20.0@3f284e96c9d9be6fe6b15c79416e1d1903dcfef4">
<file src="src/AbstractOptions.php">
<DocblockTypeContradiction>
<code><![CDATA[! is_array($options) && ! $options instanceof Traversable]]></code>
Expand Down Expand Up @@ -216,11 +216,7 @@
<code>$priority</code>
<code>$priority</code>
</InvalidArgument>
<MethodSignatureMismatch>
<code>public function insert($value, $priority)</code>
</MethodSignatureMismatch>
<MethodSignatureMustProvideReturnType>
<code>insert</code>
<code>serialize</code>
<code>unserialize</code>
</MethodSignatureMustProvideReturnType>
Expand Down
4 changes: 3 additions & 1 deletion src/ArrayUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,13 +192,15 @@ public static function isHashTable(mixed $value, $allowEmpty = false)
* non-strict check is implemented. if $strict = -1, the default in_array
* non-strict behaviour is used.
*
* @deprecated This method will be removed in version 4.0 of this component
*
* @param array $haystack
* @param int|bool $strict
* @return bool
*/
public static function inArray(mixed $needle, array $haystack, $strict = false)
{
if (! $strict) {
if ((bool) $strict === false) {
if (is_int($needle) || is_float($needle)) {
$needle = (string) $needle;
}
Expand Down
2 changes: 2 additions & 0 deletions src/SplPriorityQueue.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Laminas\Stdlib;

use ReturnTypeWillChange;
use Serializable;
use UnexpectedValueException;

Expand Down Expand Up @@ -41,6 +42,7 @@ class SplPriorityQueue extends \SplPriorityQueue implements Serializable
* @param TPriority $priority
* @return void
*/
#[ReturnTypeWillChange] // Inherited return type should be bool
public function insert($value, $priority)
{
if (! is_array($priority)) {
Expand Down

0 comments on commit 6a192dd

Please sign in to comment.