This commit is contained in:
2025-05-12 14:25:25 +02:00
parent ab2db755ef
commit 9e378ca2b7
2719 changed files with 46505 additions and 60181 deletions

View File

@@ -2,6 +2,12 @@
All notable changes are documented in this file using the [Keep a CHANGELOG](https://keepachangelog.com/) principles.
## [2.0.1] - 2024-03-02
### Changed
* Do not use implicitly nullable parameters
## [2.0.0] - 2023-02-03
### Removed
@@ -18,6 +24,7 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](htt
* Initial release
[2.0.1]: https://github.com/sebastianbergmann/cli-parser/compare/2.0.0...2.0.1
[2.0.0]: https://github.com/sebastianbergmann/cli-parser/compare/1.0.1...2.0.0
[1.0.1]: https://github.com/sebastianbergmann/cli-parser/compare/1.0.0...1.0.1
[1.0.0]: https://github.com/sebastianbergmann/cli-parser/compare/bb7bb3297957927962b0a3335befe7b66f7462e9...1.0.0

View File

@@ -1,6 +1,6 @@
BSD 3-Clause License
Copyright (c) 2020-2023, Sebastian Bergmann
Copyright (c) 2020-2024, Sebastian Bergmann
All rights reserved.
Redistribution and use in source and binary forms, with or without

View File

@@ -1,9 +1,30 @@
# 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`.

View File

@@ -12,7 +12,8 @@
}
],
"support": {
"issues": "https://github.com/sebastianbergmann/cli-parser/issues"
"issues": "https://github.com/sebastianbergmann/cli-parser/issues",
"security": "https://github.com/sebastianbergmann/cli-parser/security/policy"
},
"prefer-stable": true,
"require": {

View File

@@ -44,7 +44,7 @@ final class Parser
* @throws RequiredOptionArgumentMissingException
* @throws UnknownOptionException
*/
public function parse(array $argv, string $shortOptions, array $longOptions = null): array
public function parse(array $argv, string $shortOptions, ?array $longOptions = null): array
{
if (empty($argv)) {
return [[], []];
@@ -93,7 +93,7 @@ final class Parser
substr($arg, 2),
$longOptions,
$options,
$argv
$argv,
);
continue;
@@ -103,7 +103,7 @@ final class Parser
substr($arg, 1),
$shortOptions,
$options,
$argv
$argv,
);
}

View File

@@ -19,8 +19,8 @@ final class AmbiguousOptionException extends RuntimeException implements Excepti
parent::__construct(
sprintf(
'Option "%s" is ambiguous',
$option
)
$option,
),
);
}
}

View File

@@ -19,8 +19,8 @@ final class OptionDoesNotAllowArgumentException extends RuntimeException impleme
parent::__construct(
sprintf(
'Option "%s" does not allow an argument',
$option
)
$option,
),
);
}
}

View File

@@ -19,8 +19,8 @@ final class RequiredOptionArgumentMissingException extends RuntimeException impl
parent::__construct(
sprintf(
'Required argument for option "%s" is missing',
$option
)
$option,
),
);
}
}

View File

@@ -19,8 +19,8 @@ final class UnknownOptionException extends RuntimeException implements Exception
parent::__construct(
sprintf(
'Unknown option "%s"',
$option
)
$option,
),
);
}
}

View File

@@ -2,6 +2,18 @@
All notable changes are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
## [5.0.3] - 2024-10-18
### Fixed
* Reverted [#113](https://github.com/sebastianbergmann/comparator/pull/113) as it broke backward compatibility
## [5.0.2] - 2024-08-12
### Fixed
* [#112](https://github.com/sebastianbergmann/comparator/issues/112): Arrays with different keys and the same values are considered equal in canonicalize mode
## [5.0.1] - 2023-08-14
### Fixed
@@ -144,6 +156,8 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](htt
* Added `SebastianBergmann\Comparator\Factory::reset()` to unregister all non-default comparators
* Added support for `phpunit/phpunit-mock-objects` version `^5.0`
[5.0.3]: https://github.com/sebastianbergmann/comparator/compare/5.0.2...5.0.3
[5.0.2]: https://github.com/sebastianbergmann/comparator/compare/5.0.1...5.0.2
[5.0.1]: https://github.com/sebastianbergmann/comparator/compare/5.0.0...5.0.1
[5.0.0]: https://github.com/sebastianbergmann/comparator/compare/4.0.8...5.0.0
[4.0.8]: https://github.com/sebastianbergmann/comparator/compare/4.0.7...4.0.8

View File

@@ -1,6 +1,6 @@
BSD 3-Clause License
Copyright (c) 2002-2023, Sebastian Bergmann
Copyright (c) 2002-2024, Sebastian Bergmann
All rights reserved.
Redistribution and use in source and binary forms, with or without

View File

@@ -35,7 +35,7 @@
"ext-mbstring": "*"
},
"require-dev": {
"phpunit/phpunit": "^10.3"
"phpunit/phpunit": "^10.5"
},
"config": {
"platform": {

View File

@@ -56,7 +56,7 @@ class ArrayComparator extends Comparator
$expectedAsString .= sprintf(
" %s => %s\n",
$exporter->export($key),
$exporter->shortenedExport($value)
$exporter->shortenedExport($value),
);
$equal = false;
@@ -71,25 +71,25 @@ class ArrayComparator extends Comparator
$expectedAsString .= sprintf(
" %s => %s\n",
$exporter->export($key),
$exporter->shortenedExport($value)
$exporter->shortenedExport($value),
);
$actualAsString .= sprintf(
" %s => %s\n",
$exporter->export($key),
$exporter->shortenedExport($actual[$key])
$exporter->shortenedExport($actual[$key]),
);
} catch (ComparisonFailure $e) {
$expectedAsString .= sprintf(
" %s => %s\n",
$exporter->export($key),
$e->getExpectedAsString() ? $this->indent($e->getExpectedAsString()) : $exporter->shortenedExport($e->getExpected())
$e->getExpectedAsString() ? $this->indent($e->getExpectedAsString()) : $exporter->shortenedExport($e->getExpected()),
);
$actualAsString .= sprintf(
" %s => %s\n",
$exporter->export($key),
$e->getActualAsString() ? $this->indent($e->getActualAsString()) : $exporter->shortenedExport($e->getActual())
$e->getActualAsString() ? $this->indent($e->getActualAsString()) : $exporter->shortenedExport($e->getActual()),
);
$equal = false;
@@ -100,7 +100,7 @@ class ArrayComparator extends Comparator
$actualAsString .= sprintf(
" %s => %s\n",
$exporter->export($key),
$exporter->shortenedExport($value)
$exporter->shortenedExport($value),
);
$equal = false;
@@ -115,7 +115,7 @@ class ArrayComparator extends Comparator
$actual,
$expectedAsString,
$actualAsString,
'Failed asserting that two arrays are equal.'
'Failed asserting that two arrays are equal.',
);
}
}

View File

@@ -42,7 +42,7 @@ final class DOMNodeComparator extends ObjectComparator
$actual,
$expectedAsString,
$actualAsString,
sprintf("Failed asserting that two DOM %s are equal.\n", $type)
sprintf("Failed asserting that two DOM %s are equal.\n", $type),
);
}
}

View File

@@ -54,7 +54,7 @@ final class DateTimeComparator extends ObjectComparator
$actual,
$this->dateTimeToString($expected),
$this->dateTimeToString($actual),
'Failed asserting that two DateTime objects are equal.'
'Failed asserting that two DateTime objects are equal.',
);
}
}

View File

@@ -33,7 +33,7 @@ final class ExceptionComparator extends ObjectComparator
$array['line'],
$array['trace'],
$array['string'],
$array['xdebug_message']
$array['xdebug_message'],
);
return $array;

View File

@@ -49,8 +49,8 @@ final class NumericComparator extends ScalarComparator
sprintf(
'Failed asserting that %s matches expected %s.',
$exporter->export($actual),
$exporter->export($expected)
)
$exporter->export($expected),
),
);
}
}

View File

@@ -42,8 +42,8 @@ class ObjectComparator extends ArrayComparator
sprintf(
'%s is not instance of expected class "%s".',
$exporter->export($actual),
$expected::class
)
$expected::class,
),
);
}
@@ -66,7 +66,7 @@ class ObjectComparator extends ArrayComparator
$delta,
$canonicalize,
$ignoreCase,
$processed
$processed,
);
} catch (ComparisonFailure $e) {
throw new ComparisonFailure(
@@ -75,7 +75,7 @@ class ObjectComparator extends ArrayComparator
// replace "Array" with "MyClass object"
substr_replace($e->getExpectedAsString(), $expected::class . ' Object', 0, 5),
substr_replace($e->getActualAsString(), $actual::class . ' Object', 0, 5),
'Failed asserting that two objects are equal.'
'Failed asserting that two objects are equal.',
);
}
}

View File

@@ -35,7 +35,7 @@ final class ResourceComparator extends Comparator
$expected,
$actual,
$exporter->export($expected),
$exporter->export($actual)
$exporter->export($actual),
);
}
}

View File

@@ -59,7 +59,7 @@ class ScalarComparator extends Comparator
$actual,
$exporter->export($expected),
$exporter->export($actual),
'Failed asserting that two strings are equal.'
'Failed asserting that two strings are equal.',
);
}
@@ -73,8 +73,8 @@ class ScalarComparator extends Comparator
sprintf(
'Failed asserting that %s matches expected %s.',
$exporter->export($actual),
$exporter->export($expected)
)
$exporter->export($expected),
),
);
}
}

View File

@@ -37,7 +37,7 @@ final class SplObjectStorageComparator extends Comparator
$actual,
$exporter->export($expected),
$exporter->export($actual),
'Failed asserting that two objects are equal.'
'Failed asserting that two objects are equal.',
);
}
}
@@ -49,7 +49,7 @@ final class SplObjectStorageComparator extends Comparator
$actual,
$exporter->export($expected),
$exporter->export($actual),
'Failed asserting that two objects are equal.'
'Failed asserting that two objects are equal.',
);
}
}

View File

@@ -35,8 +35,8 @@ final class TypeComparator extends Comparator
sprintf(
'%s does not match expected type "%s".',
(new Exporter)->shortenedExport($actual),
gettype($expected)
)
gettype($expected),
),
);
}
}

View File

@@ -2,6 +2,12 @@
All notable changes are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
## [5.1.1] - 2024-03-02
### Changed
* Do not use implicitly nullable parameters
## [5.1.0] - 2023-12-22
### Added
@@ -124,6 +130,7 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](htt
* This component is no longer supported on PHP 5.6
[5.1.1]: https://github.com/sebastianbergmann/diff/compare/5.1.0...5.1.1
[5.1.0]: https://github.com/sebastianbergmann/diff/compare/5.0.3...5.1.0
[5.0.3]: https://github.com/sebastianbergmann/diff/compare/5.0.2...5.0.3
[5.0.2]: https://github.com/sebastianbergmann/diff/compare/5.0.1...5.0.2

View File

@@ -1,6 +1,6 @@
BSD 3-Clause License
Copyright (c) 2002-2023, Sebastian Bergmann
Copyright (c) 2002-2024, Sebastian Bergmann
All rights reserved.
Redistribution and use in source and binary forms, with or without

View File

@@ -31,7 +31,7 @@
},
"require-dev": {
"phpunit/phpunit": "^10.0",
"symfony/process": "^4.2 || ^5"
"symfony/process": "^6.4"
},
"autoload": {
"classmap": [

View File

@@ -42,14 +42,14 @@ final class Differ
$this->outputBuilder = $outputBuilder;
}
public function diff(array|string $from, array|string $to, LongestCommonSubsequenceCalculator $lcs = null): string
public function diff(array|string $from, array|string $to, ?LongestCommonSubsequenceCalculator $lcs = null): string
{
$diff = $this->diffToArray($from, $to, $lcs);
return $this->outputBuilder->getDiff($diff);
}
public function diffToArray(array|string $from, array|string $to, LongestCommonSubsequenceCalculator $lcs = null): array
public function diffToArray(array|string $from, array|string $to, ?LongestCommonSubsequenceCalculator $lcs = null): array
{
if (is_string($from)) {
$from = $this->splitStringByLines($from);

View File

@@ -21,17 +21,17 @@ final class ConfigurationException extends InvalidArgumentException
string $expected,
$value,
int $code = 0,
Exception $previous = null
?Exception $previous = null
) {
parent::__construct(
sprintf(
'Option "%s" must be %s, got "%s".',
$option,
$expected,
is_object($value) ? $value::class : (null === $value ? '<null>' : gettype($value) . '#' . $value)
is_object($value) ? $value::class : (null === $value ? '<null>' : gettype($value) . '#' . $value),
),
$code,
$previous
$previous,
);
}
}

View File

@@ -61,7 +61,7 @@ final class MemoryEfficientLongestCommonSubsequenceCalculator implements Longest
return array_merge(
$this->calculate($fromStart, $toStart),
$this->calculate($fromEnd, $toEnd)
$this->calculate($fromEnd, $toEnd),
);
}
@@ -78,7 +78,11 @@ final class MemoryEfficientLongestCommonSubsequenceCalculator implements Longest
if ($from[$i] === $to[$j]) {
$current[$j + 1] = $prev[$j] + 1;
} else {
// don't use max() to avoid function call overhead
/**
* @noinspection PhpConditionCanBeReplacedWithMinMaxCallInspection
*
* We do not use max() here to avoid the function call overhead
*/
if ($current[$j] > $prev[$j + 1]) {
$current[$j + 1] = $current[$j];
} else {

View File

@@ -82,7 +82,7 @@ final class StrictUnifiedDiffOutputBuilder implements DiffOutputBuilderInterface
$options['fromFile'],
null === $options['fromFileDate'] ? '' : "\t" . $options['fromFileDate'],
$options['toFile'],
null === $options['toFileDate'] ? '' : "\t" . $options['toFileDate']
null === $options['toFileDate'] ? '' : "\t" . $options['toFileDate'],
);
$this->collapseRanges = $options['collapseRanges'];
@@ -201,11 +201,11 @@ final class StrictUnifiedDiffOutputBuilder implements DiffOutputBuilderInterface
$fromRange - $cutOff + $contextStartOffset + $this->contextLines,
$toStart - $contextStartOffset,
$toRange - $cutOff + $contextStartOffset + $this->contextLines,
$output
$output,
);
$fromStart += $fromRange;
$toStart += $toRange;
$toStart += $toRange;
$hunkCapture = false;
$sameCount = $toRange = $fromRange = 0;
@@ -251,7 +251,7 @@ final class StrictUnifiedDiffOutputBuilder implements DiffOutputBuilderInterface
$contextEndOffset = min($sameCount, $this->contextLines);
$fromRange -= $sameCount;
$toRange -= $sameCount;
$toRange -= $sameCount;
$this->writeHunk(
$diff,
@@ -261,7 +261,7 @@ final class StrictUnifiedDiffOutputBuilder implements DiffOutputBuilderInterface
$fromRange + $contextStartOffset + $contextEndOffset,
$toStart - $contextStartOffset,
$toRange + $contextStartOffset + $contextEndOffset,
$output
$output,
);
}
@@ -302,11 +302,11 @@ final class StrictUnifiedDiffOutputBuilder implements DiffOutputBuilderInterface
$this->changed = true;
fwrite($output, $diff[$i][0]);
}
//} elseif ($diff[$i][1] === Differ::DIFF_LINE_END_WARNING) { // custom comment inserted by PHPUnit/diff package
// } elseif ($diff[$i][1] === Differ::DIFF_LINE_END_WARNING) { // custom comment inserted by PHPUnit/diff package
// skip
//} else {
// } else {
// unknown/invalid
//}
// }
}
}

View File

@@ -18,7 +18,6 @@ use function max;
use function min;
use function str_ends_with;
use function stream_get_contents;
use function strlen;
use function substr;
use SebastianBergmann\Diff\Differ;
@@ -67,7 +66,7 @@ final class UnifiedDiffOutputBuilder extends AbstractChunkOutputBuilder
// This might happen when both the `from` and `to` do not have a trailing linebreak
$last = substr($diff, -1);
return 0 !== strlen($diff) && "\n" !== $last && "\r" !== $last
return '' !== $diff && "\n" !== $last && "\r" !== $last
? $diff . "\n"
: $diff;
}
@@ -151,11 +150,11 @@ final class UnifiedDiffOutputBuilder extends AbstractChunkOutputBuilder
$fromRange - $cutOff + $contextStartOffset + $this->contextLines,
$toStart - $contextStartOffset,
$toRange - $cutOff + $contextStartOffset + $this->contextLines,
$output
$output,
);
$fromStart += $fromRange;
$toStart += $toRange;
$toStart += $toRange;
$hunkCapture = false;
$sameCount = $toRange = $fromRange = 0;
@@ -199,7 +198,7 @@ final class UnifiedDiffOutputBuilder extends AbstractChunkOutputBuilder
$contextEndOffset = min($sameCount, $this->contextLines);
$fromRange -= $sameCount;
$toRange -= $sameCount;
$toRange -= $sameCount;
$this->writeHunk(
$diff,
@@ -209,7 +208,7 @@ final class UnifiedDiffOutputBuilder extends AbstractChunkOutputBuilder
$fromRange + $contextStartOffset + $contextEndOffset,
$toStart - $contextStartOffset,
$toRange + $contextStartOffset + $contextEndOffset,
$output
$output,
);
}

View File

@@ -83,7 +83,7 @@ final class Parser
(int) $match['start'],
isset($match['startrange']) ? max(0, (int) $match['startrange']) : 1,
(int) $match['end'],
isset($match['endrange']) ? max(0, (int) $match['endrange']) : 1
isset($match['endrange']) ? max(0, (int) $match['endrange']) : 1,
);
$chunks[] = $chunk;

View File

@@ -2,6 +2,12 @@
All notable changes in `sebastianbergmann/environment` are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
## [6.1.0] - 2024-03-23
### Added
* [#72](https://github.com/sebastianbergmann/environment/pull/72): `Runtime::getRawBinary()`
## [6.0.1] - 2023-04-11
### Fixed
@@ -172,6 +178,7 @@ All notable changes in `sebastianbergmann/environment` are documented in this fi
* This component is no longer supported on PHP 5.6
[6.1.0]: https://github.com/sebastianbergmann/environment/compare/6.0.1...6.1.0
[6.0.1]: https://github.com/sebastianbergmann/environment/compare/6.0.0...6.0.1
[6.0.0]: https://github.com/sebastianbergmann/environment/compare/5.1.5...6.0.0
[5.1.5]: https://github.com/sebastianbergmann/environment/compare/5.1.4...5.1.5

View File

@@ -1,6 +1,6 @@
BSD 3-Clause License
Copyright (c) 2014-2023, Sebastian Bergmann
Copyright (c) 2014-2024, Sebastian Bergmann
All rights reserved.
Redistribution and use in source and binary forms, with or without

View File

@@ -38,7 +38,7 @@
},
"extra": {
"branch-alias": {
"dev-main": "6.0-dev"
"dev-main": "6.1-dev"
}
}
}

View File

@@ -97,7 +97,7 @@ final class Console
/**
* Returns if the file descriptor is an interactive terminal or not.
*
* Normally, we want to use a resource as a parameter, yet sadly it's not always awailable,
* Normally, we want to use a resource as a parameter, yet sadly it's not always available,
* eg when running code in interactive console (`php -a`), STDIN/STDOUT/STDERR constants are not defined.
*
* @param int|resource $fileDescriptor
@@ -112,7 +112,7 @@ final class Console
if (function_exists('fstat')) {
$stat = @fstat(STDOUT);
return $stat && 0020000 === ($stat['mode'] & 0170000);
return $stat && 0o020000 === ($stat['mode'] & 0o170000);
}
return false;
@@ -166,7 +166,7 @@ final class Console
$pipes,
null,
null,
['suppress_errors' => true]
['suppress_errors' => true],
);
if (is_resource($process)) {

View File

@@ -30,7 +30,7 @@ use function strrpos;
final class Runtime
{
private static string $binary;
private static string $rawBinary;
private static bool $initialized = false;
/**
@@ -91,19 +91,19 @@ final class Runtime
}
/**
* Returns the path to the binary of the current runtime.
* Returns the raw path to the binary of the current runtime.
*/
public function getBinary(): string
public function getRawBinary(): string
{
if (self::$initialized) {
return self::$binary;
return self::$rawBinary;
}
if (PHP_BINARY !== '') {
self::$binary = escapeshellarg(PHP_BINARY);
self::$rawBinary = PHP_BINARY;
self::$initialized = true;
return self::$binary;
return self::$rawBinary;
}
// @codeCoverageIgnoreStart
@@ -115,19 +115,26 @@ final class Runtime
foreach ($possibleBinaryLocations as $binary) {
if (is_readable($binary)) {
self::$binary = escapeshellarg($binary);
self::$rawBinary = $binary;
self::$initialized = true;
return self::$binary;
return self::$rawBinary;
}
}
// @codeCoverageIgnoreStart
self::$binary = 'php';
self::$rawBinary = 'php';
self::$initialized = true;
// @codeCoverageIgnoreEnd
return self::$binary;
return self::$rawBinary;
// @codeCoverageIgnoreEnd
}
/**
* Returns the escaped path to the binary of the current runtime.
*/
public function getBinary(): string
{
return escapeshellarg($this->getRawBinary());
}
public function getNameWithVersion(): string
@@ -141,7 +148,7 @@ final class Runtime
return sprintf(
'%s with PCOV %s',
$this->getNameWithVersion(),
phpversion('pcov')
phpversion('pcov'),
);
}
@@ -149,7 +156,7 @@ final class Runtime
return sprintf(
'%s with Xdebug %s',
$this->getNameWithVersion(),
phpversion('xdebug')
phpversion('xdebug'),
);
}
@@ -244,8 +251,8 @@ final class Runtime
$files,
array_map(
'trim',
explode(",\n", $scanned)
)
explode(",\n", $scanned),
),
);
}

View File

