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

New upstream version 4.0.0

parents 821b2634 df80c875
Branches
Tags upstream/4.0.0
No related merge requests found
......@@ -6,6 +6,9 @@ on:
name: "CI"
env:
COMPOSER_ROOT_VERSION: "4.0-dev"
permissions:
contents: read
......@@ -17,12 +20,12 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
php-version: 8.3
coverage: none
- name: Run PHP-CS-Fixer
......@@ -35,12 +38,12 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
php-version: 8.3
coverage: none
- name: Install dependencies with composer
......@@ -58,13 +61,13 @@ jobs:
fail-fast: false
matrix:
php-version:
- "8.1"
- "8.2"
- "8.3"
- "8.4"
steps:
- name: "Checkout"
uses: "actions/checkout@v3"
uses: "actions/checkout@v4"
- name: "Install PHP with extensions"
uses: "shivammathur/setup-php@v2"
......@@ -72,13 +75,6 @@ jobs:
php-version: "${{ matrix.php-version }}"
coverage: "pcov"
- name: "Cache dependencies installed with Composer"
uses: "actions/cache@v2"
with:
path: "~/.composer/cache"
key: "php${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.json') }}"
restore-keys: "php${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-"
- name: "Install dependencies with Composer"
run: "./tools/composer update --no-ansi --no-interaction --no-progress"
......
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="php-cs-fixer" version="^3.0" installed="3.14.3" location="./tools/php-cs-fixer" copy="true"/>
<phar name="psalm" version="^5.0" installed="5.6.0" location="./tools/psalm" copy="true"/>
<phar name="composer" version="^2.0.3" installed="2.5.1" location="./tools/composer" copy="true"/>
<phar name="php-cs-fixer" version="^3.0" installed="3.41.1" location="./tools/php-cs-fixer" copy="true"/>
<phar name="psalm" version="^5.0" installed="5.18.0" location="./tools/psalm" copy="true"/>
<phar name="composer" version="^2.0.3" installed="2.6.6" location="./tools/composer" copy="true"/>
</phive>
......@@ -25,6 +25,10 @@ $config->setFinder($finder)
'backtick_to_shell_exec' => true,
'binary_operator_spaces' => [
'operators' => [
'*=' => 'align_single_space_minimal',
'+=' => 'align_single_space_minimal',
'-=' => 'align_single_space_minimal',
'/=' => 'align_single_space_minimal',
'=' => 'align_single_space_minimal',
'=>' => 'align_single_space_minimal',
],
......@@ -33,6 +37,7 @@ $config->setFinder($finder)
'blank_line_before_statement' => [
'statements' => [
'break',
'case',
'continue',
'declare',
'default',
......@@ -44,6 +49,7 @@ $config->setFinder($finder)
'if',
'include',
'include_once',
'phpdoc',
'require',
'require_once',
'return',
......@@ -52,15 +58,21 @@ $config->setFinder($finder)
'try',
'while',
'yield',
'yield_from',
],
],
'braces' => [
'position_after_anonymous_constructs' => 'next',
'blank_lines_before_namespace' => [
'max_line_breaks' => 1,
'min_line_breaks' => 0,
],
'braces_position' => [
'anonymous_classes_opening_brace' => 'next_line_unless_newline_at_signature_end',
'anonymous_functions_opening_brace' => 'next_line_unless_newline_at_signature_end',
],
'cast_spaces' => true,
'class_attributes_separation' => [
'elements' => [
'const' => 'one',
'const' => 'none',
'method' => 'one',
'property' => 'only_if_meta'
]
......@@ -70,10 +82,13 @@ $config->setFinder($finder)
'combine_consecutive_issets' => true,
'combine_consecutive_unsets' => true,
'combine_nested_dirname' => true,
'compact_nullable_typehint' => true,
'compact_nullable_type_declaration' => true,
'concat_space' => ['spacing' => 'one'],
'constant_case' => true,
'control_structure_braces' => true,
'control_structure_continuation_position' => true,
'declare_equal_normalize' => ['space' => 'none'],
'declare_parentheses' => true,
'declare_strict_types' => true,
'dir_constant' => true,
'echo_tag_syntax' => true,
......@@ -87,7 +102,6 @@ $config->setFinder($finder)
'fully_qualified_strict_types' => true,
'function_declaration' => true,
'function_to_constant' => true,
'function_typehint_space' => true,
'get_class_to_class_keyword' => true,
'global_namespace_import' => [
'import_classes' => true,
......@@ -99,9 +113,10 @@ $config->setFinder($finder)
'implode_call' => true,
'include' => true,
'increment_style' => [
'style' => PhpCsFixer\Fixer\Operator\IncrementStyleFixer::STYLE_POST,
'style' => 'post',
],
'indentation_type' => true,
'integer_literal_case' => true,
'is_null' => true,
'lambda_not_used_import' => true,
'line_ending' => true,
......@@ -115,6 +130,8 @@ $config->setFinder($finder)
'method_argument_space' => [
'on_multiline' => 'ensure_fully_multiline',
],
'method_chaining_indentation' => true,
'modernize_strpos' => true,
'modernize_types_casting' => true,
'multiline_comment_opening_closing' => true,
'multiline_whitespace_before_semicolons' => true,
......@@ -125,10 +142,10 @@ $config->setFinder($finder)
'@internal',
],
],
'native_function_type_declaration_casing' => true,
'new_with_braces' => [
'named_class' => false,
'native_type_declaration_casing' => true,
'new_with_parentheses' => [
'anonymous_class' => false,
'named_class' => false,
],
'no_alias_functions' => true,
'no_alias_language_construct_call' => true,
......@@ -136,7 +153,6 @@ $config->setFinder($finder)
'no_binary_string' => true,
'no_blank_lines_after_class_opening' => true,
'no_blank_lines_after_phpdoc' => true,
'no_blank_lines_before_namespace' => true,
'no_break_comment' => true,
'no_closing_tag' => true,
'no_empty_comment' => true,
......@@ -148,13 +164,14 @@ $config->setFinder($finder)
'no_leading_namespace_whitespace' => true,
'no_mixed_echo_print' => ['use' => 'print'],
'no_multiline_whitespace_around_double_arrow' => true,
'no_multiple_statements_per_line' => true,
'no_null_property_initialization' => true,
'no_php4_constructor' => true,
'no_short_bool_cast' => true,
'no_singleline_whitespace_before_semicolons' => true,
'no_space_around_double_colon' => true,
'no_spaces_after_function_name' => true,
'no_spaces_around_offset' => true,
'no_spaces_inside_parenthesis' => true,
'no_superfluous_elseif' => true,
'no_superfluous_phpdoc_tags' => [
'allow_mixed' => true,
......@@ -163,15 +180,17 @@ $config->setFinder($finder)
'no_trailing_whitespace' => true,
'no_trailing_whitespace_in_comment' => true,
'no_trailing_whitespace_in_string' => true,
'no_unneeded_braces' => true,
'no_unneeded_control_parentheses' => true,
'no_unneeded_curly_braces' => true,
'no_unneeded_final_method' => true,
'no_unneeded_import_alias' => true,
'no_unreachable_default_argument_value' => true,
'no_unset_cast' => true,
'no_unset_on_property' => true,
'no_unused_imports' => true,
'no_useless_concat_operator' => true,
'no_useless_else' => true,
'no_useless_nullsafe_operator' => true,
'no_useless_return' => true,
'no_useless_sprintf' => true,
'no_whitespace_before_comma_in_array' => true,
......@@ -179,6 +198,7 @@ $config->setFinder($finder)
'non_printable_character' => true,
'normalize_index_brace' => true,
'object_operator_without_whitespace' => true,
'octal_notation' => true,
'operator_linebreak' => [
'only_booleans' => true,
'position' => 'end',
......@@ -209,9 +229,9 @@ $config->setFinder($finder)
],
'ordered_imports' => [
'imports_order' => [
PhpCsFixer\Fixer\Import\OrderedImportsFixer::IMPORT_TYPE_CONST,
PhpCsFixer\Fixer\Import\OrderedImportsFixer::IMPORT_TYPE_FUNCTION,
PhpCsFixer\Fixer\Import\OrderedImportsFixer::IMPORT_TYPE_CLASS,
'const',
'function',
'class',
]
],
'ordered_interfaces' => [
......@@ -219,6 +239,7 @@ $config->setFinder($finder)
'order' => 'alpha',
],
'ordered_traits' => true,
'ordered_types' => true,
'php_unit_set_up_tear_down_visibility' => true,
'php_unit_test_case_static_method_calls' => [
'call_type' => 'this',
......@@ -242,6 +263,7 @@ $config->setFinder($finder)
'uses',
],
],
'phpdoc_param_order' => true,
'phpdoc_return_self_reference' => true,
'phpdoc_scalar' => true,
'phpdoc_separation' => true,
......@@ -249,7 +271,7 @@ $config->setFinder($finder)
'phpdoc_summary' => true,
'phpdoc_tag_casing' => true,
'phpdoc_tag_type' => true,
'phpdoc_to_comment' => true,
'phpdoc_to_comment' => false,
'phpdoc_trim' => true,
'phpdoc_trim_consecutive_blank_line_separation' => true,
'phpdoc_types' => ['groups' => ['simple', 'meta']],
......@@ -271,14 +293,20 @@ $config->setFinder($finder)
'single_class_element_per_statement' => true,
'single_import_per_statement' => true,
'single_line_after_imports' => true,
'single_line_comment_spacing' => true,
'single_quote' => true,
'single_space_after_construct' => true,
'single_space_around_construct' => true,
'single_trait_insert_per_statement' => true,
'space_after_semicolon' => true,
'spaces_inside_parentheses' => [
'space' => 'none',
],
'standardize_increment' => true,
'standardize_not_equals' => true,
'statement_indentation' => true,
'static_lambda' => true,
'strict_param' => true,
'string_length_to_empty'=> true,
'string_line_ending' => true,
'switch_case_semicolon_to_colon' => true,
'switch_case_space' => true,
......@@ -288,13 +316,18 @@ $config->setFinder($finder)
'ternary_to_null_coalescing' => true,
'trailing_comma_in_multiline' => [
'elements' => [
'arrays'
'arguments',
'arrays',
'match',
]
],
'trim_array_spaces' => true,
'types_spaces' => [
'space' => 'none',
'type_declaration_spaces' => [
'elements' => [
'function',
],
],
'types_spaces' => true,
'unary_operator_spaces' => true,
'visibility_required' => [
'elements' => [
......@@ -307,4 +340,6 @@ $config->setFinder($finder)
'whitespace_after_comma_in_array' => true,
]);
$config->setCacheFile(__DIR__ . '/.php-cs-fixer.cache/' . sha1(@trim((string) @shell_exec('git rev-parse --abbrev-ref HEAD'))));
return $config;
......@@ -5,6 +5,8 @@
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
resolveFromConfigFile="false"
errorBaseline=".psalm/baseline.xml"
findUnusedBaselineEntry="true"
findUnusedCode="false"
>
<projectFiles>
<directory name="src" />
......
......@@ -2,6 +2,12 @@
All notable changes to `sebastianbergmann/code-unit-reverse-lookup` are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
## [4.0.0] - 2024-02-02
### Removed
* This component is no longer supported on PHP 8.1
## [3.0.0] - 2023-02-03
### Removed
......@@ -38,6 +44,7 @@ All notable changes to `sebastianbergmann/code-unit-reverse-lookup` are document
* Initial release
[4.0.0]: https://github.com/sebastianbergmann/code-unit-reverse-lookup/compare/3.0...4.0.0
[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
......
BSD 3-Clause License
Copyright (c) 2016-2023, Sebastian Bergmann
Copyright (c) 2016-2024, Sebastian Bergmann
All rights reserved.
Redistribution and use in source and binary forms, with or without
......
# 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 believe you have found a security vulnerability in the library that is developed in this repository, please report it to us through coordinated disclosure.
**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.**
**Please do not report security vulnerabilities through public GitHub issues, discussions, or pull requests.**
## Security Contact Information
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.
After the above, if you still would like to report a security vulnerability, please email `sebastian@phpunit.de`.
......@@ -9,19 +9,23 @@
"email": "sebastian@phpunit.de"
}
],
"support": {
"issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues",
"security": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/security/policy"
},
"config": {
"platform": {
"php": "8.1.0"
"php": "8.2.0"
},
"optimize-autoloader": true,
"sort-packages": true
},
"prefer-stable": true,
"require": {
"php": ">=8.1"
"php": ">=8.2"
},
"require-dev": {
"phpunit/phpunit": "^10.0"
"phpunit/phpunit": "^11.0"
},
"autoload": {
"classmap": [
......@@ -30,7 +34,7 @@
},
"extra": {
"branch-alias": {
"dev-main": "3.0-dev"
"dev-main": "4.0-dev"
}
}
}
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
cacheDirectory=".phpunit.cache"
executionOrder="depends,defects"
......@@ -16,9 +16,9 @@
</testsuite>
</testsuites>
<coverage>
<source>
<include>
<directory suffix=".php">src</directory>
<directory>src</directory>
</include>
</coverage>
</source>
</phpunit>
......@@ -11,17 +11,20 @@ namespace SebastianBergmann\CodeUnitReverseLookup;
use function array_merge;
use function assert;
use function class_exists;
use function function_exists;
use function get_declared_classes;
use function get_declared_traits;
use function get_defined_functions;
use function is_array;
use function range;
use function trait_exists;
use ReflectionClass;
use ReflectionFunction;
use ReflectionFunctionAbstract;
use ReflectionMethod;
class Wizard
final class Wizard
{
/**
* @psalm-var array<string,array<int,string>>
......@@ -62,10 +65,11 @@ class Wizard
$classes = get_declared_classes();
$traits = get_declared_traits();
/* @noinspection PhpConditionAlreadyCheckedInspection */
assert(is_array($traits));
foreach (array_merge($classes, $traits) as $classOrTrait) {
assert(class_exists($classOrTrait) || trait_exists($classOrTrait));
if (isset($this->processedClasses[$classOrTrait])) {
continue;
}
......@@ -81,6 +85,8 @@ class Wizard
private function processFunctions(): void
{
foreach (get_defined_functions()['user'] as $function) {
assert(function_exists($function));
if (isset($this->processedFunctions[$function])) {
continue;
}
......
......@@ -31,8 +31,8 @@ final class WizardTest extends TestCase
'Foo::method',
$this->wizard->lookup(
__DIR__ . '/_fixture/Foo.php',
12
)
12,
),
);
return $this->wizard;
......@@ -47,8 +47,8 @@ final class WizardTest extends TestCase
'Bar::method',
$wizard->lookup(
__DIR__ . '/_fixture/Bar.php',
12
)
12,
),
);
}
......@@ -56,7 +56,7 @@ final class WizardTest extends TestCase
{
$this->assertEquals(
'file.php:1',
$this->wizard->lookup('file.php', 1)
$this->wizard->lookup('file.php', 1),
);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment