the middle of the idiots
This commit is contained in:
		
							
								
								
									
										54
									
								
								qwen/php/vendor/sebastian/recursion-context/ChangeLog.md
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										54
									
								
								qwen/php/vendor/sebastian/recursion-context/ChangeLog.md
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,54 @@
 | 
			
		||||
# ChangeLog
 | 
			
		||||
 | 
			
		||||
All notable changes are documented in this file using the [Keep a CHANGELOG](https://keepachangelog.com/) principles.
 | 
			
		||||
 | 
			
		||||
## [5.0.1] - 2025-08-10
 | 
			
		||||
 | 
			
		||||
### Changed
 | 
			
		||||
 | 
			
		||||
* Do not use `SplObjectStorage` methods that will be deprecated in PHP 8.5
 | 
			
		||||
 | 
			
		||||
## [5.0.0] - 2023-02-03
 | 
			
		||||
 | 
			
		||||
### Removed
 | 
			
		||||
 | 
			
		||||
* This component is no longer supported on PHP 7.3, PHP 7.4 and PHP 8.0
 | 
			
		||||
 | 
			
		||||
## [4.0.5] - 2023-02-03
 | 
			
		||||
 | 
			
		||||
### Fixed
 | 
			
		||||
 | 
			
		||||
* [#26](https://github.com/sebastianbergmann/recursion-context/pull/26): Don't clobber `null` values if `array_key_exists(PHP_INT_MAX, $array)`
 | 
			
		||||
 | 
			
		||||
## [4.0.4] - 2020-10-26
 | 
			
		||||
 | 
			
		||||
### Fixed
 | 
			
		||||
 | 
			
		||||
* `SebastianBergmann\RecursionContext\Exception` now correctly extends `\Throwable`
 | 
			
		||||
 | 
			
		||||
## [4.0.3] - 2020-09-28
 | 
			
		||||
 | 
			
		||||
### Changed
 | 
			
		||||
 | 
			
		||||
* [#21](https://github.com/sebastianbergmann/recursion-context/pull/21): Add type annotations for in/out parameters
 | 
			
		||||
* Changed PHP version constraint in `composer.json` from `^7.3 || ^8.0` to `>=7.3`
 | 
			
		||||
 | 
			
		||||
## [4.0.2] - 2020-06-26
 | 
			
		||||
 | 
			
		||||
### Added
 | 
			
		||||
 | 
			
		||||
* This component is now supported on PHP 8
 | 
			
		||||
 | 
			
		||||
## [4.0.1] - 2020-06-15
 | 
			
		||||
 | 
			
		||||
### Changed
 | 
			
		||||
 | 
			
		||||
* Tests etc. are now ignored for archive exports
 | 
			
		||||
 | 
			
		||||
[5.0.1]: https://github.com/sebastianbergmann/recursion-context/compare/5.0.0...5.0.1
 | 
			
		||||
[5.0.0]: https://github.com/sebastianbergmann/recursion-context/compare/4.0.5...5.0.0
 | 
			
		||||
[4.0.5]: https://github.com/sebastianbergmann/recursion-context/compare/4.0.4...4.0.5
 | 
			
		||||
[4.0.4]: https://github.com/sebastianbergmann/recursion-context/compare/4.0.3...4.0.4
 | 
			
		||||
[4.0.3]: https://github.com/sebastianbergmann/recursion-context/compare/4.0.2...4.0.3
 | 
			
		||||
[4.0.2]: https://github.com/sebastianbergmann/recursion-context/compare/4.0.1...4.0.2
 | 
			
		||||
[4.0.1]: https://github.com/sebastianbergmann/recursion-context/compare/4.0.0...4.0.1
 | 
			
		||||
							
								
								
									
										29
									
								
								qwen/php/vendor/sebastian/recursion-context/LICENSE
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								qwen/php/vendor/sebastian/recursion-context/LICENSE
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,29 @@
 | 
			
		||||
BSD 3-Clause License
 | 
			
		||||
 | 
			
		||||
Copyright (c) 2002-2025, Sebastian Bergmann
 | 
			
		||||
All rights reserved.
 | 
			
		||||
 | 
			
		||||
Redistribution and use in source and binary forms, with or without
 | 
			
		||||
modification, are permitted provided that the following conditions are met:
 | 
			
		||||
 | 
			
		||||
1. Redistributions of source code must retain the above copyright notice, this
 | 
			
		||||
   list of conditions and the following disclaimer.
 | 
			
		||||
 | 
			
		||||
2. Redistributions in binary form must reproduce the above copyright notice,
 | 
			
		||||
   this list of conditions and the following disclaimer in the documentation
 | 
			
		||||
   and/or other materials provided with the distribution.
 | 
			
		||||
 | 
			
		||||
3. Neither the name of the copyright holder nor the names of its
 | 
			
		||||
   contributors may be used to endorse or promote products derived from
 | 
			
		||||
   this software without specific prior written permission.
 | 
			
		||||
 | 
			
		||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 | 
			
		||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 | 
			
		||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 | 
			
		||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
 | 
			
		||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 | 
			
		||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 | 
			
		||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 | 
			
		||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 | 
			
		||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 | 
			
		||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
							
								
								
									
										20
									
								
								qwen/php/vendor/sebastian/recursion-context/README.md
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								qwen/php/vendor/sebastian/recursion-context/README.md
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,20 @@
 | 
			
		||||
[](https://packagist.org/packages/sebastian/recursion-context)
 | 
			
		||||
[](https://github.com/sebastianbergmann/recursion-context/actions)
 | 
			
		||||
[](https://shepherd.dev/github/sebastianbergmann/recursion-context)
 | 
			
		||||
[](https://codecov.io/gh/sebastianbergmann/recursion-context)
 | 
			
		||||
 | 
			
		||||
# sebastian/recursion-context
 | 
			
		||||
 | 
			
		||||
## Installation
 | 
			
		||||
 | 
			
		||||
You can add this library as a local, per-project dependency to your project using [Composer](https://getcomposer.org/):
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
composer require sebastian/recursion-context
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
If you only need this library during development, for instance to run your project's test suite, then you should add it as a development-time dependency:
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
composer require --dev sebastian/recursion-context
 | 
			
		||||
```
 | 
			
		||||
							
								
								
									
										30
									
								
								qwen/php/vendor/sebastian/recursion-context/SECURITY.md
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								qwen/php/vendor/sebastian/recursion-context/SECURITY.md
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,30 @@
 | 
			
		||||
# Security Policy
 | 
			
		||||
 | 
			
		||||
If you believe you have found a security vulnerability in the library that is developed in this repository, please report it to us through coordinated disclosure.
 | 
			
		||||
 | 
			
		||||
**Please do not report security vulnerabilities through public GitHub issues, discussions, or pull requests.**
 | 
			
		||||
 | 
			
		||||
Instead, please email `sebastian@phpunit.de`.
 | 
			
		||||
 | 
			
		||||
Please include as much of the information listed below as you can to help us better understand and resolve the issue:
 | 
			
		||||
 | 
			
		||||
* The type of issue
 | 
			
		||||
* Full paths of source file(s) related to the manifestation of the issue
 | 
			
		||||
* The location of the affected source code (tag/branch/commit or direct URL)
 | 
			
		||||
* Any special configuration required to reproduce the issue
 | 
			
		||||
* Step-by-step instructions to reproduce the issue
 | 
			
		||||
* Proof-of-concept or exploit code (if possible)
 | 
			
		||||
* Impact of the issue, including how an attacker might exploit the issue
 | 
			
		||||
 | 
			
		||||
This information will help us triage your report more quickly.
 | 
			
		||||
 | 
			
		||||
## Web Context
 | 
			
		||||
 | 
			
		||||
The library that is developed in this repository was either extracted from [PHPUnit](https://github.com/sebastianbergmann/phpunit) or developed specifically as a dependency for PHPUnit.
 | 
			
		||||
 | 
			
		||||
The library is developed with a focus on development environments and the command-line. No specific testing or hardening with regard to using the library in an HTTP or web context or with untrusted input data is performed. The library might also contain functionality that intentionally exposes internal application data for debugging purposes.
 | 
			
		||||
 | 
			
		||||
If the library is used in a web application, the application developer is responsible for filtering inputs or escaping outputs as necessary and for verifying that the used functionality is safe for use within the intended context.
 | 
			
		||||
 | 
			
		||||
Vulnerabilities specific to the use outside a development context will be fixed as applicable, provided that the fix does not have an averse effect on the primary use case for development purposes.
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										48
									
								
								qwen/php/vendor/sebastian/recursion-context/composer.json
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								qwen/php/vendor/sebastian/recursion-context/composer.json
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,48 @@
 | 
			
		||||
{
 | 
			
		||||
    "name": "sebastian/recursion-context",
 | 
			
		||||
    "description": "Provides functionality to recursively process PHP variables",
 | 
			
		||||
    "homepage": "https://github.com/sebastianbergmann/recursion-context",
 | 
			
		||||
    "license": "BSD-3-Clause",
 | 
			
		||||
    "authors": [
 | 
			
		||||
        {
 | 
			
		||||
            "name": "Sebastian Bergmann",
 | 
			
		||||
            "email": "sebastian@phpunit.de"
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            "name": "Jeff Welch",
 | 
			
		||||
            "email": "whatthejeff@gmail.com"
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            "name": "Adam Harvey",
 | 
			
		||||
            "email": "aharvey@php.net"
 | 
			
		||||
        }
 | 
			
		||||
    ],
 | 
			
		||||
    "support": {
 | 
			
		||||
        "issues": "https://github.com/sebastianbergmann/recursion-context/issues",
 | 
			
		||||
        "security": "https://github.com/sebastianbergmann/recursion-context/security/policy"
 | 
			
		||||
    },
 | 
			
		||||
    "prefer-stable": true,
 | 
			
		||||
    "config": {
 | 
			
		||||
        "platform": {
 | 
			
		||||
            "php": "8.1.0"
 | 
			
		||||
        },
 | 
			
		||||
        "optimize-autoloader": true,
 | 
			
		||||
        "sort-packages": true
 | 
			
		||||
    },
 | 
			
		||||
    "require": {
 | 
			
		||||
        "php": ">=8.1"
 | 
			
		||||
    },
 | 
			
		||||
    "require-dev": {
 | 
			
		||||
        "phpunit/phpunit": "^10.5"
 | 
			
		||||
    },
 | 
			
		||||
    "autoload": {
 | 
			
		||||
        "classmap": [
 | 
			
		||||
            "src/"
 | 
			
		||||
        ]
 | 
			
		||||
    },
 | 
			
		||||
    "extra": {
 | 
			
		||||
        "branch-alias": {
 | 
			
		||||
            "dev-main": "5.0-dev"
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										141
									
								
								qwen/php/vendor/sebastian/recursion-context/src/Context.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										141
									
								
								qwen/php/vendor/sebastian/recursion-context/src/Context.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,141 @@
 | 
			
		||||
<?php declare(strict_types=1);
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of sebastian/recursion-context.
 | 
			
		||||
 *
 | 
			
		||||
 * (c) Sebastian Bergmann <sebastian@phpunit.de>
 | 
			
		||||
 *
 | 
			
		||||
 * For the full copyright and license information, please view the LICENSE
 | 
			
		||||
 * file that was distributed with this source code.
 | 
			
		||||
 */
 | 
			
		||||
namespace SebastianBergmann\RecursionContext;
 | 
			
		||||
 | 
			
		||||
use const PHP_INT_MAX;
 | 
			
		||||
use const PHP_INT_MIN;
 | 
			
		||||
use function array_key_exists;
 | 
			
		||||
use function array_pop;
 | 
			
		||||
use function array_slice;
 | 
			
		||||
use function count;
 | 
			
		||||
use function is_array;
 | 
			
		||||
use function random_int;
 | 
			
		||||
use function spl_object_hash;
 | 
			
		||||
use SplObjectStorage;
 | 
			
		||||
 | 
			
		||||
final class Context
 | 
			
		||||
{
 | 
			
		||||
    private array $arrays = [];
 | 
			
		||||
    private SplObjectStorage $objects;
 | 
			
		||||
 | 
			
		||||
    public function __construct()
 | 
			
		||||
    {
 | 
			
		||||
        $this->objects = new SplObjectStorage;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @codeCoverageIgnore
 | 
			
		||||
     */
 | 
			
		||||
    public function __destruct()
 | 
			
		||||
    {
 | 
			
		||||
        foreach ($this->arrays as &$array) {
 | 
			
		||||
            if (is_array($array)) {
 | 
			
		||||
                array_pop($array);
 | 
			
		||||
                array_pop($array);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @psalm-template T of object|array
 | 
			
		||||
     *
 | 
			
		||||
     * @psalm-param T $value
 | 
			
		||||
     *
 | 
			
		||||
     * @param-out T $value
 | 
			
		||||
     */
 | 
			
		||||
    public function add(array|object &$value): false|int|string
 | 
			
		||||
    {
 | 
			
		||||
        if (is_array($value)) {
 | 
			
		||||
            return $this->addArray($value);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $this->addObject($value);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @psalm-template T of object|array
 | 
			
		||||
     *
 | 
			
		||||
     * @psalm-param T $value
 | 
			
		||||
     *
 | 
			
		||||
     * @param-out T $value
 | 
			
		||||
     */
 | 
			
		||||
    public function contains(array|object &$value): false|int|string
 | 
			
		||||
    {
 | 
			
		||||
        if (is_array($value)) {
 | 
			
		||||
            return $this->containsArray($value);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $this->containsObject($value);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private function addArray(array &$array): int
 | 
			
		||||
    {
 | 
			
		||||
        $key = $this->containsArray($array);
 | 
			
		||||
 | 
			
		||||
        if ($key !== false) {
 | 
			
		||||
            return $key;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $key            = count($this->arrays);
 | 
			
		||||
        $this->arrays[] = &$array;
 | 
			
		||||
 | 
			
		||||
        if (!array_key_exists(PHP_INT_MAX, $array) && !array_key_exists(PHP_INT_MAX - 1, $array)) {
 | 
			
		||||
            $array[] = $key;
 | 
			
		||||
            $array[] = $this->objects;
 | 
			
		||||
        } else {
 | 
			
		||||
            /* Cover the improbable case, too.
 | 
			
		||||
             *
 | 
			
		||||
             * Note that array_slice() (used in containsArray()) will return the
 | 
			
		||||
             * last two values added, *not necessarily* the highest integer keys
 | 
			
		||||
             * in the array. Therefore, the order of these writes to $array is
 | 
			
		||||
             * important, but the actual keys used is not. */
 | 
			
		||||
            do {
 | 
			
		||||
                /** @noinspection PhpUnhandledExceptionInspection */
 | 
			
		||||
                $key = random_int(PHP_INT_MIN, PHP_INT_MAX);
 | 
			
		||||
            } while (array_key_exists($key, $array));
 | 
			
		||||
 | 
			
		||||
            $array[$key] = $key;
 | 
			
		||||
 | 
			
		||||
            do {
 | 
			
		||||
                /** @noinspection PhpUnhandledExceptionInspection */
 | 
			
		||||
                $key = random_int(PHP_INT_MIN, PHP_INT_MAX);
 | 
			
		||||
            } while (array_key_exists($key, $array));
 | 
			
		||||
 | 
			
		||||
            $array[$key] = $this->objects;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $key;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private function addObject(object $object): string
 | 
			
		||||
    {
 | 
			
		||||
        if (!$this->objects->offsetExists($object)) {
 | 
			
		||||
            $this->objects->offsetSet($object);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return spl_object_hash($object);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private function containsArray(array $array): false|int
 | 
			
		||||
    {
 | 
			
		||||
        $end = array_slice($array, -2);
 | 
			
		||||
 | 
			
		||||
        return isset($end[1]) && $end[1] === $this->objects ? $end[0] : false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private function containsObject(object $value): false|string
 | 
			
		||||
    {
 | 
			
		||||
        if ($this->objects->offsetExists($value)) {
 | 
			
		||||
            return spl_object_hash($value);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user