updated plugin WP-WebAuthn version 1.4.1

This commit is contained in:
2026-06-03 21:27:37 +00:00
committed by Gitium
parent e4b9b8235b
commit 5cd2237fad
39 changed files with 2660 additions and 1265 deletions

View File

@ -14,10 +14,7 @@ if (PHP_VERSION_ID < 50600) {
echo $err;
}
}
trigger_error(
$err,
E_USER_ERROR
);
throw new RuntimeException($err);
}
require_once __DIR__ . '/composer/autoload_real.php';

View File

@ -1,64 +0,0 @@
on: [push, pull_request]
name: CI
jobs:
tests:
name: Tests
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ['7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1']
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
tools: "cs2pr"
- name: "Cache dependencies installed with composer"
uses: "actions/cache@v1"
with:
path: "~/.composer/cache"
key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}"
restore-keys: "php-${{ matrix.php-version }}-composer-locked-"
- name: "Composer"
run: "composer update --prefer-stable"
- name: "PHPUnit"
run: "php vendor/bin/phpunit"
# lint:
# name: Lint
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v1
# - name: Setup PHP
# uses: shivammathur/setup-php@v2
# with:
# php-version: 7.4
# - name: "Cache dependencies installed with composer"
# uses: "actions/cache@v1"
# with:
# path: "~/.composer/cache"
# key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}"
# restore-keys: "php-${{ matrix.php-version }}-composer-locked-"
# - name: "Composer"
# run: "composer update --prefer-stable"
# - name: "assert:cs-lint"
# run: "composer assert:cs-lint"
# - name: "assert:sa-code"
# run: "composer assert:sa-code"
# - name: "assert:sa-tests"
# run: "composer assert:sa-tests"

View File

@ -23,7 +23,7 @@
"sort-packages": true
},
"require": {
"php": "^7.0 || ^8.0",
"php": "^7.1 || ^8.0",
"ext-simplexml": "*",
"ext-mbstring": "*",
"ext-ctype": "*",

View File

@ -42,7 +42,7 @@ abstract class Assert
* The assertion chain can be stateful, that means be careful when you reuse
* it. You should never pass around the chain.
*/
public static function that($value, $defaultMessage = null, string $defaultPropertyPath = null): AssertionChain
public static function that($value, $defaultMessage = null, ?string $defaultPropertyPath = null): AssertionChain
{
$assertionChain = new AssertionChain($value, $defaultMessage, $defaultPropertyPath);
@ -55,7 +55,7 @@ abstract class Assert
* @param mixed $values
* @param string|callable|null $defaultMessage
*/
public static function thatAll($values, $defaultMessage = null, string $defaultPropertyPath = null): AssertionChain
public static function thatAll($values, $defaultMessage = null, ?string $defaultPropertyPath = null): AssertionChain
{
return static::that($values, $defaultMessage, $defaultPropertyPath)->all();
}
@ -66,7 +66,7 @@ abstract class Assert
* @param mixed $value
* @param string|callable|null $defaultMessage
*/
public static function thatNullOr($value, $defaultMessage = null, string $defaultPropertyPath = null): AssertionChain
public static function thatNullOr($value, $defaultMessage = null, ?string $defaultPropertyPath = null): AssertionChain
{
return static::that($value, $defaultMessage, $defaultPropertyPath)->nullOr();
}

View File

@ -307,7 +307,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function eq($value, $value2, $message = null, string $propertyPath = null): bool
public static function eq($value, $value2, $message = null, ?string $propertyPath = null): bool
{
if ($value != $value2) {
$message = \sprintf(
@ -331,7 +331,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function eqArraySubset($value, $value2, $message = null, string $propertyPath = null): bool
public static function eqArraySubset($value, $value2, $message = null, ?string $propertyPath = null): bool
{
static::isArray($value, $message, $propertyPath);
static::isArray($value2, $message, $propertyPath);
@ -358,7 +358,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function same($value, $value2, $message = null, string $propertyPath = null): bool
public static function same($value, $value2, $message = null, ?string $propertyPath = null): bool
{
if ($value !== $value2) {
$message = \sprintf(
@ -382,7 +382,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function notEq($value1, $value2, $message = null, string $propertyPath = null): bool
public static function notEq($value1, $value2, $message = null, ?string $propertyPath = null): bool
{
if ($value1 == $value2) {
$message = \sprintf(
@ -412,7 +412,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function notSame($value1, $value2, $message = null, string $propertyPath = null): bool
public static function notSame($value1, $value2, $message = null, ?string $propertyPath = null): bool
{
if ($value1 === $value2) {
$message = \sprintf(
@ -434,7 +434,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function notInArray($value, array $choices, $message = null, string $propertyPath = null): bool
public static function notInArray($value, array $choices, $message = null, ?string $propertyPath = null): bool
{
if (true === \in_array($value, $choices)) {
$message = \sprintf(
@ -461,7 +461,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function integer($value, $message = null, string $propertyPath = null): bool
public static function integer($value, $message = null, ?string $propertyPath = null): bool
{
if (!\is_int($value)) {
$message = \sprintf(
@ -488,7 +488,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function float($value, $message = null, string $propertyPath = null): bool
public static function float($value, $message = null, ?string $propertyPath = null): bool
{
if (!\is_float($value)) {
$message = \sprintf(
@ -515,7 +515,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function digit($value, $message = null, string $propertyPath = null): bool
public static function digit($value, $message = null, ?string $propertyPath = null): bool
{
if (!\ctype_digit((string)$value)) {
$message = \sprintf(
@ -537,7 +537,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function integerish($value, $message = null, string $propertyPath = null): bool
public static function integerish($value, $message = null, ?string $propertyPath = null): bool
{
if (
\is_resource($value) ||
@ -577,7 +577,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function boolean($value, $message = null, string $propertyPath = null): bool
public static function boolean($value, $message = null, ?string $propertyPath = null): bool
{
if (!\is_bool($value)) {
$message = \sprintf(
@ -604,7 +604,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function scalar($value, $message = null, string $propertyPath = null): bool
public static function scalar($value, $message = null, ?string $propertyPath = null): bool
{
if (!\is_scalar($value)) {
$message = \sprintf(
@ -631,7 +631,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function notEmpty($value, $message = null, string $propertyPath = null): bool
public static function notEmpty($value, $message = null, ?string $propertyPath = null): bool
{
if (empty($value)) {
$message = \sprintf(
@ -658,7 +658,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function noContent($value, $message = null, string $propertyPath = null): bool
public static function noContent($value, $message = null, ?string $propertyPath = null): bool
{
if (!empty($value)) {
$message = \sprintf(
@ -683,7 +683,7 @@ class Assertion
*
* @return bool
*/
public static function null($value, $message = null, string $propertyPath = null): bool
public static function null($value, $message = null, ?string $propertyPath = null): bool
{
if (null !== $value) {
$message = \sprintf(
@ -710,7 +710,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function notNull($value, $message = null, string $propertyPath = null): bool
public static function notNull($value, $message = null, ?string $propertyPath = null): bool
{
if (null === $value) {
$message = \sprintf(
@ -737,7 +737,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function string($value, $message = null, string $propertyPath = null)
public static function string($value, $message = null, ?string $propertyPath = null)
{
if (!\is_string($value)) {
$message = \sprintf(
@ -766,7 +766,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function regex($value, $pattern, $message = null, string $propertyPath = null): bool
public static function regex($value, $pattern, $message = null, ?string $propertyPath = null): bool
{
static::string($value, $message, $propertyPath);
@ -794,7 +794,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function notRegex($value, $pattern, $message = null, string $propertyPath = null): bool
public static function notRegex($value, $pattern, $message = null, ?string $propertyPath = null): bool
{
static::string($value, $message, $propertyPath);
@ -825,7 +825,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function length($value, $length, $message = null, string $propertyPath = null, $encoding = 'utf8'): bool
public static function length($value, $length, $message = null, ?string $propertyPath = null, $encoding = 'utf8'): bool
{
static::string($value, $message, $propertyPath);
@ -858,7 +858,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function minLength($value, $minLength, $message = null, string $propertyPath = null, $encoding = 'utf8'): bool
public static function minLength($value, $minLength, $message = null, ?string $propertyPath = null, $encoding = 'utf8'): bool
{
static::string($value, $message, $propertyPath);
@ -891,7 +891,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function maxLength($value, $maxLength, $message = null, string $propertyPath = null, $encoding = 'utf8'): bool
public static function maxLength($value, $maxLength, $message = null, ?string $propertyPath = null, $encoding = 'utf8'): bool
{
static::string($value, $message, $propertyPath);
@ -925,7 +925,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function betweenLength($value, $minLength, $maxLength, $message = null, string $propertyPath = null, $encoding = 'utf8'): bool
public static function betweenLength($value, $minLength, $maxLength, $message = null, ?string $propertyPath = null, $encoding = 'utf8'): bool
{
static::string($value, $message, $propertyPath);
static::minLength($value, $minLength, $message, $propertyPath, $encoding);
@ -949,7 +949,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function startsWith($string, $needle, $message = null, string $propertyPath = null, $encoding = 'utf8'): bool
public static function startsWith($string, $needle, $message = null, ?string $propertyPath = null, $encoding = 'utf8'): bool
{
static::string($string, $message, $propertyPath);
@ -981,7 +981,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function endsWith($string, $needle, $message = null, string $propertyPath = null, $encoding = 'utf8'): bool
public static function endsWith($string, $needle, $message = null, ?string $propertyPath = null, $encoding = 'utf8'): bool
{
static::string($string, $message, $propertyPath);
@ -1015,7 +1015,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function contains($string, $needle, $message = null, string $propertyPath = null, $encoding = 'utf8'): bool
public static function contains($string, $needle, $message = null, ?string $propertyPath = null, $encoding = 'utf8'): bool
{
static::string($string, $message, $propertyPath);
@ -1047,7 +1047,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function notContains($string, $needle, $message = null, string $propertyPath = null, $encoding = 'utf8'): bool
public static function notContains($string, $needle, $message = null, ?string $propertyPath = null, $encoding = 'utf8'): bool
{
static::string($string, $message, $propertyPath);
@ -1072,7 +1072,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function choice($value, array $choices, $message = null, string $propertyPath = null): bool
public static function choice($value, array $choices, $message = null, ?string $propertyPath = null): bool
{
if (!\in_array($value, $choices, true)) {
$message = \sprintf(
@ -1097,7 +1097,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function inArray($value, array $choices, $message = null, string $propertyPath = null): bool
public static function inArray($value, array $choices, $message = null, ?string $propertyPath = null): bool
{
return static::choice($value, $choices, $message, $propertyPath);
}
@ -1115,7 +1115,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function numeric($value, $message = null, string $propertyPath = null): bool
public static function numeric($value, $message = null, ?string $propertyPath = null): bool
{
if (!\is_numeric($value)) {
$message = \sprintf(
@ -1140,7 +1140,7 @@ class Assertion
*
* @return bool
*/
public static function isResource($value, $message = null, string $propertyPath = null): bool
public static function isResource($value, $message = null, ?string $propertyPath = null): bool
{
if (!\is_resource($value)) {
$message = \sprintf(
@ -1167,7 +1167,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function isArray($value, $message = null, string $propertyPath = null): bool
public static function isArray($value, $message = null, ?string $propertyPath = null): bool
{
if (!\is_array($value)) {
$message = \sprintf(
@ -1194,7 +1194,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function isTraversable($value, $message = null, string $propertyPath = null): bool
public static function isTraversable($value, $message = null, ?string $propertyPath = null): bool
{
if (!\is_array($value) && !$value instanceof Traversable) {
$message = \sprintf(
@ -1216,7 +1216,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function isArrayAccessible($value, $message = null, string $propertyPath = null): bool
public static function isArrayAccessible($value, $message = null, ?string $propertyPath = null): bool
{
if (!\is_array($value) && !$value instanceof ArrayAccess) {
$message = \sprintf(
@ -1233,7 +1233,7 @@ class Assertion
/**
* Assert that value is countable.
*
* @param array|Countable|ResourceBundle|SimpleXMLElement $value
* @param mixed $value
* @param string|callable|null $message
* @param string|null $propertyPath
*
@ -1243,7 +1243,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function isCountable($value, $message = null, string $propertyPath = null): bool
public static function isCountable($value, $message = null, ?string $propertyPath = null): bool
{
if (\function_exists('is_countable')) {
$assert = \is_countable($value);
@ -1272,7 +1272,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function keyExists($value, $key, $message = null, string $propertyPath = null): bool
public static function keyExists($value, $key, $message = null, ?string $propertyPath = null): bool
{
static::isArray($value, $message, $propertyPath);
@ -1297,7 +1297,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function keyNotExists($value, $key, $message = null, string $propertyPath = null): bool
public static function keyNotExists($value, $key, $message = null, ?string $propertyPath = null): bool
{
static::isArray($value, $message, $propertyPath);
@ -1321,7 +1321,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function uniqueValues(array $values, $message = null, string $propertyPath = null): bool
public static function uniqueValues(array $values, $message = null, ?string $propertyPath = null): bool
{
foreach ($values as $key => $value) {
if (\array_search($value, $values, true) !== $key) {
@ -1346,7 +1346,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function keyIsset($value, $key, $message = null, string $propertyPath = null): bool
public static function keyIsset($value, $key, $message = null, ?string $propertyPath = null): bool
{
static::isArrayAccessible($value, $message, $propertyPath);
@ -1371,7 +1371,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function notEmptyKey($value, $key, $message = null, string $propertyPath = null): bool
public static function notEmptyKey($value, $key, $message = null, ?string $propertyPath = null): bool
{
static::keyIsset($value, $key, $message, $propertyPath);
static::notEmpty($value[$key], $message, $propertyPath);
@ -1387,7 +1387,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function notBlank($value, $message = null, string $propertyPath = null): bool
public static function notBlank($value, $message = null, ?string $propertyPath = null): bool
{
if (false === $value || (empty($value) && '0' != $value) || (\is_string($value) && '' === \trim($value))) {
$message = \sprintf(
@ -1417,7 +1417,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function isInstanceOf($value, $className, $message = null, string $propertyPath = null): bool
public static function isInstanceOf($value, $className, $message = null, ?string $propertyPath = null): bool
{
if (!($value instanceof $className)) {
$message = \sprintf(
@ -1448,7 +1448,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function notIsInstanceOf($value, $className, $message = null, string $propertyPath = null): bool
public static function notIsInstanceOf($value, $className, $message = null, ?string $propertyPath = null): bool
{
if ($value instanceof $className) {
$message = \sprintf(
@ -1472,7 +1472,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function subclassOf($value, $className, $message = null, string $propertyPath = null): bool
public static function subclassOf($value, $className, $message = null, ?string $propertyPath = null): bool
{
if (!\is_subclass_of($value, $className)) {
$message = \sprintf(
@ -1502,7 +1502,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function range($value, $minValue, $maxValue, $message = null, string $propertyPath = null): bool
public static function range($value, $minValue, $maxValue, $message = null, ?string $propertyPath = null): bool
{
static::numeric($value, $message, $propertyPath);
@ -1534,7 +1534,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function min($value, $minValue, $message = null, string $propertyPath = null): bool
public static function min($value, $minValue, $message = null, ?string $propertyPath = null): bool
{
static::numeric($value, $message, $propertyPath);
@ -1565,7 +1565,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function max($value, $maxValue, $message = null, string $propertyPath = null): bool
public static function max($value, $maxValue, $message = null, ?string $propertyPath = null): bool
{
static::numeric($value, $message, $propertyPath);
@ -1590,7 +1590,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function file($value, $message = null, string $propertyPath = null): bool
public static function file($value, $message = null, ?string $propertyPath = null): bool
{
static::string($value, $message, $propertyPath);
static::notEmpty($value, $message, $propertyPath);
@ -1615,7 +1615,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function directory($value, $message = null, string $propertyPath = null): bool
public static function directory($value, $message = null, ?string $propertyPath = null): bool
{
static::string($value, $message, $propertyPath);
@ -1639,7 +1639,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function readable($value, $message = null, string $propertyPath = null): bool
public static function readable($value, $message = null, ?string $propertyPath = null): bool
{
static::string($value, $message, $propertyPath);
@ -1663,7 +1663,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function writeable($value, $message = null, string $propertyPath = null): bool
public static function writeable($value, $message = null, ?string $propertyPath = null): bool
{
static::string($value, $message, $propertyPath);
@ -1692,7 +1692,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function email($value, $message = null, string $propertyPath = null): bool
public static function email($value, $message = null, ?string $propertyPath = null): bool
{
static::string($value, $message, $propertyPath);
@ -1726,7 +1726,7 @@ class Assertion
* @see https://github.com/symfony/Validator/blob/master/Constraints/UrlValidator.php
* @see https://github.com/symfony/Validator/blob/master/Constraints/Url.php
*/
public static function url($value, $message = null, string $propertyPath = null): bool
public static function url($value, $message = null, ?string $propertyPath = null): bool
{
static::string($value, $message, $propertyPath);
@ -1772,7 +1772,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function alnum($value, $message = null, string $propertyPath = null): bool
public static function alnum($value, $message = null, ?string $propertyPath = null): bool
{
try {
static::regex($value, '(^([a-zA-Z]{1}[a-zA-Z0-9]*)$)', $message, $propertyPath);
@ -1801,7 +1801,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function true($value, $message = null, string $propertyPath = null): bool
public static function true($value, $message = null, ?string $propertyPath = null): bool
{
if (true !== $value) {
$message = \sprintf(
@ -1828,7 +1828,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function false($value, $message = null, string $propertyPath = null): bool
public static function false($value, $message = null, ?string $propertyPath = null): bool
{
if (false !== $value) {
$message = \sprintf(
@ -1855,7 +1855,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function classExists($value, $message = null, string $propertyPath = null): bool
public static function classExists($value, $message = null, ?string $propertyPath = null): bool
{
if (!\class_exists($value)) {
$message = \sprintf(
@ -1882,7 +1882,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function interfaceExists($value, $message = null, string $propertyPath = null): bool
public static function interfaceExists($value, $message = null, ?string $propertyPath = null): bool
{
if (!\interface_exists($value)) {
$message = \sprintf(
@ -1905,7 +1905,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function implementsInterface($class, $interfaceName, $message = null, string $propertyPath = null): bool
public static function implementsInterface($class, $interfaceName, $message = null, ?string $propertyPath = null): bool
{
try {
$reflection = new ReflectionClass($class);
@ -1948,7 +1948,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function isJsonString($value, $message = null, string $propertyPath = null): bool
public static function isJsonString($value, $message = null, ?string $propertyPath = null): bool
{
if (null === \json_decode($value) && JSON_ERROR_NONE !== \json_last_error()) {
$message = \sprintf(
@ -1972,7 +1972,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function uuid($value, $message = null, string $propertyPath = null): bool
public static function uuid($value, $message = null, ?string $propertyPath = null): bool
{
$value = \str_replace(['urn:', 'uuid:', '{', '}'], '', $value);
@ -2002,7 +2002,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function e164($value, $message = null, string $propertyPath = null): bool
public static function e164($value, $message = null, ?string $propertyPath = null): bool
{
if (!\preg_match('/^\+?[1-9]\d{1,14}$/', $value)) {
$message = \sprintf(
@ -2028,7 +2028,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function count($countable, $count, $message = null, string $propertyPath = null): bool
public static function count($countable, $count, $message = null, ?string $propertyPath = null): bool
{
if ($count !== \count($countable)) {
$message = \sprintf(
@ -2052,7 +2052,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function minCount($countable, $count, $message = null, string $propertyPath = null): bool
public static function minCount($countable, $count, $message = null, ?string $propertyPath = null): bool
{
if ($count > \count($countable)) {
$message = \sprintf(
@ -2076,7 +2076,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function maxCount($countable, $count, $message = null, string $propertyPath = null): bool
public static function maxCount($countable, $count, $message = null, ?string $propertyPath = null): bool
{
if ($count < \count($countable)) {
$message = \sprintf(
@ -2147,7 +2147,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function choicesNotEmpty(array $values, array $choices, $message = null, string $propertyPath = null): bool
public static function choicesNotEmpty(array $values, array $choices, $message = null, ?string $propertyPath = null): bool
{
static::notEmpty($values, $message, $propertyPath);
@ -2167,7 +2167,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function methodExists($value, $object, $message = null, string $propertyPath = null): bool
public static function methodExists($value, $object, $message = null, ?string $propertyPath = null): bool
{
static::isObject($object, $message, $propertyPath);
@ -2196,7 +2196,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function isObject($value, $message = null, string $propertyPath = null): bool
public static function isObject($value, $message = null, ?string $propertyPath = null): bool
{
if (!\is_object($value)) {
$message = \sprintf(
@ -2219,7 +2219,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function lessThan($value, $limit, $message = null, string $propertyPath = null): bool
public static function lessThan($value, $limit, $message = null, ?string $propertyPath = null): bool
{
if ($value >= $limit) {
$message = \sprintf(
@ -2243,7 +2243,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function lessOrEqualThan($value, $limit, $message = null, string $propertyPath = null): bool
public static function lessOrEqualThan($value, $limit, $message = null, ?string $propertyPath = null): bool
{
if ($value > $limit) {
$message = \sprintf(
@ -2267,7 +2267,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function greaterThan($value, $limit, $message = null, string $propertyPath = null): bool
public static function greaterThan($value, $limit, $message = null, ?string $propertyPath = null): bool
{
if ($value <= $limit) {
$message = \sprintf(
@ -2291,7 +2291,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function greaterOrEqualThan($value, $limit, $message = null, string $propertyPath = null): bool
public static function greaterOrEqualThan($value, $limit, $message = null, ?string $propertyPath = null): bool
{
if ($value < $limit) {
$message = \sprintf(
@ -2317,7 +2317,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function between($value, $lowerLimit, $upperLimit, $message = null, string $propertyPath = null): bool
public static function between($value, $lowerLimit, $upperLimit, $message = null, ?string $propertyPath = null): bool
{
if ($lowerLimit > $value || $value > $upperLimit) {
$message = \sprintf(
@ -2344,7 +2344,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function betweenExclusive($value, $lowerLimit, $upperLimit, $message = null, string $propertyPath = null): bool
public static function betweenExclusive($value, $lowerLimit, $upperLimit, $message = null, ?string $propertyPath = null): bool
{
if ($lowerLimit >= $value || $value >= $upperLimit) {
$message = \sprintf(
@ -2368,7 +2368,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function extensionLoaded($value, $message = null, string $propertyPath = null): bool
public static function extensionLoaded($value, $message = null, ?string $propertyPath = null): bool
{
if (!\extension_loaded($value)) {
$message = \sprintf(
@ -2394,7 +2394,7 @@ class Assertion
*
* @see http://php.net/manual/function.date.php#refsect1-function.date-parameters
*/
public static function date($value, $format, $message = null, string $propertyPath = null): bool
public static function date($value, $format, $message = null, ?string $propertyPath = null): bool
{
static::string($value, $message, $propertyPath);
static::string($format, $message, $propertyPath);
@ -2422,7 +2422,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function objectOrClass($value, $message = null, string $propertyPath = null): bool
public static function objectOrClass($value, $message = null, ?string $propertyPath = null): bool
{
if (!\is_object($value)) {
static::classExists($value, $message, $propertyPath);
@ -2440,7 +2440,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function propertyExists($value, $property, $message = null, string $propertyPath = null): bool
public static function propertyExists($value, $property, $message = null, ?string $propertyPath = null): bool
{
static::objectOrClass($value);
@ -2465,7 +2465,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function propertiesExist($value, array $properties, $message = null, string $propertyPath = null): bool
public static function propertiesExist($value, array $properties, $message = null, ?string $propertyPath = null): bool
{
static::objectOrClass($value);
static::allString($properties, $message, $propertyPath);
@ -2500,7 +2500,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function version($version1, $operator, $version2, $message = null, string $propertyPath = null): bool
public static function version($version1, $operator, $version2, $message = null, ?string $propertyPath = null): bool
{
static::notEmpty($operator, 'versionCompare operator is required and cannot be empty.');
@ -2527,7 +2527,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function phpVersion($operator, $version, $message = null, string $propertyPath = null): bool
public static function phpVersion($operator, $version, $message = null, ?string $propertyPath = null): bool
{
static::defined('PHP_VERSION');
@ -2544,7 +2544,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function extensionVersion($extension, $operator, $version, $message = null, string $propertyPath = null): bool
public static function extensionVersion($extension, $operator, $version, $message = null, ?string $propertyPath = null): bool
{
static::extensionLoaded($extension, $message, $propertyPath);
@ -2564,7 +2564,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function isCallable($value, $message = null, string $propertyPath = null): bool
public static function isCallable($value, $message = null, ?string $propertyPath = null): bool
{
if (!\is_callable($value)) {
$message = \sprintf(
@ -2589,7 +2589,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function satisfy($value, $callback, $message = null, string $propertyPath = null): bool
public static function satisfy($value, $callback, $message = null, ?string $propertyPath = null): bool
{
static::isCallable($callback);
@ -2617,7 +2617,7 @@ class Assertion
*
* @see http://php.net/manual/filter.filters.flags.php
*/
public static function ip($value, $flag = null, $message = null, string $propertyPath = null): bool
public static function ip($value, $flag = null, $message = null, ?string $propertyPath = null): bool
{
static::string($value, $message, $propertyPath);
if ($flag === null) {
@ -2648,7 +2648,7 @@ class Assertion
*
* @see http://php.net/manual/filter.filters.flags.php
*/
public static function ipv4($value, $flag = null, $message = null, string $propertyPath = null): bool
public static function ipv4($value, $flag = null, $message = null, ?string $propertyPath = null): bool
{
static::ip($value, $flag | FILTER_FLAG_IPV4, static::generateMessage($message ?: 'Value "%s" was expected to be a valid IPv4 address.'), $propertyPath);
@ -2667,7 +2667,7 @@ class Assertion
*
* @see http://php.net/manual/filter.filters.flags.php
*/
public static function ipv6($value, $flag = null, $message = null, string $propertyPath = null): bool
public static function ipv6($value, $flag = null, $message = null, ?string $propertyPath = null): bool
{
static::ip($value, $flag | FILTER_FLAG_IPV6, static::generateMessage($message ?: 'Value "%s" was expected to be a valid IPv6 address.'), $propertyPath);
@ -2680,7 +2680,7 @@ class Assertion
* @param mixed $constant
* @param string|callable|null $message
*/
public static function defined($constant, $message = null, string $propertyPath = null): bool
public static function defined($constant, $message = null, ?string $propertyPath = null): bool
{
if (!\defined($constant)) {
$message = \sprintf(static::generateMessage($message ?: 'Value "%s" expected to be a defined constant.'), $constant);
@ -2699,7 +2699,7 @@ class Assertion
*
* @throws AssertionFailedException
*/
public static function base64($value, $message = null, string $propertyPath = null): bool
public static function base64($value, $message = null, ?string $propertyPath = null): bool
{
if (false === \base64_decode($value, true)) {
$message = \sprintf(static::generateMessage($message ?: 'Value "%s" is not a valid base64 string.'), $value);

View File

@ -151,7 +151,7 @@ class AssertionChain
* @param mixed $value
* @param string|callable|null $defaultMessage
*/
public function __construct($value, $defaultMessage = null, string $defaultPropertyPath = null)
public function __construct($value, $defaultMessage = null, ?string $defaultPropertyPath = null)
{
$this->value = $value;
$this->defaultMessage = $defaultMessage;

View File

@ -31,7 +31,7 @@ class InvalidArgumentException extends \InvalidArgumentException implements Asse
*/
private $constraints;
public function __construct($message, $code, string $propertyPath = null, $value = null, array $constraints = [])
public function __construct($message, $code, ?string $propertyPath = null, $value = null, array $constraints = [])
{
parent::__construct($message, $code);

View File

@ -133,7 +133,7 @@ class LazyAssertion
*
* @return static
*/
public function that($value, string $propertyPath = null, $defaultMessage = null)
public function that($value, ?string $propertyPath = null, $defaultMessage = null)
{
$this->currentChainFailed = false;
$this->thisChainTryAll = false;

View File

@ -32,7 +32,7 @@ namespace Assert;
* The assertion chain can be stateful, that means be careful when you reuse
* it. You should never pass around the chain.
*/
function that($value, $defaultMessage = null, string $defaultPropertyPath = null): AssertionChain
function that($value, $defaultMessage = null, ?string $defaultPropertyPath = null): AssertionChain
{
return Assert::that($value, $defaultMessage, $defaultPropertyPath);
}
@ -44,7 +44,7 @@ function that($value, $defaultMessage = null, string $defaultPropertyPath = null
* @param string|callable|null $defaultMessage
* @param string $defaultPropertyPath
*/
function thatAll($values, $defaultMessage = null, string $defaultPropertyPath = null): AssertionChain
function thatAll($values, $defaultMessage = null, ?string $defaultPropertyPath = null): AssertionChain
{
return Assert::thatAll($values, $defaultMessage, $defaultPropertyPath);
}
@ -58,7 +58,7 @@ function thatAll($values, $defaultMessage = null, string $defaultPropertyPath =
*
* @deprecated In favour of Assert::thatNullOr($value, $defaultMessage = null, $defaultPropertyPath = null)
*/
function thatNullOr($value, $defaultMessage = null, string $defaultPropertyPath = null): AssertionChain
function thatNullOr($value, $defaultMessage = null, ?string $defaultPropertyPath = null): AssertionChain
{
return Assert::thatNullOr($value, $defaultMessage, $defaultPropertyPath);
}

View File

@ -26,12 +26,23 @@ use Composer\Semver\VersionParser;
*/
class InstalledVersions
{
/**
* @var string|null if set (by reflection by Composer), this should be set to the path where this class is being copied to
* @internal
*/
private static $selfDir = null;
/**
* @var mixed[]|null
* @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null
*/
private static $installed;
/**
* @var bool
*/
private static $installedIsLocalDir;
/**
* @var bool|null
*/
@ -309,6 +320,24 @@ class InstalledVersions
{
self::$installed = $data;
self::$installedByVendor = array();
// when using reload, we disable the duplicate protection to ensure that self::$installed data is
// always returned, but we cannot know whether it comes from the installed.php in __DIR__ or not,
// so we have to assume it does not, and that may result in duplicate data being returned when listing
// all installed packages for example
self::$installedIsLocalDir = false;
}
/**
* @return string
*/
private static function getSelfDir()
{
if (self::$selfDir === null) {
self::$selfDir = strtr(__DIR__, '\\', '/');
}
return self::$selfDir;
}
/**
@ -322,19 +351,27 @@ class InstalledVersions
}
$installed = array();
$copiedLocalDir = false;
if (self::$canGetVendors) {
$selfDir = self::getSelfDir();
foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
$vendorDir = strtr($vendorDir, '\\', '/');
if (isset(self::$installedByVendor[$vendorDir])) {
$installed[] = self::$installedByVendor[$vendorDir];
} elseif (is_file($vendorDir.'/composer/installed.php')) {
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
$required = require $vendorDir.'/composer/installed.php';
$installed[] = self::$installedByVendor[$vendorDir] = $required;
if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
self::$installed = $installed[count($installed) - 1];
self::$installedByVendor[$vendorDir] = $required;
$installed[] = $required;
if (self::$installed === null && $vendorDir.'/composer' === $selfDir) {
self::$installed = $required;
self::$installedIsLocalDir = true;
}
}
if (self::$installedIsLocalDir && $vendorDir.'/composer' === $selfDir) {
$copiedLocalDir = true;
}
}
}
@ -350,7 +387,7 @@ class InstalledVersions
}
}
if (self::$installed !== array()) {
if (self::$installed !== array() && !$copiedLocalDir) {
$installed[] = self::$installed;
}

View File

@ -16,12 +16,12 @@ return array(
'Ramsey\\Uuid\\' => array($vendorDir . '/ramsey/uuid/src'),
'Ramsey\\Collection\\' => array($vendorDir . '/ramsey/collection/src'),
'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-message/src', $vendorDir . '/psr/http-factory/src'),
'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-factory/src', $vendorDir . '/psr/http-message/src'),
'Psr\\Http\\Client\\' => array($vendorDir . '/psr/http-client/src'),
'Nyholm\\Psr7\\' => array($vendorDir . '/nyholm/psr7/src'),
'Nyholm\\Psr7Server\\' => array($vendorDir . '/nyholm/psr7-server/src'),
'League\\Uri\\' => array($vendorDir . '/league/uri-interfaces/src', $vendorDir . '/league/uri/src'),
'Jose\\Component\\Signature\\Algorithm\\' => array($vendorDir . '/web-token/jwt-signature-algorithm-ecdsa', $vendorDir . '/web-token/jwt-signature-algorithm-eddsa', $vendorDir . '/web-token/jwt-signature-algorithm-rsa'),
'League\\Uri\\' => array($vendorDir . '/league/uri/src', $vendorDir . '/league/uri-interfaces/src'),
'Jose\\Component\\Signature\\Algorithm\\' => array($vendorDir . '/web-token/jwt-signature-algorithm-rsa', $vendorDir . '/web-token/jwt-signature-algorithm-eddsa', $vendorDir . '/web-token/jwt-signature-algorithm-ecdsa'),
'Jose\\Component\\Signature\\' => array($vendorDir . '/web-token/jwt-signature'),
'Jose\\Component\\KeyManagement\\' => array($vendorDir . '/web-token/jwt-key-mgmt'),
'Jose\\Component\\Core\\' => array($vendorDir . '/web-token/jwt-core'),

View File

@ -104,12 +104,12 @@ class ComposerStaticInite99fdfd0dbb5e609b534e430fe6b54ef
);
public static $prefixLengthsPsr4 = array (
'W' =>
'W' =>
array (
'Webauthn\\MetadataService\\' => 25,
'Webauthn\\' => 9,
),
'S' =>
'S' =>
array (
'Symfony\\Polyfill\\Php81\\' => 23,
'Symfony\\Polyfill\\Php80\\' => 23,
@ -117,157 +117,157 @@ class ComposerStaticInite99fdfd0dbb5e609b534e430fe6b54ef
'Symfony\\Component\\Process\\' => 26,
'Safe\\' => 5,
),
'R' =>
'R' =>
array (
'Ramsey\\Uuid\\' => 12,
'Ramsey\\Collection\\' => 18,
),
'P' =>
'P' =>
array (
'Psr\\Log\\' => 8,
'Psr\\Http\\Message\\' => 17,
'Psr\\Http\\Client\\' => 16,
),
'N' =>
'N' =>
array (
'Nyholm\\Psr7\\' => 12,
'Nyholm\\Psr7Server\\' => 18,
),
'L' =>
'L' =>
array (
'League\\Uri\\' => 11,
),
'J' =>
'J' =>
array (
'Jose\\Component\\Signature\\Algorithm\\' => 35,
'Jose\\Component\\Signature\\' => 25,
'Jose\\Component\\KeyManagement\\' => 29,
'Jose\\Component\\Core\\' => 20,
),
'F' =>
'F' =>
array (
'FG\\' => 3,
),
'C' =>
'C' =>
array (
'Cose\\' => 5,
'CBOR\\' => 5,
),
'B' =>
'B' =>
array (
'Brick\\Math\\' => 11,
'Base64Url\\' => 10,
),
'A' =>
'A' =>
array (
'Assert\\' => 7,
),
);
public static $prefixDirsPsr4 = array (
'Webauthn\\MetadataService\\' =>
'Webauthn\\MetadataService\\' =>
array (
0 => __DIR__ . '/..' . '/web-auth/metadata-service/src',
),
'Webauthn\\' =>
'Webauthn\\' =>
array (
0 => __DIR__ . '/..' . '/web-auth/webauthn-lib/src',
),
'Symfony\\Polyfill\\Php81\\' =>
'Symfony\\Polyfill\\Php81\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/polyfill-php81',
),
'Symfony\\Polyfill\\Php80\\' =>
'Symfony\\Polyfill\\Php80\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/polyfill-php80',
),
'Symfony\\Polyfill\\Ctype\\' =>
'Symfony\\Polyfill\\Ctype\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/polyfill-ctype',
),
'Symfony\\Component\\Process\\' =>
'Symfony\\Component\\Process\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/process',
),
'Safe\\' =>
'Safe\\' =>
array (
0 => __DIR__ . '/..' . '/thecodingmachine/safe/lib',
1 => __DIR__ . '/..' . '/thecodingmachine/safe/deprecated',
2 => __DIR__ . '/..' . '/thecodingmachine/safe/generated',
),
'Ramsey\\Uuid\\' =>
'Ramsey\\Uuid\\' =>
array (
0 => __DIR__ . '/..' . '/ramsey/uuid/src',
),
'Ramsey\\Collection\\' =>
'Ramsey\\Collection\\' =>
array (
0 => __DIR__ . '/..' . '/ramsey/collection/src',
),
'Psr\\Log\\' =>
'Psr\\Log\\' =>
array (
0 => __DIR__ . '/..' . '/psr/log/Psr/Log',
),
'Psr\\Http\\Message\\' =>
'Psr\\Http\\Message\\' =>
array (
0 => __DIR__ . '/..' . '/psr/http-message/src',
1 => __DIR__ . '/..' . '/psr/http-factory/src',
0 => __DIR__ . '/..' . '/psr/http-factory/src',
1 => __DIR__ . '/..' . '/psr/http-message/src',
),
'Psr\\Http\\Client\\' =>
'Psr\\Http\\Client\\' =>
array (
0 => __DIR__ . '/..' . '/psr/http-client/src',
),
'Nyholm\\Psr7\\' =>
'Nyholm\\Psr7\\' =>
array (
0 => __DIR__ . '/..' . '/nyholm/psr7/src',
),
'Nyholm\\Psr7Server\\' =>
'Nyholm\\Psr7Server\\' =>
array (
0 => __DIR__ . '/..' . '/nyholm/psr7-server/src',
),
'League\\Uri\\' =>
'League\\Uri\\' =>
array (
0 => __DIR__ . '/..' . '/league/uri-interfaces/src',
1 => __DIR__ . '/..' . '/league/uri/src',
0 => __DIR__ . '/..' . '/league/uri/src',
1 => __DIR__ . '/..' . '/league/uri-interfaces/src',
),
'Jose\\Component\\Signature\\Algorithm\\' =>
'Jose\\Component\\Signature\\Algorithm\\' =>
array (
0 => __DIR__ . '/..' . '/web-token/jwt-signature-algorithm-ecdsa',
0 => __DIR__ . '/..' . '/web-token/jwt-signature-algorithm-rsa',
1 => __DIR__ . '/..' . '/web-token/jwt-signature-algorithm-eddsa',
2 => __DIR__ . '/..' . '/web-token/jwt-signature-algorithm-rsa',
2 => __DIR__ . '/..' . '/web-token/jwt-signature-algorithm-ecdsa',
),
'Jose\\Component\\Signature\\' =>
'Jose\\Component\\Signature\\' =>
array (
0 => __DIR__ . '/..' . '/web-token/jwt-signature',
),
'Jose\\Component\\KeyManagement\\' =>
'Jose\\Component\\KeyManagement\\' =>
array (
0 => __DIR__ . '/..' . '/web-token/jwt-key-mgmt',
),
'Jose\\Component\\Core\\' =>
'Jose\\Component\\Core\\' =>
array (
0 => __DIR__ . '/..' . '/web-token/jwt-core',
),
'FG\\' =>
'FG\\' =>
array (
0 => __DIR__ . '/..' . '/fgrosse/phpasn1/lib',
),
'Cose\\' =>
'Cose\\' =>
array (
0 => __DIR__ . '/..' . '/web-auth/cose-lib/src',
),
'CBOR\\' =>
'CBOR\\' =>
array (
0 => __DIR__ . '/..' . '/spomky-labs/cbor-php/src',
),
'Brick\\Math\\' =>
'Brick\\Math\\' =>
array (
0 => __DIR__ . '/..' . '/brick/math/src',
),
'Base64Url\\' =>
'Base64Url\\' =>
array (
0 => __DIR__ . '/..' . '/spomky-labs/base64url/src',
),
'Assert\\' =>
'Assert\\' =>
array (
0 => __DIR__ . '/..' . '/beberlei/assert/lib/Assert',
),

View File

@ -2,17 +2,17 @@
"packages": [
{
"name": "beberlei/assert",
"version": "v3.3.2",
"version_normalized": "3.3.2.0",
"version": "v3.3.3",
"version_normalized": "3.3.3.0",
"source": {
"type": "git",
"url": "https://github.com/beberlei/assert.git",
"reference": "cb70015c04be1baee6f5f5c953703347c0ac1655"
"reference": "b5fd8eacd8915a1b627b8bfc027803f1939734dd"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/beberlei/assert/zipball/cb70015c04be1baee6f5f5c953703347c0ac1655",
"reference": "cb70015c04be1baee6f5f5c953703347c0ac1655",
"url": "https://api.github.com/repos/beberlei/assert/zipball/b5fd8eacd8915a1b627b8bfc027803f1939734dd",
"reference": "b5fd8eacd8915a1b627b8bfc027803f1939734dd",
"shasum": "",
"mirrors": [
{
@ -26,7 +26,7 @@
"ext-json": "*",
"ext-mbstring": "*",
"ext-simplexml": "*",
"php": "^7.0 || ^8.0"
"php": "^7.1 || ^8.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "*",
@ -37,7 +37,7 @@
"suggest": {
"ext-intl": "Needed to allow Assertion::count(), Assertion::isCountable(), Assertion::minCount(), and Assertion::maxCount() to operate on ResourceBundles"
},
"time": "2021-12-16T21:41:27+00:00",
"time": "2024-07-15T13:18:35+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@ -72,7 +72,7 @@
],
"support": {
"issues": "https://github.com/beberlei/assert/issues",
"source": "https://github.com/beberlei/assert/tree/v3.3.2"
"source": "https://github.com/beberlei/assert/tree/v3.3.3"
},
"install-path": "../beberlei/assert"
},
@ -991,11 +991,11 @@
"time": "2021-09-25T23:10:38+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "4.x-dev"
},
"captainhook": {
"force-install": true
},
"branch-alias": {
"dev-main": "4.x-dev"
}
},
"installation-source": "dist",
@ -1198,8 +1198,8 @@
},
{
"name": "symfony/polyfill-ctype",
"version": "v1.31.0",
"version_normalized": "1.31.0.0",
"version": "v1.32.0",
"version_normalized": "1.32.0.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
@ -1230,8 +1230,8 @@
"type": "library",
"extra": {
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
"url": "https://github.com/symfony/polyfill",
"name": "symfony/polyfill"
}
},
"installation-source": "dist",
@ -1266,7 +1266,7 @@
"portable"
],
"support": {
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.31.0"
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.32.0"
},
"funding": [
{
@ -1286,17 +1286,17 @@
},
{
"name": "symfony/polyfill-php80",
"version": "v1.31.0",
"version_normalized": "1.31.0.0",
"version": "v1.33.0",
"version_normalized": "1.33.0.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php80.git",
"reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8"
"reference": "0cc9dd0f17f61d8131e7df6b84bd344899fe2608"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/60328e362d4c2c802a54fcbf04f9d3fb892b4cf8",
"reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8",
"url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/0cc9dd0f17f61d8131e7df6b84bd344899fe2608",
"reference": "0cc9dd0f17f61d8131e7df6b84bd344899fe2608",
"shasum": "",
"mirrors": [
{
@ -1308,12 +1308,12 @@
"require": {
"php": ">=7.2"
},
"time": "2024-09-09T11:45:10+00:00",
"time": "2025-01-02T08:10:11+00:00",
"type": "library",
"extra": {
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
"url": "https://github.com/symfony/polyfill",
"name": "symfony/polyfill"
}
},
"installation-source": "dist",
@ -1355,7 +1355,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-php80/tree/v1.31.0"
"source": "https://github.com/symfony/polyfill-php80/tree/v1.33.0"
},
"funding": [
{
@ -1366,6 +1366,10 @@
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://github.com/nicolas-grekas",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
@ -1375,17 +1379,17 @@
},
{
"name": "symfony/polyfill-php81",
"version": "v1.30.0",
"version_normalized": "1.30.0.0",
"version": "v1.32.0",
"version_normalized": "1.32.0.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php81.git",
"reference": "3fb075789fb91f9ad9af537c4012d523085bd5af"
"reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/3fb075789fb91f9ad9af537c4012d523085bd5af",
"reference": "3fb075789fb91f9ad9af537c4012d523085bd5af",
"url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c",
"reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c",
"shasum": "",
"mirrors": [
{
@ -1395,14 +1399,14 @@
]
},
"require": {
"php": ">=7.1"
"php": ">=7.2"
},
"time": "2024-06-19T12:30:46+00:00",
"time": "2024-09-09T11:45:10+00:00",
"type": "library",
"extra": {
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
"url": "https://github.com/symfony/polyfill",
"name": "symfony/polyfill"
}
},
"installation-source": "dist",
@ -1440,7 +1444,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-php81/tree/v1.30.0"
"source": "https://github.com/symfony/polyfill-php81/tree/v1.32.0"
},
"funding": [
{
@ -1460,17 +1464,17 @@
},
{
"name": "symfony/process",
"version": "v5.4.40",
"version_normalized": "5.4.40.0",
"version": "v5.4.47",
"version_normalized": "5.4.47.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/process.git",
"reference": "deedcb3bb4669cae2148bc920eafd2b16dc7c046"
"reference": "5d1662fb32ebc94f17ddb8d635454a776066733d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/process/zipball/deedcb3bb4669cae2148bc920eafd2b16dc7c046",
"reference": "deedcb3bb4669cae2148bc920eafd2b16dc7c046",
"url": "https://api.github.com/repos/symfony/process/zipball/5d1662fb32ebc94f17ddb8d635454a776066733d",
"reference": "5d1662fb32ebc94f17ddb8d635454a776066733d",
"shasum": "",
"mirrors": [
{
@ -1483,7 +1487,7 @@
"php": ">=7.2.5",
"symfony/polyfill-php80": "^1.16"
},
"time": "2024-05-31T14:33:22+00:00",
"time": "2024-11-06T11:36:42+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@ -1511,7 +1515,7 @@
"description": "Executes commands in sub-processes",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/process/tree/v5.4.40"
"source": "https://github.com/symfony/process/tree/v5.4.47"
},
"funding": [
{

View File

@ -1,9 +1,9 @@
<?php return array(
'root' => array(
'name' => '__root__',
'pretty_version' => '1.3.4',
'version' => '1.3.4.0',
'reference' => '88207a7a7032f209d572a80f06699769886cdeb3',
'pretty_version' => '1.4.1',
'version' => '1.4.1.0',
'reference' => '01964b4933ae48870823ca1620868423cfd4bf2b',
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
@ -11,18 +11,18 @@
),
'versions' => array(
'__root__' => array(
'pretty_version' => '1.3.4',
'version' => '1.3.4.0',
'reference' => '88207a7a7032f209d572a80f06699769886cdeb3',
'pretty_version' => '1.4.1',
'version' => '1.4.1.0',
'reference' => '01964b4933ae48870823ca1620868423cfd4bf2b',
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'dev_requirement' => false,
),
'beberlei/assert' => array(
'pretty_version' => 'v3.3.2',
'version' => '3.3.2.0',
'reference' => 'cb70015c04be1baee6f5f5c953703347c0ac1655',
'pretty_version' => 'v3.3.3',
'version' => '3.3.3.0',
'reference' => 'b5fd8eacd8915a1b627b8bfc027803f1939734dd',
'type' => 'library',
'install_path' => __DIR__ . '/../beberlei/assert',
'aliases' => array(),
@ -179,8 +179,8 @@
'dev_requirement' => false,
),
'symfony/polyfill-ctype' => array(
'pretty_version' => 'v1.31.0',
'version' => '1.31.0.0',
'pretty_version' => 'v1.32.0',
'version' => '1.32.0.0',
'reference' => 'a3cc8b044a6ea513310cbd48ef7333b384945638',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-ctype',
@ -188,27 +188,27 @@
'dev_requirement' => false,
),
'symfony/polyfill-php80' => array(
'pretty_version' => 'v1.31.0',
'version' => '1.31.0.0',
'reference' => '60328e362d4c2c802a54fcbf04f9d3fb892b4cf8',
'pretty_version' => 'v1.33.0',
'version' => '1.33.0.0',
'reference' => '0cc9dd0f17f61d8131e7df6b84bd344899fe2608',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-php80',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/polyfill-php81' => array(
'pretty_version' => 'v1.30.0',
'version' => '1.30.0.0',
'reference' => '3fb075789fb91f9ad9af537c4012d523085bd5af',
'pretty_version' => 'v1.32.0',
'version' => '1.32.0.0',
'reference' => '4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-php81',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/process' => array(
'pretty_version' => 'v5.4.40',
'version' => '5.4.40.0',
'reference' => 'deedcb3bb4669cae2148bc920eafd2b16dc7c046',
'pretty_version' => 'v5.4.47',
'version' => '5.4.47.0',
'reference' => '5d1662fb32ebc94f17ddb8d635454a776066733d',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/process',
'aliases' => array(),

View File

@ -29,7 +29,7 @@ class PhpToken implements \Stringable
public $text;
/**
* @var int
* @var -1|positive-int
*/
public $line;
@ -38,6 +38,9 @@ class PhpToken implements \Stringable
*/
public $pos;
/**
* @param -1|positive-int $line
*/
public function __construct(int $id, string $text, int $line = -1, int $position = -1)
{
$this->id = $id;
@ -80,7 +83,7 @@ class PhpToken implements \Stringable
}
/**
* @return static[]
* @return list<static>
*/
public static function tokenize(string $code, int $flags = 0): array
{

View File

@ -16,7 +16,7 @@
}
],
"require": {
"php": ">=7.1"
"php": ">=7.2"
},
"autoload": {
"psr-4": { "Symfony\\Polyfill\\Php81\\": "" },

View File

@ -19,7 +19,15 @@ namespace Symfony\Component\Process;
*/
class ExecutableFinder
{
private $suffixes = ['.exe', '.bat', '.cmd', '.com'];
private const CMD_BUILTINS = [
'assoc', 'break', 'call', 'cd', 'chdir', 'cls', 'color', 'copy', 'date',
'del', 'dir', 'echo', 'endlocal', 'erase', 'exit', 'for', 'ftype', 'goto',
'help', 'if', 'label', 'md', 'mkdir', 'mklink', 'move', 'path', 'pause',
'popd', 'prompt', 'pushd', 'rd', 'rem', 'ren', 'rename', 'rmdir', 'set',
'setlocal', 'shift', 'start', 'time', 'title', 'type', 'ver', 'vol',
];
private $suffixes = [];
/**
* Replaces default suffixes of executable.
@ -48,39 +56,48 @@ class ExecutableFinder
*/
public function find(string $name, ?string $default = null, array $extraDirs = [])
{
if (\ini_get('open_basedir')) {
$searchPath = array_merge(explode(\PATH_SEPARATOR, \ini_get('open_basedir')), $extraDirs);
$dirs = [];
foreach ($searchPath as $path) {
// Silencing against https://bugs.php.net/69240
if (@is_dir($path)) {
$dirs[] = $path;
} else {
if (basename($path) == $name && @is_executable($path)) {
return $path;
}
}
}
} else {
$dirs = array_merge(
explode(\PATH_SEPARATOR, getenv('PATH') ?: getenv('Path')),
$extraDirs
);
// windows built-in commands that are present in cmd.exe should not be resolved using PATH as they do not exist as exes
if ('\\' === \DIRECTORY_SEPARATOR && \in_array(strtolower($name), self::CMD_BUILTINS, true)) {
return $name;
}
$suffixes = [''];
$dirs = array_merge(
explode(\PATH_SEPARATOR, getenv('PATH') ?: getenv('Path')),
$extraDirs
);
$suffixes = [];
if ('\\' === \DIRECTORY_SEPARATOR) {
$pathExt = getenv('PATHEXT');
$suffixes = array_merge($pathExt ? explode(\PATH_SEPARATOR, $pathExt) : $this->suffixes, $suffixes);
$suffixes = $this->suffixes;
$suffixes = array_merge($suffixes, $pathExt ? explode(\PATH_SEPARATOR, $pathExt) : ['.exe', '.bat', '.cmd', '.com']);
}
$suffixes = '' !== pathinfo($name, PATHINFO_EXTENSION) ? array_merge([''], $suffixes) : array_merge($suffixes, ['']);
foreach ($suffixes as $suffix) {
foreach ($dirs as $dir) {
if ('' === $dir) {
$dir = '.';
}
if (@is_file($file = $dir.\DIRECTORY_SEPARATOR.$name.$suffix) && ('\\' === \DIRECTORY_SEPARATOR || @is_executable($file))) {
return $file;
}
if (!@is_dir($dir) && basename($dir) === $name.$suffix && @is_executable($dir)) {
return $dir;
}
}
}
if ('\\' === \DIRECTORY_SEPARATOR || !\function_exists('exec') || \strlen($name) !== strcspn($name, '/'.\DIRECTORY_SEPARATOR)) {
return $default;
}
$execResult = exec('command -v -- '.escapeshellarg($name));
if (($executablePath = substr($execResult, 0, strpos($execResult, \PHP_EOL) ?: null)) && @is_executable($executablePath)) {
return $executablePath;
}
return $default;
}
}

View File

@ -34,15 +34,8 @@ class PhpExecutableFinder
public function find(bool $includeArgs = true)
{
if ($php = getenv('PHP_BINARY')) {
if (!is_executable($php)) {
$command = '\\' === \DIRECTORY_SEPARATOR ? 'where' : 'command -v --';
if ($php = strtok(exec($command.' '.escapeshellarg($php)), \PHP_EOL)) {
if (!is_executable($php)) {
return false;
}
} else {
return false;
}
if (!is_executable($php) && !$php = $this->executableFinder->find($php)) {
return false;
}
if (@is_dir($php)) {

View File

@ -352,7 +352,7 @@ class Process implements \IteratorAggregate
$this->process = @proc_open($commandline, $descriptors, $this->processPipes->pipes, $this->cwd, $envPairs, $this->options);
if (!\is_resource($this->process)) {
if (!$this->process) {
throw new RuntimeException('Unable to launch a new process.');
}
$this->status = self::STATUS_STARTED;
@ -1456,8 +1456,9 @@ class Process implements \IteratorAggregate
private function close(): int
{
$this->processPipes->close();
if (\is_resource($this->process)) {
if ($this->process) {
proc_close($this->process);
$this->process = null;
}
$this->exitcode = $this->processInformation['exitcode'];
$this->status = self::STATUS_TERMINATED;
@ -1591,7 +1592,14 @@ class Process implements \IteratorAggregate
$cmd
);
$cmd = 'cmd /V:ON /E:ON /D /C ('.str_replace("\n", ' ', $cmd).')';
static $comSpec;
if (!$comSpec && $comSpec = (new ExecutableFinder())->find('cmd.exe')) {
// Escape according to CommandLineToArgvW rules
$comSpec = '"'.preg_replace('{(\\\\*+)"}', '$1$1\"', $comSpec) .'"';
}
$cmd = ($comSpec ?? 'cmd').' /V:ON /E:ON /D /C ('.str_replace("\n", ' ', $cmd).')';
foreach ($this->processPipes->getFiles() as $offset => $filename) {
$cmd .= ' '.$offset.'>"'.$filename.'"';
}
@ -1637,7 +1645,7 @@ class Process implements \IteratorAggregate
if (str_contains($argument, "\0")) {
$argument = str_replace("\0", '?', $argument);
}
if (!preg_match('/[\/()%!^"<>&|\s]/', $argument)) {
if (!preg_match('/[()%!^"<>&|\s]/', $argument)) {
return $argument;
}
$argument = preg_replace('/(\\\\+)$/', '$1$1', $argument);