@@ -2,6 +2,12 @@
All notable changes are documented in this file using the [Keep a CHANGELOG](https://keepachangelog.com/) principles.
## [5.1.2] - 2024-03-02
### Changed
* Do not use implicitly nullable parameters
## [5.1.1] - 2023-09-24
### Changed
@@ -94,6 +100,7 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](htt
* Remove HHVM-specific code that is no longer needed
[5.1.2]: https://github.com/sebastianbergmann/exporter/compare/5.1.1...5.1.2
[5.1.1]: https://github.com/sebastianbergmann/exporter/compare/5.1.0...5.1.1
[5.1.0]: https://github.com/sebastianbergmann/exporter/compare/5.0.1...5.1.0
[5.0.1]: https://github.com/sebastianbergmann/exporter/compare/5.0.0...5.0.1

View File

@@ -1,6 +1,6 @@
BSD 3-Clause License
Copyright (c) 2002-2023, Sebastian Bergmann
Copyright (c) 2002-2024, Sebastian Bergmann
All rights reserved.
Redistribution and use in source and binary forms, with or without

View File

@@ -54,7 +54,7 @@ final class Exporter
return $this->recursiveExport($value, $indentation);
}
public function shortenedRecursiveExport(array &$data, Context $context = null): string
public function shortenedRecursiveExport(array &$data, ?Context $context = null): string
{
$result = [];
$exporter = new self;

View File

@@ -2,6 +2,12 @@
All notable changes in `sebastian/global-state` are documented in this file using the [Keep a CHANGELOG](https://keepachangelog.com/) principles.
## [6.0.2] - 2024-03-02
### Changed
* Do not use implicitly nullable parameters
## [6.0.1] - 2023-07-19
### Changed
@@ -86,6 +92,7 @@ All notable changes in `sebastian/global-state` are documented in this file usin
* This component is no longer supported on PHP 7.0 and PHP 7.1
[6.0.2]: https://github.com/sebastianbergmann/global-state/compare/6.0.1...6.0.2
[6.0.1]: https://github.com/sebastianbergmann/global-state/compare/6.0.0...6.0.1
[6.0.0]: https://github.com/sebastianbergmann/global-state/compare/5.0.5...6.0.0
[5.0.5]: https://github.com/sebastianbergmann/global-state/compare/5.0.4...5.0.5

View File

@@ -1,6 +1,6 @@
BSD 3-Clause License
Copyright (c) 2001-2023, Sebastian Bergmann
Copyright (c) 2001-2024, Sebastian Bergmann
All rights reserved.
Redistribution and use in source and binary forms, with or without

View File

@@ -2,7 +2,7 @@
"name": "sebastian/global-state",
"description": "Snapshotting of global state",
"keywords": ["global state"],
"homepage": "http://www.github.com/sebastianbergmann/global-state",
"homepage": "https://www.github.com/sebastianbergmann/global-state",
"license": "BSD-3-Clause",
"authors": [
{

View File

@@ -27,7 +27,7 @@ final class CodeExporter
'if (!defined(\'%s\')) define(\'%s\', %s);' . "\n",
$name,
$name,
$this->exportVariable($value)
$this->exportVariable($value),
);
}
@@ -53,7 +53,7 @@ EOT;
$result .= sprintf(
'$GLOBALS[%s] = %s;' . PHP_EOL,
$this->exportVariable($name),
$this->exportVariable($value)
$this->exportVariable($value),
);
}
@@ -68,7 +68,7 @@ EOT;
$result .= sprintf(
'@ini_set(%s, %s);' . "\n",
$this->exportVariable($key),
$this->exportVariable($value)
$this->exportVariable($value),
);
}

View File

@@ -10,7 +10,7 @@
namespace SebastianBergmann\GlobalState;
use function in_array;
use function strpos;
use function str_starts_with;
use ReflectionClass;
final class ExcludeList
@@ -71,7 +71,7 @@ final class ExcludeList
}
foreach ($this->classNamePrefixes as $prefix) {
if (strpos($className, $prefix) === 0) {
if (str_starts_with($className, $prefix)) {
return true;
}
}

View File

@@ -90,8 +90,8 @@ final class Restorer
$keys = array_keys(
array_merge(
$GLOBALS[$superGlobalArray],
$superGlobalVariables[$superGlobalArray]
)
$superGlobalVariables[$superGlobalArray],
),
);
foreach ($keys as $key) {

View File

@@ -51,7 +51,7 @@ class Snapshot
private array $classes = [];
private array $traits = [];
public function __construct(ExcludeList $excludeList = null, bool $includeGlobalVariables = true, bool $includeStaticProperties = true, bool $includeConstants = true, bool $includeFunctions = true, bool $includeClasses = true, bool $includeInterfaces = true, bool $includeTraits = true, bool $includeIniSettings = true, bool $includeIncludedFiles = true)
public function __construct(?ExcludeList $excludeList = null, bool $includeGlobalVariables = true, bool $includeStaticProperties = true, bool $includeConstants = true, bool $includeFunctions = true, bool $includeClasses = true, bool $includeInterfaces = true, bool $includeTraits = true, bool $includeIniSettings = true, bool $includeIncludedFiles = true)
{
$this->excludeList = $excludeList ?: new ExcludeList;
@@ -340,7 +340,7 @@ class Snapshot
/** @noinspection SlowArrayOperationsInLoopInspection */
$result = array_merge(
$result,
$this->enumerateObjectsAndResources($element, $processed)
$this->enumerateObjectsAndResources($element, $processed),
);
} else {
$result[] = $element;
@@ -358,7 +358,7 @@ class Snapshot
/** @noinspection SlowArrayOperationsInLoopInspection */
$result = array_merge(
$result,
$this->enumerateObjectsAndResources($value, $processed)
$this->enumerateObjectsAndResources($value, $processed),
);
} else {
$result[] = $value;