the middle of the idiots
This commit is contained in:
		
							
								
								
									
										9
									
								
								qwen/php/vendor/sebastian/code-unit-reverse-lookup/.psalm/baseline.xml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								qwen/php/vendor/sebastian/code-unit-reverse-lookup/.psalm/baseline.xml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,9 @@
 | 
			
		||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<files psalm-version="5.5.0@b63061a27f2683ec0f3509012bb22daab3b65b61">
 | 
			
		||||
  <file src="src/Wizard.php">
 | 
			
		||||
    <RedundantCondition>
 | 
			
		||||
      <code>assert(is_array($traits))</code>
 | 
			
		||||
      <code>is_array($traits)</code>
 | 
			
		||||
    </RedundantCondition>
 | 
			
		||||
  </file>
 | 
			
		||||
</files>
 | 
			
		||||
							
								
								
									
										15
									
								
								qwen/php/vendor/sebastian/code-unit-reverse-lookup/.psalm/config.xml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								qwen/php/vendor/sebastian/code-unit-reverse-lookup/.psalm/config.xml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,15 @@
 | 
			
		||||
<?xml version="1.0"?>
 | 
			
		||||
<psalm
 | 
			
		||||
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 | 
			
		||||
    xmlns="https://getpsalm.org/schema/config"
 | 
			
		||||
    xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
 | 
			
		||||
    resolveFromConfigFile="false"
 | 
			
		||||
    errorBaseline=".psalm/baseline.xml"
 | 
			
		||||
>
 | 
			
		||||
    <projectFiles>
 | 
			
		||||
        <directory name="src" />
 | 
			
		||||
        <ignoreFiles>
 | 
			
		||||
            <directory name="vendor" />
 | 
			
		||||
        </ignoreFiles>
 | 
			
		||||
    </projectFiles>
 | 
			
		||||
</psalm>
 | 
			
		||||
							
								
								
									
										45
									
								
								qwen/php/vendor/sebastian/code-unit-reverse-lookup/ChangeLog.md
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								qwen/php/vendor/sebastian/code-unit-reverse-lookup/ChangeLog.md
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,45 @@
 | 
			
		||||
# Change Log
 | 
			
		||||
 | 
			
		||||
All notable changes to `sebastianbergmann/code-unit-reverse-lookup` are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
 | 
			
		||||
 | 
			
		||||
## [3.0.0] - 2023-02-03
 | 
			
		||||
 | 
			
		||||
### Removed
 | 
			
		||||
 | 
			
		||||
* This component is no longer supported on PHP 7.3, PHP 7.4, and PHP 8.0
 | 
			
		||||
 | 
			
		||||
## [2.0.3] - 2020-09-28
 | 
			
		||||
 | 
			
		||||
### Changed
 | 
			
		||||
 | 
			
		||||
* Changed PHP version constraint in `composer.json` from `^7.3 || ^8.0` to `>=7.3`
 | 
			
		||||
 | 
			
		||||
## [2.0.2] - 2020-06-26
 | 
			
		||||
 | 
			
		||||
### Added
 | 
			
		||||
 | 
			
		||||
* This component is now supported on PHP 8
 | 
			
		||||
 | 
			
		||||
## [2.0.1] - 2020-06-15
 | 
			
		||||
 | 
			
		||||
### Changed
 | 
			
		||||
 | 
			
		||||
* Tests etc. are now ignored for archive exports
 | 
			
		||||
 | 
			
		||||
## 2.0.0 - 2020-02-07
 | 
			
		||||
 | 
			
		||||
### Removed
 | 
			
		||||
 | 
			
		||||
* This component is no longer supported on PHP 5.6, PHP 7.0, PHP 7.1, and PHP 7.2
 | 
			
		||||
 | 
			
		||||
## 1.0.0 - 2016-02-13
 | 
			
		||||
 | 
			
		||||
### Added
 | 
			
		||||
 | 
			
		||||
* Initial release
 | 
			
		||||
 | 
			
		||||
[3.0.0]: https://github.com/sebastianbergmann/code-unit-reverse-lookup/compare/2.0.3...3.0.0
 | 
			
		||||
[2.0.3]: https://github.com/sebastianbergmann/code-unit-reverse-lookup/compare/2.0.2...2.0.3
 | 
			
		||||
[2.0.2]: https://github.com/sebastianbergmann/code-unit-reverse-lookup/compare/2.0.1...2.0.2
 | 
			
		||||
[2.0.1]: https://github.com/sebastianbergmann/code-unit-reverse-lookup/compare/2.0.0...2.0.1
 | 
			
		||||
[2.0.0]: https://github.com/sebastianbergmann/code-unit-reverse-lookup/compare/1.0.0...2.0.0
 | 
			
		||||
							
								
								
									
										29
									
								
								qwen/php/vendor/sebastian/code-unit-reverse-lookup/LICENSE
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								qwen/php/vendor/sebastian/code-unit-reverse-lookup/LICENSE
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,29 @@
 | 
			
		||||
BSD 3-Clause License
 | 
			
		||||
 | 
			
		||||
Copyright (c) 2016-2023, 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.
 | 
			
		||||
							
								
								
									
										22
									
								
								qwen/php/vendor/sebastian/code-unit-reverse-lookup/README.md
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								qwen/php/vendor/sebastian/code-unit-reverse-lookup/README.md
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,22 @@
 | 
			
		||||
[](https://packagist.org/packages/sebastian/code-unit-reverse-lookup)
 | 
			
		||||
[](https://github.com/sebastianbergmann/code-unit-reverse-lookup/actions)
 | 
			
		||||
[](https://shepherd.dev/github/sebastianbergmann/code-unit-reverse-lookup)
 | 
			
		||||
[](https://codecov.io/gh/sebastianbergmann/code-unit-reverse-lookup)
 | 
			
		||||
 | 
			
		||||
# sebastian/code-unit-reverse-lookup
 | 
			
		||||
 | 
			
		||||
Looks up which function or method a line of code belongs to.
 | 
			
		||||
 | 
			
		||||
## Installation
 | 
			
		||||
 | 
			
		||||
You can add this library as a local, per-project dependency to your project using [Composer](https://getcomposer.org/):
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
composer require sebastian/code-unit-reverse-lookup
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
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/code-unit-reverse-lookup
 | 
			
		||||
```
 | 
			
		||||
							
								
								
									
										9
									
								
								qwen/php/vendor/sebastian/code-unit-reverse-lookup/SECURITY.md
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								qwen/php/vendor/sebastian/code-unit-reverse-lookup/SECURITY.md
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,9 @@
 | 
			
		||||
# Security Policy
 | 
			
		||||
 | 
			
		||||
This library is intended to be used in development environments only. For instance, it is used by the testing framework PHPUnit. There is no reason why this library should be installed on a webserver.
 | 
			
		||||
 | 
			
		||||
**If you upload this library to a webserver then your deployment process is broken. On a more general note, if your `vendor` directory is publicly accessible on your webserver then your deployment process is also broken.**
 | 
			
		||||
 | 
			
		||||
## Security Contact Information
 | 
			
		||||
 | 
			
		||||
After the above, if you still would like to report a security vulnerability, please email `sebastian@phpunit.de`.
 | 
			
		||||
							
								
								
									
										36
									
								
								qwen/php/vendor/sebastian/code-unit-reverse-lookup/composer.json
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								qwen/php/vendor/sebastian/code-unit-reverse-lookup/composer.json
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,36 @@
 | 
			
		||||
{
 | 
			
		||||
    "name": "sebastian/code-unit-reverse-lookup",
 | 
			
		||||
    "description": "Looks up which function or method a line of code belongs to",
 | 
			
		||||
    "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/",
 | 
			
		||||
    "license": "BSD-3-Clause",
 | 
			
		||||
    "authors": [
 | 
			
		||||
        {
 | 
			
		||||
            "name": "Sebastian Bergmann",
 | 
			
		||||
            "email": "sebastian@phpunit.de"
 | 
			
		||||
        }
 | 
			
		||||
    ],
 | 
			
		||||
    "config": {
 | 
			
		||||
        "platform": {
 | 
			
		||||
            "php": "8.1.0"
 | 
			
		||||
        },
 | 
			
		||||
        "optimize-autoloader": true,
 | 
			
		||||
        "sort-packages": true
 | 
			
		||||
    },
 | 
			
		||||
    "prefer-stable": true,
 | 
			
		||||
    "require": {
 | 
			
		||||
        "php": ">=8.1"
 | 
			
		||||
    },
 | 
			
		||||
    "require-dev": {
 | 
			
		||||
        "phpunit/phpunit": "^10.0"
 | 
			
		||||
    },
 | 
			
		||||
    "autoload": {
 | 
			
		||||
        "classmap": [
 | 
			
		||||
            "src/"
 | 
			
		||||
        ]
 | 
			
		||||
    },
 | 
			
		||||
    "extra": {
 | 
			
		||||
        "branch-alias": {
 | 
			
		||||
            "dev-main": "3.0-dev"
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										114
									
								
								qwen/php/vendor/sebastian/code-unit-reverse-lookup/src/Wizard.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										114
									
								
								qwen/php/vendor/sebastian/code-unit-reverse-lookup/src/Wizard.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,114 @@
 | 
			
		||||
<?php declare(strict_types=1);
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of sebastian/code-unit-reverse-lookup.
 | 
			
		||||
 *
 | 
			
		||||
 * (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\CodeUnitReverseLookup;
 | 
			
		||||
 | 
			
		||||
use function array_merge;
 | 
			
		||||
use function assert;
 | 
			
		||||
use function get_declared_classes;
 | 
			
		||||
use function get_declared_traits;
 | 
			
		||||
use function get_defined_functions;
 | 
			
		||||
use function is_array;
 | 
			
		||||
use function range;
 | 
			
		||||
use ReflectionClass;
 | 
			
		||||
use ReflectionFunction;
 | 
			
		||||
use ReflectionFunctionAbstract;
 | 
			
		||||
use ReflectionMethod;
 | 
			
		||||
 | 
			
		||||
class Wizard
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * @psalm-var array<string,array<int,string>>
 | 
			
		||||
     */
 | 
			
		||||
    private array $lookupTable = [];
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @psalm-var array<class-string,true>
 | 
			
		||||
     */
 | 
			
		||||
    private array $processedClasses = [];
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @psalm-var array<string,true>
 | 
			
		||||
     */
 | 
			
		||||
    private array $processedFunctions = [];
 | 
			
		||||
 | 
			
		||||
    public function lookup(string $filename, int $lineNumber): string
 | 
			
		||||
    {
 | 
			
		||||
        if (!isset($this->lookupTable[$filename][$lineNumber])) {
 | 
			
		||||
            $this->updateLookupTable();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (isset($this->lookupTable[$filename][$lineNumber])) {
 | 
			
		||||
            return $this->lookupTable[$filename][$lineNumber];
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $filename . ':' . $lineNumber;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private function updateLookupTable(): void
 | 
			
		||||
    {
 | 
			
		||||
        $this->processClassesAndTraits();
 | 
			
		||||
        $this->processFunctions();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private function processClassesAndTraits(): void
 | 
			
		||||
    {
 | 
			
		||||
        $classes = get_declared_classes();
 | 
			
		||||
        $traits  = get_declared_traits();
 | 
			
		||||
 | 
			
		||||
        /* @noinspection PhpConditionAlreadyCheckedInspection */
 | 
			
		||||
        assert(is_array($traits));
 | 
			
		||||
 | 
			
		||||
        foreach (array_merge($classes, $traits) as $classOrTrait) {
 | 
			
		||||
            if (isset($this->processedClasses[$classOrTrait])) {
 | 
			
		||||
                continue;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            foreach ((new ReflectionClass($classOrTrait))->getMethods() as $method) {
 | 
			
		||||
                $this->processFunctionOrMethod($method);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            $this->processedClasses[$classOrTrait] = true;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private function processFunctions(): void
 | 
			
		||||
    {
 | 
			
		||||
        foreach (get_defined_functions()['user'] as $function) {
 | 
			
		||||
            if (isset($this->processedFunctions[$function])) {
 | 
			
		||||
                continue;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            $this->processFunctionOrMethod(new ReflectionFunction($function));
 | 
			
		||||
 | 
			
		||||
            $this->processedFunctions[$function] = true;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private function processFunctionOrMethod(ReflectionFunctionAbstract $functionOrMethod): void
 | 
			
		||||
    {
 | 
			
		||||
        if ($functionOrMethod->isInternal()) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $name = $functionOrMethod->getName();
 | 
			
		||||
 | 
			
		||||
        if ($functionOrMethod instanceof ReflectionMethod) {
 | 
			
		||||
            $name = $functionOrMethod->getDeclaringClass()->getName() . '::' . $name;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (!isset($this->lookupTable[$functionOrMethod->getFileName()])) {
 | 
			
		||||
            $this->lookupTable[$functionOrMethod->getFileName()] = [];
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        foreach (range($functionOrMethod->getStartLine(), $functionOrMethod->getEndLine()) as $line) {
 | 
			
		||||
            $this->lookupTable[$functionOrMethod->getFileName()][$line] = $name;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user