Skip to content
Snippets Groups Projects
Commit b9b0505e authored by David Prévot's avatar David Prévot
Browse files

New upstream version 1.9.3

parent 6f5194ee
No related branches found
No related tags found
No related merge requests found
Pipeline #804468 failed
...@@ -11,7 +11,7 @@ jobs: ...@@ -11,7 +11,7 @@ jobs:
strategy: strategy:
matrix: matrix:
php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3'] php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
steps: steps:
- name: Checkout Code - name: Checkout Code
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
}, },
"require-dev": { "require-dev": {
"bamarni/composer-bin-plugin": "^1.8.2", "bamarni/composer-bin-plugin": "^1.8.2",
"phpunit/phpunit": "^8.5.34 || ^9.6.13 || ^10.4.2" "phpunit/phpunit": "^8.5.39 || ^9.6.20 || ^10.5.28"
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {
...@@ -41,12 +41,10 @@ ...@@ -41,12 +41,10 @@
"extra": { "extra": {
"bamarni-bin": { "bamarni-bin": {
"bin-links": true, "bin-links": true,
"forward-command": true "forward-command": false
}, },
"branch-alias": { "branch-alias": {
"dev-master": "1.9-dev" "dev-master": "1.9-dev"
} }
}, }
"minimum-stability": "dev",
"prefer-stable": true
} }
...@@ -21,7 +21,7 @@ parameters: ...@@ -21,7 +21,7 @@ parameters:
path: src/PhpOption/Option.php path: src/PhpOption/Option.php
- -
message: "#^Parameter \\#2 \\$callback of function array_reduce expects callable\\(mixed, mixed\\)\\: mixed, Closure\\(mixed, PhpOption\\\\Option\\)\\: mixed given\\.$#" message: "#^Parameter \\#2 \\$callback of function array_reduce expects callable\\(bool\\|TReturn, mixed\\)\\: \\(bool\\|TReturn\\), Closure\\(mixed, PhpOption\\\\Option\\)\\: \\(bool\\|TReturn\\) given\\.$#"
count: 1 count: 1
path: src/PhpOption/Option.php path: src/PhpOption/Option.php
......
...@@ -5,4 +5,3 @@ parameters: ...@@ -5,4 +5,3 @@ parameters:
level: max level: max
paths: paths:
- src - src
checkGenericClassInNonGenericObjectType: false
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" beStrictAboutTestsThatDoNotTestAnything="true" beStrictAboutOutputDuringTests="true" bootstrap="tests/bootstrap.php" colors="true" failOnRisky="true" failOnWarning="true" processIsolation="false" stopOnError="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd"> <phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" beStrictAboutTestsThatDoNotTestAnything="true" beStrictAboutOutputDuringTests="true" bootstrap="tests/bootstrap.php" colors="true" failOnRisky="true" failOnWarning="true" processIsolation="false" stopOnError="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.4/phpunit.xsd">
<testsuites> <testsuites>
<testsuite name="PhpOption Type Test Suite"> <testsuite name="PhpOption Type Test Suite">
<directory>./tests/PhpOption/</directory> <directory>./tests/PhpOption/</directory>
......
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="5.25.0@01a8eb06b9e9cc6cfb6a320bf9fb14331919d505"/>
...@@ -5,6 +5,9 @@ ...@@ -5,6 +5,9 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config" xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd" xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
errorBaseline="psalm-baseline.xml"
findUnusedBaselineEntry="true"
findUnusedCode="false"
> >
<projectFiles> <projectFiles>
<directory name="src" /> <directory name="src" />
......
...@@ -62,13 +62,13 @@ abstract class Option implements IteratorAggregate ...@@ -62,13 +62,13 @@ abstract class Option implements IteratorAggregate
* @template S * @template S
* *
* @param array<string|int,S>|ArrayAccess<string|int,S>|null $array A potential array or \ArrayAccess value. * @param array<string|int,S>|ArrayAccess<string|int,S>|null $array A potential array or \ArrayAccess value.
* @param string $key The key to check. * @param string|int|null $key The key to check.
* *
* @return Option<S> * @return Option<S>
*/ */
public static function fromArraysValue($array, $key) public static function fromArraysValue($array, $key)
{ {
if (!(is_array($array) || $array instanceof ArrayAccess) || !isset($array[$key])) { if ($key === null || !(is_array($array) || $array instanceof ArrayAccess) || !isset($array[$key])) {
return None::create(); return None::create();
} }
......
...@@ -31,11 +31,17 @@ class OptionTest extends TestCase ...@@ -31,11 +31,17 @@ class OptionTest extends TestCase
self::assertEquals(None::create(), Option::fromArraysValue(null, 'bar')); self::assertEquals(None::create(), Option::fromArraysValue(null, 'bar'));
self::assertEquals(None::create(), Option::fromArraysValue(['foo' => 'bar'], 'baz')); self::assertEquals(None::create(), Option::fromArraysValue(['foo' => 'bar'], 'baz'));
self::assertEquals(None::create(), Option::fromArraysValue(['foo' => null], 'foo')); self::assertEquals(None::create(), Option::fromArraysValue(['foo' => null], 'foo'));
self::assertEquals(None::create(), Option::fromArraysValue(['foo' => 'bar'], null));
self::assertEquals(new Some('foo'), Option::fromArraysValue(['foo' => 'foo'], 'foo')); self::assertEquals(new Some('foo'), Option::fromArraysValue(['foo' => 'foo'], 'foo'));
self::assertEquals(new Some('foo'), Option::fromArraysValue([13 => 'foo'], 13));
$object = new SomeArrayObject(); $object = new SomeArrayObject();
$object['foo'] = 'foo'; $object['foo'] = 'foo';
self::assertEquals(new Some('foo'), Option::fromArraysValue($object, 'foo')); self::assertEquals(new Some('foo'), Option::fromArraysValue($object, 'foo'));
$object = new SomeArrayObject();
$object[13] = 'foo';
self::assertEquals(new Some('foo'), Option::fromArraysValue($object, 13));
} }
public function testFromReturn(): void public function testFromReturn(): void
......
{ {
"require": { "require": {
"phpstan/phpstan": "1.10.41" "phpstan/phpstan": "1.11.7"
}, },
"config": { "config": {
"preferred-install": "dist" "preferred-install": "dist"
......
{ {
"require": { "require": {
"psalm/phar": "5.15.0" "psalm/phar": "5.25.0"
}, },
"config": { "config": {
"preferred-install": "dist" "preferred-install": "dist"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment