N°5122 - Update libs to new PHP requirements

This commit is contained in:
Molkobain
2022-08-08 14:10:26 +02:00
parent 30021d9236
commit 57c36d0e51
585 changed files with 62279 additions and 20427 deletions

View File

@@ -4,16 +4,15 @@
/**
* Proxy PHP file generated by Composer
*
* This file includes the referenced bin path (../laminas/laminas-servicemanager/bin/generate-deps-for-config-factory)
* using a stream wrapper to prevent the shebang from being output on PHP<8
* This file includes the referenced bin path (../laminas/laminas-servicemanager/bin/generate-deps-for-config-factory) using ob_start to remove the shebang if present
* to prevent the shebang from being output on PHP<8
*
* @generated
*/
namespace Composer;
$GLOBALS['_composer_bin_dir'] = __DIR__;
$GLOBALS['_composer_autoload_path'] = __DIR__ . '/..'.'/autoload.php';
$binPath = __DIR__ . "/" . '../laminas/laminas-servicemanager/bin/generate-deps-for-config-factory';
if (PHP_VERSION_ID < 80000) {
if (!class_exists('Composer\BinProxyWrapper')) {
@@ -24,17 +23,18 @@ if (PHP_VERSION_ID < 80000) {
{
private $handle;
private $position;
private $realpath;
public function stream_open($path, $mode, $options, &$opened_path)
{
// get rid of phpvfscomposer:// prefix for __FILE__ & __DIR__ resolution
$opened_path = substr($path, 17);
$this->realpath = realpath($opened_path) ?: $opened_path;
$opened_path = $this->realpath;
$this->handle = fopen($this->realpath, $mode);
// get rid of composer-bin-proxy:// prefix for __FILE__ & __DIR__ resolution
$opened_path = substr($path, 21);
$opened_path = realpath($opened_path) ?: $opened_path;
$this->handle = fopen($opened_path, $mode);
$this->position = 0;
// remove all traces of this stream wrapper once it has been used
stream_wrapper_unregister('composer-bin-proxy');
return (bool) $this->handle;
}
@@ -66,16 +66,6 @@ if (PHP_VERSION_ID < 80000) {
return $operation ? flock($this->handle, $operation) : true;
}
public function stream_seek($offset, $whence)
{
if (0 === fseek($this->handle, $offset, $whence)) {
$this->position = ftell($this->handle);
return true;
}
return false;
}
public function stream_tell()
{
return $this->position;
@@ -88,30 +78,20 @@ if (PHP_VERSION_ID < 80000) {
public function stream_stat()
{
return array();
return fstat($this->handle);
}
public function stream_set_option($option, $arg1, $arg2)
{
return true;
}
public function url_stat($path, $flags)
{
$path = substr($path, 17);
if (file_exists($path)) {
return stat($path);
}
return false;
}
}
}
if (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper')) {
include("phpvfscomposer://" . __DIR__ . '/..'.'/laminas/laminas-servicemanager/bin/generate-deps-for-config-factory');
if (function_exists('stream_wrapper_register') && stream_wrapper_register('composer-bin-proxy', 'Composer\BinProxyWrapper')) {
include("composer-bin-proxy://" . $binPath);
exit(0);
}
}
include __DIR__ . '/..'.'/laminas/laminas-servicemanager/bin/generate-deps-for-config-factory';
include $binPath;

View File

@@ -1,5 +1,4 @@
@ECHO OFF
setlocal DISABLEDELAYEDEXPANSION
SET BIN_TARGET=%~dp0/generate-deps-for-config-factory
SET COMPOSER_RUNTIME_BIN_DIR=%~dp0
SET BIN_TARGET=%~dp0/../laminas/laminas-servicemanager/bin/generate-deps-for-config-factory
php "%BIN_TARGET%" %*

View File

@@ -4,16 +4,15 @@
/**
* Proxy PHP file generated by Composer
*
* This file includes the referenced bin path (../laminas/laminas-servicemanager/bin/generate-factory-for-class)
* using a stream wrapper to prevent the shebang from being output on PHP<8
* This file includes the referenced bin path (../laminas/laminas-servicemanager/bin/generate-factory-for-class) using ob_start to remove the shebang if present
* to prevent the shebang from being output on PHP<8
*
* @generated
*/
namespace Composer;
$GLOBALS['_composer_bin_dir'] = __DIR__;
$GLOBALS['_composer_autoload_path'] = __DIR__ . '/..'.'/autoload.php';
$binPath = __DIR__ . "/" . '../laminas/laminas-servicemanager/bin/generate-factory-for-class';
if (PHP_VERSION_ID < 80000) {
if (!class_exists('Composer\BinProxyWrapper')) {
@@ -24,17 +23,18 @@ if (PHP_VERSION_ID < 80000) {
{
private $handle;
private $position;
private $realpath;
public function stream_open($path, $mode, $options, &$opened_path)
{
// get rid of phpvfscomposer:// prefix for __FILE__ & __DIR__ resolution
$opened_path = substr($path, 17);
$this->realpath = realpath($opened_path) ?: $opened_path;
$opened_path = $this->realpath;
$this->handle = fopen($this->realpath, $mode);
// get rid of composer-bin-proxy:// prefix for __FILE__ & __DIR__ resolution
$opened_path = substr($path, 21);
$opened_path = realpath($opened_path) ?: $opened_path;
$this->handle = fopen($opened_path, $mode);
$this->position = 0;
// remove all traces of this stream wrapper once it has been used
stream_wrapper_unregister('composer-bin-proxy');
return (bool) $this->handle;
}
@@ -66,16 +66,6 @@ if (PHP_VERSION_ID < 80000) {
return $operation ? flock($this->handle, $operation) : true;
}
public function stream_seek($offset, $whence)
{
if (0 === fseek($this->handle, $offset, $whence)) {
$this->position = ftell($this->handle);
return true;
}
return false;
}
public function stream_tell()
{
return $this->position;
@@ -88,30 +78,20 @@ if (PHP_VERSION_ID < 80000) {
public function stream_stat()
{
return array();
return fstat($this->handle);
}
public function stream_set_option($option, $arg1, $arg2)
{
return true;
}
public function url_stat($path, $flags)
{
$path = substr($path, 17);
if (file_exists($path)) {
return stat($path);
}
return false;
}
}
}
if (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper')) {
include("phpvfscomposer://" . __DIR__ . '/..'.'/laminas/laminas-servicemanager/bin/generate-factory-for-class');
if (function_exists('stream_wrapper_register') && stream_wrapper_register('composer-bin-proxy', 'Composer\BinProxyWrapper')) {
include("composer-bin-proxy://" . $binPath);
exit(0);
}
}
include __DIR__ . '/..'.'/laminas/laminas-servicemanager/bin/generate-factory-for-class';
include $binPath;

View File

@@ -1,5 +1,4 @@
@ECHO OFF
setlocal DISABLEDELAYEDEXPANSION
SET BIN_TARGET=%~dp0/generate-factory-for-class
SET COMPOSER_RUNTIME_BIN_DIR=%~dp0
SET BIN_TARGET=%~dp0/../laminas/laminas-servicemanager/bin/generate-factory-for-class
php "%BIN_TARGET%" %*

View File

@@ -4,16 +4,15 @@
/**
* Proxy PHP file generated by Composer
*
* This file includes the referenced bin path (../scssphp/scssphp/bin/pscss)
* using a stream wrapper to prevent the shebang from being output on PHP<8
* This file includes the referenced bin path (../scssphp/scssphp/bin/pscss) using ob_start to remove the shebang if present
* to prevent the shebang from being output on PHP<8
*
* @generated
*/
namespace Composer;
$GLOBALS['_composer_bin_dir'] = __DIR__;
$GLOBALS['_composer_autoload_path'] = __DIR__ . '/..'.'/autoload.php';
$binPath = __DIR__ . "/" . '../scssphp/scssphp/bin/pscss';
if (PHP_VERSION_ID < 80000) {
if (!class_exists('Composer\BinProxyWrapper')) {
@@ -24,17 +23,18 @@ if (PHP_VERSION_ID < 80000) {
{
private $handle;
private $position;
private $realpath;
public function stream_open($path, $mode, $options, &$opened_path)
{
// get rid of phpvfscomposer:// prefix for __FILE__ & __DIR__ resolution
$opened_path = substr($path, 17);
$this->realpath = realpath($opened_path) ?: $opened_path;
$opened_path = $this->realpath;
$this->handle = fopen($this->realpath, $mode);
// get rid of composer-bin-proxy:// prefix for __FILE__ & __DIR__ resolution
$opened_path = substr($path, 21);
$opened_path = realpath($opened_path) ?: $opened_path;
$this->handle = fopen($opened_path, $mode);
$this->position = 0;
// remove all traces of this stream wrapper once it has been used
stream_wrapper_unregister('composer-bin-proxy');
return (bool) $this->handle;
}
@@ -66,16 +66,6 @@ if (PHP_VERSION_ID < 80000) {
return $operation ? flock($this->handle, $operation) : true;
}
public function stream_seek($offset, $whence)
{
if (0 === fseek($this->handle, $offset, $whence)) {
$this->position = ftell($this->handle);
return true;
}
return false;
}
public function stream_tell()
{
return $this->position;
@@ -88,33 +78,20 @@ if (PHP_VERSION_ID < 80000) {
public function stream_stat()
{
return array();
return fstat($this->handle);
}
public function stream_set_option($option, $arg1, $arg2)
{
return true;
}
public function url_stat($path, $flags)
{
$path = substr($path, 17);
if (file_exists($path)) {
return stat($path);
}
return false;
}
}
}
if (
(function_exists('stream_get_wrappers') && in_array('phpvfscomposer', stream_get_wrappers(), true))
|| (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper'))
) {
include("phpvfscomposer://" . __DIR__ . '/..'.'/scssphp/scssphp/bin/pscss');
if (function_exists('stream_wrapper_register') && stream_wrapper_register('composer-bin-proxy', 'Composer\BinProxyWrapper')) {
include("composer-bin-proxy://" . $binPath);
exit(0);
}
}
include __DIR__ . '/..'.'/scssphp/scssphp/bin/pscss';
include $binPath;

View File

@@ -1,5 +1,4 @@
@ECHO OFF
setlocal DISABLEDELAYEDEXPANSION
SET BIN_TARGET=%~dp0/pscss
SET COMPOSER_RUNTIME_BIN_DIR=%~dp0
SET BIN_TARGET=%~dp0/../scssphp/scssphp/bin/pscss
php "%BIN_TARGET%" %*

View File

@@ -21,14 +21,12 @@ use Composer\Semver\VersionParser;
* See also https://getcomposer.org/doc/07-runtime.md#installed-versions
*
* To require its presence, you can require `composer-runtime-api ^2.0`
*
* @final
*/
class InstalledVersions
{
/**
* @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
* @psalm-var array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}|array{}|null
*/
private static $installed;
@@ -39,7 +37,7 @@ class InstalledVersions
/**
* @var array[]
* @psalm-var array<string, 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[]}>}>
* @psalm-var array<string, array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
*/
private static $installedByVendor = array();
@@ -243,7 +241,7 @@ class InstalledVersions
/**
* @return array
* @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}
* @psalm-return array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}
*/
public static function getRootPackage()
{
@@ -257,7 +255,7 @@ class InstalledVersions
*
* @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
* @return array[]
* @psalm-return 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[]}>}
* @psalm-return array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}
*/
public static function getRawData()
{
@@ -280,7 +278,7 @@ class InstalledVersions
* Returns the raw data of all installed.php which are currently loaded for custom implementations
*
* @return array[]
* @psalm-return list<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[]}>}>
* @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
*/
public static function getAllRawData()
{
@@ -303,7 +301,7 @@ class InstalledVersions
* @param array[] $data A vendor/composer/installed.php data set
* @return void
*
* @psalm-param 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[]}>} $data
* @psalm-param array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>} $data
*/
public static function reload($data)
{
@@ -313,7 +311,7 @@ class InstalledVersions
/**
* @return array[]
* @psalm-return list<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[]}>}>
* @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
*/
private static function getInstalled()
{

View File

@@ -543,8 +543,10 @@ return array(
'GuzzleHttp\\Psr7\\BufferStream' => $vendorDir . '/guzzlehttp/psr7/src/BufferStream.php',
'GuzzleHttp\\Psr7\\CachingStream' => $vendorDir . '/guzzlehttp/psr7/src/CachingStream.php',
'GuzzleHttp\\Psr7\\DroppingStream' => $vendorDir . '/guzzlehttp/psr7/src/DroppingStream.php',
'GuzzleHttp\\Psr7\\Exception\\MalformedUriException' => $vendorDir . '/guzzlehttp/psr7/src/Exception/MalformedUriException.php',
'GuzzleHttp\\Psr7\\FnStream' => $vendorDir . '/guzzlehttp/psr7/src/FnStream.php',
'GuzzleHttp\\Psr7\\Header' => $vendorDir . '/guzzlehttp/psr7/src/Header.php',
'GuzzleHttp\\Psr7\\HttpFactory' => $vendorDir . '/guzzlehttp/psr7/src/HttpFactory.php',
'GuzzleHttp\\Psr7\\InflateStream' => $vendorDir . '/guzzlehttp/psr7/src/InflateStream.php',
'GuzzleHttp\\Psr7\\LazyOpenStream' => $vendorDir . '/guzzlehttp/psr7/src/LazyOpenStream.php',
'GuzzleHttp\\Psr7\\LimitStream' => $vendorDir . '/guzzlehttp/psr7/src/LimitStream.php',
@@ -583,9 +585,6 @@ return array(
'InlineImage' => $baseDir . '/core/inlineimage.class.inc.php',
'InlineImageGC' => $baseDir . '/core/inlineimage.class.inc.php',
'InputOutputTask' => $baseDir . '/application/iotask.class.inc.php',
'Interop\\Container\\ContainerInterface' => $vendorDir . '/container-interop/container-interop/src/Interop/Container/ContainerInterface.php',
'Interop\\Container\\Exception\\ContainerException' => $vendorDir . '/container-interop/container-interop/src/Interop/Container/Exception/ContainerException.php',
'Interop\\Container\\Exception\\NotFoundException' => $vendorDir . '/container-interop/container-interop/src/Interop/Container/Exception/NotFoundException.php',
'IntervalExpression' => $baseDir . '/core/oql/expression.class.inc.php',
'IntervalOqlExpression' => $baseDir . '/core/oql/oqlquery.class.inc.php',
'Introspection' => $baseDir . '/core/introspection.class.inc.php',
@@ -694,6 +693,7 @@ return array(
'Laminas\\Mail\\Storage\\Message' => $vendorDir . '/laminas/laminas-mail/src/Storage/Message.php',
'Laminas\\Mail\\Storage\\Message\\File' => $vendorDir . '/laminas/laminas-mail/src/Storage/Message/File.php',
'Laminas\\Mail\\Storage\\Message\\MessageInterface' => $vendorDir . '/laminas/laminas-mail/src/Storage/Message/MessageInterface.php',
'Laminas\\Mail\\Storage\\ParamsNormalizer' => $vendorDir . '/laminas/laminas-mail/src/Storage/ParamsNormalizer.php',
'Laminas\\Mail\\Storage\\Part' => $vendorDir . '/laminas/laminas-mail/src/Storage/Part.php',
'Laminas\\Mail\\Storage\\Part\\Exception\\ExceptionInterface' => $vendorDir . '/laminas/laminas-mail/src/Storage/Part/Exception/ExceptionInterface.php',
'Laminas\\Mail\\Storage\\Part\\Exception\\InvalidArgumentException' => $vendorDir . '/laminas/laminas-mail/src/Storage/Part/Exception/InvalidArgumentException.php',
@@ -746,9 +746,9 @@ return array(
'Laminas\\ServiceManager\\Initializer\\InitializerInterface' => $vendorDir . '/laminas/laminas-servicemanager/src/Initializer/InitializerInterface.php',
'Laminas\\ServiceManager\\PluginManagerInterface' => $vendorDir . '/laminas/laminas-servicemanager/src/PluginManagerInterface.php',
'Laminas\\ServiceManager\\Proxy\\LazyServiceFactory' => $vendorDir . '/laminas/laminas-servicemanager/src/Proxy/LazyServiceFactory.php',
'Laminas\\ServiceManager\\PsrContainerDecorator' => $vendorDir . '/laminas/laminas-servicemanager/src/PsrContainerDecorator.php',
'Laminas\\ServiceManager\\ServiceLocatorInterface' => $vendorDir . '/laminas/laminas-servicemanager/src/ServiceLocatorInterface.php',
'Laminas\\ServiceManager\\ServiceManager' => $vendorDir . '/laminas/laminas-servicemanager/src/ServiceManager.php',
'Laminas\\ServiceManager\\Test\\CommonPluginManagerTrait' => $vendorDir . '/laminas/laminas-servicemanager/src/Test/CommonPluginManagerTrait.php',
'Laminas\\ServiceManager\\Tool\\ConfigDumper' => $vendorDir . '/laminas/laminas-servicemanager/src/Tool/ConfigDumper.php',
'Laminas\\ServiceManager\\Tool\\ConfigDumperCommand' => $vendorDir . '/laminas/laminas-servicemanager/src/Tool/ConfigDumperCommand.php',
'Laminas\\ServiceManager\\Tool\\FactoryCreator' => $vendorDir . '/laminas/laminas-servicemanager/src/Tool/FactoryCreator.php',
@@ -835,6 +835,7 @@ return array(
'Laminas\\Validator\\Barcode\\Upce' => $vendorDir . '/laminas/laminas-validator/src/Barcode/Upce.php',
'Laminas\\Validator\\Between' => $vendorDir . '/laminas/laminas-validator/src/Between.php',
'Laminas\\Validator\\Bitwise' => $vendorDir . '/laminas/laminas-validator/src/Bitwise.php',
'Laminas\\Validator\\BusinessIdentifierCode' => $vendorDir . '/laminas/laminas-validator/src/BusinessIdentifierCode.php',
'Laminas\\Validator\\Callback' => $vendorDir . '/laminas/laminas-validator/src/Callback.php',
'Laminas\\Validator\\ConfigProvider' => $vendorDir . '/laminas/laminas-validator/src/ConfigProvider.php',
'Laminas\\Validator\\CreditCard' => $vendorDir . '/laminas/laminas-validator/src/CreditCard.php',
@@ -909,11 +910,6 @@ return array(
'Laminas\\Validator\\ValidatorPluginManagerAwareInterface' => $vendorDir . '/laminas/laminas-validator/src/ValidatorPluginManagerAwareInterface.php',
'Laminas\\Validator\\ValidatorPluginManagerFactory' => $vendorDir . '/laminas/laminas-validator/src/ValidatorPluginManagerFactory.php',
'Laminas\\Validator\\ValidatorProviderInterface' => $vendorDir . '/laminas/laminas-validator/src/ValidatorProviderInterface.php',
'Laminas\\ZendFrameworkBridge\\Autoloader' => $vendorDir . '/laminas/laminas-zendframework-bridge/src/Autoloader.php',
'Laminas\\ZendFrameworkBridge\\ConfigPostProcessor' => $vendorDir . '/laminas/laminas-zendframework-bridge/src/ConfigPostProcessor.php',
'Laminas\\ZendFrameworkBridge\\Module' => $vendorDir . '/laminas/laminas-zendframework-bridge/src/Module.php',
'Laminas\\ZendFrameworkBridge\\Replacements' => $vendorDir . '/laminas/laminas-zendframework-bridge/src/Replacements.php',
'Laminas\\ZendFrameworkBridge\\RewriteRules' => $vendorDir . '/laminas/laminas-zendframework-bridge/src/RewriteRules.php',
'League\\OAuth2\\Client\\Exception\\HostedDomainException' => $vendorDir . '/league/oauth2-google/src/Exception/HostedDomainException.php',
'League\\OAuth2\\Client\\Grant\\AbstractGrant' => $vendorDir . '/league/oauth2-client/src/Grant/AbstractGrant.php',
'League\\OAuth2\\Client\\Grant\\AuthorizationCode' => $vendorDir . '/league/oauth2-client/src/Grant/AuthorizationCode.php',
@@ -1301,11 +1297,17 @@ return array(
'Psr\\Http\\Client\\NetworkExceptionInterface' => $vendorDir . '/psr/http-client/src/NetworkExceptionInterface.php',
'Psr\\Http\\Client\\RequestExceptionInterface' => $vendorDir . '/psr/http-client/src/RequestExceptionInterface.php',
'Psr\\Http\\Message\\MessageInterface' => $vendorDir . '/psr/http-message/src/MessageInterface.php',
'Psr\\Http\\Message\\RequestFactoryInterface' => $vendorDir . '/psr/http-factory/src/RequestFactoryInterface.php',
'Psr\\Http\\Message\\RequestInterface' => $vendorDir . '/psr/http-message/src/RequestInterface.php',
'Psr\\Http\\Message\\ResponseFactoryInterface' => $vendorDir . '/psr/http-factory/src/ResponseFactoryInterface.php',
'Psr\\Http\\Message\\ResponseInterface' => $vendorDir . '/psr/http-message/src/ResponseInterface.php',
'Psr\\Http\\Message\\ServerRequestFactoryInterface' => $vendorDir . '/psr/http-factory/src/ServerRequestFactoryInterface.php',
'Psr\\Http\\Message\\ServerRequestInterface' => $vendorDir . '/psr/http-message/src/ServerRequestInterface.php',
'Psr\\Http\\Message\\StreamFactoryInterface' => $vendorDir . '/psr/http-factory/src/StreamFactoryInterface.php',
'Psr\\Http\\Message\\StreamInterface' => $vendorDir . '/psr/http-message/src/StreamInterface.php',
'Psr\\Http\\Message\\UploadedFileFactoryInterface' => $vendorDir . '/psr/http-factory/src/UploadedFileFactoryInterface.php',
'Psr\\Http\\Message\\UploadedFileInterface' => $vendorDir . '/psr/http-message/src/UploadedFileInterface.php',
'Psr\\Http\\Message\\UriFactoryInterface' => $vendorDir . '/psr/http-factory/src/UriFactoryInterface.php',
'Psr\\Http\\Message\\UriInterface' => $vendorDir . '/psr/http-message/src/UriInterface.php',
'Psr\\Log\\AbstractLogger' => $vendorDir . '/psr/log/Psr/Log/AbstractLogger.php',
'Psr\\Log\\InvalidArgumentException' => $vendorDir . '/psr/log/Psr/Log/InvalidArgumentException.php',
@@ -1589,6 +1591,14 @@ return array(
'Symfony\\Bundle\\FrameworkBundle\\Secrets\\SodiumVault' => $vendorDir . '/symfony/framework-bundle/Secrets/SodiumVault.php',
'Symfony\\Bundle\\FrameworkBundle\\Session\\DeprecatedSessionFactory' => $vendorDir . '/symfony/framework-bundle/Session/DeprecatedSessionFactory.php',
'Symfony\\Bundle\\FrameworkBundle\\Session\\ServiceSessionFactory' => $vendorDir . '/symfony/framework-bundle/Session/ServiceSessionFactory.php',
'Symfony\\Bundle\\FrameworkBundle\\Test\\BrowserKitAssertionsTrait' => $vendorDir . '/symfony/framework-bundle/Test/BrowserKitAssertionsTrait.php',
'Symfony\\Bundle\\FrameworkBundle\\Test\\DomCrawlerAssertionsTrait' => $vendorDir . '/symfony/framework-bundle/Test/DomCrawlerAssertionsTrait.php',
'Symfony\\Bundle\\FrameworkBundle\\Test\\KernelTestCase' => $vendorDir . '/symfony/framework-bundle/Test/KernelTestCase.php',
'Symfony\\Bundle\\FrameworkBundle\\Test\\MailerAssertionsTrait' => $vendorDir . '/symfony/framework-bundle/Test/MailerAssertionsTrait.php',
'Symfony\\Bundle\\FrameworkBundle\\Test\\TestBrowserToken' => $vendorDir . '/symfony/framework-bundle/Test/TestBrowserToken.php',
'Symfony\\Bundle\\FrameworkBundle\\Test\\TestContainer' => $vendorDir . '/symfony/framework-bundle/Test/TestContainer.php',
'Symfony\\Bundle\\FrameworkBundle\\Test\\WebTestAssertionsTrait' => $vendorDir . '/symfony/framework-bundle/Test/WebTestAssertionsTrait.php',
'Symfony\\Bundle\\FrameworkBundle\\Test\\WebTestCase' => $vendorDir . '/symfony/framework-bundle/Test/WebTestCase.php',
'Symfony\\Bundle\\FrameworkBundle\\Translation\\Translator' => $vendorDir . '/symfony/framework-bundle/Translation/Translator.php',
'Symfony\\Bundle\\TwigBundle\\CacheWarmer\\TemplateCacheWarmer' => $vendorDir . '/symfony/twig-bundle/CacheWarmer/TemplateCacheWarmer.php',
'Symfony\\Bundle\\TwigBundle\\Command\\LintCommand' => $vendorDir . '/symfony/twig-bundle/Command/LintCommand.php',
@@ -2222,6 +2232,16 @@ return array(
'Symfony\\Component\\HttpFoundation\\Session\\Storage\\SessionStorageFactoryInterface' => $vendorDir . '/symfony/http-foundation/Session/Storage/SessionStorageFactoryInterface.php',
'Symfony\\Component\\HttpFoundation\\Session\\Storage\\SessionStorageInterface' => $vendorDir . '/symfony/http-foundation/Session/Storage/SessionStorageInterface.php',
'Symfony\\Component\\HttpFoundation\\StreamedResponse' => $vendorDir . '/symfony/http-foundation/StreamedResponse.php',
'Symfony\\Component\\HttpFoundation\\Test\\Constraint\\RequestAttributeValueSame' => $vendorDir . '/symfony/http-foundation/Test/Constraint/RequestAttributeValueSame.php',
'Symfony\\Component\\HttpFoundation\\Test\\Constraint\\ResponseCookieValueSame' => $vendorDir . '/symfony/http-foundation/Test/Constraint/ResponseCookieValueSame.php',
'Symfony\\Component\\HttpFoundation\\Test\\Constraint\\ResponseFormatSame' => $vendorDir . '/symfony/http-foundation/Test/Constraint/ResponseFormatSame.php',
'Symfony\\Component\\HttpFoundation\\Test\\Constraint\\ResponseHasCookie' => $vendorDir . '/symfony/http-foundation/Test/Constraint/ResponseHasCookie.php',
'Symfony\\Component\\HttpFoundation\\Test\\Constraint\\ResponseHasHeader' => $vendorDir . '/symfony/http-foundation/Test/Constraint/ResponseHasHeader.php',
'Symfony\\Component\\HttpFoundation\\Test\\Constraint\\ResponseHeaderSame' => $vendorDir . '/symfony/http-foundation/Test/Constraint/ResponseHeaderSame.php',
'Symfony\\Component\\HttpFoundation\\Test\\Constraint\\ResponseIsRedirected' => $vendorDir . '/symfony/http-foundation/Test/Constraint/ResponseIsRedirected.php',
'Symfony\\Component\\HttpFoundation\\Test\\Constraint\\ResponseIsSuccessful' => $vendorDir . '/symfony/http-foundation/Test/Constraint/ResponseIsSuccessful.php',
'Symfony\\Component\\HttpFoundation\\Test\\Constraint\\ResponseIsUnprocessable' => $vendorDir . '/symfony/http-foundation/Test/Constraint/ResponseIsUnprocessable.php',
'Symfony\\Component\\HttpFoundation\\Test\\Constraint\\ResponseStatusCodeSame' => $vendorDir . '/symfony/http-foundation/Test/Constraint/ResponseStatusCodeSame.php',
'Symfony\\Component\\HttpFoundation\\UrlHelper' => $vendorDir . '/symfony/http-foundation/UrlHelper.php',
'Symfony\\Component\\HttpKernel\\Attribute\\ArgumentInterface' => $vendorDir . '/symfony/http-kernel/Attribute/ArgumentInterface.php',
'Symfony\\Component\\HttpKernel\\Attribute\\AsController' => $vendorDir . '/symfony/http-kernel/Attribute/AsController.php',
@@ -2510,6 +2530,7 @@ return array(
'Symfony\\Component\\VarDumper\\Exception\\ThrowingCasterException' => $vendorDir . '/symfony/var-dumper/Exception/ThrowingCasterException.php',
'Symfony\\Component\\VarDumper\\Server\\Connection' => $vendorDir . '/symfony/var-dumper/Server/Connection.php',
'Symfony\\Component\\VarDumper\\Server\\DumpServer' => $vendorDir . '/symfony/var-dumper/Server/DumpServer.php',
'Symfony\\Component\\VarDumper\\Test\\VarDumperTestTrait' => $vendorDir . '/symfony/var-dumper/Test/VarDumperTestTrait.php',
'Symfony\\Component\\VarDumper\\VarDumper' => $vendorDir . '/symfony/var-dumper/VarDumper.php',
'Symfony\\Component\\VarExporter\\Exception\\ClassNotFoundException' => $vendorDir . '/symfony/var-exporter/Exception/ClassNotFoundException.php',
'Symfony\\Component\\VarExporter\\Exception\\ExceptionInterface' => $vendorDir . '/symfony/var-exporter/Exception/ExceptionInterface.php',
@@ -2553,8 +2574,13 @@ return array(
'Symfony\\Contracts\\Translation\\TranslatorTrait' => $vendorDir . '/symfony/translation-contracts/TranslatorTrait.php',
'Symfony\\Polyfill\\Ctype\\Ctype' => $vendorDir . '/symfony/polyfill-ctype/Ctype.php',
'Symfony\\Polyfill\\Intl\\Grapheme\\Grapheme' => $vendorDir . '/symfony/polyfill-intl-grapheme/Grapheme.php',
'Symfony\\Polyfill\\Intl\\Idn\\Idn' => $vendorDir . '/symfony/polyfill-intl-idn/Idn.php',
'Symfony\\Polyfill\\Intl\\Idn\\Info' => $vendorDir . '/symfony/polyfill-intl-idn/Info.php',
'Symfony\\Polyfill\\Intl\\Idn\\Resources\\unidata\\DisallowedRanges' => $vendorDir . '/symfony/polyfill-intl-idn/Resources/unidata/DisallowedRanges.php',
'Symfony\\Polyfill\\Intl\\Idn\\Resources\\unidata\\Regex' => $vendorDir . '/symfony/polyfill-intl-idn/Resources/unidata/Regex.php',
'Symfony\\Polyfill\\Intl\\Normalizer\\Normalizer' => $vendorDir . '/symfony/polyfill-intl-normalizer/Normalizer.php',
'Symfony\\Polyfill\\Mbstring\\Mbstring' => $vendorDir . '/symfony/polyfill-mbstring/Mbstring.php',
'Symfony\\Polyfill\\Php72\\Php72' => $vendorDir . '/symfony/polyfill-php72/Php72.php',
'Symfony\\Polyfill\\Php73\\Php73' => $vendorDir . '/symfony/polyfill-php73/Php73.php',
'Symfony\\Polyfill\\Php80\\Php80' => $vendorDir . '/symfony/polyfill-php80/Php80.php',
'Symfony\\Polyfill\\Php80\\PhpToken' => $vendorDir . '/symfony/polyfill-php80/PhpToken.php',
@@ -2596,10 +2622,6 @@ return array(
'TriggerOnStateEnter' => $baseDir . '/core/trigger.class.inc.php',
'TriggerOnStateLeave' => $baseDir . '/core/trigger.class.inc.php',
'TriggerOnThresholdReached' => $baseDir . '/core/trigger.class.inc.php',
'TrueBV\\Exception\\DomainOutOfBoundsException' => $vendorDir . '/true/punycode/src/Exception/DomainOutOfBoundsException.php',
'TrueBV\\Exception\\LabelOutOfBoundsException' => $vendorDir . '/true/punycode/src/Exception/LabelOutOfBoundsException.php',
'TrueBV\\Exception\\OutOfBoundsException' => $vendorDir . '/true/punycode/src/Exception/OutOfBoundsException.php',
'TrueBV\\Punycode' => $vendorDir . '/true/punycode/src/Punycode.php',
'TrueExpression' => $baseDir . '/core/oql/expression.class.inc.php',
'Twig\\Cache\\CacheInterface' => $vendorDir . '/twig/twig/src/Cache/CacheInterface.php',
'Twig\\Cache\\FilesystemCache' => $vendorDir . '/twig/twig/src/Cache/FilesystemCache.php',
@@ -2803,6 +2825,9 @@ return array(
'VariableOqlExpression' => $baseDir . '/core/oql/oqlquery.class.inc.php',
'WebPage' => $baseDir . '/sources/Application/WebPage/WebPage.php',
'WebPageMenuNode' => $baseDir . '/application/menunode.class.inc.php',
'Webmozart\\Assert\\Assert' => $vendorDir . '/webmozart/assert/src/Assert.php',
'Webmozart\\Assert\\InvalidArgumentException' => $vendorDir . '/webmozart/assert/src/InvalidArgumentException.php',
'Webmozart\\Assert\\Mixin' => $vendorDir . '/webmozart/assert/src/Mixin.php',
'WeeklyRotatingLogFileNameBuilder' => $baseDir . '/core/log.class.inc.php',
'WizardHelper' => $baseDir . '/application/wizardhelper.class.inc.php',
'XLSXWriter' => $baseDir . '/application/xlsxwriter.class.php',

View File

@@ -12,13 +12,14 @@ return array(
'320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php',
'0d59ee240a4cd96ddbb4ff164fccea4d' => $vendorDir . '/symfony/polyfill-php73/bootstrap.php',
'23c18046f52bef3eea034657bafda50f' => $vendorDir . '/symfony/polyfill-php81/bootstrap.php',
'7e9bd612cc444b3eed788ebbe46263a0' => $vendorDir . '/laminas/laminas-zendframework-bridge/src/autoload.php',
'667aeda72477189d0494fecd327c3641' => $vendorDir . '/symfony/var-dumper/Resources/functions/dump.php',
'8825ede83f2f289127722d4e842cf7e8' => $vendorDir . '/symfony/polyfill-intl-grapheme/bootstrap.php',
'e69f7f6ee287b969198c3c9d6777bd38' => $vendorDir . '/symfony/polyfill-intl-normalizer/bootstrap.php',
'b6b991a57620e2fb6b2f66f03fe9ddc2' => $vendorDir . '/symfony/string/Resources/functions.php',
'7b11c4dc42b3b3023073cb14e519683c' => $vendorDir . '/ralouphie/getallheaders/src/getallheaders.php',
'8825ede83f2f289127722d4e842cf7e8' => $vendorDir . '/symfony/polyfill-intl-grapheme/bootstrap.php',
'c9d07b32a2e02bc0fc582d4f0c1b56cc' => $vendorDir . '/laminas/laminas-servicemanager/src/autoload.php',
'c964ee0ededf28c96ebd9db5099ef910' => $vendorDir . '/guzzlehttp/promises/src/functions_include.php',
'a0edc8309cc5e1d60e3047b5df6b7052' => $vendorDir . '/guzzlehttp/psr7/src/functions_include.php',
'b6b991a57620e2fb6b2f66f03fe9ddc2' => $vendorDir . '/symfony/string/Resources/functions.php',
'37a3dc5111fe8f707ab4c132ef1dbc62' => $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php',
'25072dd6e2470089de65ae7bf11d3109' => $vendorDir . '/symfony/polyfill-php72/bootstrap.php',
'f598d06aa772fa33d905e87be6398fb1' => $vendorDir . '/symfony/polyfill-intl-idn/bootstrap.php',
);

View File

@@ -6,14 +6,16 @@ $vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'Webmozart\\Assert\\' => array($vendorDir . '/webmozart/assert/src'),
'Twig\\' => array($vendorDir . '/twig/twig/src'),
'TrueBV\\' => array($vendorDir . '/true/punycode/src'),
'TheNetworg\\OAuth2\\Client\\' => array($vendorDir . '/thenetworg/oauth2-azure/src'),
'Symfony\\Polyfill\\Php81\\' => array($vendorDir . '/symfony/polyfill-php81'),
'Symfony\\Polyfill\\Php80\\' => array($vendorDir . '/symfony/polyfill-php80'),
'Symfony\\Polyfill\\Php73\\' => array($vendorDir . '/symfony/polyfill-php73'),
'Symfony\\Polyfill\\Php72\\' => array($vendorDir . '/symfony/polyfill-php72'),
'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'),
'Symfony\\Polyfill\\Intl\\Normalizer\\' => array($vendorDir . '/symfony/polyfill-intl-normalizer'),
'Symfony\\Polyfill\\Intl\\Idn\\' => array($vendorDir . '/symfony/polyfill-intl-idn'),
'Symfony\\Polyfill\\Intl\\Grapheme\\' => array($vendorDir . '/symfony/polyfill-intl-grapheme'),
'Symfony\\Polyfill\\Ctype\\' => array($vendorDir . '/symfony/polyfill-ctype'),
'Symfony\\Contracts\\Translation\\' => array($vendorDir . '/symfony/translation-contracts'),
@@ -45,7 +47,7 @@ return array(
'ScssPhp\\ScssPhp\\' => array($vendorDir . '/scssphp/scssphp/src'),
'Sabberworm\\CSS\\' => array($vendorDir . '/sabberworm/php-css-parser/src'),
'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-message/src'),
'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-message/src', $vendorDir . '/psr/http-factory/src'),
'Psr\\Http\\Client\\' => array($vendorDir . '/psr/http-client/src'),
'Psr\\EventDispatcher\\' => array($vendorDir . '/psr/event-dispatcher/src'),
'Psr\\Container\\' => array($vendorDir . '/psr/container/src'),
@@ -53,14 +55,12 @@ return array(
'PhpParser\\' => array($vendorDir . '/nikic/php-parser/lib/PhpParser'),
'Pelago\\Emogrifier\\' => array($vendorDir . '/pelago/emogrifier/src'),
'League\\OAuth2\\Client\\' => array($vendorDir . '/league/oauth2-client/src', $vendorDir . '/league/oauth2-google/src'),
'Laminas\\ZendFrameworkBridge\\' => array($vendorDir . '/laminas/laminas-zendframework-bridge/src'),
'Laminas\\Validator\\' => array($vendorDir . '/laminas/laminas-validator/src'),
'Laminas\\Stdlib\\' => array($vendorDir . '/laminas/laminas-stdlib/src'),
'Laminas\\ServiceManager\\' => array($vendorDir . '/laminas/laminas-servicemanager/src'),
'Laminas\\Mime\\' => array($vendorDir . '/laminas/laminas-mime/src'),
'Laminas\\Mail\\' => array($vendorDir . '/laminas/laminas-mail/src'),
'Laminas\\Loader\\' => array($vendorDir . '/laminas/laminas-loader/src'),
'Interop\\Container\\' => array($vendorDir . '/container-interop/container-interop/src/Interop/Container'),
'GuzzleHttp\\Psr7\\' => array($vendorDir . '/guzzlehttp/psr7/src'),
'GuzzleHttp\\Promise\\' => array($vendorDir . '/guzzlehttp/promises/src'),
'GuzzleHttp\\' => array($vendorDir . '/guzzlehttp/guzzle/src'),

View File

@@ -13,22 +13,26 @@ class ComposerStaticInit7f81b4a2a468a061c306af5e447a9a9f
'320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
'0d59ee240a4cd96ddbb4ff164fccea4d' => __DIR__ . '/..' . '/symfony/polyfill-php73/bootstrap.php',
'23c18046f52bef3eea034657bafda50f' => __DIR__ . '/..' . '/symfony/polyfill-php81/bootstrap.php',
'7e9bd612cc444b3eed788ebbe46263a0' => __DIR__ . '/..' . '/laminas/laminas-zendframework-bridge/src/autoload.php',
'667aeda72477189d0494fecd327c3641' => __DIR__ . '/..' . '/symfony/var-dumper/Resources/functions/dump.php',
'8825ede83f2f289127722d4e842cf7e8' => __DIR__ . '/..' . '/symfony/polyfill-intl-grapheme/bootstrap.php',
'e69f7f6ee287b969198c3c9d6777bd38' => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer/bootstrap.php',
'b6b991a57620e2fb6b2f66f03fe9ddc2' => __DIR__ . '/..' . '/symfony/string/Resources/functions.php',
'7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php',
'8825ede83f2f289127722d4e842cf7e8' => __DIR__ . '/..' . '/symfony/polyfill-intl-grapheme/bootstrap.php',
'c9d07b32a2e02bc0fc582d4f0c1b56cc' => __DIR__ . '/..' . '/laminas/laminas-servicemanager/src/autoload.php',
'c964ee0ededf28c96ebd9db5099ef910' => __DIR__ . '/..' . '/guzzlehttp/promises/src/functions_include.php',
'a0edc8309cc5e1d60e3047b5df6b7052' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/functions_include.php',
'b6b991a57620e2fb6b2f66f03fe9ddc2' => __DIR__ . '/..' . '/symfony/string/Resources/functions.php',
'37a3dc5111fe8f707ab4c132ef1dbc62' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/functions_include.php',
'25072dd6e2470089de65ae7bf11d3109' => __DIR__ . '/..' . '/symfony/polyfill-php72/bootstrap.php',
'f598d06aa772fa33d905e87be6398fb1' => __DIR__ . '/..' . '/symfony/polyfill-intl-idn/bootstrap.php',
);
public static $prefixLengthsPsr4 = array (
'W' =>
array (
'Webmozart\\Assert\\' => 17,
),
'T' =>
array (
'Twig\\' => 5,
'TrueBV\\' => 7,
'TheNetworg\\OAuth2\\Client\\' => 25,
),
'S' =>
@@ -36,8 +40,10 @@ class ComposerStaticInit7f81b4a2a468a061c306af5e447a9a9f
'Symfony\\Polyfill\\Php81\\' => 23,
'Symfony\\Polyfill\\Php80\\' => 23,
'Symfony\\Polyfill\\Php73\\' => 23,
'Symfony\\Polyfill\\Php72\\' => 23,
'Symfony\\Polyfill\\Mbstring\\' => 26,
'Symfony\\Polyfill\\Intl\\Normalizer\\' => 33,
'Symfony\\Polyfill\\Intl\\Idn\\' => 26,
'Symfony\\Polyfill\\Intl\\Grapheme\\' => 31,
'Symfony\\Polyfill\\Ctype\\' => 23,
'Symfony\\Contracts\\Translation\\' => 30,
@@ -83,7 +89,6 @@ class ComposerStaticInit7f81b4a2a468a061c306af5e447a9a9f
'L' =>
array (
'League\\OAuth2\\Client\\' => 21,
'Laminas\\ZendFrameworkBridge\\' => 28,
'Laminas\\Validator\\' => 18,
'Laminas\\Stdlib\\' => 15,
'Laminas\\ServiceManager\\' => 23,
@@ -91,10 +96,6 @@ class ComposerStaticInit7f81b4a2a468a061c306af5e447a9a9f
'Laminas\\Mail\\' => 13,
'Laminas\\Loader\\' => 15,
),
'I' =>
array (
'Interop\\Container\\' => 18,
),
'G' =>
array (
'GuzzleHttp\\Psr7\\' => 16,
@@ -108,14 +109,14 @@ class ComposerStaticInit7f81b4a2a468a061c306af5e447a9a9f
);
public static $prefixDirsPsr4 = array (
'Webmozart\\Assert\\' =>
array (
0 => __DIR__ . '/..' . '/webmozart/assert/src',
),
'Twig\\' =>
array (
0 => __DIR__ . '/..' . '/twig/twig/src',
),
'TrueBV\\' =>
array (
0 => __DIR__ . '/..' . '/true/punycode/src',
),
'TheNetworg\\OAuth2\\Client\\' =>
array (
0 => __DIR__ . '/..' . '/thenetworg/oauth2-azure/src',
@@ -132,6 +133,10 @@ class ComposerStaticInit7f81b4a2a468a061c306af5e447a9a9f
array (
0 => __DIR__ . '/..' . '/symfony/polyfill-php73',
),
'Symfony\\Polyfill\\Php72\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/polyfill-php72',
),
'Symfony\\Polyfill\\Mbstring\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring',
@@ -140,6 +145,10 @@ class ComposerStaticInit7f81b4a2a468a061c306af5e447a9a9f
array (
0 => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer',
),
'Symfony\\Polyfill\\Intl\\Idn\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/polyfill-intl-idn',
),
'Symfony\\Polyfill\\Intl\\Grapheme\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/polyfill-intl-grapheme',
@@ -267,6 +276,7 @@ class ComposerStaticInit7f81b4a2a468a061c306af5e447a9a9f
'Psr\\Http\\Message\\' =>
array (
0 => __DIR__ . '/..' . '/psr/http-message/src',
1 => __DIR__ . '/..' . '/psr/http-factory/src',
),
'Psr\\Http\\Client\\' =>
array (
@@ -297,10 +307,6 @@ class ComposerStaticInit7f81b4a2a468a061c306af5e447a9a9f
0 => __DIR__ . '/..' . '/league/oauth2-client/src',
1 => __DIR__ . '/..' . '/league/oauth2-google/src',
),
'Laminas\\ZendFrameworkBridge\\' =>
array (
0 => __DIR__ . '/..' . '/laminas/laminas-zendframework-bridge/src',
),
'Laminas\\Validator\\' =>
array (
0 => __DIR__ . '/..' . '/laminas/laminas-validator/src',
@@ -325,10 +331,6 @@ class ComposerStaticInit7f81b4a2a468a061c306af5e447a9a9f
array (
0 => __DIR__ . '/..' . '/laminas/laminas-loader/src',
),
'Interop\\Container\\' =>
array (
0 => __DIR__ . '/..' . '/container-interop/container-interop/src/Interop/Container',
),
'GuzzleHttp\\Psr7\\' =>
array (
0 => __DIR__ . '/..' . '/guzzlehttp/psr7/src',
@@ -906,8 +908,10 @@ class ComposerStaticInit7f81b4a2a468a061c306af5e447a9a9f
'GuzzleHttp\\Psr7\\BufferStream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/BufferStream.php',
'GuzzleHttp\\Psr7\\CachingStream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/CachingStream.php',
'GuzzleHttp\\Psr7\\DroppingStream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/DroppingStream.php',
'GuzzleHttp\\Psr7\\Exception\\MalformedUriException' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/Exception/MalformedUriException.php',
'GuzzleHttp\\Psr7\\FnStream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/FnStream.php',
'GuzzleHttp\\Psr7\\Header' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/Header.php',
'GuzzleHttp\\Psr7\\HttpFactory' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/HttpFactory.php',
'GuzzleHttp\\Psr7\\InflateStream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/InflateStream.php',
'GuzzleHttp\\Psr7\\LazyOpenStream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/LazyOpenStream.php',
'GuzzleHttp\\Psr7\\LimitStream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/LimitStream.php',
@@ -946,9 +950,6 @@ class ComposerStaticInit7f81b4a2a468a061c306af5e447a9a9f
'InlineImage' => __DIR__ . '/../..' . '/core/inlineimage.class.inc.php',
'InlineImageGC' => __DIR__ . '/../..' . '/core/inlineimage.class.inc.php',
'InputOutputTask' => __DIR__ . '/../..' . '/application/iotask.class.inc.php',
'Interop\\Container\\ContainerInterface' => __DIR__ . '/..' . '/container-interop/container-interop/src/Interop/Container/ContainerInterface.php',
'Interop\\Container\\Exception\\ContainerException' => __DIR__ . '/..' . '/container-interop/container-interop/src/Interop/Container/Exception/ContainerException.php',
'Interop\\Container\\Exception\\NotFoundException' => __DIR__ . '/..' . '/container-interop/container-interop/src/Interop/Container/Exception/NotFoundException.php',
'IntervalExpression' => __DIR__ . '/../..' . '/core/oql/expression.class.inc.php',
'IntervalOqlExpression' => __DIR__ . '/../..' . '/core/oql/oqlquery.class.inc.php',
'Introspection' => __DIR__ . '/../..' . '/core/introspection.class.inc.php',
@@ -1057,6 +1058,7 @@ class ComposerStaticInit7f81b4a2a468a061c306af5e447a9a9f
'Laminas\\Mail\\Storage\\Message' => __DIR__ . '/..' . '/laminas/laminas-mail/src/Storage/Message.php',
'Laminas\\Mail\\Storage\\Message\\File' => __DIR__ . '/..' . '/laminas/laminas-mail/src/Storage/Message/File.php',
'Laminas\\Mail\\Storage\\Message\\MessageInterface' => __DIR__ . '/..' . '/laminas/laminas-mail/src/Storage/Message/MessageInterface.php',
'Laminas\\Mail\\Storage\\ParamsNormalizer' => __DIR__ . '/..' . '/laminas/laminas-mail/src/Storage/ParamsNormalizer.php',
'Laminas\\Mail\\Storage\\Part' => __DIR__ . '/..' . '/laminas/laminas-mail/src/Storage/Part.php',
'Laminas\\Mail\\Storage\\Part\\Exception\\ExceptionInterface' => __DIR__ . '/..' . '/laminas/laminas-mail/src/Storage/Part/Exception/ExceptionInterface.php',
'Laminas\\Mail\\Storage\\Part\\Exception\\InvalidArgumentException' => __DIR__ . '/..' . '/laminas/laminas-mail/src/Storage/Part/Exception/InvalidArgumentException.php',
@@ -1109,9 +1111,9 @@ class ComposerStaticInit7f81b4a2a468a061c306af5e447a9a9f
'Laminas\\ServiceManager\\Initializer\\InitializerInterface' => __DIR__ . '/..' . '/laminas/laminas-servicemanager/src/Initializer/InitializerInterface.php',
'Laminas\\ServiceManager\\PluginManagerInterface' => __DIR__ . '/..' . '/laminas/laminas-servicemanager/src/PluginManagerInterface.php',
'Laminas\\ServiceManager\\Proxy\\LazyServiceFactory' => __DIR__ . '/..' . '/laminas/laminas-servicemanager/src/Proxy/LazyServiceFactory.php',
'Laminas\\ServiceManager\\PsrContainerDecorator' => __DIR__ . '/..' . '/laminas/laminas-servicemanager/src/PsrContainerDecorator.php',
'Laminas\\ServiceManager\\ServiceLocatorInterface' => __DIR__ . '/..' . '/laminas/laminas-servicemanager/src/ServiceLocatorInterface.php',
'Laminas\\ServiceManager\\ServiceManager' => __DIR__ . '/..' . '/laminas/laminas-servicemanager/src/ServiceManager.php',
'Laminas\\ServiceManager\\Test\\CommonPluginManagerTrait' => __DIR__ . '/..' . '/laminas/laminas-servicemanager/src/Test/CommonPluginManagerTrait.php',
'Laminas\\ServiceManager\\Tool\\ConfigDumper' => __DIR__ . '/..' . '/laminas/laminas-servicemanager/src/Tool/ConfigDumper.php',
'Laminas\\ServiceManager\\Tool\\ConfigDumperCommand' => __DIR__ . '/..' . '/laminas/laminas-servicemanager/src/Tool/ConfigDumperCommand.php',
'Laminas\\ServiceManager\\Tool\\FactoryCreator' => __DIR__ . '/..' . '/laminas/laminas-servicemanager/src/Tool/FactoryCreator.php',
@@ -1198,6 +1200,7 @@ class ComposerStaticInit7f81b4a2a468a061c306af5e447a9a9f
'Laminas\\Validator\\Barcode\\Upce' => __DIR__ . '/..' . '/laminas/laminas-validator/src/Barcode/Upce.php',
'Laminas\\Validator\\Between' => __DIR__ . '/..' . '/laminas/laminas-validator/src/Between.php',
'Laminas\\Validator\\Bitwise' => __DIR__ . '/..' . '/laminas/laminas-validator/src/Bitwise.php',
'Laminas\\Validator\\BusinessIdentifierCode' => __DIR__ . '/..' . '/laminas/laminas-validator/src/BusinessIdentifierCode.php',
'Laminas\\Validator\\Callback' => __DIR__ . '/..' . '/laminas/laminas-validator/src/Callback.php',
'Laminas\\Validator\\ConfigProvider' => __DIR__ . '/..' . '/laminas/laminas-validator/src/ConfigProvider.php',
'Laminas\\Validator\\CreditCard' => __DIR__ . '/..' . '/laminas/laminas-validator/src/CreditCard.php',
@@ -1272,11 +1275,6 @@ class ComposerStaticInit7f81b4a2a468a061c306af5e447a9a9f
'Laminas\\Validator\\ValidatorPluginManagerAwareInterface' => __DIR__ . '/..' . '/laminas/laminas-validator/src/ValidatorPluginManagerAwareInterface.php',
'Laminas\\Validator\\ValidatorPluginManagerFactory' => __DIR__ . '/..' . '/laminas/laminas-validator/src/ValidatorPluginManagerFactory.php',
'Laminas\\Validator\\ValidatorProviderInterface' => __DIR__ . '/..' . '/laminas/laminas-validator/src/ValidatorProviderInterface.php',
'Laminas\\ZendFrameworkBridge\\Autoloader' => __DIR__ . '/..' . '/laminas/laminas-zendframework-bridge/src/Autoloader.php',
'Laminas\\ZendFrameworkBridge\\ConfigPostProcessor' => __DIR__ . '/..' . '/laminas/laminas-zendframework-bridge/src/ConfigPostProcessor.php',
'Laminas\\ZendFrameworkBridge\\Module' => __DIR__ . '/..' . '/laminas/laminas-zendframework-bridge/src/Module.php',
'Laminas\\ZendFrameworkBridge\\Replacements' => __DIR__ . '/..' . '/laminas/laminas-zendframework-bridge/src/Replacements.php',
'Laminas\\ZendFrameworkBridge\\RewriteRules' => __DIR__ . '/..' . '/laminas/laminas-zendframework-bridge/src/RewriteRules.php',
'League\\OAuth2\\Client\\Exception\\HostedDomainException' => __DIR__ . '/..' . '/league/oauth2-google/src/Exception/HostedDomainException.php',
'League\\OAuth2\\Client\\Grant\\AbstractGrant' => __DIR__ . '/..' . '/league/oauth2-client/src/Grant/AbstractGrant.php',
'League\\OAuth2\\Client\\Grant\\AuthorizationCode' => __DIR__ . '/..' . '/league/oauth2-client/src/Grant/AuthorizationCode.php',
@@ -1664,11 +1662,17 @@ class ComposerStaticInit7f81b4a2a468a061c306af5e447a9a9f
'Psr\\Http\\Client\\NetworkExceptionInterface' => __DIR__ . '/..' . '/psr/http-client/src/NetworkExceptionInterface.php',
'Psr\\Http\\Client\\RequestExceptionInterface' => __DIR__ . '/..' . '/psr/http-client/src/RequestExceptionInterface.php',
'Psr\\Http\\Message\\MessageInterface' => __DIR__ . '/..' . '/psr/http-message/src/MessageInterface.php',
'Psr\\Http\\Message\\RequestFactoryInterface' => __DIR__ . '/..' . '/psr/http-factory/src/RequestFactoryInterface.php',
'Psr\\Http\\Message\\RequestInterface' => __DIR__ . '/..' . '/psr/http-message/src/RequestInterface.php',
'Psr\\Http\\Message\\ResponseFactoryInterface' => __DIR__ . '/..' . '/psr/http-factory/src/ResponseFactoryInterface.php',
'Psr\\Http\\Message\\ResponseInterface' => __DIR__ . '/..' . '/psr/http-message/src/ResponseInterface.php',
'Psr\\Http\\Message\\ServerRequestFactoryInterface' => __DIR__ . '/..' . '/psr/http-factory/src/ServerRequestFactoryInterface.php',
'Psr\\Http\\Message\\ServerRequestInterface' => __DIR__ . '/..' . '/psr/http-message/src/ServerRequestInterface.php',
'Psr\\Http\\Message\\StreamFactoryInterface' => __DIR__ . '/..' . '/psr/http-factory/src/StreamFactoryInterface.php',
'Psr\\Http\\Message\\StreamInterface' => __DIR__ . '/..' . '/psr/http-message/src/StreamInterface.php',
'Psr\\Http\\Message\\UploadedFileFactoryInterface' => __DIR__ . '/..' . '/psr/http-factory/src/UploadedFileFactoryInterface.php',
'Psr\\Http\\Message\\UploadedFileInterface' => __DIR__ . '/..' . '/psr/http-message/src/UploadedFileInterface.php',
'Psr\\Http\\Message\\UriFactoryInterface' => __DIR__ . '/..' . '/psr/http-factory/src/UriFactoryInterface.php',
'Psr\\Http\\Message\\UriInterface' => __DIR__ . '/..' . '/psr/http-message/src/UriInterface.php',
'Psr\\Log\\AbstractLogger' => __DIR__ . '/..' . '/psr/log/Psr/Log/AbstractLogger.php',
'Psr\\Log\\InvalidArgumentException' => __DIR__ . '/..' . '/psr/log/Psr/Log/InvalidArgumentException.php',
@@ -1952,6 +1956,14 @@ class ComposerStaticInit7f81b4a2a468a061c306af5e447a9a9f
'Symfony\\Bundle\\FrameworkBundle\\Secrets\\SodiumVault' => __DIR__ . '/..' . '/symfony/framework-bundle/Secrets/SodiumVault.php',
'Symfony\\Bundle\\FrameworkBundle\\Session\\DeprecatedSessionFactory' => __DIR__ . '/..' . '/symfony/framework-bundle/Session/DeprecatedSessionFactory.php',
'Symfony\\Bundle\\FrameworkBundle\\Session\\ServiceSessionFactory' => __DIR__ . '/..' . '/symfony/framework-bundle/Session/ServiceSessionFactory.php',
'Symfony\\Bundle\\FrameworkBundle\\Test\\BrowserKitAssertionsTrait' => __DIR__ . '/..' . '/symfony/framework-bundle/Test/BrowserKitAssertionsTrait.php',
'Symfony\\Bundle\\FrameworkBundle\\Test\\DomCrawlerAssertionsTrait' => __DIR__ . '/..' . '/symfony/framework-bundle/Test/DomCrawlerAssertionsTrait.php',
'Symfony\\Bundle\\FrameworkBundle\\Test\\KernelTestCase' => __DIR__ . '/..' . '/symfony/framework-bundle/Test/KernelTestCase.php',
'Symfony\\Bundle\\FrameworkBundle\\Test\\MailerAssertionsTrait' => __DIR__ . '/..' . '/symfony/framework-bundle/Test/MailerAssertionsTrait.php',
'Symfony\\Bundle\\FrameworkBundle\\Test\\TestBrowserToken' => __DIR__ . '/..' . '/symfony/framework-bundle/Test/TestBrowserToken.php',
'Symfony\\Bundle\\FrameworkBundle\\Test\\TestContainer' => __DIR__ . '/..' . '/symfony/framework-bundle/Test/TestContainer.php',
'Symfony\\Bundle\\FrameworkBundle\\Test\\WebTestAssertionsTrait' => __DIR__ . '/..' . '/symfony/framework-bundle/Test/WebTestAssertionsTrait.php',
'Symfony\\Bundle\\FrameworkBundle\\Test\\WebTestCase' => __DIR__ . '/..' . '/symfony/framework-bundle/Test/WebTestCase.php',
'Symfony\\Bundle\\FrameworkBundle\\Translation\\Translator' => __DIR__ . '/..' . '/symfony/framework-bundle/Translation/Translator.php',
'Symfony\\Bundle\\TwigBundle\\CacheWarmer\\TemplateCacheWarmer' => __DIR__ . '/..' . '/symfony/twig-bundle/CacheWarmer/TemplateCacheWarmer.php',
'Symfony\\Bundle\\TwigBundle\\Command\\LintCommand' => __DIR__ . '/..' . '/symfony/twig-bundle/Command/LintCommand.php',
@@ -2585,6 +2597,16 @@ class ComposerStaticInit7f81b4a2a468a061c306af5e447a9a9f
'Symfony\\Component\\HttpFoundation\\Session\\Storage\\SessionStorageFactoryInterface' => __DIR__ . '/..' . '/symfony/http-foundation/Session/Storage/SessionStorageFactoryInterface.php',
'Symfony\\Component\\HttpFoundation\\Session\\Storage\\SessionStorageInterface' => __DIR__ . '/..' . '/symfony/http-foundation/Session/Storage/SessionStorageInterface.php',
'Symfony\\Component\\HttpFoundation\\StreamedResponse' => __DIR__ . '/..' . '/symfony/http-foundation/StreamedResponse.php',
'Symfony\\Component\\HttpFoundation\\Test\\Constraint\\RequestAttributeValueSame' => __DIR__ . '/..' . '/symfony/http-foundation/Test/Constraint/RequestAttributeValueSame.php',
'Symfony\\Component\\HttpFoundation\\Test\\Constraint\\ResponseCookieValueSame' => __DIR__ . '/..' . '/symfony/http-foundation/Test/Constraint/ResponseCookieValueSame.php',
'Symfony\\Component\\HttpFoundation\\Test\\Constraint\\ResponseFormatSame' => __DIR__ . '/..' . '/symfony/http-foundation/Test/Constraint/ResponseFormatSame.php',
'Symfony\\Component\\HttpFoundation\\Test\\Constraint\\ResponseHasCookie' => __DIR__ . '/..' . '/symfony/http-foundation/Test/Constraint/ResponseHasCookie.php',
'Symfony\\Component\\HttpFoundation\\Test\\Constraint\\ResponseHasHeader' => __DIR__ . '/..' . '/symfony/http-foundation/Test/Constraint/ResponseHasHeader.php',
'Symfony\\Component\\HttpFoundation\\Test\\Constraint\\ResponseHeaderSame' => __DIR__ . '/..' . '/symfony/http-foundation/Test/Constraint/ResponseHeaderSame.php',
'Symfony\\Component\\HttpFoundation\\Test\\Constraint\\ResponseIsRedirected' => __DIR__ . '/..' . '/symfony/http-foundation/Test/Constraint/ResponseIsRedirected.php',
'Symfony\\Component\\HttpFoundation\\Test\\Constraint\\ResponseIsSuccessful' => __DIR__ . '/..' . '/symfony/http-foundation/Test/Constraint/ResponseIsSuccessful.php',
'Symfony\\Component\\HttpFoundation\\Test\\Constraint\\ResponseIsUnprocessable' => __DIR__ . '/..' . '/symfony/http-foundation/Test/Constraint/ResponseIsUnprocessable.php',
'Symfony\\Component\\HttpFoundation\\Test\\Constraint\\ResponseStatusCodeSame' => __DIR__ . '/..' . '/symfony/http-foundation/Test/Constraint/ResponseStatusCodeSame.php',
'Symfony\\Component\\HttpFoundation\\UrlHelper' => __DIR__ . '/..' . '/symfony/http-foundation/UrlHelper.php',
'Symfony\\Component\\HttpKernel\\Attribute\\ArgumentInterface' => __DIR__ . '/..' . '/symfony/http-kernel/Attribute/ArgumentInterface.php',
'Symfony\\Component\\HttpKernel\\Attribute\\AsController' => __DIR__ . '/..' . '/symfony/http-kernel/Attribute/AsController.php',
@@ -2873,6 +2895,7 @@ class ComposerStaticInit7f81b4a2a468a061c306af5e447a9a9f
'Symfony\\Component\\VarDumper\\Exception\\ThrowingCasterException' => __DIR__ . '/..' . '/symfony/var-dumper/Exception/ThrowingCasterException.php',
'Symfony\\Component\\VarDumper\\Server\\Connection' => __DIR__ . '/..' . '/symfony/var-dumper/Server/Connection.php',
'Symfony\\Component\\VarDumper\\Server\\DumpServer' => __DIR__ . '/..' . '/symfony/var-dumper/Server/DumpServer.php',
'Symfony\\Component\\VarDumper\\Test\\VarDumperTestTrait' => __DIR__ . '/..' . '/symfony/var-dumper/Test/VarDumperTestTrait.php',
'Symfony\\Component\\VarDumper\\VarDumper' => __DIR__ . '/..' . '/symfony/var-dumper/VarDumper.php',
'Symfony\\Component\\VarExporter\\Exception\\ClassNotFoundException' => __DIR__ . '/..' . '/symfony/var-exporter/Exception/ClassNotFoundException.php',
'Symfony\\Component\\VarExporter\\Exception\\ExceptionInterface' => __DIR__ . '/..' . '/symfony/var-exporter/Exception/ExceptionInterface.php',
@@ -2916,8 +2939,13 @@ class ComposerStaticInit7f81b4a2a468a061c306af5e447a9a9f
'Symfony\\Contracts\\Translation\\TranslatorTrait' => __DIR__ . '/..' . '/symfony/translation-contracts/TranslatorTrait.php',
'Symfony\\Polyfill\\Ctype\\Ctype' => __DIR__ . '/..' . '/symfony/polyfill-ctype/Ctype.php',
'Symfony\\Polyfill\\Intl\\Grapheme\\Grapheme' => __DIR__ . '/..' . '/symfony/polyfill-intl-grapheme/Grapheme.php',
'Symfony\\Polyfill\\Intl\\Idn\\Idn' => __DIR__ . '/..' . '/symfony/polyfill-intl-idn/Idn.php',
'Symfony\\Polyfill\\Intl\\Idn\\Info' => __DIR__ . '/..' . '/symfony/polyfill-intl-idn/Info.php',
'Symfony\\Polyfill\\Intl\\Idn\\Resources\\unidata\\DisallowedRanges' => __DIR__ . '/..' . '/symfony/polyfill-intl-idn/Resources/unidata/DisallowedRanges.php',
'Symfony\\Polyfill\\Intl\\Idn\\Resources\\unidata\\Regex' => __DIR__ . '/..' . '/symfony/polyfill-intl-idn/Resources/unidata/Regex.php',
'Symfony\\Polyfill\\Intl\\Normalizer\\Normalizer' => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer/Normalizer.php',
'Symfony\\Polyfill\\Mbstring\\Mbstring' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/Mbstring.php',
'Symfony\\Polyfill\\Php72\\Php72' => __DIR__ . '/..' . '/symfony/polyfill-php72/Php72.php',
'Symfony\\Polyfill\\Php73\\Php73' => __DIR__ . '/..' . '/symfony/polyfill-php73/Php73.php',
'Symfony\\Polyfill\\Php80\\Php80' => __DIR__ . '/..' . '/symfony/polyfill-php80/Php80.php',
'Symfony\\Polyfill\\Php80\\PhpToken' => __DIR__ . '/..' . '/symfony/polyfill-php80/PhpToken.php',
@@ -2959,10 +2987,6 @@ class ComposerStaticInit7f81b4a2a468a061c306af5e447a9a9f
'TriggerOnStateEnter' => __DIR__ . '/../..' . '/core/trigger.class.inc.php',
'TriggerOnStateLeave' => __DIR__ . '/../..' . '/core/trigger.class.inc.php',
'TriggerOnThresholdReached' => __DIR__ . '/../..' . '/core/trigger.class.inc.php',
'TrueBV\\Exception\\DomainOutOfBoundsException' => __DIR__ . '/..' . '/true/punycode/src/Exception/DomainOutOfBoundsException.php',
'TrueBV\\Exception\\LabelOutOfBoundsException' => __DIR__ . '/..' . '/true/punycode/src/Exception/LabelOutOfBoundsException.php',
'TrueBV\\Exception\\OutOfBoundsException' => __DIR__ . '/..' . '/true/punycode/src/Exception/OutOfBoundsException.php',
'TrueBV\\Punycode' => __DIR__ . '/..' . '/true/punycode/src/Punycode.php',
'TrueExpression' => __DIR__ . '/../..' . '/core/oql/expression.class.inc.php',
'Twig\\Cache\\CacheInterface' => __DIR__ . '/..' . '/twig/twig/src/Cache/CacheInterface.php',
'Twig\\Cache\\FilesystemCache' => __DIR__ . '/..' . '/twig/twig/src/Cache/FilesystemCache.php',
@@ -3166,6 +3190,9 @@ class ComposerStaticInit7f81b4a2a468a061c306af5e447a9a9f
'VariableOqlExpression' => __DIR__ . '/../..' . '/core/oql/oqlquery.class.inc.php',
'WebPage' => __DIR__ . '/../..' . '/sources/Application/WebPage/WebPage.php',
'WebPageMenuNode' => __DIR__ . '/../..' . '/application/menunode.class.inc.php',
'Webmozart\\Assert\\Assert' => __DIR__ . '/..' . '/webmozart/assert/src/Assert.php',
'Webmozart\\Assert\\InvalidArgumentException' => __DIR__ . '/..' . '/webmozart/assert/src/InvalidArgumentException.php',
'Webmozart\\Assert\\Mixin' => __DIR__ . '/..' . '/webmozart/assert/src/Mixin.php',
'WeeklyRotatingLogFileNameBuilder' => __DIR__ . '/../..' . '/core/log.class.inc.php',
'WizardHelper' => __DIR__ . '/../..' . '/application/wizardhelper.class.inc.php',
'XLSXWriter' => __DIR__ . '/../..' . '/application/xlsxwriter.class.php',

File diff suppressed because it is too large Load Diff

View File

@@ -1,235 +1,217 @@
<?php return array(
'root' => array(
'name' => 'combodo/itop',
'pretty_version' => 'dev-develop',
'version' => 'dev-develop',
'reference' => 'f295d43978c4e53c77cad51c9bad327633ac813c',
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'reference' => '30021d92368e2bfb13e4b166967b9a1a43796904',
'name' => 'combodo/itop',
'dev' => true,
),
'versions' => array(
'combodo/itop' => array(
'pretty_version' => 'dev-develop',
'version' => 'dev-develop',
'reference' => 'f295d43978c4e53c77cad51c9bad327633ac813c',
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'reference' => '30021d92368e2bfb13e4b166967b9a1a43796904',
'dev_requirement' => false,
),
'combodo/tcpdf' => array(
'pretty_version' => '6.4.4',
'version' => '6.4.4.0',
'reference' => '0e31c013ccd000aa6762e9186778aa6e259ac8e8',
'type' => 'library',
'install_path' => __DIR__ . '/../combodo/tcpdf',
'aliases' => array(),
'reference' => '0e31c013ccd000aa6762e9186778aa6e259ac8e8',
'dev_requirement' => false,
),
'container-interop/container-interop' => array(
'pretty_version' => '1.2.0',
'version' => '1.2.0.0',
'reference' => '79cbf1341c22ec75643d841642dd5d6acd83bdb8',
'type' => 'library',
'install_path' => __DIR__ . '/../container-interop/container-interop',
'aliases' => array(),
'dev_requirement' => false,
),
'container-interop/container-interop-implementation' => array(
'dev_requirement' => false,
'provided' => array(
0 => '^1.2',
'replaced' => array(
0 => '^1.2.0',
),
),
'firebase/php-jwt' => array(
'pretty_version' => 'v5.5.1',
'version' => '5.5.1.0',
'reference' => '83b609028194aa042ea33b5af2d41a7427de80e6',
'pretty_version' => 'v6.3.0',
'version' => '6.3.0.0',
'type' => 'library',
'install_path' => __DIR__ . '/../firebase/php-jwt',
'aliases' => array(),
'reference' => '018dfc4e1da92ad8a1b90adc4893f476a3b41cb8',
'dev_requirement' => false,
),
'guzzlehttp/guzzle' => array(
'pretty_version' => '7.4.5',
'version' => '7.4.5.0',
'reference' => '1dd98b0564cb3f6bd16ce683cb755f94c10fbd82',
'type' => 'library',
'install_path' => __DIR__ . '/../guzzlehttp/guzzle',
'aliases' => array(),
'reference' => '1dd98b0564cb3f6bd16ce683cb755f94c10fbd82',
'dev_requirement' => false,
),
'guzzlehttp/promises' => array(
'pretty_version' => '1.5.1',
'version' => '1.5.1.0',
'reference' => 'fe752aedc9fd8fcca3fe7ad05d419d32998a06da',
'type' => 'library',
'install_path' => __DIR__ . '/../guzzlehttp/promises',
'aliases' => array(),
'reference' => 'fe752aedc9fd8fcca3fe7ad05d419d32998a06da',
'dev_requirement' => false,
),
'guzzlehttp/psr7' => array(
'pretty_version' => '1.9.0',
'version' => '1.9.0.0',
'reference' => 'e98e3e6d4f86621a9b75f623996e6bbdeb4b9318',
'pretty_version' => '2.4.0',
'version' => '2.4.0.0',
'type' => 'library',
'install_path' => __DIR__ . '/../guzzlehttp/psr7',
'aliases' => array(),
'reference' => '13388f00956b1503577598873fffb5ae994b5737',
'dev_requirement' => false,
),
'laminas/laminas-loader' => array(
'pretty_version' => '2.6.1',
'version' => '2.6.1.0',
'reference' => '5d01c2c237ae9e68bec262f339947e2ea18979bc',
'pretty_version' => '2.8.0',
'version' => '2.8.0.0',
'type' => 'library',
'install_path' => __DIR__ . '/../laminas/laminas-loader',
'aliases' => array(),
'reference' => 'd0589ec9dd48365fd95ad10d1c906efd7711c16b',
'dev_requirement' => false,
),
'laminas/laminas-mail' => array(
'pretty_version' => '2.12.5',
'version' => '2.12.5.0',
'reference' => 'ed5b36a0deef4ffafe6138c2ae9cafcffafab856',
'pretty_version' => '2.16.0',
'version' => '2.16.0.0',
'type' => 'library',
'install_path' => __DIR__ . '/../laminas/laminas-mail',
'aliases' => array(),
'reference' => '1ee1a384b96c8af29ecad9b3a7adc27a150ebc49',
'dev_requirement' => false,
),
'laminas/laminas-mime' => array(
'pretty_version' => '2.7.4',
'version' => '2.7.4.0',
'reference' => 'e45a7d856bf7b4a7b5bd00d6371f9961dc233add',
'pretty_version' => '2.9.1',
'version' => '2.9.1.0',
'type' => 'library',
'install_path' => __DIR__ . '/../laminas/laminas-mime',
'aliases' => array(),
'reference' => '72d21a1b4bb7086d4a4d7058c0abca180b209184',
'dev_requirement' => false,
),
'laminas/laminas-servicemanager' => array(
'pretty_version' => '3.5.2',
'version' => '3.5.2.0',
'reference' => '0669e1eec8d9f61e35a5bc5012796d49f418b259',
'pretty_version' => '3.16.0',
'version' => '3.16.0.0',
'type' => 'library',
'install_path' => __DIR__ . '/../laminas/laminas-servicemanager',
'aliases' => array(),
'reference' => '863c66733740cd36ebf5e700f4258ef2c68a2a24',
'dev_requirement' => false,
),
'laminas/laminas-stdlib' => array(
'pretty_version' => '3.2.1',
'version' => '3.2.1.0',
'reference' => '2b18347625a2f06a1a485acfbc870f699dbe51c6',
'pretty_version' => '3.11.0',
'version' => '3.11.0.0',
'type' => 'library',
'install_path' => __DIR__ . '/../laminas/laminas-stdlib',
'aliases' => array(),
'reference' => 'aad7d2b11ba0069ba0d9b40f6dde3c2fa664b57f',
'dev_requirement' => false,
),
'laminas/laminas-validator' => array(
'pretty_version' => '2.13.5',
'version' => '2.13.5.0',
'reference' => 'd334dddda43af263d6a7e5024fd2b013cb6981f7',
'pretty_version' => '2.23.0',
'version' => '2.23.0.0',
'type' => 'library',
'install_path' => __DIR__ . '/../laminas/laminas-validator',
'aliases' => array(),
'dev_requirement' => false,
),
'laminas/laminas-zendframework-bridge' => array(
'pretty_version' => '1.1.1',
'version' => '1.1.1.0',
'reference' => '6ede70583e101030bcace4dcddd648f760ddf642',
'type' => 'library',
'install_path' => __DIR__ . '/../laminas/laminas-zendframework-bridge',
'aliases' => array(),
'reference' => '6d61b6cc3b222f13807a18d9247cdfb084958b03',
'dev_requirement' => false,
),
'league/oauth2-client' => array(
'pretty_version' => '2.6.1',
'version' => '2.6.1.0',
'reference' => '2334c249907190c132364f5dae0287ab8666aa19',
'type' => 'library',
'install_path' => __DIR__ . '/../league/oauth2-client',
'aliases' => array(),
'reference' => '2334c249907190c132364f5dae0287ab8666aa19',
'dev_requirement' => false,
),
'league/oauth2-google' => array(
'pretty_version' => '3.0.4',
'version' => '3.0.4.0',
'reference' => '6b79441f244040760bed5fdcd092a2bda7cf34c6',
'type' => 'library',
'install_path' => __DIR__ . '/../league/oauth2-google',
'aliases' => array(),
'reference' => '6b79441f244040760bed5fdcd092a2bda7cf34c6',
'dev_requirement' => false,
),
'nikic/php-parser' => array(
'pretty_version' => 'v4.14.0',
'version' => '4.14.0.0',
'reference' => '34bea19b6e03d8153165d8f30bba4c3be86184c1',
'type' => 'library',
'install_path' => __DIR__ . '/../nikic/php-parser',
'aliases' => array(),
'reference' => '34bea19b6e03d8153165d8f30bba4c3be86184c1',
'dev_requirement' => false,
),
'paragonie/random_compat' => array(
'pretty_version' => 'v9.99.100',
'version' => '9.99.100.0',
'reference' => '996434e5492cb4c3edcb9168db6fbb1359ef965a',
'type' => 'library',
'install_path' => __DIR__ . '/../paragonie/random_compat',
'aliases' => array(),
'reference' => '996434e5492cb4c3edcb9168db6fbb1359ef965a',
'dev_requirement' => false,
),
'pear/archive_tar' => array(
'pretty_version' => '1.4.14',
'version' => '1.4.14.0',
'reference' => '4d761c5334c790e45ef3245f0864b8955c562caa',
'type' => 'library',
'install_path' => __DIR__ . '/../pear/archive_tar',
'aliases' => array(),
'reference' => '4d761c5334c790e45ef3245f0864b8955c562caa',
'dev_requirement' => false,
),
'pear/console_getopt' => array(
'pretty_version' => 'v1.4.3',
'version' => '1.4.3.0',
'reference' => 'a41f8d3e668987609178c7c4a9fe48fecac53fa0',
'type' => 'library',
'install_path' => __DIR__ . '/../pear/console_getopt',
'aliases' => array(),
'reference' => 'a41f8d3e668987609178c7c4a9fe48fecac53fa0',
'dev_requirement' => false,
),
'pear/pear-core-minimal' => array(
'pretty_version' => 'v1.10.11',
'version' => '1.10.11.0',
'reference' => '68d0d32ada737153b7e93b8d3c710ebe70ac867d',
'type' => 'library',
'install_path' => __DIR__ . '/../pear/pear-core-minimal',
'aliases' => array(),
'reference' => '68d0d32ada737153b7e93b8d3c710ebe70ac867d',
'dev_requirement' => false,
),
'pear/pear_exception' => array(
'pretty_version' => 'v1.0.2',
'version' => '1.0.2.0',
'reference' => 'b14fbe2ddb0b9f94f5b24cf08783d599f776fff0',
'type' => 'class',
'install_path' => __DIR__ . '/../pear/pear_exception',
'aliases' => array(),
'reference' => 'b14fbe2ddb0b9f94f5b24cf08783d599f776fff0',
'dev_requirement' => false,
),
'pelago/emogrifier' => array(
'pretty_version' => 'v6.0.0',
'version' => '6.0.0.0',
'reference' => 'aa72d5407efac118f3896bcb995a2cba793df0ae',
'type' => 'library',
'install_path' => __DIR__ . '/../pelago/emogrifier',
'aliases' => array(),
'reference' => 'aa72d5407efac118f3896bcb995a2cba793df0ae',
'dev_requirement' => false,
),
'psr/cache' => array(
'pretty_version' => '1.0.1',
'version' => '1.0.1.0',
'reference' => 'd11b50ad223250cf17b86e38383413f5a6764bf8',
'type' => 'library',
'install_path' => __DIR__ . '/../psr/cache',
'aliases' => array(),
'reference' => 'd11b50ad223250cf17b86e38383413f5a6764bf8',
'dev_requirement' => false,
),
'psr/cache-implementation' => array(
@@ -239,12 +221,12 @@
),
),
'psr/container' => array(
'pretty_version' => '1.1.1',
'version' => '1.1.1.0',
'reference' => '8622567409010282b7aeebe4bb841fe98b58dcaf',
'pretty_version' => '1.1.2',
'version' => '1.1.2.0',
'type' => 'library',
'install_path' => __DIR__ . '/../psr/container',
'aliases' => array(),
'reference' => '513e0666f7216c7459170d56df27dfcefe1689ea',
'dev_requirement' => false,
),
'psr/container-implementation' => array(
@@ -257,10 +239,10 @@
'psr/event-dispatcher' => array(
'pretty_version' => '1.0.0',
'version' => '1.0.0.0',
'reference' => 'dbefd12671e8a14ec7f180cab83036ed26714bb0',
'type' => 'library',
'install_path' => __DIR__ . '/../psr/event-dispatcher',
'aliases' => array(),
'reference' => 'dbefd12671e8a14ec7f180cab83036ed26714bb0',
'dev_requirement' => false,
),
'psr/event-dispatcher-implementation' => array(
@@ -272,10 +254,10 @@
'psr/http-client' => array(
'pretty_version' => '1.0.1',
'version' => '1.0.1.0',
'reference' => '2dfb5f6c5eff0e91e20e913f8c5452ed95b86621',
'type' => 'library',
'install_path' => __DIR__ . '/../psr/http-client',
'aliases' => array(),
'reference' => '2dfb5f6c5eff0e91e20e913f8c5452ed95b86621',
'dev_requirement' => false,
),
'psr/http-client-implementation' => array(
@@ -284,13 +266,28 @@
0 => '1.0',
),
),
'psr/http-factory' => array(
'pretty_version' => '1.0.1',
'version' => '1.0.1.0',
'type' => 'library',
'install_path' => __DIR__ . '/../psr/http-factory',
'aliases' => array(),
'reference' => '12ac7fcd07e5b077433f5f2bee95b3a771bf61be',
'dev_requirement' => false,
),
'psr/http-factory-implementation' => array(
'dev_requirement' => false,
'provided' => array(
0 => '1.0',
),
),
'psr/http-message' => array(
'pretty_version' => '1.0.1',
'version' => '1.0.1.0',
'reference' => 'f6561bf28d520154e4b0ec72be95418abe6d9363',
'type' => 'library',
'install_path' => __DIR__ . '/../psr/http-message',
'aliases' => array(),
'reference' => 'f6561bf28d520154e4b0ec72be95418abe6d9363',
'dev_requirement' => false,
),
'psr/http-message-implementation' => array(
@@ -302,10 +299,10 @@
'psr/log' => array(
'pretty_version' => '1.1.4',
'version' => '1.1.4.0',
'reference' => 'd49695b909c3b7628b6289db5479a1c204601f11',
'type' => 'library',
'install_path' => __DIR__ . '/../psr/log',
'aliases' => array(),
'reference' => 'd49695b909c3b7628b6289db5479a1c204601f11',
'dev_requirement' => false,
),
'psr/log-implementation' => array(
@@ -323,10 +320,10 @@
'ralouphie/getallheaders' => array(
'pretty_version' => '3.0.3',
'version' => '3.0.3.0',
'reference' => '120b605dfeb996808c31b6477290a714d356e822',
'type' => 'library',
'install_path' => __DIR__ . '/../ralouphie/getallheaders',
'aliases' => array(),
'reference' => '120b605dfeb996808c31b6477290a714d356e822',
'dev_requirement' => false,
),
'rsky/pear-core-min' => array(
@@ -338,37 +335,37 @@
'sabberworm/php-css-parser' => array(
'pretty_version' => '8.4.0',
'version' => '8.4.0.0',
'reference' => 'e41d2140031d533348b2192a83f02d8dd8a71d30',
'type' => 'library',
'install_path' => __DIR__ . '/../sabberworm/php-css-parser',
'aliases' => array(),
'reference' => 'e41d2140031d533348b2192a83f02d8dd8a71d30',
'dev_requirement' => false,
),
'scssphp/scssphp' => array(
'pretty_version' => 'v1.10.3',
'version' => '1.10.3.0',
'reference' => '0f1e1516ed2412ad43e42a6a319e77624ba1f713',
'pretty_version' => 'v1.10.5',
'version' => '1.10.5.0',
'type' => 'library',
'install_path' => __DIR__ . '/../scssphp/scssphp',
'aliases' => array(),
'reference' => '6d44282ccf283e133ab70b6282f8e068ff2f9bf9',
'dev_requirement' => false,
),
'symfony/cache' => array(
'pretty_version' => 'v5.4.10',
'version' => '5.4.10.0',
'reference' => 'c4e387b739022fd4b20abd8edb2143c44c5daa14',
'pretty_version' => 'v5.4.11',
'version' => '5.4.11.0',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/cache',
'aliases' => array(),
'reference' => '5a0fff46df349f0db3fe242263451fddf5277362',
'dev_requirement' => false,
),
'symfony/cache-contracts' => array(
'pretty_version' => 'v2.5.2',
'version' => '2.5.2.0',
'reference' => '64be4a7acb83b6f2bf6de9a02cee6dad41277ebc',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/cache-contracts',
'aliases' => array(),
'reference' => '64be4a7acb83b6f2bf6de9a02cee6dad41277ebc',
'dev_requirement' => false,
),
'symfony/cache-implementation' => array(
@@ -378,84 +375,84 @@
),
),
'symfony/config' => array(
'pretty_version' => 'v5.4.9',
'version' => '5.4.9.0',
'reference' => '8f551fe22672ac7ab2c95fe46d899f960ed4d979',
'pretty_version' => 'v5.4.11',
'version' => '5.4.11.0',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/config',
'aliases' => array(),
'reference' => 'ec79e03125c1d2477e43dde8528535d90cc78379',
'dev_requirement' => false,
),
'symfony/console' => array(
'pretty_version' => 'v5.4.10',
'version' => '5.4.10.0',
'reference' => '4d671ab4ddac94ee439ea73649c69d9d200b5000',
'pretty_version' => 'v5.4.11',
'version' => '5.4.11.0',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/console',
'aliases' => array(),
'reference' => '535846c7ee6bc4dd027ca0d93220601456734b10',
'dev_requirement' => false,
),
'symfony/css-selector' => array(
'pretty_version' => 'v5.4.3',
'version' => '5.4.3.0',
'reference' => 'b0a190285cd95cb019237851205b8140ef6e368e',
'pretty_version' => 'v5.4.11',
'version' => '5.4.11.0',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/css-selector',
'aliases' => array(),
'reference' => 'c1681789f059ab756001052164726ae88512ae3d',
'dev_requirement' => false,
),
'symfony/dependency-injection' => array(
'pretty_version' => 'v5.4.10',
'version' => '5.4.10.0',
'reference' => '88d1c0d38c2e60f757fa11d89cfc885f0b7f5171',
'pretty_version' => 'v5.4.11',
'version' => '5.4.11.0',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/dependency-injection',
'aliases' => array(),
'reference' => 'a8b9251016e9476db73e25fa836904bc0bf74c62',
'dev_requirement' => false,
),
'symfony/deprecation-contracts' => array(
'pretty_version' => 'v2.5.2',
'version' => '2.5.2.0',
'reference' => 'e8b495ea28c1d97b5e0c121748d6f9b53d075c66',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/deprecation-contracts',
'aliases' => array(),
'reference' => 'e8b495ea28c1d97b5e0c121748d6f9b53d075c66',
'dev_requirement' => false,
),
'symfony/dotenv' => array(
'pretty_version' => 'v5.4.5',
'version' => '5.4.5.0',
'reference' => '83a2310904a4f5d4f42526227b5a578ac82232a9',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/dotenv',
'aliases' => array(),
'reference' => '83a2310904a4f5d4f42526227b5a578ac82232a9',
'dev_requirement' => false,
),
'symfony/error-handler' => array(
'pretty_version' => 'v5.4.9',
'version' => '5.4.9.0',
'reference' => 'c116cda1f51c678782768dce89a45f13c949455d',
'pretty_version' => 'v5.4.11',
'version' => '5.4.11.0',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/error-handler',
'aliases' => array(),
'reference' => 'f75d17cb4769eb38cd5fccbda95cd80a054d35c8',
'dev_requirement' => false,
),
'symfony/event-dispatcher' => array(
'pretty_version' => 'v5.4.9',
'version' => '5.4.9.0',
'reference' => '8e6ce1cc0279e3ff3c8ff0f43813bc88d21ca1bc',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/event-dispatcher',
'aliases' => array(),
'reference' => '8e6ce1cc0279e3ff3c8ff0f43813bc88d21ca1bc',
'dev_requirement' => false,
),
'symfony/event-dispatcher-contracts' => array(
'pretty_version' => 'v2.5.2',
'version' => '2.5.2.0',
'reference' => 'f98b54df6ad059855739db6fcbc2d36995283fe1',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/event-dispatcher-contracts',
'aliases' => array(),
'reference' => 'f98b54df6ad059855739db6fcbc2d36995283fe1',
'dev_requirement' => false,
),
'symfony/event-dispatcher-implementation' => array(
@@ -465,129 +462,147 @@
),
),
'symfony/filesystem' => array(
'pretty_version' => 'v5.4.9',
'version' => '5.4.9.0',
'reference' => '36a017fa4cce1eff1b8e8129ff53513abcef05ba',
'pretty_version' => 'v5.4.11',
'version' => '5.4.11.0',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/filesystem',
'aliases' => array(),
'reference' => '6699fb0228d1bc35b12aed6dd5e7455457609ddd',
'dev_requirement' => false,
),
'symfony/finder' => array(
'pretty_version' => 'v5.4.8',
'version' => '5.4.8.0',
'reference' => '9b630f3427f3ebe7cd346c277a1408b00249dad9',
'pretty_version' => 'v5.4.11',
'version' => '5.4.11.0',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/finder',
'aliases' => array(),
'reference' => '7872a66f57caffa2916a584db1aa7f12adc76f8c',
'dev_requirement' => false,
),
'symfony/framework-bundle' => array(
'pretty_version' => 'v5.4.10',
'version' => '5.4.10.0',
'reference' => '7cbc790e067a23a47b9f0dc59e2ff0ecddbd3e14',
'pretty_version' => 'v5.4.11',
'version' => '5.4.11.0',
'type' => 'symfony-bundle',
'install_path' => __DIR__ . '/../symfony/framework-bundle',
'aliases' => array(),
'reference' => 'a0660b602357d5c2ceaac1c9f80c5820bbff803d',
'dev_requirement' => false,
),
'symfony/http-foundation' => array(
'pretty_version' => 'v5.4.10',
'version' => '5.4.10.0',
'reference' => 'e7793b7906f72a8cc51054fbca9dcff7a8af1c1e',
'pretty_version' => 'v5.4.11',
'version' => '5.4.11.0',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/http-foundation',
'aliases' => array(),
'reference' => '0a5868e0999e9d47859ba3d918548ff6943e6389',
'dev_requirement' => false,
),
'symfony/http-kernel' => array(
'pretty_version' => 'v5.4.10',
'version' => '5.4.10.0',
'reference' => '255ae3b0a488d78fbb34da23d3e0c059874b5948',
'pretty_version' => 'v5.4.11',
'version' => '5.4.11.0',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/http-kernel',
'aliases' => array(),
'reference' => '4fd590a2ef3f62560dbbf6cea511995dd77321ee',
'dev_requirement' => false,
),
'symfony/polyfill-ctype' => array(
'pretty_version' => 'v1.26.0',
'version' => '1.26.0.0',
'reference' => '6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-ctype',
'aliases' => array(),
'reference' => '6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4',
'dev_requirement' => false,
),
'symfony/polyfill-intl-grapheme' => array(
'pretty_version' => 'v1.26.0',
'version' => '1.26.0.0',
'reference' => '433d05519ce6990bf3530fba6957499d327395c2',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-intl-grapheme',
'aliases' => array(),
'reference' => '433d05519ce6990bf3530fba6957499d327395c2',
'dev_requirement' => false,
),
'symfony/polyfill-intl-idn' => array(
'pretty_version' => 'v1.26.0',
'version' => '1.26.0.0',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-intl-idn',
'aliases' => array(),
'reference' => '59a8d271f00dd0e4c2e518104cc7963f655a1aa8',
'dev_requirement' => false,
),
'symfony/polyfill-intl-normalizer' => array(
'pretty_version' => 'v1.26.0',
'version' => '1.26.0.0',
'reference' => '219aa369ceff116e673852dce47c3a41794c14bd',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-intl-normalizer',
'aliases' => array(),
'reference' => '219aa369ceff116e673852dce47c3a41794c14bd',
'dev_requirement' => false,
),
'symfony/polyfill-mbstring' => array(
'pretty_version' => 'v1.26.0',
'version' => '1.26.0.0',
'reference' => '9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-mbstring',
'aliases' => array(),
'reference' => '9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e',
'dev_requirement' => false,
),
'symfony/polyfill-php72' => array(
'pretty_version' => 'v1.26.0',
'version' => '1.26.0.0',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-php72',
'aliases' => array(),
'reference' => 'bf44a9fd41feaac72b074de600314a93e2ae78e2',
'dev_requirement' => false,
),
'symfony/polyfill-php73' => array(
'pretty_version' => 'v1.26.0',
'version' => '1.26.0.0',
'reference' => 'e440d35fa0286f77fb45b79a03fedbeda9307e85',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-php73',
'aliases' => array(),
'reference' => 'e440d35fa0286f77fb45b79a03fedbeda9307e85',
'dev_requirement' => false,
),
'symfony/polyfill-php80' => array(
'pretty_version' => 'v1.26.0',
'version' => '1.26.0.0',
'reference' => 'cfa0ae98841b9e461207c13ab093d76b0fa7bace',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-php80',
'aliases' => array(),
'reference' => 'cfa0ae98841b9e461207c13ab093d76b0fa7bace',
'dev_requirement' => false,
),
'symfony/polyfill-php81' => array(
'pretty_version' => 'v1.26.0',
'version' => '1.26.0.0',
'reference' => '13f6d1271c663dc5ae9fb843a8f16521db7687a1',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-php81',
'aliases' => array(),
'reference' => '13f6d1271c663dc5ae9fb843a8f16521db7687a1',
'dev_requirement' => false,
),
'symfony/routing' => array(
'pretty_version' => 'v5.4.8',
'version' => '5.4.8.0',
'reference' => 'e07817bb6244ea33ef5ad31abc4a9288bef3f2f7',
'pretty_version' => 'v5.4.11',
'version' => '5.4.11.0',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/routing',
'aliases' => array(),
'reference' => '3e01ccd9b2a3a4167ba2b3c53612762300300226',
'dev_requirement' => false,
),
'symfony/service-contracts' => array(
'pretty_version' => 'v2.5.2',
'version' => '2.5.2.0',
'reference' => '4b426aac47d6427cc1a1d0f7e2ac724627f5966c',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/service-contracts',
'aliases' => array(),
'reference' => '4b426aac47d6427cc1a1d0f7e2ac724627f5966c',
'dev_requirement' => false,
),
'symfony/service-implementation' => array(
@@ -599,82 +614,82 @@
'symfony/stopwatch' => array(
'pretty_version' => 'v5.4.5',
'version' => '5.4.5.0',
'reference' => '4d04b5c24f3c9a1a168a131f6cbe297155bc0d30',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/stopwatch',
'aliases' => array(),
'reference' => '4d04b5c24f3c9a1a168a131f6cbe297155bc0d30',
'dev_requirement' => true,
),
'symfony/string' => array(
'pretty_version' => 'v5.4.10',
'version' => '5.4.10.0',
'reference' => '4432bc7df82a554b3e413a8570ce2fea90e94097',
'pretty_version' => 'v5.4.11',
'version' => '5.4.11.0',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/string',
'aliases' => array(),
'reference' => '5eb661e49ad389e4ae2b6e4df8d783a8a6548322',
'dev_requirement' => false,
),
'symfony/translation-contracts' => array(
'pretty_version' => 'v2.5.2',
'version' => '2.5.2.0',
'reference' => '136b19dd05cdf0709db6537d058bcab6dd6e2dbe',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/translation-contracts',
'aliases' => array(),
'reference' => '136b19dd05cdf0709db6537d058bcab6dd6e2dbe',
'dev_requirement' => false,
),
'symfony/twig-bridge' => array(
'pretty_version' => 'v5.4.9',
'version' => '5.4.9.0',
'reference' => 'fd13c89a1abdbaa7ee2e655d9a11405adcb7a6cf',
'pretty_version' => 'v5.4.11',
'version' => '5.4.11.0',
'type' => 'symfony-bridge',
'install_path' => __DIR__ . '/../symfony/twig-bridge',
'aliases' => array(),
'reference' => '63b8a50d48c9fe3d04e77307d4f1771dd848baa8',
'dev_requirement' => false,
),
'symfony/twig-bundle' => array(
'pretty_version' => 'v5.4.8',
'version' => '5.4.8.0',
'reference' => 'c992b4474c3a31f3c40a1ca593d213833f91b818',
'type' => 'symfony-bundle',
'install_path' => __DIR__ . '/../symfony/twig-bundle',
'aliases' => array(),
'reference' => 'c992b4474c3a31f3c40a1ca593d213833f91b818',
'dev_requirement' => false,
),
'symfony/var-dumper' => array(
'pretty_version' => 'v5.4.9',
'version' => '5.4.9.0',
'reference' => 'af52239a330fafd192c773795520dc2dd62b5657',
'pretty_version' => 'v5.4.11',
'version' => '5.4.11.0',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/var-dumper',
'aliases' => array(),
'reference' => 'b8f306d7b8ef34fb3db3305be97ba8e088fb4861',
'dev_requirement' => false,
),
'symfony/var-exporter' => array(
'pretty_version' => 'v5.4.10',
'version' => '5.4.10.0',
'reference' => '8fc03ee75eeece3d9be1ef47d26d79bea1afb340',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/var-exporter',
'aliases' => array(),
'reference' => '8fc03ee75eeece3d9be1ef47d26d79bea1afb340',
'dev_requirement' => false,
),
'symfony/web-profiler-bundle' => array(
'pretty_version' => 'v5.4.10',
'version' => '5.4.10.0',
'reference' => 'f61c99d8dbd864b11935851b598f784bcff36fc7',
'type' => 'symfony-bundle',
'install_path' => __DIR__ . '/../symfony/web-profiler-bundle',
'aliases' => array(),
'reference' => 'f61c99d8dbd864b11935851b598f784bcff36fc7',
'dev_requirement' => true,
),
'symfony/yaml' => array(
'pretty_version' => 'v5.4.10',
'version' => '5.4.10.0',
'reference' => '04e42926429d9e8b39c174387ab990bf7817f7a2',
'pretty_version' => 'v5.4.11',
'version' => '5.4.11.0',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/yaml',
'aliases' => array(),
'reference' => '05d4ea560f3402c6c116afd99fdc66e60eda227e',
'dev_requirement' => false,
),
'tecnickcom/tcpdf' => array(
@@ -686,65 +701,29 @@
'thenetworg/oauth2-azure' => array(
'pretty_version' => 'v2.1.1',
'version' => '2.1.1.0',
'reference' => '06fb2d620fb6e6c934f632c7ec7c5ea2e978a844',
'type' => 'library',
'install_path' => __DIR__ . '/../thenetworg/oauth2-azure',
'aliases' => array(),
'dev_requirement' => false,
),
'true/punycode' => array(
'pretty_version' => 'v2.1.1',
'version' => '2.1.1.0',
'reference' => 'a4d0c11a36dd7f4e7cd7096076cab6d3378a071e',
'type' => 'library',
'install_path' => __DIR__ . '/../true/punycode',
'aliases' => array(),
'reference' => '06fb2d620fb6e6c934f632c7ec7c5ea2e978a844',
'dev_requirement' => false,
),
'twig/twig' => array(
'pretty_version' => 'v3.4.1',
'version' => '3.4.1.0',
'reference' => 'e939eae92386b69b49cfa4599dd9bead6bf4a342',
'type' => 'library',
'install_path' => __DIR__ . '/../twig/twig',
'aliases' => array(),
'reference' => 'e939eae92386b69b49cfa4599dd9bead6bf4a342',
'dev_requirement' => false,
),
'zendframework/zend-loader' => array(
'webmozart/assert' => array(
'pretty_version' => '1.11.0',
'version' => '1.11.0.0',
'type' => 'library',
'install_path' => __DIR__ . '/../webmozart/assert',
'aliases' => array(),
'reference' => '11cb2199493b2f8a3b53e7f19068fc6aac760991',
'dev_requirement' => false,
'replaced' => array(
0 => '2.6.1',
),
),
'zendframework/zend-mail' => array(
'dev_requirement' => false,
'replaced' => array(
0 => '^2.10.0',
),
),
'zendframework/zend-mime' => array(
'dev_requirement' => false,
'replaced' => array(
0 => '^2.7.2',
),
),
'zendframework/zend-servicemanager' => array(
'dev_requirement' => false,
'replaced' => array(
0 => '^3.4.0',
),
),
'zendframework/zend-stdlib' => array(
'dev_requirement' => false,
'replaced' => array(
0 => '3.2.1',
),
),
'zendframework/zend-validator' => array(
'dev_requirement' => false,
'replaced' => array(
0 => '^2.13.0',
),
),
),
);

View File

@@ -4,8 +4,8 @@
$issues = array();
if (!(PHP_VERSION_ID >= 70205)) {
$issues[] = 'Your Composer dependencies require a PHP version ">= 7.2.5". You are running ' . PHP_VERSION . '.';
if (!(PHP_VERSION_ID >= 70400)) {
$issues[] = 'Your Composer dependencies require a PHP version ">= 7.4.0". You are running ' . PHP_VERSION . '.';
}
$missingExtensions = array();

View File

@@ -1,3 +0,0 @@
composer.lock
composer.phar
/vendor/

View File

@@ -1,148 +0,0 @@
# Container Interoperability
[![Latest Stable Version](https://poser.pugx.org/container-interop/container-interop/v/stable.png)](https://packagist.org/packages/container-interop/container-interop)
[![Total Downloads](https://poser.pugx.org/container-interop/container-interop/downloads.svg)](https://packagist.org/packages/container-interop/container-interop)
## Deprecation warning!
Starting Feb. 13th 2017, container-interop is officially deprecated in favor of [PSR-11](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-11-container.md).
Container-interop has been the test-bed of PSR-11. From v1.2, container-interop directly extends PSR-11 interfaces.
Therefore, all containers implementing container-interop are now *de-facto* compatible with PSR-11.
- Projects implementing container-interop interfaces are encouraged to directly implement PSR-11 interfaces instead.
- Projects consuming container-interop interfaces are very strongly encouraged to directly type-hint on PSR-11 interfaces, in order to be compatible with PSR-11 containers that are not compatible with container-interop.
Regarding the delegate lookup feature, that is present in container-interop and not in PSR-11, the feature is actually a design pattern. It is therefore not deprecated. Documentation regarding this design pattern will be migrated from this repository into a separate website in the future.
## About
*container-interop* tries to identify and standardize features in *container* objects (service locators,
dependency injection containers, etc.) to achieve interoperability.
Through discussions and trials, we try to create a standard, made of common interfaces but also recommendations.
If PHP projects that provide container implementations begin to adopt these common standards, then PHP
applications and projects that use containers can depend on the common interfaces instead of specific
implementations. This facilitates a high-level of interoperability and flexibility that allows users to consume
*any* container implementation that can be adapted to these interfaces.
The work done in this project is not officially endorsed by the [PHP-FIG](http://www.php-fig.org/), but it is being
worked on by members of PHP-FIG and other good developers. We adhere to the spirit and ideals of PHP-FIG, and hope
this project will pave the way for one or more future PSRs.
## Installation
You can install this package through Composer:
```json
composer require container-interop/container-interop
```
The packages adheres to the [SemVer](http://semver.org/) specification, and there will be full backward compatibility
between minor versions.
## Standards
### Available
- [`ContainerInterface`](src/Interop/Container/ContainerInterface.php).
[Description](docs/ContainerInterface.md) [Meta Document](docs/ContainerInterface-meta.md).
Describes the interface of a container that exposes methods to read its entries.
- [*Delegate lookup feature*](docs/Delegate-lookup.md).
[Meta Document](docs/Delegate-lookup-meta.md).
Describes the ability for a container to delegate the lookup of its dependencies to a third-party container. This
feature lets several containers work together in a single application.
### Proposed
View open [request for comments](https://github.com/container-interop/container-interop/labels/RFC)
## Compatible projects
### Projects implementing `ContainerInterface`
- [Acclimate](https://github.com/jeremeamia/acclimate-container): Adapters for
Aura.Di, Laravel, Nette DI, Pimple, Symfony DI, ZF2 Service manager, ZF2
Dependency injection and any container using `ArrayAccess`
- [Aura.Di](https://github.com/auraphp/Aura.Di)
- [auryn-container-interop](https://github.com/elazar/auryn-container-interop)
- [Burlap](https://github.com/codeeverything/burlap)
- [Chernozem](https://github.com/pyrsmk/Chernozem)
- [Data Manager](https://github.com/chrismichaels84/data-manager)
- [Disco](https://github.com/bitexpert/disco)
- [InDI](https://github.com/idealogica/indi)
- [League/Container](http://container.thephpleague.com/)
- [Mouf](http://mouf-php.com)
- [Njasm Container](https://github.com/njasm/container)
- [PHP-DI](http://php-di.org)
- [Picotainer](https://github.com/thecodingmachine/picotainer)
- [PimpleInterop](https://github.com/moufmouf/pimple-interop)
- [Pimple3-ContainerInterop](https://github.com/Sam-Burns/pimple3-containerinterop) (using Pimple v3)
- [SitePoint Container](https://github.com/sitepoint/Container)
- [Thruster Container](https://github.com/ThrusterIO/container) (PHP7 only)
- [Ultra-Lite Container](https://github.com/ultra-lite/container)
- [Unbox](https://github.com/mindplay-dk/unbox)
- [XStatic](https://github.com/jeremeamia/xstatic)
- [Zend\ServiceManager](https://github.com/zendframework/zend-servicemanager)
- [Zit](https://github.com/inxilpro/Zit)
### Projects implementing the *delegate lookup* feature
- [Aura.Di](https://github.com/auraphp/Aura.Di)
- [Burlap](https://github.com/codeeverything/burlap)
- [Chernozem](https://github.com/pyrsmk/Chernozem)
- [InDI](https://github.com/idealogica/indi)
- [League/Container](http://container.thephpleague.com/)
- [Mouf](http://mouf-php.com)
- [Picotainer](https://github.com/thecodingmachine/picotainer)
- [PHP-DI](http://php-di.org)
- [PimpleInterop](https://github.com/moufmouf/pimple-interop)
- [Ultra-Lite Container](https://github.com/ultra-lite/container)
### Middlewares implementing `ContainerInterface`
- [Alias-Container](https://github.com/thecodingmachine/alias-container): add
aliases support to any container
- [Prefixer-Container](https://github.com/thecodingmachine/prefixer-container):
dynamically prefix identifiers
- [Lazy-Container](https://github.com/snapshotpl/lazy-container): lazy services
### Projects using `ContainerInterface`
The list below contains only a sample of all the projects consuming `ContainerInterface`. For a more complete list have a look [here](http://packanalyst.com/class?q=Interop%5CContainer%5CContainerInterface).
| | Downloads |
| --- | --- |
| [Adroit](https://github.com/bitexpert/adroit) | ![](https://img.shields.io/packagist/dt/bitexpert/adroit.svg) |
| [Behat](https://github.com/Behat/Behat/pull/974) | ![](https://img.shields.io/packagist/dt/behat/behat.svg) |
| [blast-facades](https://github.com/phpthinktank/blast-facades): Minimize complexity and represent dependencies as facades. | ![](https://img.shields.io/packagist/dt/blast/facades.svg) |
| [interop.silex.di](https://github.com/thecodingmachine/interop.silex.di): an extension to [Silex](http://silex.sensiolabs.org/) that adds support for any *container-interop* compatible container | ![](https://img.shields.io/packagist/dt/mouf/interop.silex.di.svg) |
| [mindplay/walkway](https://github.com/mindplay-dk/walkway): a modular request router | ![](https://img.shields.io/packagist/dt/mindplay/walkway.svg) |
| [mindplay/middleman](https://github.com/mindplay-dk/middleman): minimalist PSR-7 middleware dispatcher | ![](https://img.shields.io/packagist/dt/mindplay/middleman.svg) |
| [PHP-DI/Invoker](https://github.com/PHP-DI/Invoker): extensible and configurable invoker/dispatcher | ![](https://img.shields.io/packagist/dt/php-di/invoker.svg) |
| [Prophiler](https://github.com/fabfuel/prophiler) | ![](https://img.shields.io/packagist/dt/fabfuel/prophiler.svg) |
| [Silly](https://github.com/mnapoli/silly): CLI micro-framework | ![](https://img.shields.io/packagist/dt/mnapoli/silly.svg) |
| [Slim v3](https://github.com/slimphp/Slim) | ![](https://img.shields.io/packagist/dt/slim/slim.svg) |
| [Splash](http://mouf-php.com/packages/mouf/mvc.splash-common/version/8.0-dev/README.md) | ![](https://img.shields.io/packagist/dt/mouf/mvc.splash-common.svg) |
| [Woohoo Labs. Harmony](https://github.com/woohoolabs/harmony): a flexible micro-framework | ![](https://img.shields.io/packagist/dt/woohoolabs/harmony.svg) |
| [zend-expressive](https://github.com/zendframework/zend-expressive) | ![](https://img.shields.io/packagist/dt/zendframework/zend-expressive.svg) |
## Workflow
Everyone is welcome to join and contribute.
The general workflow looks like this:
1. Someone opens a discussion (GitHub issue) to suggest an interface
1. Feedback is gathered
1. The interface is added to a development branch
1. We release alpha versions so that the interface can be experimented with
1. Discussions and edits ensue until the interface is deemed stable by a general consensus
1. A new minor version of the package is released
We try to not break BC by creating new interfaces instead of editing existing ones.
While we currently work on interfaces, we are open to anything that might help towards interoperability, may that
be code, best practices, etc.

View File

@@ -1,15 +0,0 @@
{
"name": "container-interop/container-interop",
"type": "library",
"description": "Promoting the interoperability of container objects (DIC, SL, etc.)",
"homepage": "https://github.com/container-interop/container-interop",
"license": "MIT",
"autoload": {
"psr-4": {
"Interop\\Container\\": "src/Interop/Container/"
}
},
"require": {
"psr/container": "^1.0"
}
}

View File

@@ -1,114 +0,0 @@
# ContainerInterface Meta Document
## Introduction
This document describes the process and discussions that lead to the `ContainerInterface`.
Its goal is to explain the reasons behind each decision.
## Goal
The goal set by `ContainerInterface` is to standardize how frameworks and libraries make use of a
container to obtain objects and parameters.
By standardizing such a behavior, frameworks and libraries using the `ContainerInterface`
could work with any compatible container.
That would allow end users to choose their own container based on their own preferences.
It is important to distinguish the two usages of a container:
- configuring entries
- fetching entries
Most of the time, those two sides are not used by the same party.
While it is often end users who tend to configure entries, it is generally the framework that fetch
entries to build the application.
This is why this interface focuses only on how entries can be fetched from a container.
## Interface name
The interface name has been thoroughly discussed and was decided by a vote.
The list of options considered with their respective votes are:
- `ContainerInterface`: +8
- `ProviderInterface`: +2
- `LocatorInterface`: 0
- `ReadableContainerInterface`: -5
- `ServiceLocatorInterface`: -6
- `ObjectFactory`: -6
- `ObjectStore`: -8
- `ConsumerInterface`: -9
[Full results of the vote](https://github.com/container-interop/container-interop/wiki/%231-interface-name:-Vote)
The complete discussion can be read in [the issue #1](https://github.com/container-interop/container-interop/issues/1).
## Interface methods
The choice of which methods the interface would contain was made after a statistical analysis of existing containers.
The results of this analysis are available [in this document](https://gist.github.com/mnapoli/6159681).
The summary of the analysis showed that:
- all containers offer a method to get an entry by its id
- a large majority name such method `get()`
- for all containers, the `get()` method has 1 mandatory parameter of type string
- some containers have an optional additional argument for `get()`, but it doesn't have the same purpose between containers
- a large majority of the containers offer a method to test if it can return an entry by its id
- a majority name such method `has()`
- for all containers offering `has()`, the method has exactly 1 parameter of type string
- a large majority of the containers throw an exception rather than returning null when an entry is not found in `get()`
- a large majority of the containers don't implement `ArrayAccess`
The question of whether to include methods to define entries has been discussed in
[issue #1](https://github.com/container-interop/container-interop/issues/1).
It has been judged that such methods do not belong in the interface described here because it is out of its scope
(see the "Goal" section).
As a result, the `ContainerInterface` contains two methods:
- `get()`, returning anything, with one mandatory string parameter. Should throw an exception if the entry is not found.
- `has()`, returning a boolean, with one mandatory string parameter.
### Number of parameters in `get()` method
While `ContainerInterface` only defines one mandatory parameter in `get()`, it is not incompatible with
existing containers that have additional optional parameters. PHP allows an implementation to offer more parameters
as long as they are optional, because the implementation *does* satisfy the interface.
This issue has been discussed in [issue #6](https://github.com/container-interop/container-interop/issues/6).
### Type of the `$id` parameter
The type of the `$id` parameter in `get()` and `has()` has been discussed in
[issue #6](https://github.com/container-interop/container-interop/issues/6).
While `string` is used in all the containers that were analyzed, it was suggested that allowing
anything (such as objects) could allow containers to offer a more advanced query API.
An example given was to use the container as an object builder. The `$id` parameter would then be an
object that would describe how to create an instance.
The conclusion of the discussion was that this was beyond the scope of getting entries from a container without
knowing how the container provided them, and it was more fit for a factory.
## Contributors
Are listed here all people that contributed in the discussions or votes, by alphabetical order:
- [Amy Stephen](https://github.com/AmyStephen)
- [David Négrier](https://github.com/moufmouf)
- [Don Gilbert](https://github.com/dongilbert)
- [Jason Judge](https://github.com/judgej)
- [Jeremy Lindblom](https://github.com/jeremeamia)
- [Marco Pivetta](https://github.com/Ocramius)
- [Matthieu Napoli](https://github.com/mnapoli)
- [Paul M. Jones](https://github.com/pmjones)
- [Stephan Hochdörfer](https://github.com/shochdoerfer)
- [Taylor Otwell](https://github.com/taylorotwell)
## Relevant links
- [`ContainerInterface.php`](https://github.com/container-interop/container-interop/blob/master/src/Interop/Container/ContainerInterface.php)
- [List of all issues](https://github.com/container-interop/container-interop/issues?labels=ContainerInterface&milestone=&page=1&state=closed)
- [Vote for the interface name](https://github.com/container-interop/container-interop/wiki/%231-interface-name:-Vote)

View File

@@ -1,158 +0,0 @@
Container interface
===================
This document describes a common interface for dependency injection containers.
The goal set by `ContainerInterface` is to standardize how frameworks and libraries make use of a
container to obtain objects and parameters (called *entries* in the rest of this document).
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD",
"SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be
interpreted as described in [RFC 2119][].
The word `implementor` in this document is to be interpreted as someone
implementing the `ContainerInterface` in a dependency injection-related library or framework.
Users of dependency injections containers (DIC) are referred to as `user`.
[RFC 2119]: http://tools.ietf.org/html/rfc2119
1. Specification
-----------------
### 1.1 Basics
- The `Interop\Container\ContainerInterface` exposes two methods : `get` and `has`.
- `get` takes one mandatory parameter: an entry identifier. It MUST be a string.
A call to `get` can return anything (a *mixed* value), or throws an exception if the identifier
is not known to the container. Two successive calls to `get` with the same
identifier SHOULD return the same value. However, depending on the `implementor`
design and/or `user` configuration, different values might be returned, so
`user` SHOULD NOT rely on getting the same value on 2 successive calls.
While `ContainerInterface` only defines one mandatory parameter in `get()`, implementations
MAY accept additional optional parameters.
- `has` takes one unique parameter: an entry identifier. It MUST return `true`
if an entry identifier is known to the container and `false` if it is not.
`has($id)` returning true does not mean that `get($id)` will not throw an exception.
It does however mean that `get($id)` will not throw a `NotFoundException`.
### 1.2 Exceptions
Exceptions directly thrown by the container MUST implement the
[`Interop\Container\Exception\ContainerException`](../src/Interop/Container/Exception/ContainerException.php).
A call to the `get` method with a non-existing id SHOULD throw a
[`Interop\Container\Exception\NotFoundException`](../src/Interop/Container/Exception/NotFoundException.php).
### 1.3 Additional features
This section describes additional features that MAY be added to a container. Containers are not
required to implement these features to respect the ContainerInterface.
#### 1.3.1 Delegate lookup feature
The goal of the *delegate lookup* feature is to allow several containers to share entries.
Containers implementing this feature can perform dependency lookups in other containers.
Containers implementing this feature will offer a greater lever of interoperability
with other containers. Implementation of this feature is therefore RECOMMENDED.
A container implementing this feature:
- MUST implement the `ContainerInterface`
- MUST provide a way to register a delegate container (using a constructor parameter, or a setter,
or any possible way). The delegate container MUST implement the `ContainerInterface`.
When a container is configured to use a delegate container for dependencies:
- Calls to the `get` method should only return an entry if the entry is part of the container.
If the entry is not part of the container, an exception should be thrown
(as requested by the `ContainerInterface`).
- Calls to the `has` method should only return `true` if the entry is part of the container.
If the entry is not part of the container, `false` should be returned.
- If the fetched entry has dependencies, **instead** of performing
the dependency lookup in the container, the lookup is performed on the *delegate container*.
Important! By default, the lookup SHOULD be performed on the delegate container **only**, not on the container itself.
It is however allowed for containers to provide exception cases for special entries, and a way to lookup
into the same container (or another container) instead of the delegate container.
2. Package
----------
The interfaces and classes described as well as relevant exception are provided as part of the
[container-interop/container-interop](https://packagist.org/packages/container-interop/container-interop) package.
3. `Interop\Container\ContainerInterface`
-----------------------------------------
```php
<?php
namespace Interop\Container;
use Interop\Container\Exception\ContainerException;
use Interop\Container\Exception\NotFoundException;
/**
* Describes the interface of a container that exposes methods to read its entries.
*/
interface ContainerInterface
{
/**
* Finds an entry of the container by its identifier and returns it.
*
* @param string $id Identifier of the entry to look for.
*
* @throws NotFoundException No entry was found for this identifier.
* @throws ContainerException Error while retrieving the entry.
*
* @return mixed Entry.
*/
public function get($id);
/**
* Returns true if the container can return an entry for the given identifier.
* Returns false otherwise.
*
* `has($id)` returning true does not mean that `get($id)` will not throw an exception.
* It does however mean that `get($id)` will not throw a `NotFoundException`.
*
* @param string $id Identifier of the entry to look for.
*
* @return boolean
*/
public function has($id);
}
```
4. `Interop\Container\Exception\ContainerException`
---------------------------------------------------
```php
<?php
namespace Interop\Container\Exception;
/**
* Base interface representing a generic exception in a container.
*/
interface ContainerException
{
}
```
5. `Interop\Container\Exception\NotFoundException`
---------------------------------------------------
```php
<?php
namespace Interop\Container\Exception;
/**
* No entry was found in the container.
*/
interface NotFoundException extends ContainerException
{
}
```

View File

@@ -1,259 +0,0 @@
Delegate lookup feature Meta Document
=====================================
1. Summary
----------
This document describes the *delegate lookup feature*.
Containers are not required to implement this feature to respect the `ContainerInterface`.
However, containers implementing this feature will offer a greater lever of interoperability
with other containers, allowing multiple containers to share entries in the same application.
Implementation of this feature is therefore recommanded.
2. Why Bother?
--------------
The [`ContainerInterface`](../src/Interop/Container/ContainerInterface.php) ([meta doc](ContainerInterface.md))
standardizes how frameworks and libraries make use of a container to obtain objects and parameters.
By standardizing such a behavior, frameworks and libraries relying on the `ContainerInterface`
could work with any compatible container.
That would allow end users to choose their own container based on their own preferences.
The `ContainerInterface` is also enough if we want to have several containers side-by-side in the same
application. For instance, this is what the [CompositeContainer](https://github.com/jeremeamia/acclimate-container/blob/master/src/CompositeContainer.php)
class of [Acclimate](https://github.com/jeremeamia/acclimate-container) is designed for:
![Side by side containers](images/side_by_side_containers.png)
However, an instance in container 1 cannot reference an instance in container 2.
It would be better if an instance of container 1 could reference an instance in container 2,
and the opposite should be true.
![Interoperating containers](images/interoperating_containers.png)
In the sample above, entry 1 in container 1 is referencing entry 3 in container 2.
3. Scope
--------
### 3.1 Goals
The goal of the *delegate lookup* feature is to allow several containers to share entries.
4. Approaches
-------------
### 4.1 Chosen Approach
Containers implementing this feature can perform dependency lookups in other containers.
A container implementing this feature:
- must implement the `ContainerInterface`
- must provide a way to register a *delegate container* (using a constructor parameter, or a setter, or any
possible way). The *delegate container* must implement the `ContainerInterface`.
When a *delegate container* is configured on a container:
- Calls to the `get` method should only return an entry if the entry is part of the container.
If the entry is not part of the container, an exception should be thrown (as required in the `ContainerInterface`).
- Calls to the `has` method should only return *true* if the entry is part of the container.
If the entry is not part of the container, *false* should be returned.
- Finally, the important part: if the entry we are fetching has dependencies,
**instead** of perfoming the dependency lookup in the container, the lookup is performed on the *delegate container*.
Important! By default, the lookup should be performed on the delegate container **only**, not on the container itself.
It is however allowed for containers to provide exception cases for special entries, and a way to lookup into
the same container (or another container) instead of the delegate container.
### 4.2 Typical usage
The *delegate container* will usually be a composite container. A composite container is a container that
contains several other containers. When performing a lookup on a composite container, the inner containers are
queried until one container returns an entry.
An inner container implementing the *delegate lookup feature* will return entries it contains, but if these
entries have dependencies, the dependencies lookup calls will be performed on the composite container, giving
a chance to all containers to answer.
Interestingly enough, the order in which containers are added in the composite container matters. Indeed,
the first containers to be added in the composite container can "override" the entries of containers with
lower priority.
![Containers priority](images/priority.png)
In the example above, "container 2" contains a controller "myController" and the controller is referencing an
"entityManager" entry. "Container 1" contains also an entry named "entityManager".
Without the *delegate lookup* feature, when requesting the "myController" instance to container 2, it would take
in charge the instanciation of both entries.
However, using the *delegate lookup* feature, here is what happens when we ask the composite container for the
"myController" instance:
- The composite container asks container 1 if if contains the "myController" instance. The answer is no.
- The composite container asks container 2 if if contains the "myController" instance. The answer is yes.
- The composite container performs a `get` call on container 2 for the "myController" instance.
- Container 2 sees that "myController" has a dependency on "entityManager".
- Container 2 delegates the lookup of "entityManager" to the composite container.
- The composite container asks container 1 if if contains the "entityManager" instance. The answer is yes.
- The composite container performs a `get` call on container 1 for the "entityManager" instance.
In the end, we get a controller instanciated by container 2 that references an entityManager instanciated
by container 1.
### 4.3 Alternative: the fallback strategy
The first proposed approach we tried was to perform all the lookups in the "local" container,
and if a lookup fails in the container, to use the delegate container. In this scenario, the
delegate container is used in "fallback" mode.
This strategy has been described in @moufmouf blog post: http://mouf-php.com/container-interop-whats-next (solution 1).
It was also discussed [here](https://github.com/container-interop/container-interop/pull/8#issuecomment-33570697) and
[here](https://github.com/container-interop/container-interop/pull/20#issuecomment-56599631).
Problems with this strategy:
- Heavy problem regarding infinite loops
- Unable to overload a container entry with the delegate container entry
### 4.4 Alternative: force implementing an interface
The first proposed approach was to develop a `ParentAwareContainerInterface` interface.
It was proposed here: https://github.com/container-interop/container-interop/pull/8
The interface would have had the behaviour of the delegate lookup feature but would have forced the addition of
a `setParentContainter` method:
```php
interface ParentAwareContainerInterface extends ReadableContainerInterface {
/**
* Sets the parent container associated to that container. This container will call
* the parent container to fetch dependencies.
*
* @param ContainerInterface $container
*/
public function setParentContainer(ContainerInterface $container);
}
```
The interface idea was first questioned by @Ocramius [here](https://github.com/container-interop/container-interop/pull/8#issuecomment-51721777).
@Ocramius expressed the idea that an interface should not contain setters, otherwise, it is forcing implementation
details on the class implementing the interface.
Then @mnapoli made a proposal for a "convention" [here](https://github.com/container-interop/container-interop/pull/8#issuecomment-51841079),
this idea was further discussed until all participants in the discussion agreed to remove the interface idea
and replace it with a "standard" feature.
**Pros:**
If we had had an interface, we could have delegated the registration of the delegate/composite container to the
the delegate/composite container itself.
For instance:
```php
$containerA = new ContainerA();
$containerB = new ContainerB();
$compositeContainer = new CompositeContainer([$containerA, $containerB]);
// The call to 'setParentContainer' is delegated to the CompositeContainer
// It is not the responsibility of the user anymore.
class CompositeContainer {
...
public function __construct($containers) {
foreach ($containers as $container) {
if ($container instanceof ParentAwareContainerInterface) {
$container->setParentContainer($this);
}
}
...
}
}
```
**Cons:**
Cons have been extensively discussed [here](https://github.com/container-interop/container-interop/pull/8#issuecomment-51721777).
Basically, forcing a setter into an interface is a bad idea. Setters are similar to constructor arguments,
and it's a bad idea to standardize a constructor: how the delegate container is configured into a container is an implementation detail. This outweights the benefits of the interface.
### 4.4 Alternative: no exception case for delegate lookups
Originally, the proposed wording for delegate lookup calls was:
> Important! The lookup MUST be performed on the delegate container **only**, not on the container itself.
This was later replaced by:
> Important! By default, the lookup SHOULD be performed on the delegate container **only**, not on the container itself.
>
> It is however allowed for containers to provide exception cases for special entries, and a way to lookup
> into the same container (or another container) instead of the delegate container.
Exception cases have been allowed to avoid breaking dependencies with some services that must be provided
by the container (on @njasm proposal). This was proposed here: https://github.com/container-interop/container-interop/pull/20#issuecomment-56597235
### 4.5 Alternative: having one of the containers act as the composite container
In real-life scenarios, we usually have a big framework (Symfony 2, Zend Framework 2, etc...) and we want to
add another DI container to this container. Most of the time, the "big" framework will be responsible for
creating the controller's instances, using it's own DI container. Until *container-interop* is fully adopted,
the "big" framework will not be aware of the existence of a composite container that it should use instead
of its own container.
For this real-life use cases, @mnapoli and @moufmouf proposed to extend the "big" framework's DI container
to make it act as a composite container.
This has been discussed [here](https://github.com/container-interop/container-interop/pull/8#issuecomment-40367194)
and [here](http://mouf-php.com/container-interop-whats-next#solution4).
This was implemented in Symfony 2 using:
- [interop.symfony.di](https://github.com/thecodingmachine/interop.symfony.di/tree/v0.1.0)
- [framework interop](https://github.com/mnapoli/framework-interop/)
This was implemented in Silex using:
- [interop.silex.di](https://github.com/thecodingmachine/interop.silex.di)
Having a container act as the composite container is not part of the delegate lookup standard because it is
simply a temporary design pattern used to make existing frameworks that do not support yet ContainerInterop
play nice with other DI containers.
5. Implementations
------------------
The following projects already implement the delegate lookup feature:
- [Mouf](http://mouf-php.com), through the [`setDelegateLookupContainer` method](https://github.com/thecodingmachine/mouf/blob/2.0/src/Mouf/MoufManager.php#L2120)
- [PHP-DI](http://php-di.org/), through the [`$wrapperContainer` parameter of the constructor](https://github.com/mnapoli/PHP-DI/blob/master/src/DI/Container.php#L72)
- [pimple-interop](https://github.com/moufmouf/pimple-interop), through the [`$container` parameter of the constructor](https://github.com/moufmouf/pimple-interop/blob/master/src/Interop/Container/Pimple/PimpleInterop.php#L62)
6. People
---------
Are listed here all people that contributed in the discussions, by alphabetical order:
- [Alexandru Pătrănescu](https://github.com/drealecs)
- [Ben Peachey](https://github.com/potherca)
- [David Négrier](https://github.com/moufmouf)
- [Jeremy Lindblom](https://github.com/jeremeamia)
- [Marco Pivetta](https://github.com/Ocramius)
- [Matthieu Napoli](https://github.com/mnapoli)
- [Nelson J Morais](https://github.com/njasm)
- [Phil Sturgeon](https://github.com/philsturgeon)
- [Stephan Hochdörfer](https://github.com/shochdoerfer)
7. Relevant Links
-----------------
_**Note:** Order descending chronologically._
- [Pull request on the delegate lookup feature](https://github.com/container-interop/container-interop/pull/20)
- [Pull request on the interface idea](https://github.com/container-interop/container-interop/pull/8)
- [Original article exposing the delegate lookup idea along many others](http://mouf-php.com/container-interop-whats-next)

View File

@@ -1,60 +0,0 @@
Delegate lookup feature
=======================
This document describes a standard for dependency injection containers.
The goal set by the *delegate lookup* feature is to allow several containers to share entries.
Containers implementing this feature can perform dependency lookups in other containers.
Containers implementing this feature will offer a greater lever of interoperability
with other containers. Implementation of this feature is therefore RECOMMENDED.
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD",
"SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be
interpreted as described in [RFC 2119][].
The word `implementor` in this document is to be interpreted as someone
implementing the delegate lookup feature in a dependency injection-related library or framework.
Users of dependency injections containers (DIC) are referred to as `user`.
[RFC 2119]: http://tools.ietf.org/html/rfc2119
1. Vocabulary
-------------
In a dependency injection container, the container is used to fetch entries.
Entries can have dependencies on other entries. Usually, these other entries are fetched by the container.
The *delegate lookup* feature is the ability for a container to fetch dependencies in
another container. In the rest of the document, the word "container" will reference the container
implemented by the implementor. The word "delegate container" will reference the container we are
fetching the dependencies from.
2. Specification
----------------
A container implementing the *delegate lookup* feature:
- MUST implement the [`ContainerInterface`](ContainerInterface.md)
- MUST provide a way to register a delegate container (using a constructor parameter, or a setter,
or any possible way). The delegate container MUST implement the [`ContainerInterface`](ContainerInterface.md).
When a container is configured to use a delegate container for dependencies:
- Calls to the `get` method should only return an entry if the entry is part of the container.
If the entry is not part of the container, an exception should be thrown
(as requested by the [`ContainerInterface`](ContainerInterface.md)).
- Calls to the `has` method should only return `true` if the entry is part of the container.
If the entry is not part of the container, `false` should be returned.
- If the fetched entry has dependencies, **instead** of performing
the dependency lookup in the container, the lookup is performed on the *delegate container*.
Important: By default, the dependency lookups SHOULD be performed on the delegate container **only**, not on the container itself.
It is however allowed for containers to provide exception cases for special entries, and a way to lookup
into the same container (or another container) instead of the delegate container.
3. Package / Interface
----------------------
This feature is not tied to any code, interface or package.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

View File

@@ -1,15 +0,0 @@
<?php
/**
* @license http://www.opensource.org/licenses/mit-license.php MIT (see the LICENSE file)
*/
namespace Interop\Container;
use Psr\Container\ContainerInterface as PsrContainerInterface;
/**
* Describes the interface of a container that exposes methods to read its entries.
*/
interface ContainerInterface extends PsrContainerInterface
{
}

View File

@@ -1,15 +0,0 @@
<?php
/**
* @license http://www.opensource.org/licenses/mit-license.php MIT (see the LICENSE file)
*/
namespace Interop\Container\Exception;
use Psr\Container\ContainerExceptionInterface as PsrContainerException;
/**
* Base interface representing a generic exception in a container.
*/
interface ContainerException extends PsrContainerException
{
}

View File

@@ -1,15 +0,0 @@
<?php
/**
* @license http://www.opensource.org/licenses/mit-license.php MIT (see the LICENSE file)
*/
namespace Interop\Container\Exception;
use Psr\Container\NotFoundExceptionInterface as PsrNotFoundException;
/**
* No entry was found in the container.
*/
interface NotFoundException extends ContainerException, PsrNotFoundException
{
}

View File

@@ -1,4 +1,4 @@
[![Build Status](https://travis-ci.org/firebase/php-jwt.png?branch=master)](https://travis-ci.org/firebase/php-jwt)
![Build Status](https://github.com/firebase/php-jwt/actions/workflows/tests.yml/badge.svg)
[![Latest Stable Version](https://poser.pugx.org/firebase/php-jwt/v/stable)](https://packagist.org/packages/firebase/php-jwt)
[![Total Downloads](https://poser.pugx.org/firebase/php-jwt/downloads)](https://packagist.org/packages/firebase/php-jwt)
[![License](https://poser.pugx.org/firebase/php-jwt/license)](https://packagist.org/packages/firebase/php-jwt)
@@ -29,13 +29,13 @@ Example
use Firebase\JWT\JWT;
use Firebase\JWT\Key;
$key = "example_key";
$payload = array(
"iss" => "http://example.org",
"aud" => "http://example.com",
"iat" => 1356999524,
"nbf" => 1357000000
);
$key = 'example_key';
$payload = [
'iss' => 'http://example.org',
'aud' => 'http://example.com',
'iat' => 1356999524,
'nbf' => 1357000000
];
/**
* IMPORTANT:
@@ -98,12 +98,12 @@ ehde/zUxo6UvS7UrBQIDAQAB
-----END PUBLIC KEY-----
EOD;
$payload = array(
"iss" => "example.org",
"aud" => "example.com",
"iat" => 1356999524,
"nbf" => 1357000000
);
$payload = [
'iss' => 'example.org',
'aud' => 'example.com',
'iat' => 1356999524,
'nbf' => 1357000000
];
$jwt = JWT::encode($payload, $privateKey, 'RS256');
echo "Encode:\n" . print_r($jwt, true) . "\n";
@@ -139,12 +139,12 @@ $privateKey = openssl_pkey_get_private(
$passphrase
);
$payload = array(
"iss" => "example.org",
"aud" => "example.com",
"iat" => 1356999524,
"nbf" => 1357000000
);
$payload = [
'iss' => 'example.org',
'aud' => 'example.com',
'iat' => 1356999524,
'nbf' => 1357000000
];
$jwt = JWT::encode($payload, $privateKey, 'RS256');
echo "Encode:\n" . print_r($jwt, true) . "\n";
@@ -173,12 +173,12 @@ $privateKey = base64_encode(sodium_crypto_sign_secretkey($keyPair));
$publicKey = base64_encode(sodium_crypto_sign_publickey($keyPair));
$payload = array(
"iss" => "example.org",
"aud" => "example.com",
"iat" => 1356999524,
"nbf" => 1357000000
);
$payload = [
'iss' => 'example.org',
'aud' => 'example.com',
'iat' => 1356999524,
'nbf' => 1357000000
];
$jwt = JWT::encode($payload, $privateKey, 'EdDSA');
echo "Encode:\n" . print_r($jwt, true) . "\n";
@@ -198,15 +198,93 @@ use Firebase\JWT\JWT;
// this endpoint: https://www.gstatic.com/iap/verify/public_key-jwk
$jwks = ['keys' => []];
// JWK::parseKeySet($jwks) returns an associative array of **kid** to private
// key. Pass this as the second parameter to JWT::decode.
// NOTE: The deprecated $supportedAlgorithm must be supplied when parsing from JWK.
JWT::decode($payload, JWK::parseKeySet($jwks), $supportedAlgorithm);
// JWK::parseKeySet($jwks) returns an associative array of **kid** to Firebase\JWT\Key
// objects. Pass this as the second parameter to JWT::decode.
JWT::decode($payload, JWK::parseKeySet($jwks));
```
Using Cached Key Sets
---------------------
The `CachedKeySet` class can be used to fetch and cache JWKS (JSON Web Key Sets) from a public URI.
This has the following advantages:
1. The results are cached for performance.
2. If an unrecognized key is requested, the cache is refreshed, to accomodate for key rotation.
3. If rate limiting is enabled, the JWKS URI will not make more than 10 requests a second.
```php
use Firebase\JWT\CachedKeySet;
use Firebase\JWT\JWT;
// The URI for the JWKS you wish to cache the results from
$jwksUri = 'https://www.gstatic.com/iap/verify/public_key-jwk';
// Create an HTTP client (can be any PSR-7 compatible HTTP client)
$httpClient = new GuzzleHttp\Client();
// Create an HTTP request factory (can be any PSR-17 compatible HTTP request factory)
$httpFactory = new GuzzleHttp\Psr\HttpFactory();
// Create a cache item pool (can be any PSR-6 compatible cache item pool)
$cacheItemPool = Phpfastcache\CacheManager::getInstance('files');
$keySet = new CachedKeySet(
$jwksUri,
$httpClient,
$httpFactory,
$cacheItemPool,
null, // $expiresAfter int seconds to set the JWKS to expire
true // $rateLimit true to enable rate limit of 10 RPS on lookup of invalid keys
);
$jwt = 'eyJhbGci...'; // Some JWT signed by a key from the $jwkUri above
$decoded = JWT::decode($jwt, $keySet);
```
Miscellaneous
-------------
#### Casting to array
The return value of `JWT::decode` is the generic PHP object `stdClass`. If you'd like to handle with arrays
instead, you can do the following:
```php
// return type is stdClass
$decoded = JWT::decode($payload, $keys);
// cast to array
$decoded = json_decode(json_encode($decoded), true);
```
Changelog
---------
#### 6.3.0 / 2022-07-15
- Added ES256 support to JWK parsing ([#399](https://github.com/firebase/php-jwt/pull/399))
- Fixed potential caching error in `CachedKeySet` by caching jwks as strings ([#435](https://github.com/firebase/php-jwt/pull/435))
#### 6.2.0 / 2022-05-14
- Added `CachedKeySet` ([#397](https://github.com/firebase/php-jwt/pull/397))
- Added `$defaultAlg` parameter to `JWT::parseKey` and `JWT::parseKeySet` ([#426](https://github.com/firebase/php-jwt/pull/426)).
#### 6.1.0 / 2022-03-23
- Drop support for PHP 5.3, 5.4, 5.5, 5.6, and 7.0
- Add parameter typing and return types where possible
#### 6.0.0 / 2022-01-24
- **Backwards-Compatibility Breaking Changes**: See the [Release Notes](https://github.com/firebase/php-jwt/releases/tag/v6.0.0) for more information.
- New Key object to prevent key/algorithm type confusion (#365)
- Add JWK support (#273)
- Add ES256 support (#256)
- Add ES384 support (#324)
- Add Ed25519 support (#343)
#### 5.0.0 / 2017-06-26
- Support RS384 and RS512.
See [#117](https://github.com/firebase/php-jwt/pull/117). Thanks [@joostfaassen](https://github.com/joostfaassen)!

View File

@@ -20,7 +20,7 @@
],
"license": "BSD-3-Clause",
"require": {
"php": ">=5.3.0"
"php": "^7.1||^8.0"
},
"suggest": {
"paragonie/sodium_compat": "Support EdDSA (Ed25519) signatures when libsodium is not present"
@@ -31,6 +31,11 @@
}
},
"require-dev": {
"phpunit/phpunit": ">=4.8 <=9"
"guzzlehttp/guzzle": "^6.5||^7.4",
"phpspec/prophecy-phpunit": "^1.1",
"phpunit/phpunit": "^7.5||^9.5",
"psr/cache": "^1.0||^2.0",
"psr/http-client": "^1.0",
"psr/http-factory": "^1.0"
}
}

View File

@@ -20,12 +20,24 @@ use UnexpectedValueException;
*/
class JWK
{
private const OID = '1.2.840.10045.2.1';
private const ASN1_OBJECT_IDENTIFIER = 0x06;
private const ASN1_SEQUENCE = 0x10; // also defined in JWT
private const ASN1_BIT_STRING = 0x03;
private const EC_CURVES = [
'P-256' => '1.2.840.10045.3.1.7', // Len: 64
// 'P-384' => '1.3.132.0.34', // Len: 96 (not yet supported)
// 'P-521' => '1.3.132.0.35', // Len: 132 (not supported)
];
/**
* Parse a set of JWK keys
*
* @param array $jwks The JSON Web Key Set as an associative array
* @param array<mixed> $jwks The JSON Web Key Set as an associative array
* @param string $defaultAlg The algorithm for the Key object if "alg" is not set in the
* JSON Web Key Set
*
* @return array An associative array that represents the set of keys
* @return array<string, Key> An associative array of key IDs (kid) to Key objects
*
* @throws InvalidArgumentException Provided JWK Set is empty
* @throws UnexpectedValueException Provided JWK Set was invalid
@@ -33,21 +45,22 @@ class JWK
*
* @uses parseKey
*/
public static function parseKeySet(array $jwks)
public static function parseKeySet(array $jwks, string $defaultAlg = null): array
{
$keys = array();
$keys = [];
if (!isset($jwks['keys'])) {
throw new UnexpectedValueException('"keys" member must exist in the JWK Set');
}
if (empty($jwks['keys'])) {
throw new InvalidArgumentException('JWK Set did not contain any keys');
}
foreach ($jwks['keys'] as $k => $v) {
$kid = isset($v['kid']) ? $v['kid'] : $k;
if ($key = self::parseKey($v)) {
$keys[$kid] = $key;
if ($key = self::parseKey($v, $defaultAlg)) {
$keys[(string) $kid] = $key;
}
}
@@ -61,9 +74,11 @@ class JWK
/**
* Parse a JWK key
*
* @param array $jwk An individual JWK
* @param array<mixed> $jwk An individual JWK
* @param string $defaultAlg The algorithm for the Key object if "alg" is not set in the
* JSON Web Key Set
*
* @return resource|array An associative array that represents the key
* @return Key The key object for the JWK
*
* @throws InvalidArgumentException Provided JWK is empty
* @throws UnexpectedValueException Provided JWK was invalid
@@ -71,15 +86,27 @@ class JWK
*
* @uses createPemFromModulusAndExponent
*/
public static function parseKey(array $jwk)
public static function parseKey(array $jwk, string $defaultAlg = null): ?Key
{
if (empty($jwk)) {
throw new InvalidArgumentException('JWK must not be empty');
}
if (!isset($jwk['kty'])) {
throw new UnexpectedValueException('JWK must contain a "kty" parameter');
}
if (!isset($jwk['alg'])) {
if (\is_null($defaultAlg)) {
// The "alg" parameter is optional in a KTY, but an algorithm is required
// for parsing in this library. Use the $defaultAlg parameter when parsing the
// key set in order to prevent this error.
// @see https://datatracker.ietf.org/doc/html/rfc7517#section-4.4
throw new UnexpectedValueException('JWK must contain an "alg" parameter');
}
$jwk['alg'] = $defaultAlg;
}
switch ($jwk['kty']) {
case 'RSA':
if (!empty($jwk['d'])) {
@@ -96,11 +123,72 @@ class JWK
'OpenSSL error: ' . \openssl_error_string()
);
}
return $publicKey;
return new Key($publicKey, $jwk['alg']);
case 'EC':
if (isset($jwk['d'])) {
// The key is actually a private key
throw new UnexpectedValueException('Key data must be for a public key');
}
if (empty($jwk['crv'])) {
throw new UnexpectedValueException('crv not set');
}
if (!isset(self::EC_CURVES[$jwk['crv']])) {
throw new DomainException('Unrecognised or unsupported EC curve');
}
if (empty($jwk['x']) || empty($jwk['y'])) {
throw new UnexpectedValueException('x and y not set');
}
$publicKey = self::createPemFromCrvAndXYCoordinates($jwk['crv'], $jwk['x'], $jwk['y']);
return new Key($publicKey, $jwk['alg']);
default:
// Currently only RSA is supported
break;
}
return null;
}
/**
* Converts the EC JWK values to pem format.
*
* @param string $crv The EC curve (only P-256 is supported)
* @param string $x The EC x-coordinate
* @param string $y The EC y-coordinate
*
* @return string
*/
private static function createPemFromCrvAndXYCoordinates(string $crv, string $x, string $y): string
{
$pem =
self::encodeDER(
self::ASN1_SEQUENCE,
self::encodeDER(
self::ASN1_SEQUENCE,
self::encodeDER(
self::ASN1_OBJECT_IDENTIFIER,
self::encodeOID(self::OID)
)
. self::encodeDER(
self::ASN1_OBJECT_IDENTIFIER,
self::encodeOID(self::EC_CURVES[$crv])
)
) .
self::encodeDER(
self::ASN1_BIT_STRING,
\chr(0x00) . \chr(0x04)
. JWT::urlsafeB64Decode($x)
. JWT::urlsafeB64Decode($y)
)
);
return sprintf(
"-----BEGIN PUBLIC KEY-----\n%s\n-----END PUBLIC KEY-----\n",
wordwrap(base64_encode($pem), 64, "\n", true)
);
}
/**
@@ -113,22 +201,22 @@ class JWK
*
* @uses encodeLength
*/
private static function createPemFromModulusAndExponent($n, $e)
{
$modulus = JWT::urlsafeB64Decode($n);
$publicExponent = JWT::urlsafeB64Decode($e);
private static function createPemFromModulusAndExponent(
string $n,
string $e
): string {
$mod = JWT::urlsafeB64Decode($n);
$exp = JWT::urlsafeB64Decode($e);
$components = array(
'modulus' => \pack('Ca*a*', 2, self::encodeLength(\strlen($modulus)), $modulus),
'publicExponent' => \pack('Ca*a*', 2, self::encodeLength(\strlen($publicExponent)), $publicExponent)
);
$modulus = \pack('Ca*a*', 2, self::encodeLength(\strlen($mod)), $mod);
$publicExponent = \pack('Ca*a*', 2, self::encodeLength(\strlen($exp)), $exp);
$rsaPublicKey = \pack(
'Ca*a*a*',
48,
self::encodeLength(\strlen($components['modulus']) + \strlen($components['publicExponent'])),
$components['modulus'],
$components['publicExponent']
self::encodeLength(\strlen($modulus) + \strlen($publicExponent)),
$modulus,
$publicExponent
);
// sequence(oid(1.2.840.113549.1.1.1), null)) = rsaEncryption.
@@ -143,11 +231,9 @@ class JWK
$rsaOID . $rsaPublicKey
);
$rsaPublicKey = "-----BEGIN PUBLIC KEY-----\r\n" .
return "-----BEGIN PUBLIC KEY-----\r\n" .
\chunk_split(\base64_encode($rsaPublicKey), 64) .
'-----END PUBLIC KEY-----';
return $rsaPublicKey;
}
/**
@@ -159,7 +245,7 @@ class JWK
* @param int $length
* @return string
*/
private static function encodeLength($length)
private static function encodeLength(int $length): string
{
if ($length <= 0x7F) {
return \chr($length);
@@ -169,4 +255,68 @@ class JWK
return \pack('Ca*', 0x80 | \strlen($temp), $temp);
}
/**
* Encodes a value into a DER object.
* Also defined in Firebase\JWT\JWT
*
* @param int $type DER tag
* @param string $value the value to encode
* @return string the encoded object
*/
private static function encodeDER(int $type, string $value): string
{
$tag_header = 0;
if ($type === self::ASN1_SEQUENCE) {
$tag_header |= 0x20;
}
// Type
$der = \chr($tag_header | $type);
// Length
$der .= \chr(\strlen($value));
return $der . $value;
}
/**
* Encodes a string into a DER-encoded OID.
*
* @param string $oid the OID string
* @return string the binary DER-encoded OID
*/
private static function encodeOID(string $oid): string
{
$octets = explode('.', $oid);
// Get the first octet
$first = (int) array_shift($octets);
$second = (int) array_shift($octets);
$oid = \chr($first * 40 + $second);
// Iterate over subsequent octets
foreach ($octets as $octet) {
if ($octet == 0) {
$oid .= \chr(0x00);
continue;
}
$bin = '';
while ($octet) {
$bin .= \chr(0x80 | ($octet & 0x7f));
$octet >>= 7;
}
$bin[0] = $bin[0] & \chr(0x7f);
// Convert to big endian if necessary
if (pack('V', 65534) == pack('L', 65534)) {
$oid .= strrev($bin);
} else {
$oid .= $bin;
}
}
return $oid;
}
}

View File

@@ -3,12 +3,14 @@
namespace Firebase\JWT;
use ArrayAccess;
use DateTime;
use DomainException;
use Exception;
use InvalidArgumentException;
use OpenSSLAsymmetricKey;
use OpenSSLCertificate;
use stdClass;
use UnexpectedValueException;
use DateTime;
/**
* JSON Web Token implementation, based on this spec:
@@ -25,52 +27,57 @@ use DateTime;
*/
class JWT
{
const ASN1_INTEGER = 0x02;
const ASN1_SEQUENCE = 0x10;
const ASN1_BIT_STRING = 0x03;
private const ASN1_INTEGER = 0x02;
private const ASN1_SEQUENCE = 0x10;
private const ASN1_BIT_STRING = 0x03;
/**
* When checking nbf, iat or expiration times,
* we want to provide some extra leeway time to
* account for clock skew.
*
* @var int
*/
public static $leeway = 0;
/**
* Allow the current timestamp to be specified.
* Useful for fixing a value within unit testing.
*
* Will default to PHP time() value if null.
*
* @var ?int
*/
public static $timestamp = null;
public static $supported_algs = array(
'ES384' => array('openssl', 'SHA384'),
'ES256' => array('openssl', 'SHA256'),
'HS256' => array('hash_hmac', 'SHA256'),
'HS384' => array('hash_hmac', 'SHA384'),
'HS512' => array('hash_hmac', 'SHA512'),
'RS256' => array('openssl', 'SHA256'),
'RS384' => array('openssl', 'SHA384'),
'RS512' => array('openssl', 'SHA512'),
'EdDSA' => array('sodium_crypto', 'EdDSA'),
);
/**
* @var array<string, string[]>
*/
public static $supported_algs = [
'ES384' => ['openssl', 'SHA384'],
'ES256' => ['openssl', 'SHA256'],
'HS256' => ['hash_hmac', 'SHA256'],
'HS384' => ['hash_hmac', 'SHA384'],
'HS512' => ['hash_hmac', 'SHA512'],
'RS256' => ['openssl', 'SHA256'],
'RS384' => ['openssl', 'SHA384'],
'RS512' => ['openssl', 'SHA512'],
'EdDSA' => ['sodium_crypto', 'EdDSA'],
];
/**
* Decodes a JWT string into a PHP object.
*
* @param string $jwt The JWT
* @param Key|array<Key>|mixed $keyOrKeyArray The Key or array of Key objects.
* If the algorithm used is asymmetric, this is the public key
* Each Key object contains an algorithm and matching key.
* Supported algorithms are 'ES384','ES256', 'HS256', 'HS384',
* 'HS512', 'RS256', 'RS384', and 'RS512'
* @param array $allowed_algs [DEPRECATED] List of supported verification algorithms. Only
* should be used for backwards compatibility.
* @param string $jwt The JWT
* @param Key|array<string,Key> $keyOrKeyArray The Key or associative array of key IDs (kid) to Key objects.
* If the algorithm used is asymmetric, this is the public key
* Each Key object contains an algorithm and matching key.
* Supported algorithms are 'ES384','ES256', 'HS256', 'HS384',
* 'HS512', 'RS256', 'RS384', and 'RS512'
*
* @return object The JWT's payload as a PHP object
* @return stdClass The JWT's payload as a PHP object
*
* @throws InvalidArgumentException Provided JWT was empty
* @throws InvalidArgumentException Provided key/key-array was empty
* @throws DomainException Provided JWT is malformed
* @throws UnexpectedValueException Provided JWT was invalid
* @throws SignatureInvalidException Provided JWT was invalid because the signature verification failed
* @throws BeforeValidException Provided JWT is trying to be used before it's eligible as defined by 'nbf'
@@ -80,27 +87,37 @@ class JWT
* @uses jsonDecode
* @uses urlsafeB64Decode
*/
public static function decode($jwt, $keyOrKeyArray, array $allowed_algs = array())
{
public static function decode(
string $jwt,
$keyOrKeyArray
): stdClass {
// Validate JWT
$timestamp = \is_null(static::$timestamp) ? \time() : static::$timestamp;
if (empty($keyOrKeyArray)) {
throw new InvalidArgumentException('Key may not be empty');
}
$tks = \explode('.', $jwt);
if (\count($tks) != 3) {
if (\count($tks) !== 3) {
throw new UnexpectedValueException('Wrong number of segments');
}
list($headb64, $bodyb64, $cryptob64) = $tks;
if (null === ($header = static::jsonDecode(static::urlsafeB64Decode($headb64)))) {
$headerRaw = static::urlsafeB64Decode($headb64);
if (null === ($header = static::jsonDecode($headerRaw))) {
throw new UnexpectedValueException('Invalid header encoding');
}
if (null === $payload = static::jsonDecode(static::urlsafeB64Decode($bodyb64))) {
$payloadRaw = static::urlsafeB64Decode($bodyb64);
if (null === ($payload = static::jsonDecode($payloadRaw))) {
throw new UnexpectedValueException('Invalid claims encoding');
}
if (false === ($sig = static::urlsafeB64Decode($cryptob64))) {
throw new UnexpectedValueException('Invalid signature encoding');
if (\is_array($payload)) {
// prevent PHP Fatal Error in edge-cases when payload is empty array
$payload = (object) $payload;
}
if (!$payload instanceof stdClass) {
throw new UnexpectedValueException('Payload must be a JSON object');
}
$sig = static::urlsafeB64Decode($cryptob64);
if (empty($header->alg)) {
throw new UnexpectedValueException('Empty algorithm');
}
@@ -108,31 +125,18 @@ class JWT
throw new UnexpectedValueException('Algorithm not supported');
}
list($keyMaterial, $algorithm) = self::getKeyMaterialAndAlgorithm(
$keyOrKeyArray,
empty($header->kid) ? null : $header->kid
);
$key = self::getKey($keyOrKeyArray, property_exists($header, 'kid') ? $header->kid : null);
if (empty($algorithm)) {
// Use deprecated "allowed_algs" to determine if the algorithm is supported.
// This opens up the possibility of an attack in some implementations.
// @see https://github.com/firebase/php-jwt/issues/351
if (!\in_array($header->alg, $allowed_algs)) {
throw new UnexpectedValueException('Algorithm not allowed');
}
} else {
// Check the algorithm
if (!self::constantTimeEquals($algorithm, $header->alg)) {
// See issue #351
throw new UnexpectedValueException('Incorrect key for this algorithm');
}
// Check the algorithm
if (!self::constantTimeEquals($key->getAlgorithm(), $header->alg)) {
// See issue #351
throw new UnexpectedValueException('Incorrect key for this algorithm');
}
if ($header->alg === 'ES256' || $header->alg === 'ES384') {
// OpenSSL expects an ASN.1 DER sequence for ES256/ES384 signatures
$sig = self::signatureToDER($sig);
}
if (!static::verify("$headb64.$bodyb64", $sig, $keyMaterial, $header->alg)) {
if (!self::verify("${headb64}.${bodyb64}", $sig, $key->getKeyMaterial(), $header->alg)) {
throw new SignatureInvalidException('Signature verification failed');
}
@@ -164,32 +168,35 @@ class JWT
/**
* Converts and signs a PHP object or array into a JWT string.
*
* @param object|array $payload PHP object or array
* @param string|resource $key The secret key.
* If the algorithm used is asymmetric, this is the private key
* @param string $alg The signing algorithm.
* Supported algorithms are 'ES384','ES256', 'HS256', 'HS384',
* 'HS512', 'RS256', 'RS384', and 'RS512'
* @param mixed $keyId
* @param array $head An array with header elements to attach
* @param array<mixed> $payload PHP array
* @param string|resource|OpenSSLAsymmetricKey|OpenSSLCertificate $key The secret key.
* @param string $alg Supported algorithms are 'ES384','ES256', 'HS256', 'HS384',
* 'HS512', 'RS256', 'RS384', and 'RS512'
* @param string $keyId
* @param array<string, string> $head An array with header elements to attach
*
* @return string A signed JWT
*
* @uses jsonEncode
* @uses urlsafeB64Encode
*/
public static function encode($payload, $key, $alg = 'HS256', $keyId = null, $head = null)
{
$header = array('typ' => 'JWT', 'alg' => $alg);
public static function encode(
array $payload,
$key,
string $alg,
string $keyId = null,
array $head = null
): string {
$header = ['typ' => 'JWT', 'alg' => $alg];
if ($keyId !== null) {
$header['kid'] = $keyId;
}
if (isset($head) && \is_array($head)) {
$header = \array_merge($head, $header);
}
$segments = array();
$segments[] = static::urlsafeB64Encode(static::jsonEncode($header));
$segments[] = static::urlsafeB64Encode(static::jsonEncode($payload));
$segments = [];
$segments[] = static::urlsafeB64Encode((string) static::jsonEncode($header));
$segments[] = static::urlsafeB64Encode((string) static::jsonEncode($payload));
$signing_input = \implode('.', $segments);
$signature = static::sign($signing_input, $key, $alg);
@@ -201,30 +208,35 @@ class JWT
/**
* Sign a string with a given key and algorithm.
*
* @param string $msg The message to sign
* @param string|resource $key The secret key
* @param string $alg The signing algorithm.
* Supported algorithms are 'ES384','ES256', 'HS256', 'HS384',
* 'HS512', 'RS256', 'RS384', and 'RS512'
* @param string $msg The message to sign
* @param string|resource|OpenSSLAsymmetricKey|OpenSSLCertificate $key The secret key.
* @param string $alg Supported algorithms are 'ES384','ES256', 'HS256', 'HS384',
* 'HS512', 'RS256', 'RS384', and 'RS512'
*
* @return string An encrypted message
*
* @throws DomainException Unsupported algorithm or bad key was specified
*/
public static function sign($msg, $key, $alg = 'HS256')
{
public static function sign(
string $msg,
$key,
string $alg
): string {
if (empty(static::$supported_algs[$alg])) {
throw new DomainException('Algorithm not supported');
}
list($function, $algorithm) = static::$supported_algs[$alg];
switch ($function) {
case 'hash_hmac':
if (!\is_string($key)) {
throw new InvalidArgumentException('key must be a string when using hmac');
}
return \hash_hmac($algorithm, $msg, $key, true);
case 'openssl':
$signature = '';
$success = \openssl_sign($msg, $signature, $key, $algorithm);
$success = \openssl_sign($msg, $signature, $key, $algorithm); // @phpstan-ignore-line
if (!$success) {
throw new DomainException("OpenSSL unable to sign data");
throw new DomainException('OpenSSL unable to sign data');
}
if ($alg === 'ES256') {
$signature = self::signatureFromDER($signature, 256);
@@ -233,35 +245,44 @@ class JWT
}
return $signature;
case 'sodium_crypto':
if (!function_exists('sodium_crypto_sign_detached')) {
if (!\function_exists('sodium_crypto_sign_detached')) {
throw new DomainException('libsodium is not available');
}
if (!\is_string($key)) {
throw new InvalidArgumentException('key must be a string when using EdDSA');
}
try {
// The last non-empty line is used as the key.
$lines = array_filter(explode("\n", $key));
$key = base64_decode(end($lines));
$key = base64_decode((string) end($lines));
return sodium_crypto_sign_detached($msg, $key);
} catch (Exception $e) {
throw new DomainException($e->getMessage(), 0, $e);
}
}
throw new DomainException('Algorithm not supported');
}
/**
* Verify a signature with the message, key and method. Not all methods
* are symmetric, so we must have a separate verify and sign method.
*
* @param string $msg The original message (header and body)
* @param string $signature The original signature
* @param string|resource $key For HS*, a string key works. for RS*, must be a resource of an openssl public key
* @param string $alg The algorithm
* @param string $msg The original message (header and body)
* @param string $signature The original signature
* @param string|resource|OpenSSLAsymmetricKey|OpenSSLCertificate $keyMaterial For HS*, a string key works. for RS*, must be an instance of OpenSSLAsymmetricKey
* @param string $alg The algorithm
*
* @return bool
*
* @throws DomainException Invalid Algorithm, bad key, or OpenSSL failure
*/
private static function verify($msg, $signature, $key, $alg)
{
private static function verify(
string $msg,
string $signature,
$keyMaterial,
string $alg
): bool {
if (empty(static::$supported_algs[$alg])) {
throw new DomainException('Algorithm not supported');
}
@@ -269,10 +290,11 @@ class JWT
list($function, $algorithm) = static::$supported_algs[$alg];
switch ($function) {
case 'openssl':
$success = \openssl_verify($msg, $signature, $key, $algorithm);
$success = \openssl_verify($msg, $signature, $keyMaterial, $algorithm); // @phpstan-ignore-line
if ($success === 1) {
return true;
} elseif ($success === 0) {
}
if ($success === 0) {
return false;
}
// returns 1 on success, 0 on failure, -1 on error.
@@ -280,21 +302,27 @@ class JWT
'OpenSSL error: ' . \openssl_error_string()
);
case 'sodium_crypto':
if (!function_exists('sodium_crypto_sign_verify_detached')) {
throw new DomainException('libsodium is not available');
}
try {
// The last non-empty line is used as the key.
$lines = array_filter(explode("\n", $key));
$key = base64_decode(end($lines));
return sodium_crypto_sign_verify_detached($signature, $msg, $key);
} catch (Exception $e) {
throw new DomainException($e->getMessage(), 0, $e);
}
if (!\function_exists('sodium_crypto_sign_verify_detached')) {
throw new DomainException('libsodium is not available');
}
if (!\is_string($keyMaterial)) {
throw new InvalidArgumentException('key must be a string when using EdDSA');
}
try {
// The last non-empty line is used as the key.
$lines = array_filter(explode("\n", $keyMaterial));
$key = base64_decode((string) end($lines));
return sodium_crypto_sign_verify_detached($signature, $msg, $key);
} catch (Exception $e) {
throw new DomainException($e->getMessage(), 0, $e);
}
case 'hash_hmac':
default:
$hash = \hash_hmac($algorithm, $msg, $key, true);
return self::constantTimeEquals($signature, $hash);
if (!\is_string($keyMaterial)) {
throw new InvalidArgumentException('key must be a string when using hmac');
}
$hash = \hash_hmac($algorithm, $msg, $keyMaterial, true);
return self::constantTimeEquals($hash, $signature);
}
}
@@ -303,30 +331,16 @@ class JWT
*
* @param string $input JSON string
*
* @return object Object representation of JSON string
* @return mixed The decoded JSON string
*
* @throws DomainException Provided string was invalid JSON
*/
public static function jsonDecode($input)
public static function jsonDecode(string $input)
{
if (\version_compare(PHP_VERSION, '5.4.0', '>=') && !(\defined('JSON_C_VERSION') && PHP_INT_SIZE > 4)) {
/** In PHP >=5.4.0, json_decode() accepts an options parameter, that allows you
* to specify that large ints (like Steam Transaction IDs) should be treated as
* strings, rather than the PHP default behaviour of converting them to floats.
*/
$obj = \json_decode($input, false, 512, JSON_BIGINT_AS_STRING);
} else {
/** Not all servers will support that, however, so for older versions we must
* manually detect large ints in the JSON string and quote them (thus converting
*them to strings) before decoding, hence the preg_replace() call.
*/
$max_int_length = \strlen((string) PHP_INT_MAX) - 1;
$json_without_bigints = \preg_replace('/:\s*(-?\d{'.$max_int_length.',})/', ': "$1"', $input);
$obj = \json_decode($json_without_bigints);
}
$obj = \json_decode($input, false, 512, JSON_BIGINT_AS_STRING);
if ($errno = \json_last_error()) {
static::handleJsonError($errno);
self::handleJsonError($errno);
} elseif ($obj === null && $input !== 'null') {
throw new DomainException('Null result with non-null input');
}
@@ -334,22 +348,30 @@ class JWT
}
/**
* Encode a PHP object into a JSON string.
* Encode a PHP array into a JSON string.
*
* @param object|array $input A PHP object or array
* @param array<mixed> $input A PHP array
*
* @return string JSON representation of the PHP object or array
* @return string JSON representation of the PHP array
*
* @throws DomainException Provided object could not be encoded to valid JSON
*/
public static function jsonEncode($input)
public static function jsonEncode(array $input): string
{
$json = \json_encode($input);
if (PHP_VERSION_ID >= 50400) {
$json = \json_encode($input, \JSON_UNESCAPED_SLASHES);
} else {
// PHP 5.3 only
$json = \json_encode($input);
}
if ($errno = \json_last_error()) {
static::handleJsonError($errno);
self::handleJsonError($errno);
} elseif ($json === 'null' && $input !== null) {
throw new DomainException('Null result with non-null input');
}
if ($json === false) {
throw new DomainException('Provided object could not be encoded to valid JSON');
}
return $json;
}
@@ -359,8 +381,10 @@ class JWT
* @param string $input A Base64 encoded string
*
* @return string A decoded string
*
* @throws InvalidArgumentException invalid base64 characters
*/
public static function urlsafeB64Decode($input)
public static function urlsafeB64Decode(string $input): string
{
$remainder = \strlen($input) % 4;
if ($remainder) {
@@ -377,7 +401,7 @@ class JWT
*
* @return string The base64 encode of what you passed in
*/
public static function urlsafeB64Encode($input)
public static function urlsafeB64Encode(string $input): string
{
return \str_replace('=', '', \strtr(\base64_encode($input), '+/', '-_'));
}
@@ -386,67 +410,53 @@ class JWT
/**
* Determine if an algorithm has been provided for each Key
*
* @param Key|array<Key>|mixed $keyOrKeyArray
* @param string|null $kid
* @param Key|ArrayAccess<string,Key>|array<string,Key> $keyOrKeyArray
* @param string|null $kid
*
* @throws UnexpectedValueException
*
* @return array containing the keyMaterial and algorithm
* @return Key
*/
private static function getKeyMaterialAndAlgorithm($keyOrKeyArray, $kid = null)
{
if (
is_string($keyOrKeyArray)
|| is_resource($keyOrKeyArray)
|| $keyOrKeyArray instanceof OpenSSLAsymmetricKey
) {
return array($keyOrKeyArray, null);
}
private static function getKey(
$keyOrKeyArray,
?string $kid
): Key {
if ($keyOrKeyArray instanceof Key) {
return array($keyOrKeyArray->getKeyMaterial(), $keyOrKeyArray->getAlgorithm());
return $keyOrKeyArray;
}
if (is_array($keyOrKeyArray) || $keyOrKeyArray instanceof ArrayAccess) {
if (!isset($kid)) {
throw new UnexpectedValueException('"kid" empty, unable to lookup correct key');
}
if (!isset($keyOrKeyArray[$kid])) {
throw new UnexpectedValueException('"kid" invalid, unable to lookup correct key');
}
$key = $keyOrKeyArray[$kid];
if ($key instanceof Key) {
return array($key->getKeyMaterial(), $key->getAlgorithm());
}
return array($key, null);
if ($keyOrKeyArray instanceof CachedKeySet) {
// Skip "isset" check, as this will automatically refresh if not set
return $keyOrKeyArray[$kid];
}
throw new UnexpectedValueException(
'$keyOrKeyArray must be a string|resource key, an array of string|resource keys, '
. 'an instance of Firebase\JWT\Key key or an array of Firebase\JWT\Key keys'
);
if (empty($kid)) {
throw new UnexpectedValueException('"kid" empty, unable to lookup correct key');
}
if (!isset($keyOrKeyArray[$kid])) {
throw new UnexpectedValueException('"kid" invalid, unable to lookup correct key');
}
return $keyOrKeyArray[$kid];
}
/**
* @param string $left
* @param string $right
* @param string $left The string of known length to compare against
* @param string $right The user-supplied string
* @return bool
*/
public static function constantTimeEquals($left, $right)
public static function constantTimeEquals(string $left, string $right): bool
{
if (\function_exists('hash_equals')) {
return \hash_equals($left, $right);
}
$len = \min(static::safeStrlen($left), static::safeStrlen($right));
$len = \min(self::safeStrlen($left), self::safeStrlen($right));
$status = 0;
for ($i = 0; $i < $len; $i++) {
$status |= (\ord($left[$i]) ^ \ord($right[$i]));
}
$status |= (static::safeStrlen($left) ^ static::safeStrlen($right));
$status |= (self::safeStrlen($left) ^ self::safeStrlen($right));
return ($status === 0);
}
@@ -456,17 +466,19 @@ class JWT
*
* @param int $errno An error number from json_last_error()
*
* @throws DomainException
*
* @return void
*/
private static function handleJsonError($errno)
private static function handleJsonError(int $errno): void
{
$messages = array(
$messages = [
JSON_ERROR_DEPTH => 'Maximum stack depth exceeded',
JSON_ERROR_STATE_MISMATCH => 'Invalid or malformed JSON',
JSON_ERROR_CTRL_CHAR => 'Unexpected control character found',
JSON_ERROR_SYNTAX => 'Syntax error, malformed JSON',
JSON_ERROR_UTF8 => 'Malformed UTF-8 characters' //PHP >= 5.3.3
);
];
throw new DomainException(
isset($messages[$errno])
? $messages[$errno]
@@ -481,7 +493,7 @@ class JWT
*
* @return int
*/
private static function safeStrlen($str)
private static function safeStrlen(string $str): int
{
if (\function_exists('mb_strlen')) {
return \mb_strlen($str, '8bit');
@@ -495,10 +507,11 @@ class JWT
* @param string $sig The ECDSA signature to convert
* @return string The encoded DER object
*/
private static function signatureToDER($sig)
private static function signatureToDER(string $sig): string
{
// Separate the signature into r-value and s-value
list($r, $s) = \str_split($sig, (int) (\strlen($sig) / 2));
$length = max(1, (int) (\strlen($sig) / 2));
list($r, $s) = \str_split($sig, $length);
// Trim leading zeros
$r = \ltrim($r, "\x00");
@@ -525,9 +538,10 @@ class JWT
*
* @param int $type DER tag
* @param string $value the value to encode
*
* @return string the encoded object
*/
private static function encodeDER($type, $value)
private static function encodeDER(int $type, string $value): string
{
$tag_header = 0;
if ($type === self::ASN1_SEQUENCE) {
@@ -548,9 +562,10 @@ class JWT
*
* @param string $der binary signature in DER format
* @param int $keySize the number of bits in the key
*
* @return string the signature
*/
private static function signatureFromDER($der, $keySize)
private static function signatureFromDER(string $der, int $keySize): string
{
// OpenSSL returns the ECDSA signatures as a binary ASN.1 DER SEQUENCE
list($offset, $_) = self::readDER($der);
@@ -575,9 +590,10 @@ class JWT
* @param string $der the binary data in DER format
* @param int $offset the offset of the data stream containing the object
* to decode
* @return array [$offset, $data] the new offset and the decoded object
*
* @return array{int, string|null} the new offset and the decoded object
*/
private static function readDER($der, $offset = 0)
private static function readDER(string $der, int $offset = 0): array
{
$pos = $offset;
$size = \strlen($der);
@@ -595,7 +611,7 @@ class JWT
}
// Value
if ($type == self::ASN1_BIT_STRING) {
if ($type === self::ASN1_BIT_STRING) {
$pos++; // Skip the first contents octet (padding indicator)
$data = \substr($der, $pos, $len - 1);
$pos += $len - 1;
@@ -606,6 +622,6 @@ class JWT
$data = null;
}
return array($pos, $data);
return [$pos, $data];
}
}

View File

@@ -4,37 +4,42 @@ namespace Firebase\JWT;
use InvalidArgumentException;
use OpenSSLAsymmetricKey;
use OpenSSLCertificate;
use TypeError;
class Key
{
/** @var string $algorithm */
/** @var string|resource|OpenSSLAsymmetricKey|OpenSSLCertificate */
private $keyMaterial;
/** @var string */
private $algorithm;
/** @var string|resource|OpenSSLAsymmetricKey $keyMaterial */
private $keyMaterial;
/**
* @param string|resource|OpenSSLAsymmetricKey $keyMaterial
* @param string|resource|OpenSSLAsymmetricKey|OpenSSLCertificate $keyMaterial
* @param string $algorithm
*/
public function __construct($keyMaterial, $algorithm)
{
public function __construct(
$keyMaterial,
string $algorithm
) {
if (
!is_string($keyMaterial)
&& !is_resource($keyMaterial)
!\is_string($keyMaterial)
&& !$keyMaterial instanceof OpenSSLAsymmetricKey
&& !$keyMaterial instanceof OpenSSLCertificate
&& !\is_resource($keyMaterial)
) {
throw new InvalidArgumentException('Type error: $keyMaterial must be a string, resource, or OpenSSLAsymmetricKey');
throw new TypeError('Key material must be a string, resource, or OpenSSLAsymmetricKey');
}
if (empty($keyMaterial)) {
throw new InvalidArgumentException('Type error: $keyMaterial must not be empty');
throw new InvalidArgumentException('Key material must not be empty');
}
if (!is_string($algorithm)|| empty($keyMaterial)) {
throw new InvalidArgumentException('Type error: $algorithm must be a string');
if (empty($algorithm)) {
throw new InvalidArgumentException('Algorithm must not be empty');
}
// TODO: Remove in PHP 8.0 in favor of class constructor property promotion
$this->keyMaterial = $keyMaterial;
$this->algorithm = $algorithm;
}
@@ -44,13 +49,13 @@ class Key
*
* @return string
*/
public function getAlgorithm()
public function getAlgorithm(): string
{
return $this->algorithm;
}
/**
* @return string|resource|OpenSSLAsymmetricKey
* @return string|resource|OpenSSLAsymmetricKey|OpenSSLCertificate
*/
public function getKeyMaterial()
{

View File

@@ -1,2 +0,0 @@
github: [Nyholm, GrahamCampbell]
tidelift: "packagist/guzzlehttp/psr7"

View File

@@ -1,14 +0,0 @@
daysUntilStale: 120
daysUntilClose: 14
exemptLabels:
- lifecycle/keep-open
- lifecycle/ready-for-merge
# Label to use when marking an issue as stale
staleLabel: lifecycle/stale
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed after 2 weeks if no further activity occurs. Thank you
for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false

View File

@@ -1,34 +0,0 @@
name: CI
on:
pull_request:
jobs:
build:
name: Build
runs-on: ubuntu-latest
strategy:
max-parallel: 10
matrix:
php: ['5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1']
steps:
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: 'none'
extensions: mbstring
- name: Checkout code
uses: actions/checkout@v2
- name: Mimic PHP 8.0
run: composer config platform.php 8.0.999
if: matrix.php > 8
- name: Install dependencies
run: composer update --no-interaction --no-progress
- name: Run tests
run: make test

View File

@@ -1,37 +0,0 @@
name: Integration
on:
pull_request:
jobs:
build:
name: Test
runs-on: ubuntu-latest
strategy:
max-parallel: 10
matrix:
php: ['7.2', '7.3', '7.4', '8.0']
steps:
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none
- name: Checkout code
uses: actions/checkout@v2
- name: Download dependencies
uses: ramsey/composer-install@v1
with:
composer-options: --no-interaction --optimize-autoloader
- name: Start server
run: php -S 127.0.0.1:10002 tests/Integration/server.php &
- name: Run tests
env:
TEST_SERVER: 127.0.0.1:10002
run: ./vendor/bin/phpunit --testsuite Integration

View File

@@ -1,29 +0,0 @@
name: Static analysis
on:
pull_request:
jobs:
php-cs-fixer:
name: PHP-CS-Fixer
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
coverage: none
extensions: mbstring
- name: Download dependencies
run: composer update --no-interaction --no-progress
- name: Download PHP CS Fixer
run: composer require "friendsofphp/php-cs-fixer:2.18.4"
- name: Execute PHP CS Fixer
run: vendor/bin/php-cs-fixer fix --diff-format udiff --dry-run

View File

@@ -1,56 +0,0 @@
<?php
$config = PhpCsFixer\Config::create()
->setRiskyAllowed(true)
->setRules([
'@PSR2' => true,
'array_syntax' => ['syntax' => 'short'],
'concat_space' => ['spacing' => 'one'],
'declare_strict_types' => false,
'final_static_access' => true,
'fully_qualified_strict_types' => true,
'header_comment' => false,
'is_null' => ['use_yoda_style' => true],
'list_syntax' => ['syntax' => 'long'],
'lowercase_cast' => true,
'magic_method_casing' => true,
'modernize_types_casting' => true,
'multiline_comment_opening_closing' => true,
'no_alias_functions' => true,
'no_alternative_syntax' => true,
'no_blank_lines_after_phpdoc' => true,
'no_empty_comment' => true,
'no_empty_phpdoc' => true,
'no_empty_statement' => true,
'no_extra_blank_lines' => true,
'no_leading_import_slash' => true,
'no_trailing_comma_in_singleline_array' => true,
'no_unset_cast' => true,
'no_unused_imports' => true,
'no_whitespace_in_blank_line' => true,
'ordered_imports' => true,
'php_unit_ordered_covers' => true,
'php_unit_test_annotation' => ['style' => 'prefix'],
'php_unit_test_case_static_method_calls' => ['call_type' => 'self'],
'phpdoc_align' => ['align' => 'vertical'],
'phpdoc_no_useless_inheritdoc' => true,
'phpdoc_scalar' => true,
'phpdoc_separation' => true,
'phpdoc_single_line_var_spacing' => true,
'phpdoc_trim' => true,
'phpdoc_trim_consecutive_blank_line_separation' => true,
'phpdoc_types' => true,
'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'],
'phpdoc_var_without_name' => true,
'single_trait_insert_per_statement' => true,
'standardize_not_equals' => true,
])
->setFinder(
PhpCsFixer\Finder::create()
->in(__DIR__.'/src')
->in(__DIR__.'/tests')
->name('*.php')
)
;
return $config;

View File

@@ -1,44 +1,104 @@
# Change Log
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased
## 1.9.0 - 2022-06-20
## 2.4.0 - 2022-06-20
### Added
- Added provisional PHP 8.2 support
- Added `UriComparator::isCrossOrigin` method
## 1.8.5 - 2022-03-20
## 2.3.0 - 2022-06-09
### Fixed
- Added `Header::splitList` method
- Added `Utils::tryGetContents` method
- Improved `Stream::getContents` method
- Updated mimetype mappings
## 2.2.2 - 2022-06-08
### Fixed
- Fix `Message::parseRequestUri` for numeric headers
- Re-wrap exceptions thrown in `fread` into runtime exceptions
- Throw an exception when multipart options is misformatted
## 2.2.1 - 2022-03-20
### Fixed
- Correct header value validation
## 1.8.4 - 2022-03-20
## 2.2.0 - 2022-03-20
### Added
- A more compressive list of mime types
- Add JsonSerializable to Uri
- Missing return types
### Fixed
- Bug MultipartStream no `uri` metadata
- Bug MultipartStream with filename for `data://` streams
- Fixed new line handling in MultipartStream
- Reduced RAM usage when copying streams
- Updated parsing in `Header::normalize()`
## 2.1.1 - 2022-03-20
### Fixed
- Validate header values properly
## 1.8.3 - 2021-10-05
## 2.1.0 - 2021-10-06
### Changed
- Attempting to create a `Uri` object from a malformed URI will no longer throw a generic
`InvalidArgumentException`, but rather a `MalformedUriException`, which inherits from the former
for backwards compatibility. Callers relying on the exception being thrown to detect invalid
URIs should catch the new exception.
### Fixed
- Return `null` in caching stream size if remote size is `null`
## 1.8.2 - 2021-04-26
## 2.0.0 - 2021-06-30
Identical to the RC release.
## 2.0.0@RC-1 - 2021-04-29
### Fixed
- Handle possibly unset `url` in `stream_get_meta_data`
## 2.0.0@beta-1 - 2021-03-21
### Added
- PSR-17 factories
- Made classes final
- PHP7 type hints
### Changed
- When building a query string, booleans are represented as 1 and 0.
### Removed
- PHP < 7.2 support
- All functions in the Guzzle\Psr7 namespace
## 1.8.1 - 2021-03-21
### Fixed

View File

@@ -4,8 +4,8 @@ This repository contains a full [PSR-7](https://www.php-fig.org/psr/psr-7/)
message implementation, several stream decorators, and some helpful
functionality like query string parsing.
[![Build Status](https://travis-ci.org/guzzle/psr7.svg?branch=master)](https://travis-ci.org/guzzle/psr7)
![CI](https://github.com/guzzle/psr7/workflows/CI/badge.svg)
![Static analysis](https://github.com/guzzle/psr7/workflows/Static%20analysis/badge.svg)
# Stream implementation
@@ -130,10 +130,9 @@ $fnStream->rewind();
`GuzzleHttp\Psr7\InflateStream`
Uses PHP's zlib.inflate filter to inflate deflate or gzipped content.
Uses PHP's zlib.inflate filter to inflate zlib (HTTP deflate, RFC1950) or gzipped (RFC1952) content.
This stream decorator skips the first 10 bytes of the given stream to remove
the gzip header, converts the provided stream to a PHP stream resource,
This stream decorator converts the provided stream to a PHP stream resource,
then appends the zlib.inflate filter. The stream is then converted back
to a Guzzle stream resource to be used as a Guzzle stream.
@@ -528,6 +527,17 @@ When fopen fails, PHP normally raises a warning. This function adds an
error handler that checks for errors and throws an exception instead.
## `GuzzleHttp\Psr7\Utils::tryGetContents`
`public static function tryGetContents(resource $stream): string`
Safely gets the contents of a given stream.
When stream_get_contents fails, PHP normally raises a warning. This
function adds an error handler that checks for errors and throws an
exception instead.
## `GuzzleHttp\Psr7\Utils::uriFor`
`public static function uriFor(string|UriInterface $uri): UriInterface`
@@ -555,7 +565,7 @@ Maps a file extensions to a mimetype.
## Upgrading from Function API
The static API was first introduced in 1.7.0, in order to mitigate problems with functions conflicting between global and local copies of the package. The function API will be removed in 2.0.0. A migration table has been provided here for your convenience:
The static API was first introduced in 1.7.0, in order to mitigate problems with functions conflicting between global and local copies of the package. The function API was removed in 2.0.0. A migration table has been provided here for your convenience:
| Original Function | Replacement Method |
|----------------|----------------|

View File

@@ -1,7 +1,16 @@
{
"name": "guzzlehttp/psr7",
"description": "PSR-7 message implementation that also provides common utility methods",
"keywords": ["request", "response", "message", "stream", "http", "uri", "url", "psr-7"],
"keywords": [
"request",
"response",
"message",
"stream",
"http",
"uri",
"url",
"psr-7"
],
"license": "MIT",
"authors": [
{
@@ -33,28 +42,35 @@
"name": "Tobias Schultze",
"email": "webmaster@tubo-world.de",
"homepage": "https://github.com/Tobion"
},
{
"name": "Márk Sági-Kazár",
"email": "mark.sagikazar@gmail.com",
"homepage": "https://sagikazarmark.hu"
}
],
"require": {
"php": ">=5.4.0",
"psr/http-message": "~1.0",
"ralouphie/getallheaders": "^2.0.5 || ^3.0.0"
},
"require-dev": {
"phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.8 || ^9.3.10",
"ext-zlib": "*"
"php": "^7.2.5 || ^8.0",
"psr/http-factory": "^1.0",
"psr/http-message": "^1.0",
"ralouphie/getallheaders": "^3.0"
},
"provide": {
"psr/http-factory-implementation": "1.0",
"psr/http-message-implementation": "1.0"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.4.1",
"http-interop/http-factory-tests": "^0.9",
"phpunit/phpunit": "^8.5.8 || ^9.3.10"
},
"suggest": {
"laminas/laminas-httphandlerrunner": "Emit PSR-7 responses"
},
"autoload": {
"psr-4": {
"GuzzleHttp\\Psr7\\": "src/"
},
"files": ["src/functions_include.php"]
}
},
"autoload-dev": {
"psr-4": {
@@ -63,14 +79,14 @@
},
"extra": {
"branch-alias": {
"dev-master": "1.9-dev"
"dev-master": "2.4-dev"
}
},
"config": {
"preferred-install": "dist",
"sort-packages": true,
"allow-plugins": {
"bamarni/composer-bin-plugin": true
}
},
"preferred-install": "dist",
"sort-packages": true
}
}

View File

@@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace GuzzleHttp\Psr7;
use Psr\Http\Message\StreamInterface;
@@ -8,16 +10,19 @@ use Psr\Http\Message\StreamInterface;
* Reads from multiple streams, one after the other.
*
* This is a read-only stream decorator.
*
* @final
*/
class AppendStream implements StreamInterface
final class AppendStream implements StreamInterface
{
/** @var StreamInterface[] Streams being decorated */
private $streams = [];
/** @var bool */
private $seekable = true;
/** @var int */
private $current = 0;
/** @var int */
private $pos = 0;
/**
@@ -31,12 +36,16 @@ class AppendStream implements StreamInterface
}
}
public function __toString()
public function __toString(): string
{
try {
$this->rewind();
return $this->getContents();
} catch (\Exception $e) {
} catch (\Throwable $e) {
if (\PHP_VERSION_ID >= 70400) {
throw $e;
}
trigger_error(sprintf('%s::__toString exception: %s', self::class, (string) $e), E_USER_ERROR);
return '';
}
}
@@ -48,7 +57,7 @@ class AppendStream implements StreamInterface
*
* @throws \InvalidArgumentException if the stream is not readable
*/
public function addStream(StreamInterface $stream)
public function addStream(StreamInterface $stream): void
{
if (!$stream->isReadable()) {
throw new \InvalidArgumentException('Each stream must be readable');
@@ -62,17 +71,15 @@ class AppendStream implements StreamInterface
$this->streams[] = $stream;
}
public function getContents()
public function getContents(): string
{
return Utils::copyToString($this);
}
/**
* Closes each attached stream.
*
* {@inheritdoc}
*/
public function close()
public function close(): void
{
$this->pos = $this->current = 0;
$this->seekable = true;
@@ -88,8 +95,6 @@ class AppendStream implements StreamInterface
* Detaches each attached stream.
*
* Returns null as it's not clear which underlying stream resource to return.
*
* {@inheritdoc}
*/
public function detach()
{
@@ -105,7 +110,7 @@ class AppendStream implements StreamInterface
return null;
}
public function tell()
public function tell(): int
{
return $this->pos;
}
@@ -115,10 +120,8 @@ class AppendStream implements StreamInterface
*
* If any of the streams do not return a valid number, then the size of the
* append stream cannot be determined and null is returned.
*
* {@inheritdoc}
*/
public function getSize()
public function getSize(): ?int
{
$size = 0;
@@ -133,24 +136,22 @@ class AppendStream implements StreamInterface
return $size;
}
public function eof()
public function eof(): bool
{
return !$this->streams ||
($this->current >= count($this->streams) - 1 &&
$this->streams[$this->current]->eof());
}
public function rewind()
public function rewind(): void
{
$this->seek(0);
}
/**
* Attempts to seek to the given position. Only supports SEEK_SET.
*
* {@inheritdoc}
*/
public function seek($offset, $whence = SEEK_SET)
public function seek($offset, $whence = SEEK_SET): void
{
if (!$this->seekable) {
throw new \RuntimeException('This AppendStream is not seekable');
@@ -181,10 +182,8 @@ class AppendStream implements StreamInterface
/**
* Reads from all of the appended streams until the length is met or EOF.
*
* {@inheritdoc}
*/
public function read($length)
public function read($length): string
{
$buffer = '';
$total = count($this->streams) - 1;
@@ -204,8 +203,7 @@ class AppendStream implements StreamInterface
$result = $this->streams[$this->current]->read($remaining);
// Using a loose comparison here to match on '', false, and null
if ($result == null) {
if ($result === '') {
$progressToNext = true;
continue;
}
@@ -219,26 +217,31 @@ class AppendStream implements StreamInterface
return $buffer;
}
public function isReadable()
public function isReadable(): bool
{
return true;
}
public function isWritable()
public function isWritable(): bool
{
return false;
}
public function isSeekable()
public function isSeekable(): bool
{
return $this->seekable;
}
public function write($string)
public function write($string): int
{
throw new \RuntimeException('Cannot write to an AppendStream');
}
/**
* {@inheritdoc}
*
* @return mixed
*/
public function getMetadata($key = null)
{
return $key ? null : [];

View File

@@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace GuzzleHttp\Psr7;
use Psr\Http\Message\StreamInterface;
@@ -11,32 +13,33 @@ use Psr\Http\Message\StreamInterface;
* This stream returns a "hwm" metadata value that tells upstream consumers
* what the configured high water mark of the stream is, or the maximum
* preferred size of the buffer.
*
* @final
*/
class BufferStream implements StreamInterface
final class BufferStream implements StreamInterface
{
/** @var int */
private $hwm;
/** @var string */
private $buffer = '';
/**
* @param int $hwm High water mark, representing the preferred maximum
* buffer size. If the size of the buffer exceeds the high
* water mark, then calls to write will continue to succeed
* but will return false to inform writers to slow down
* but will return 0 to inform writers to slow down
* until the buffer has been drained by reading from it.
*/
public function __construct($hwm = 16384)
public function __construct(int $hwm = 16384)
{
$this->hwm = $hwm;
}
public function __toString()
public function __toString(): string
{
return $this->getContents();
}
public function getContents()
public function getContents(): string
{
$buffer = $this->buffer;
$this->buffer = '';
@@ -44,7 +47,7 @@ class BufferStream implements StreamInterface
return $buffer;
}
public function close()
public function close(): void
{
$this->buffer = '';
}
@@ -56,42 +59,42 @@ class BufferStream implements StreamInterface
return null;
}
public function getSize()
public function getSize(): ?int
{
return strlen($this->buffer);
}
public function isReadable()
public function isReadable(): bool
{
return true;
}
public function isWritable()
public function isWritable(): bool
{
return true;
}
public function isSeekable()
public function isSeekable(): bool
{
return false;
}
public function rewind()
public function rewind(): void
{
$this->seek(0);
}
public function seek($offset, $whence = SEEK_SET)
public function seek($offset, $whence = SEEK_SET): void
{
throw new \RuntimeException('Cannot seek a BufferStream');
}
public function eof()
public function eof(): bool
{
return strlen($this->buffer) === 0;
}
public function tell()
public function tell(): int
{
throw new \RuntimeException('Cannot determine the position of a BufferStream');
}
@@ -99,7 +102,7 @@ class BufferStream implements StreamInterface
/**
* Reads data from the buffer.
*/
public function read($length)
public function read($length): string
{
$currentLength = strlen($this->buffer);
@@ -119,21 +122,25 @@ class BufferStream implements StreamInterface
/**
* Writes data to the buffer.
*/
public function write($string)
public function write($string): int
{
$this->buffer .= $string;
// TODO: What should happen here?
if (strlen($this->buffer) >= $this->hwm) {
return false;
return 0;
}
return strlen($string);
}
/**
* {@inheritdoc}
*
* @return mixed
*/
public function getMetadata($key = null)
{
if ($key == 'hwm') {
if ($key === 'hwm') {
return $this->hwm;
}

View File

@@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace GuzzleHttp\Psr7;
use Psr\Http\Message\StreamInterface;
@@ -7,10 +9,8 @@ use Psr\Http\Message\StreamInterface;
/**
* Stream decorator that can cache previously read bytes from a sequentially
* read stream.
*
* @final
*/
class CachingStream implements StreamInterface
final class CachingStream implements StreamInterface
{
use StreamDecoratorTrait;
@@ -20,6 +20,11 @@ class CachingStream implements StreamInterface
/** @var int Number of bytes to skip reading due to a write on the buffer */
private $skipReadBytes = 0;
/**
* @var StreamInterface
*/
private $stream;
/**
* We will treat the buffer object as the body of the stream
*
@@ -34,7 +39,7 @@ class CachingStream implements StreamInterface
$this->stream = $target ?: new Stream(Utils::tryFopen('php://temp', 'r+'));
}
public function getSize()
public function getSize(): ?int
{
$remoteSize = $this->remoteStream->getSize();
@@ -45,18 +50,18 @@ class CachingStream implements StreamInterface
return max($this->stream->getSize(), $remoteSize);
}
public function rewind()
public function rewind(): void
{
$this->seek(0);
}
public function seek($offset, $whence = SEEK_SET)
public function seek($offset, $whence = SEEK_SET): void
{
if ($whence == SEEK_SET) {
if ($whence === SEEK_SET) {
$byte = $offset;
} elseif ($whence == SEEK_CUR) {
} elseif ($whence === SEEK_CUR) {
$byte = $offset + $this->tell();
} elseif ($whence == SEEK_END) {
} elseif ($whence === SEEK_END) {
$size = $this->remoteStream->getSize();
if ($size === null) {
$size = $this->cacheEntireStream();
@@ -81,7 +86,7 @@ class CachingStream implements StreamInterface
}
}
public function read($length)
public function read($length): string
{
// Perform a regular read on any previously read data from the buffer
$data = $this->stream->read($length);
@@ -110,7 +115,7 @@ class CachingStream implements StreamInterface
return $data;
}
public function write($string)
public function write($string): int
{
// When appending to the end of the currently read stream, you'll want
// to skip bytes from being read from the remote stream to emulate
@@ -124,7 +129,7 @@ class CachingStream implements StreamInterface
return $this->stream->write($string);
}
public function eof()
public function eof(): bool
{
return $this->stream->eof() && $this->remoteStream->eof();
}
@@ -132,12 +137,13 @@ class CachingStream implements StreamInterface
/**
* Close both the remote stream and buffer stream
*/
public function close()
public function close(): void
{
$this->remoteStream->close() && $this->stream->close();
$this->remoteStream->close();
$this->stream->close();
}
private function cacheEntireStream()
private function cacheEntireStream(): int
{
$target = new FnStream(['write' => 'strlen']);
Utils::copyToStream($this, $target);

View File

@@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace GuzzleHttp\Psr7;
use Psr\Http\Message\StreamInterface;
@@ -7,26 +9,28 @@ use Psr\Http\Message\StreamInterface;
/**
* Stream decorator that begins dropping data once the size of the underlying
* stream becomes too full.
*
* @final
*/
class DroppingStream implements StreamInterface
final class DroppingStream implements StreamInterface
{
use StreamDecoratorTrait;
/** @var int */
private $maxLength;
/** @var StreamInterface */
private $stream;
/**
* @param StreamInterface $stream Underlying stream to decorate.
* @param int $maxLength Maximum size before dropping data.
*/
public function __construct(StreamInterface $stream, $maxLength)
public function __construct(StreamInterface $stream, int $maxLength)
{
$this->stream = $stream;
$this->maxLength = $maxLength;
}
public function write($string)
public function write($string): int
{
$diff = $this->maxLength - $this->stream->getSize();

View File

@@ -0,0 +1,14 @@
<?php
declare(strict_types=1);
namespace GuzzleHttp\Psr7\Exception;
use InvalidArgumentException;
/**
* Exception thrown if a URI cannot be parsed because it's malformed.
*/
class MalformedUriException extends InvalidArgumentException
{
}

View File

@@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace GuzzleHttp\Psr7;
use Psr\Http\Message\StreamInterface;
@@ -9,21 +11,21 @@ use Psr\Http\Message\StreamInterface;
*
* Allows for easy testing and extension of a provided stream without needing
* to create a concrete class for a simple extension point.
*
* @final
*/
class FnStream implements StreamInterface
#[\AllowDynamicProperties]
final class FnStream implements StreamInterface
{
/** @var array */
private const SLOTS = [
'__toString', 'close', 'detach', 'rewind',
'getSize', 'tell', 'eof', 'isSeekable', 'seek', 'isWritable', 'write',
'isReadable', 'read', 'getContents', 'getMetadata'
];
/** @var array<string, callable> */
private $methods;
/** @var array Methods that must be implemented in the given array */
private static $slots = ['__toString', 'close', 'detach', 'rewind',
'getSize', 'tell', 'eof', 'isSeekable', 'seek', 'isWritable', 'write',
'isReadable', 'read', 'getContents', 'getMetadata'];
/**
* @param array $methods Hash of method name to a callable.
* @param array<string, callable> $methods Hash of method name to a callable.
*/
public function __construct(array $methods)
{
@@ -40,7 +42,7 @@ class FnStream implements StreamInterface
*
* @throws \BadMethodCallException
*/
public function __get($name)
public function __get(string $name): void
{
throw new \BadMethodCallException(str_replace('_fn_', '', $name)
. '() is not implemented in the FnStream');
@@ -61,7 +63,7 @@ class FnStream implements StreamInterface
*
* @throws \LogicException
*/
public function __wakeup()
public function __wakeup(): void
{
throw new \LogicException('FnStream should never be unserialized');
}
@@ -70,8 +72,8 @@ class FnStream implements StreamInterface
* Adds custom functionality to an underlying stream by intercepting
* specific method calls.
*
* @param StreamInterface $stream Stream to decorate
* @param array $methods Hash of method name to a closure
* @param StreamInterface $stream Stream to decorate
* @param array<string, callable> $methods Hash of method name to a closure
*
* @return FnStream
*/
@@ -79,21 +81,31 @@ class FnStream implements StreamInterface
{
// If any of the required methods were not provided, then simply
// proxy to the decorated stream.
foreach (array_diff(self::$slots, array_keys($methods)) as $diff) {
$methods[$diff] = [$stream, $diff];
foreach (array_diff(self::SLOTS, array_keys($methods)) as $diff) {
/** @var callable $callable */
$callable = [$stream, $diff];
$methods[$diff] = $callable;
}
return new self($methods);
}
public function __toString()
public function __toString(): string
{
return call_user_func($this->_fn___toString);
try {
return call_user_func($this->_fn___toString);
} catch (\Throwable $e) {
if (\PHP_VERSION_ID >= 70400) {
throw $e;
}
trigger_error(sprintf('%s::__toString exception: %s', self::class, (string) $e), E_USER_ERROR);
return '';
}
}
public function close()
public function close(): void
{
return call_user_func($this->_fn_close);
call_user_func($this->_fn_close);
}
public function detach()
@@ -101,61 +113,66 @@ class FnStream implements StreamInterface
return call_user_func($this->_fn_detach);
}
public function getSize()
public function getSize(): ?int
{
return call_user_func($this->_fn_getSize);
}
public function tell()
public function tell(): int
{
return call_user_func($this->_fn_tell);
}
public function eof()
public function eof(): bool
{
return call_user_func($this->_fn_eof);
}
public function isSeekable()
public function isSeekable(): bool
{
return call_user_func($this->_fn_isSeekable);
}
public function rewind()
public function rewind(): void
{
call_user_func($this->_fn_rewind);
}
public function seek($offset, $whence = SEEK_SET)
public function seek($offset, $whence = SEEK_SET): void
{
call_user_func($this->_fn_seek, $offset, $whence);
}
public function isWritable()
public function isWritable(): bool
{
return call_user_func($this->_fn_isWritable);
}
public function write($string)
public function write($string): int
{
return call_user_func($this->_fn_write, $string);
}
public function isReadable()
public function isReadable(): bool
{
return call_user_func($this->_fn_isReadable);
}
public function read($length)
public function read($length): string
{
return call_user_func($this->_fn_read, $length);
}
public function getContents()
public function getContents(): string
{
return call_user_func($this->_fn_getContents);
}
/**
* {@inheritdoc}
*
* @return mixed
*/
public function getMetadata($key = null)
{
return call_user_func($this->_fn_getMetadata, $key);

View File

@@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace GuzzleHttp\Psr7;
final class Header
@@ -11,28 +13,28 @@ final class Header
* contains a key, this function will inject a key with a '' string value.
*
* @param string|array $header Header to parse into components.
*
* @return array Returns the parsed header values.
*/
public static function parse($header)
public static function parse($header): array
{
static $trimmed = "\"' \n\t\r";
$params = $matches = [];
foreach (self::normalize($header) as $val) {
$part = [];
foreach (preg_split('/;(?=([^"]*"[^"]*")*[^"]*$)/', $val) as $kvp) {
if (preg_match_all('/<[^>]+>|[^=]+/', $kvp, $matches)) {
$m = $matches[0];
if (isset($m[1])) {
$part[trim($m[0], $trimmed)] = trim($m[1], $trimmed);
} else {
$part[] = trim($m[0], $trimmed);
foreach ((array) $header as $value) {
foreach (self::splitList($value) as $val) {
$part = [];
foreach (preg_split('/;(?=([^"]*"[^"]*")*[^"]*$)/', $val) as $kvp) {
if (preg_match_all('/<[^>]+>|[^=]+/', $kvp, $matches)) {
$m = $matches[0];
if (isset($m[1])) {
$part[trim($m[0], $trimmed)] = trim($m[1], $trimmed);
} else {
$part[] = trim($m[0], $trimmed);
}
}
}
}
if ($part) {
$params[] = $part;
if ($part) {
$params[] = $part;
}
}
}
@@ -45,24 +47,85 @@ final class Header
*
* @param string|array $header Header to normalize.
*
* @return array Returns the normalized header field values.
* @deprecated Use self::splitList() instead.
*/
public static function normalize($header)
public static function normalize($header): array
{
if (!is_array($header)) {
return array_map('trim', explode(',', $header));
$result = [];
foreach ((array) $header as $value) {
foreach (self::splitList($value) as $parsed) {
$result[] = $parsed;
}
}
return $result;
}
/**
* Splits a HTTP header defined to contain comma-separated list into
* each individual value. Empty values will be removed.
*
* Example headers include 'accept', 'cache-control' and 'if-none-match'.
*
* This method must not be used to parse headers that are not defined as
* a list, such as 'user-agent' or 'set-cookie'.
*
* @param string|string[] $values Header value as returned by MessageInterface::getHeader()
*
* @return string[]
*/
public static function splitList($values): array
{
if (!\is_array($values)) {
$values = [$values];
}
$result = [];
foreach ($header as $value) {
foreach ((array) $value as $v) {
if (strpos($v, ',') === false) {
$result[] = $v;
foreach ($values as $value) {
if (!\is_string($value)) {
throw new \TypeError('$header must either be a string or an array containing strings.');
}
$v = '';
$isQuoted = false;
$isEscaped = false;
for ($i = 0, $max = \strlen($value); $i < $max; $i++) {
if ($isEscaped) {
$v .= $value[$i];
$isEscaped = false;
continue;
}
foreach (preg_split('/,(?=([^"]*"[^"]*")*[^"]*$)/', $v) as $vv) {
$result[] = trim($vv);
if (!$isQuoted && $value[$i] === ',') {
$v = \trim($v);
if ($v !== '') {
$result[] = $v;
}
$v = '';
continue;
}
if ($isQuoted && $value[$i] === '\\') {
$isEscaped = true;
$v .= $value[$i];
continue;
}
if ($value[$i] === '"') {
$isQuoted = !$isQuoted;
$v .= $value[$i];
continue;
}
$v .= $value[$i];
}
$v = \trim($v);
if ($v !== '') {
$result[] = $v;
}
}

View File

@@ -0,0 +1,100 @@
<?php
declare(strict_types=1);
namespace GuzzleHttp\Psr7;
use Psr\Http\Message\RequestFactoryInterface;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseFactoryInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestFactoryInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\StreamFactoryInterface;
use Psr\Http\Message\StreamInterface;
use Psr\Http\Message\UploadedFileFactoryInterface;
use Psr\Http\Message\UploadedFileInterface;
use Psr\Http\Message\UriFactoryInterface;
use Psr\Http\Message\UriInterface;
/**
* Implements all of the PSR-17 interfaces.
*
* Note: in consuming code it is recommended to require the implemented interfaces
* and inject the instance of this class multiple times.
*/
final class HttpFactory implements
RequestFactoryInterface,
ResponseFactoryInterface,
ServerRequestFactoryInterface,
StreamFactoryInterface,
UploadedFileFactoryInterface,
UriFactoryInterface
{
public function createUploadedFile(
StreamInterface $stream,
int $size = null,
int $error = \UPLOAD_ERR_OK,
string $clientFilename = null,
string $clientMediaType = null
): UploadedFileInterface {
if ($size === null) {
$size = $stream->getSize();
}
return new UploadedFile($stream, $size, $error, $clientFilename, $clientMediaType);
}
public function createStream(string $content = ''): StreamInterface
{
return Utils::streamFor($content);
}
public function createStreamFromFile(string $file, string $mode = 'r'): StreamInterface
{
try {
$resource = Utils::tryFopen($file, $mode);
} catch (\RuntimeException $e) {
if ('' === $mode || false === \in_array($mode[0], ['r', 'w', 'a', 'x', 'c'], true)) {
throw new \InvalidArgumentException(sprintf('Invalid file opening mode "%s"', $mode), 0, $e);
}
throw $e;
}
return Utils::streamFor($resource);
}
public function createStreamFromResource($resource): StreamInterface
{
return Utils::streamFor($resource);
}
public function createServerRequest(string $method, $uri, array $serverParams = []): ServerRequestInterface
{
if (empty($method)) {
if (!empty($serverParams['REQUEST_METHOD'])) {
$method = $serverParams['REQUEST_METHOD'];
} else {
throw new \InvalidArgumentException('Cannot determine HTTP method');
}
}
return new ServerRequest($method, $uri, [], null, '1.1', $serverParams);
}
public function createResponse(int $code = 200, string $reasonPhrase = ''): ResponseInterface
{
return new Response($code, [], null, '1.1', $reasonPhrase);
}
public function createRequest(string $method, $uri): RequestInterface
{
return new Request($method, $uri);
}
public function createUri(string $uri = ''): UriInterface
{
return new Uri($uri);
}
}

View File

@@ -1,56 +1,37 @@
<?php
declare(strict_types=1);
namespace GuzzleHttp\Psr7;
use Psr\Http\Message\StreamInterface;
/**
* Uses PHP's zlib.inflate filter to inflate deflate or gzipped content.
* Uses PHP's zlib.inflate filter to inflate zlib (HTTP deflate, RFC1950) or gzipped (RFC1952) content.
*
* This stream decorator skips the first 10 bytes of the given stream to remove
* the gzip header, converts the provided stream to a PHP stream resource,
* This stream decorator converts the provided stream to a PHP stream resource,
* then appends the zlib.inflate filter. The stream is then converted back
* to a Guzzle stream resource to be used as a Guzzle stream.
*
* @link http://tools.ietf.org/html/rfc1950
* @link http://tools.ietf.org/html/rfc1952
* @link http://php.net/manual/en/filters.compression.php
*
* @final
*/
class InflateStream implements StreamInterface
final class InflateStream implements StreamInterface
{
use StreamDecoratorTrait;
/** @var StreamInterface */
private $stream;
public function __construct(StreamInterface $stream)
{
// read the first 10 bytes, ie. gzip header
$header = $stream->read(10);
$filenameHeaderLength = $this->getLengthOfPossibleFilenameHeader($stream, $header);
// Skip the header, that is 10 + length of filename + 1 (nil) bytes
$stream = new LimitStream($stream, -1, 10 + $filenameHeaderLength);
$resource = StreamWrapper::getResource($stream);
stream_filter_append($resource, 'zlib.inflate', STREAM_FILTER_READ);
// Specify window=15+32, so zlib will use header detection to both gzip (with header) and zlib data
// See http://www.zlib.net/manual.html#Advanced definition of inflateInit2
// "Add 32 to windowBits to enable zlib and gzip decoding with automatic header detection"
// Default window size is 15.
stream_filter_append($resource, 'zlib.inflate', STREAM_FILTER_READ, ['window' => 15 + 32]);
$this->stream = $stream->isSeekable() ? new Stream($resource) : new NoSeekStream(new Stream($resource));
}
/**
* @param StreamInterface $stream
* @param $header
*
* @return int
*/
private function getLengthOfPossibleFilenameHeader(StreamInterface $stream, $header)
{
$filename_header_length = 0;
if (substr(bin2hex($header), 6, 2) === '08') {
// we have a filename, read until nil
$filename_header_length = 1;
while ($stream->read(1) !== chr(0)) {
$filename_header_length++;
}
}
return $filename_header_length;
}
}

View File

@@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace GuzzleHttp\Psr7;
use Psr\Http\Message\StreamInterface;
@@ -7,14 +9,13 @@ use Psr\Http\Message\StreamInterface;
/**
* Lazily reads or writes to a file that is opened only after an IO operation
* take place on the stream.
*
* @final
*/
class LazyOpenStream implements StreamInterface
#[\AllowDynamicProperties]
final class LazyOpenStream implements StreamInterface
{
use StreamDecoratorTrait;
/** @var string File to open */
/** @var string */
private $filename;
/** @var string */
@@ -24,7 +25,7 @@ class LazyOpenStream implements StreamInterface
* @param string $filename File to lazily open
* @param string $mode fopen mode to use when opening the stream
*/
public function __construct($filename, $mode)
public function __construct(string $filename, string $mode)
{
$this->filename = $filename;
$this->mode = $mode;
@@ -32,10 +33,8 @@ class LazyOpenStream implements StreamInterface
/**
* Creates the underlying stream lazily when required.
*
* @return StreamInterface
*/
protected function createStream()
protected function createStream(): StreamInterface
{
return Utils::streamFor(Utils::tryFopen($this->filename, $this->mode));
}

View File

@@ -1,15 +1,15 @@
<?php
declare(strict_types=1);
namespace GuzzleHttp\Psr7;
use Psr\Http\Message\StreamInterface;
/**
* Decorator used to return only a subset of a stream.
*
* @final
*/
class LimitStream implements StreamInterface
final class LimitStream implements StreamInterface
{
use StreamDecoratorTrait;
@@ -19,6 +19,9 @@ class LimitStream implements StreamInterface
/** @var int Limit the number of bytes that can be read */
private $limit;
/** @var StreamInterface */
private $stream;
/**
* @param StreamInterface $stream Stream to wrap
* @param int $limit Total number of bytes to allow to be read
@@ -28,15 +31,15 @@ class LimitStream implements StreamInterface
*/
public function __construct(
StreamInterface $stream,
$limit = -1,
$offset = 0
int $limit = -1,
int $offset = 0
) {
$this->stream = $stream;
$this->setLimit($limit);
$this->setOffset($offset);
}
public function eof()
public function eof(): bool
{
// Always return true if the underlying stream is EOF
if ($this->stream->eof()) {
@@ -44,7 +47,7 @@ class LimitStream implements StreamInterface
}
// No limit and the underlying stream is not at EOF
if ($this->limit == -1) {
if ($this->limit === -1) {
return false;
}
@@ -53,13 +56,12 @@ class LimitStream implements StreamInterface
/**
* Returns the size of the limited subset of data
* {@inheritdoc}
*/
public function getSize()
public function getSize(): ?int
{
if (null === ($length = $this->stream->getSize())) {
return null;
} elseif ($this->limit == -1) {
} elseif ($this->limit === -1) {
return $length - $this->offset;
} else {
return min($this->limit, $length - $this->offset);
@@ -68,9 +70,8 @@ class LimitStream implements StreamInterface
/**
* Allow for a bounded seek on the read limited stream
* {@inheritdoc}
*/
public function seek($offset, $whence = SEEK_SET)
public function seek($offset, $whence = SEEK_SET): void
{
if ($whence !== SEEK_SET || $offset < 0) {
throw new \RuntimeException(sprintf(
@@ -93,9 +94,8 @@ class LimitStream implements StreamInterface
/**
* Give a relative tell()
* {@inheritdoc}
*/
public function tell()
public function tell(): int
{
return $this->stream->tell() - $this->offset;
}
@@ -107,7 +107,7 @@ class LimitStream implements StreamInterface
*
* @throws \RuntimeException if the stream cannot be seeked.
*/
public function setOffset($offset)
public function setOffset(int $offset): void
{
$current = $this->stream->tell();
@@ -132,14 +132,14 @@ class LimitStream implements StreamInterface
* @param int $limit Number of bytes to allow to be read from the stream.
* Use -1 for no limit.
*/
public function setLimit($limit)
public function setLimit(int $limit): void
{
$this->limit = $limit;
}
public function read($length)
public function read($length): string
{
if ($this->limit == -1) {
if ($this->limit === -1) {
return $this->stream->read($length);
}

View File

@@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace GuzzleHttp\Psr7;
use Psr\Http\Message\MessageInterface;
@@ -12,10 +14,8 @@ final class Message
* Returns the string representation of an HTTP message.
*
* @param MessageInterface $message Message to convert to a string.
*
* @return string
*/
public static function toString(MessageInterface $message)
public static function toString(MessageInterface $message): string
{
if ($message instanceof RequestInterface) {
$msg = trim($message->getMethod() . ' '
@@ -52,10 +52,8 @@ final class Message
*
* @param MessageInterface $message The message to get the body summary
* @param int $truncateAt The maximum allowed size of the summary
*
* @return string|null
*/
public static function bodySummary(MessageInterface $message, $truncateAt = 120)
public static function bodySummary(MessageInterface $message, int $truncateAt = 120): ?string
{
$body = $message->getBody();
@@ -95,7 +93,7 @@ final class Message
*
* @throws \RuntimeException
*/
public static function rewindBody(MessageInterface $message)
public static function rewindBody(MessageInterface $message): void
{
$body = $message->getBody();
@@ -112,10 +110,8 @@ final class Message
* array values, and a "body" key containing the body of the message.
*
* @param string $message HTTP request or response to parse.
*
* @return array
*/
public static function parseMessage($message)
public static function parseMessage(string $message): array
{
if (!$message) {
throw new \InvalidArgumentException('Invalid message');
@@ -129,7 +125,7 @@ final class Message
throw new \InvalidArgumentException('Invalid message: Missing header delimiter');
}
list($rawHeaders, $body) = $messageParts;
[$rawHeaders, $body] = $messageParts;
$rawHeaders .= "\r\n"; // Put back the delimiter we split previously
$headerParts = preg_split("/\r?\n/", $rawHeaders, 2);
@@ -137,7 +133,7 @@ final class Message
throw new \InvalidArgumentException('Invalid message: Missing status line');
}
list($startLine, $rawHeaders) = $headerParts;
[$startLine, $rawHeaders] = $headerParts;
if (preg_match("/(?:^HTTP\/|^[A-Z]+ \S+ HTTP\/)(\d+(?:\.\d+)?)/i", $startLine, $matches) && $matches[1] === '1.0') {
// Header folding is deprecated for HTTP/1.1, but allowed in HTTP/1.0
@@ -175,12 +171,13 @@ final class Message
*
* @param string $path Path from the start-line
* @param array $headers Array of headers (each value an array).
*
* @return string
*/
public static function parseRequestUri($path, array $headers)
public static function parseRequestUri(string $path, array $headers): string
{
$hostKey = array_filter(array_keys($headers), function ($k) {
// Numeric array keys are converted to int by PHP.
$k = (string) $k;
return strtolower($k) === 'host';
});
@@ -199,10 +196,8 @@ final class Message
* Parses a request message string into a request object.
*
* @param string $message Request message string.
*
* @return Request
*/
public static function parseRequest($message)
public static function parseRequest(string $message): RequestInterface
{
$data = self::parseMessage($message);
$matches = [];
@@ -227,10 +222,8 @@ final class Message
* Parses a response message string into a response object.
*
* @param string $message Response message string.
*
* @return Response
*/
public static function parseResponse($message)
public static function parseResponse(string $message): ResponseInterface
{
$data = self::parseMessage($message);
// According to https://tools.ietf.org/html/rfc7230#section-3.1.2 the space
@@ -246,7 +239,7 @@ final class Message
$data['headers'],
$data['body'],
explode('/', $parts[0])[1],
isset($parts[2]) ? $parts[2] : null
$parts[2] ?? null
);
}
}

View File

@@ -1,7 +1,10 @@
<?php
declare(strict_types=1);
namespace GuzzleHttp\Psr7;
use Psr\Http\Message\MessageInterface;
use Psr\Http\Message\StreamInterface;
/**
@@ -9,10 +12,10 @@ use Psr\Http\Message\StreamInterface;
*/
trait MessageTrait
{
/** @var array Map of all registered headers, as original name => array of values */
/** @var array<string, string[]> Map of all registered headers, as original name => array of values */
private $headers = [];
/** @var array Map of lowercase header name => original name at registration */
/** @var array<string, string> Map of lowercase header name => original name at registration */
private $headerNames = [];
/** @var string */
@@ -21,12 +24,12 @@ trait MessageTrait
/** @var StreamInterface|null */
private $stream;
public function getProtocolVersion()
public function getProtocolVersion(): string
{
return $this->protocol;
}
public function withProtocolVersion($version)
public function withProtocolVersion($version): MessageInterface
{
if ($this->protocol === $version) {
return $this;
@@ -37,17 +40,17 @@ trait MessageTrait
return $new;
}
public function getHeaders()
public function getHeaders(): array
{
return $this->headers;
}
public function hasHeader($header)
public function hasHeader($header): bool
{
return isset($this->headerNames[strtolower($header)]);
}
public function getHeader($header)
public function getHeader($header): array
{
$header = strtolower($header);
@@ -60,12 +63,12 @@ trait MessageTrait
return $this->headers[$header];
}
public function getHeaderLine($header)
public function getHeaderLine($header): string
{
return implode(', ', $this->getHeader($header));
}
public function withHeader($header, $value)
public function withHeader($header, $value): MessageInterface
{
$this->assertHeader($header);
$value = $this->normalizeHeaderValue($value);
@@ -81,7 +84,7 @@ trait MessageTrait
return $new;
}
public function withAddedHeader($header, $value)
public function withAddedHeader($header, $value): MessageInterface
{
$this->assertHeader($header);
$value = $this->normalizeHeaderValue($value);
@@ -99,7 +102,7 @@ trait MessageTrait
return $new;
}
public function withoutHeader($header)
public function withoutHeader($header): MessageInterface
{
$normalized = strtolower($header);
@@ -115,7 +118,7 @@ trait MessageTrait
return $new;
}
public function getBody()
public function getBody(): StreamInterface
{
if (!$this->stream) {
$this->stream = Utils::streamFor('');
@@ -124,7 +127,7 @@ trait MessageTrait
return $this->stream;
}
public function withBody(StreamInterface $body)
public function withBody(StreamInterface $body): MessageInterface
{
if ($body === $this->stream) {
return $this;
@@ -135,15 +138,16 @@ trait MessageTrait
return $new;
}
private function setHeaders(array $headers)
/**
* @param array<string|int, string|string[]> $headers
*/
private function setHeaders(array $headers): void
{
$this->headerNames = $this->headers = [];
foreach ($headers as $header => $value) {
if (is_int($header)) {
// Numeric array keys are converted to int by PHP but having a header name '123' is not forbidden by the spec
// and also allowed in withHeader(). So we need to cast it to string again for the following assertion to pass.
$header = (string) $header;
}
// Numeric array keys are converted to int by PHP.
$header = (string) $header;
$this->assertHeader($header);
$value = $this->normalizeHeaderValue($value);
$normalized = strtolower($header);
@@ -162,7 +166,7 @@ trait MessageTrait
*
* @return string[]
*/
private function normalizeHeaderValue($value)
private function normalizeHeaderValue($value): array
{
if (!is_array($value)) {
return $this->trimAndValidateHeaderValues([$value]);
@@ -189,7 +193,7 @@ trait MessageTrait
*
* @see https://tools.ietf.org/html/rfc7230#section-3.2.4
*/
private function trimAndValidateHeaderValues(array $values)
private function trimAndValidateHeaderValues(array $values): array
{
return array_map(function ($value) {
if (!is_scalar($value) && null !== $value) {
@@ -210,10 +214,8 @@ trait MessageTrait
* @see https://tools.ietf.org/html/rfc7230#section-3.2
*
* @param mixed $header
*
* @return void
*/
private function assertHeader($header)
private function assertHeader($header): void
{
if (!is_string($header)) {
throw new \InvalidArgumentException(sprintf(
@@ -222,10 +224,6 @@ trait MessageTrait
));
}
if ($header === '') {
throw new \InvalidArgumentException('Header name can not be empty.');
}
if (! preg_match('/^[a-zA-Z0-9\'`#$%&*+.^_|~!-]+$/', $header)) {
throw new \InvalidArgumentException(
sprintf(
@@ -237,10 +235,6 @@ trait MessageTrait
}
/**
* @param string $value
*
* @return void
*
* @see https://tools.ietf.org/html/rfc7230#section-3.2
*
* field-value = *( field-content / obs-fold )
@@ -250,7 +244,7 @@ trait MessageTrait
* obs-text = %x80-FF
* obs-fold = CRLF 1*( SP / HTAB )
*/
private function assertValue($value)
private function assertValue(string $value): void
{
// The regular expression intentionally does not support the obs-fold production, because as
// per RFC 7230#3.2.4:

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace GuzzleHttp\Psr7;
use Psr\Http\Message\StreamInterface;
@@ -7,15 +9,17 @@ use Psr\Http\Message\StreamInterface;
/**
* Stream that when read returns bytes for a streaming multipart or
* multipart/form-data stream.
*
* @final
*/
class MultipartStream implements StreamInterface
final class MultipartStream implements StreamInterface
{
use StreamDecoratorTrait;
/** @var string */
private $boundary;
/** @var StreamInterface */
private $stream;
/**
* @param array $elements Array of associative arrays, each containing a
* required "name" key mapping to the form field,
@@ -28,31 +32,28 @@ class MultipartStream implements StreamInterface
*
* @throws \InvalidArgumentException
*/
public function __construct(array $elements = [], $boundary = null)
public function __construct(array $elements = [], string $boundary = null)
{
$this->boundary = $boundary ?: sha1(uniqid('', true));
$this->stream = $this->createStream($elements);
}
/**
* Get the boundary
*
* @return string
*/
public function getBoundary()
public function getBoundary(): string
{
return $this->boundary;
}
public function isWritable()
public function isWritable(): bool
{
return false;
}
/**
* Get the headers needed before transferring the content of a POST file
*
* @param array<string, string> $headers
*/
private function getHeaders(array $headers)
private function getHeaders(array $headers): string
{
$str = '';
foreach ($headers as $key => $value) {
@@ -65,11 +66,14 @@ class MultipartStream implements StreamInterface
/**
* Create the aggregate stream that will be used to upload the POST data
*/
protected function createStream(array $elements)
protected function createStream(array $elements = []): StreamInterface
{
$stream = new AppendStream();
foreach ($elements as $element) {
if (!is_array($element)) {
throw new \UnexpectedValueException("An array is expected");
}
$this->addElement($stream, $element);
}
@@ -79,7 +83,7 @@ class MultipartStream implements StreamInterface
return $stream;
}
private function addElement(AppendStream $stream, array $element)
private function addElement(AppendStream $stream, array $element): void
{
foreach (['contents', 'name'] as $key) {
if (!array_key_exists($key, $element)) {
@@ -91,16 +95,16 @@ class MultipartStream implements StreamInterface
if (empty($element['filename'])) {
$uri = $element['contents']->getMetadata('uri');
if (substr($uri, 0, 6) !== 'php://') {
if ($uri && \is_string($uri) && \substr($uri, 0, 6) !== 'php://' && \substr($uri, 0, 7) !== 'data://') {
$element['filename'] = $uri;
}
}
list($body, $headers) = $this->createElement(
[$body, $headers] = $this->createElement(
$element['name'],
$element['contents'],
isset($element['filename']) ? $element['filename'] : null,
isset($element['headers']) ? $element['headers'] : []
$element['filename'] ?? null,
$element['headers'] ?? []
);
$stream->addStream(Utils::streamFor($this->getHeaders($headers)));
@@ -108,10 +112,7 @@ class MultipartStream implements StreamInterface
$stream->addStream(Utils::streamFor("\r\n"));
}
/**
* @return array
*/
private function createElement($name, StreamInterface $stream, $filename, array $headers)
private function createElement(string $name, StreamInterface $stream, ?string $filename, array $headers): array
{
// Set a default content-disposition header if one was no provided
$disposition = $this->getHeader($headers, 'content-disposition');
@@ -144,7 +145,7 @@ class MultipartStream implements StreamInterface
return [$stream, $headers];
}
private function getHeader(array $headers, $key)
private function getHeader(array $headers, string $key)
{
$lowercaseHeader = strtolower($key);
foreach ($headers as $k => $v) {

View File

@@ -1,24 +1,27 @@
<?php
declare(strict_types=1);
namespace GuzzleHttp\Psr7;
use Psr\Http\Message\StreamInterface;
/**
* Stream decorator that prevents a stream from being seeked.
*
* @final
*/
class NoSeekStream implements StreamInterface
final class NoSeekStream implements StreamInterface
{
use StreamDecoratorTrait;
public function seek($offset, $whence = SEEK_SET)
/** @var StreamInterface */
private $stream;
public function seek($offset, $whence = SEEK_SET): void
{
throw new \RuntimeException('Cannot seek a NoSeekStream');
}
public function isSeekable()
public function isSeekable(): bool
{
return false;
}

View File

@@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace GuzzleHttp\Psr7;
use Psr\Http\Message\StreamInterface;
@@ -13,15 +15,13 @@ use Psr\Http\Message\StreamInterface;
* returned by the provided callable is buffered internally until drained using
* the read() function of the PumpStream. The provided callable MUST return
* false when there is no more data to read.
*
* @final
*/
class PumpStream implements StreamInterface
final class PumpStream implements StreamInterface
{
/** @var callable */
/** @var callable|null */
private $source;
/** @var int */
/** @var int|null */
private $size;
/** @var int */
@@ -34,91 +34,95 @@ class PumpStream implements StreamInterface
private $buffer;
/**
* @param callable $source Source of the stream data. The callable MAY
* accept an integer argument used to control the
* amount of data to return. The callable MUST
* return a string when called, or false on error
* or EOF.
* @param array $options Stream options:
* - metadata: Hash of metadata to use with stream.
* - size: Size of the stream, if known.
* @param callable(int): (string|null|false) $source Source of the stream data. The callable MAY
* accept an integer argument used to control the
* amount of data to return. The callable MUST
* return a string when called, or false|null on error
* or EOF.
* @param array{size?: int, metadata?: array} $options Stream options:
* - metadata: Hash of metadata to use with stream.
* - size: Size of the stream, if known.
*/
public function __construct(callable $source, array $options = [])
{
$this->source = $source;
$this->size = isset($options['size']) ? $options['size'] : null;
$this->metadata = isset($options['metadata']) ? $options['metadata'] : [];
$this->size = $options['size'] ?? null;
$this->metadata = $options['metadata'] ?? [];
$this->buffer = new BufferStream();
}
public function __toString()
public function __toString(): string
{
try {
return Utils::copyToString($this);
} catch (\Exception $e) {
} catch (\Throwable $e) {
if (\PHP_VERSION_ID >= 70400) {
throw $e;
}
trigger_error(sprintf('%s::__toString exception: %s', self::class, (string) $e), E_USER_ERROR);
return '';
}
}
public function close()
public function close(): void
{
$this->detach();
}
public function detach()
{
$this->tellPos = false;
$this->tellPos = 0;
$this->source = null;
return null;
}
public function getSize()
public function getSize(): ?int
{
return $this->size;
}
public function tell()
public function tell(): int
{
return $this->tellPos;
}
public function eof()
public function eof(): bool
{
return !$this->source;
return $this->source === null;
}
public function isSeekable()
public function isSeekable(): bool
{
return false;
}
public function rewind()
public function rewind(): void
{
$this->seek(0);
}
public function seek($offset, $whence = SEEK_SET)
public function seek($offset, $whence = SEEK_SET): void
{
throw new \RuntimeException('Cannot seek a PumpStream');
}
public function isWritable()
public function isWritable(): bool
{
return false;
}
public function write($string)
public function write($string): int
{
throw new \RuntimeException('Cannot write to a PumpStream');
}
public function isReadable()
public function isReadable(): bool
{
return true;
}
public function read($length)
public function read($length): string
{
$data = $this->buffer->read($length);
$readLen = strlen($data);
@@ -134,7 +138,7 @@ class PumpStream implements StreamInterface
return $data;
}
public function getContents()
public function getContents(): string
{
$result = '';
while (!$this->eof()) {
@@ -144,16 +148,21 @@ class PumpStream implements StreamInterface
return $result;
}
/**
* {@inheritdoc}
*
* @return mixed
*/
public function getMetadata($key = null)
{
if (!$key) {
return $this->metadata;
}
return isset($this->metadata[$key]) ? $this->metadata[$key] : null;
return $this->metadata[$key] ?? null;
}
private function pump($length)
private function pump(int $length): void
{
if ($this->source) {
do {

View File

@@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace GuzzleHttp\Psr7;
final class Query
@@ -14,10 +16,8 @@ final class Query
*
* @param string $str Query string to parse
* @param int|bool $urlEncoding How the query string is encoded
*
* @return array
*/
public static function parse($str, $urlEncoding = true)
public static function parse(string $str, $urlEncoding = true): array
{
$result = [];
@@ -27,7 +27,7 @@ final class Query
if ($urlEncoding === true) {
$decoder = function ($value) {
return rawurldecode(str_replace('+', ' ', $value));
return rawurldecode(str_replace('+', ' ', (string) $value));
};
} elseif ($urlEncoding === PHP_QUERY_RFC3986) {
$decoder = 'rawurldecode';
@@ -43,7 +43,7 @@ final class Query
$parts = explode('=', $kvp, 2);
$key = $decoder($parts[0]);
$value = isset($parts[1]) ? $decoder($parts[1]) : null;
if (!isset($result[$key])) {
if (!array_key_exists($key, $result)) {
$result[$key] = $value;
} else {
if (!is_array($result[$key])) {
@@ -67,17 +67,15 @@ final class Query
* @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986
* to encode using RFC3986, or PHP_QUERY_RFC1738
* to encode using RFC1738.
*
* @return string
*/
public static function build(array $params, $encoding = PHP_QUERY_RFC3986)
public static function build(array $params, $encoding = PHP_QUERY_RFC3986): string
{
if (!$params) {
return '';
}
if ($encoding === false) {
$encoder = function ($str) {
$encoder = function (string $str): string {
return $str;
};
} elseif ($encoding === PHP_QUERY_RFC3986) {
@@ -90,18 +88,20 @@ final class Query
$qs = '';
foreach ($params as $k => $v) {
$k = $encoder($k);
$k = $encoder((string) $k);
if (!is_array($v)) {
$qs .= $k;
$v = is_bool($v) ? (int) $v : $v;
if ($v !== null) {
$qs .= '=' . $encoder($v);
$qs .= '=' . $encoder((string) $v);
}
$qs .= '&';
} else {
foreach ($v as $vv) {
$qs .= $k;
$vv = is_bool($vv) ? (int) $vv : $vv;
if ($vv !== null) {
$qs .= '=' . $encoder($vv);
$qs .= '=' . $encoder((string) $vv);
}
$qs .= '&';
}

View File

@@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace GuzzleHttp\Psr7;
use InvalidArgumentException;
@@ -26,16 +28,16 @@ class Request implements RequestInterface
/**
* @param string $method HTTP method
* @param string|UriInterface $uri URI
* @param array $headers Request headers
* @param array<string, string|string[]> $headers Request headers
* @param string|resource|StreamInterface|null $body Request body
* @param string $version Protocol version
*/
public function __construct(
$method,
string $method,
$uri,
array $headers = [],
$body = null,
$version = '1.1'
string $version = '1.1'
) {
$this->assertMethod($method);
if (!($uri instanceof UriInterface)) {
@@ -56,14 +58,14 @@ class Request implements RequestInterface
}
}
public function getRequestTarget()
public function getRequestTarget(): string
{
if ($this->requestTarget !== null) {
return $this->requestTarget;
}
$target = $this->uri->getPath();
if ($target == '') {
if ($target === '') {
$target = '/';
}
if ($this->uri->getQuery() != '') {
@@ -73,7 +75,7 @@ class Request implements RequestInterface
return $target;
}
public function withRequestTarget($requestTarget)
public function withRequestTarget($requestTarget): RequestInterface
{
if (preg_match('#\s#', $requestTarget)) {
throw new InvalidArgumentException(
@@ -86,12 +88,12 @@ class Request implements RequestInterface
return $new;
}
public function getMethod()
public function getMethod(): string
{
return $this->method;
}
public function withMethod($method)
public function withMethod($method): RequestInterface
{
$this->assertMethod($method);
$new = clone $this;
@@ -99,12 +101,12 @@ class Request implements RequestInterface
return $new;
}
public function getUri()
public function getUri(): UriInterface
{
return $this->uri;
}
public function withUri(UriInterface $uri, $preserveHost = false)
public function withUri(UriInterface $uri, $preserveHost = false): RequestInterface
{
if ($uri === $this->uri) {
return $this;
@@ -120,7 +122,7 @@ class Request implements RequestInterface
return $new;
}
private function updateHostFromUri()
private function updateHostFromUri(): void
{
$host = $this->uri->getHost();
@@ -143,10 +145,13 @@ class Request implements RequestInterface
$this->headers = [$header => [$host]] + $this->headers;
}
private function assertMethod($method)
/**
* @param mixed $method
*/
private function assertMethod($method): void
{
if (!is_string($method) || $method === '') {
throw new \InvalidArgumentException('Method must be a non-empty string.');
throw new InvalidArgumentException('Method must be a non-empty string.');
}
}
}

View File

@@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace GuzzleHttp\Psr7;
use Psr\Http\Message\ResponseInterface;
@@ -12,8 +14,8 @@ class Response implements ResponseInterface
{
use MessageTrait;
/** @var array Map of standard HTTP status code/reason phrases */
private static $phrases = [
/** Map of standard HTTP status code/reason phrases */
private const PHRASES = [
100 => 'Continue',
101 => 'Switching Protocols',
102 => 'Processing',
@@ -34,6 +36,7 @@ class Response implements ResponseInterface
305 => 'Use Proxy',
306 => 'Switch Proxy',
307 => 'Temporary Redirect',
308 => 'Permanent Redirect',
400 => 'Bad Request',
401 => 'Unauthorized',
402 => 'Payment Required',
@@ -71,31 +74,30 @@ class Response implements ResponseInterface
506 => 'Variant Also Negotiates',
507 => 'Insufficient Storage',
508 => 'Loop Detected',
510 => 'Not Extended',
511 => 'Network Authentication Required',
];
/** @var string */
private $reasonPhrase = '';
private $reasonPhrase;
/** @var int */
private $statusCode = 200;
private $statusCode;
/**
* @param int $status Status code
* @param array $headers Response headers
* @param array<string, string|string[]> $headers Response headers
* @param string|resource|StreamInterface|null $body Response body
* @param string $version Protocol version
* @param string|null $reason Reason phrase (when empty a default will be used based on the status code)
*/
public function __construct(
$status = 200,
int $status = 200,
array $headers = [],
$body = null,
$version = '1.1',
$reason = null
string $version = '1.1',
string $reason = null
) {
$this->assertStatusCodeIsInteger($status);
$status = (int) $status;
$this->assertStatusCodeRange($status);
$this->statusCode = $status;
@@ -105,8 +107,8 @@ class Response implements ResponseInterface
}
$this->setHeaders($headers);
if ($reason == '' && isset(self::$phrases[$this->statusCode])) {
$this->reasonPhrase = self::$phrases[$this->statusCode];
if ($reason == '' && isset(self::PHRASES[$this->statusCode])) {
$this->reasonPhrase = self::PHRASES[$this->statusCode];
} else {
$this->reasonPhrase = (string) $reason;
}
@@ -114,17 +116,17 @@ class Response implements ResponseInterface
$this->protocol = $version;
}
public function getStatusCode()
public function getStatusCode(): int
{
return $this->statusCode;
}
public function getReasonPhrase()
public function getReasonPhrase(): string
{
return $this->reasonPhrase;
}
public function withStatus($code, $reasonPhrase = '')
public function withStatus($code, $reasonPhrase = ''): ResponseInterface
{
$this->assertStatusCodeIsInteger($code);
$code = (int) $code;
@@ -132,21 +134,24 @@ class Response implements ResponseInterface
$new = clone $this;
$new->statusCode = $code;
if ($reasonPhrase == '' && isset(self::$phrases[$new->statusCode])) {
$reasonPhrase = self::$phrases[$new->statusCode];
if ($reasonPhrase == '' && isset(self::PHRASES[$new->statusCode])) {
$reasonPhrase = self::PHRASES[$new->statusCode];
}
$new->reasonPhrase = (string) $reasonPhrase;
return $new;
}
private function assertStatusCodeIsInteger($statusCode)
/**
* @param mixed $statusCode
*/
private function assertStatusCodeIsInteger($statusCode): void
{
if (filter_var($statusCode, FILTER_VALIDATE_INT) === false) {
throw new \InvalidArgumentException('Status code must be an integer value.');
}
}
private function assertStatusCodeRange($statusCode)
private function assertStatusCodeRange(int $statusCode): void
{
if ($statusCode < 100 || $statusCode >= 600) {
throw new \InvalidArgumentException('Status code must be an integer value between 1xx and 5xx.');

View File

@@ -1,12 +1,16 @@
<?php
declare(strict_types=1);
namespace GuzzleHttp\Psr7;
/**
* @internal
*/
final class Rfc7230
{
/**
* Header related regular expressions (copied from amphp/http package)
* (Note: once we require PHP 7.x we could just depend on the upstream package)
* Header related regular expressions (based on amphp/http package)
*
* Note: header delimiter (\r\n) is modified to \r?\n to accept line feed only delimiters for BC reasons.
*
@@ -14,6 +18,6 @@ final class Rfc7230
*
* @license https://github.com/amphp/http/blob/v1.0.1/LICENSE
*/
const HEADER_REGEX = "(^([^()<>@,;:\\\"/[\]?={}\x01-\x20\x7F]++):[ \t]*+((?:[ \t]*+[\x21-\x7E\x80-\xFF]++)*+)[ \t]*+\r?\n)m";
const HEADER_FOLD_REGEX = "(\r?\n[ \t]++)";
public const HEADER_REGEX = "(^([^()<>@,;:\\\"/[\]?={}\x01-\x20\x7F]++):[ \t]*+((?:[ \t]*+[\x21-\x7E\x80-\xFF]++)*+)[ \t]*+\r?\n)m";
public const HEADER_FOLD_REGEX = "(\r?\n[ \t]++)";
}

View File

@@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace GuzzleHttp\Psr7;
use InvalidArgumentException;
@@ -57,17 +59,17 @@ class ServerRequest extends Request implements ServerRequestInterface
/**
* @param string $method HTTP method
* @param string|UriInterface $uri URI
* @param array $headers Request headers
* @param array<string, string|string[]> $headers Request headers
* @param string|resource|StreamInterface|null $body Request body
* @param string $version Protocol version
* @param array $serverParams Typically the $_SERVER superglobal
*/
public function __construct(
$method,
string $method,
$uri,
array $headers = [],
$body = null,
$version = '1.1',
string $version = '1.1',
array $serverParams = []
) {
$this->serverParams = $serverParams;
@@ -78,13 +80,11 @@ class ServerRequest extends Request implements ServerRequestInterface
/**
* Return an UploadedFile instance array.
*
* @param array $files A array which respect $_FILES structure
*
* @return array
* @param array $files An array which respect $_FILES structure
*
* @throws InvalidArgumentException for unrecognized values
*/
public static function normalizeFiles(array $files)
public static function normalizeFiles(array $files): array
{
$normalized = [];
@@ -112,7 +112,7 @@ class ServerRequest extends Request implements ServerRequestInterface
*
* @param array $value $_FILES struct
*
* @return array|UploadedFileInterface
* @return UploadedFileInterface|UploadedFileInterface[]
*/
private static function createUploadedFileFromSpec(array $value)
{
@@ -135,11 +135,9 @@ class ServerRequest extends Request implements ServerRequestInterface
* Loops through all nested files and returns a normalized array of
* UploadedFileInterface instances.
*
* @param array $files
*
* @return UploadedFileInterface[]
*/
private static function normalizeNestedFileSpec(array $files = [])
private static function normalizeNestedFileSpec(array $files = []): array
{
$normalizedFiles = [];
@@ -164,12 +162,10 @@ class ServerRequest extends Request implements ServerRequestInterface
* $_COOKIE
* $_FILES
* $_SERVER
*
* @return ServerRequestInterface
*/
public static function fromGlobals()
public static function fromGlobals(): ServerRequestInterface
{
$method = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : 'GET';
$method = $_SERVER['REQUEST_METHOD'] ?? 'GET';
$headers = getallheaders();
$uri = self::getUriFromGlobals();
$body = new CachingStream(new LazyOpenStream('php://input', 'r+'));
@@ -184,7 +180,7 @@ class ServerRequest extends Request implements ServerRequestInterface
->withUploadedFiles(self::normalizeFiles($_FILES));
}
private static function extractHostAndPortFromAuthority($authority)
private static function extractHostAndPortFromAuthority(string $authority): array
{
$uri = 'http://' . $authority;
$parts = parse_url($uri);
@@ -192,18 +188,16 @@ class ServerRequest extends Request implements ServerRequestInterface
return [null, null];
}
$host = isset($parts['host']) ? $parts['host'] : null;
$port = isset($parts['port']) ? $parts['port'] : null;
$host = $parts['host'] ?? null;
$port = $parts['port'] ?? null;
return [$host, $port];
}
/**
* Get a Uri populated with values from $_SERVER.
*
* @return UriInterface
*/
public static function getUriFromGlobals()
public static function getUriFromGlobals(): UriInterface
{
$uri = new Uri('');
@@ -211,7 +205,7 @@ class ServerRequest extends Request implements ServerRequestInterface
$hasPort = false;
if (isset($_SERVER['HTTP_HOST'])) {
list($host, $port) = self::extractHostAndPortFromAuthority($_SERVER['HTTP_HOST']);
[$host, $port] = self::extractHostAndPortFromAuthority($_SERVER['HTTP_HOST']);
if ($host !== null) {
$uri = $uri->withHost($host);
}
@@ -247,26 +241,17 @@ class ServerRequest extends Request implements ServerRequestInterface
return $uri;
}
/**
* {@inheritdoc}
*/
public function getServerParams()
public function getServerParams(): array
{
return $this->serverParams;
}
/**
* {@inheritdoc}
*/
public function getUploadedFiles()
public function getUploadedFiles(): array
{
return $this->uploadedFiles;
}
/**
* {@inheritdoc}
*/
public function withUploadedFiles(array $uploadedFiles)
public function withUploadedFiles(array $uploadedFiles): ServerRequestInterface
{
$new = clone $this;
$new->uploadedFiles = $uploadedFiles;
@@ -274,18 +259,12 @@ class ServerRequest extends Request implements ServerRequestInterface
return $new;
}
/**
* {@inheritdoc}
*/
public function getCookieParams()
public function getCookieParams(): array
{
return $this->cookieParams;
}
/**
* {@inheritdoc}
*/
public function withCookieParams(array $cookies)
public function withCookieParams(array $cookies): ServerRequestInterface
{
$new = clone $this;
$new->cookieParams = $cookies;
@@ -293,18 +272,12 @@ class ServerRequest extends Request implements ServerRequestInterface
return $new;
}
/**
* {@inheritdoc}
*/
public function getQueryParams()
public function getQueryParams(): array
{
return $this->queryParams;
}
/**
* {@inheritdoc}
*/
public function withQueryParams(array $query)
public function withQueryParams(array $query): ServerRequestInterface
{
$new = clone $this;
$new->queryParams = $query;
@@ -314,16 +287,15 @@ class ServerRequest extends Request implements ServerRequestInterface
/**
* {@inheritdoc}
*
* @return array|object|null
*/
public function getParsedBody()
{
return $this->parsedBody;
}
/**
* {@inheritdoc}
*/
public function withParsedBody($data)
public function withParsedBody($data): ServerRequestInterface
{
$new = clone $this;
$new->parsedBody = $data;
@@ -331,16 +303,15 @@ class ServerRequest extends Request implements ServerRequestInterface
return $new;
}
/**
* {@inheritdoc}
*/
public function getAttributes()
public function getAttributes(): array
{
return $this->attributes;
}
/**
* {@inheritdoc}
*
* @return mixed
*/
public function getAttribute($attribute, $default = null)
{
@@ -351,10 +322,7 @@ class ServerRequest extends Request implements ServerRequestInterface
return $this->attributes[$attribute];
}
/**
* {@inheritdoc}
*/
public function withAttribute($attribute, $value)
public function withAttribute($attribute, $value): ServerRequestInterface
{
$new = clone $this;
$new->attributes[$attribute] = $value;
@@ -362,10 +330,7 @@ class ServerRequest extends Request implements ServerRequestInterface
return $new;
}
/**
* {@inheritdoc}
*/
public function withoutAttribute($attribute)
public function withoutAttribute($attribute): ServerRequestInterface
{
if (false === array_key_exists($attribute, $this->attributes)) {
return $this;

View File

@@ -1,33 +1,36 @@
<?php
declare(strict_types=1);
namespace GuzzleHttp\Psr7;
use Psr\Http\Message\StreamInterface;
/**
* PHP stream implementation.
*
* @var $stream
*/
class Stream implements StreamInterface
{
/**
* Resource modes.
*
* @var string
*
* @see http://php.net/manual/function.fopen.php
* @see http://php.net/manual/en/function.gzopen.php
*/
const READABLE_MODES = '/r|a\+|ab\+|w\+|wb\+|x\+|xb\+|c\+|cb\+/';
const WRITABLE_MODES = '/a|w|r\+|rb\+|rw|x|c/';
private const READABLE_MODES = '/r|a\+|ab\+|w\+|wb\+|x\+|xb\+|c\+|cb\+/';
private const WRITABLE_MODES = '/a|w|r\+|rb\+|rw|x|c/';
/** @var resource */
private $stream;
/** @var int|null */
private $size;
/** @var bool */
private $seekable;
/** @var bool */
private $readable;
/** @var bool */
private $writable;
/** @var string|null */
private $uri;
/** @var mixed[] */
private $customMetadata;
/**
@@ -39,12 +42,12 @@ class Stream implements StreamInterface
* - metadata: (array) Any additional metadata to return when the metadata
* of the stream is accessed.
*
* @param resource $stream Stream resource to wrap.
* @param array $options Associative array of options.
* @param resource $stream Stream resource to wrap.
* @param array{size?: int, metadata?: array} $options Associative array of options.
*
* @throws \InvalidArgumentException if the stream is not a stream resource
*/
public function __construct($stream, $options = [])
public function __construct($stream, array $options = [])
{
if (!is_resource($stream)) {
throw new \InvalidArgumentException('Stream must be a resource');
@@ -54,10 +57,7 @@ class Stream implements StreamInterface
$this->size = $options['size'];
}
$this->customMetadata = isset($options['metadata'])
? $options['metadata']
: [];
$this->customMetadata = $options['metadata'] ?? [];
$this->stream = $stream;
$meta = stream_get_meta_data($this->stream);
$this->seekable = $meta['seekable'];
@@ -74,34 +74,36 @@ class Stream implements StreamInterface
$this->close();
}
public function __toString()
public function __toString(): string
{
try {
if ($this->isSeekable()) {
$this->seek(0);
}
return $this->getContents();
} catch (\Exception $e) {
} catch (\Throwable $e) {
if (\PHP_VERSION_ID >= 70400) {
throw $e;
}
trigger_error(sprintf('%s::__toString exception: %s', self::class, (string) $e), E_USER_ERROR);
return '';
}
}
public function getContents()
public function getContents(): string
{
if (!isset($this->stream)) {
throw new \RuntimeException('Stream is detached');
}
$contents = stream_get_contents($this->stream);
if ($contents === false) {
throw new \RuntimeException('Unable to read stream contents');
if (!$this->readable) {
throw new \RuntimeException('Cannot read from non-readable stream');
}
return $contents;
return Utils::tryGetContents($this->stream);
}
public function close()
public function close(): void
{
if (isset($this->stream)) {
if (is_resource($this->stream)) {
@@ -125,7 +127,7 @@ class Stream implements StreamInterface
return $result;
}
public function getSize()
public function getSize(): ?int
{
if ($this->size !== null) {
return $this->size;
@@ -141,7 +143,7 @@ class Stream implements StreamInterface
}
$stats = fstat($this->stream);
if (isset($stats['size'])) {
if (is_array($stats) && isset($stats['size'])) {
$this->size = $stats['size'];
return $this->size;
}
@@ -149,22 +151,22 @@ class Stream implements StreamInterface
return null;
}
public function isReadable()
public function isReadable(): bool
{
return $this->readable;
}
public function isWritable()
public function isWritable(): bool
{
return $this->writable;
}
public function isSeekable()
public function isSeekable(): bool
{
return $this->seekable;
}
public function eof()
public function eof(): bool
{
if (!isset($this->stream)) {
throw new \RuntimeException('Stream is detached');
@@ -173,7 +175,7 @@ class Stream implements StreamInterface
return feof($this->stream);
}
public function tell()
public function tell(): int
{
if (!isset($this->stream)) {
throw new \RuntimeException('Stream is detached');
@@ -188,12 +190,12 @@ class Stream implements StreamInterface
return $result;
}
public function rewind()
public function rewind(): void
{
$this->seek(0);
}
public function seek($offset, $whence = SEEK_SET)
public function seek($offset, $whence = SEEK_SET): void
{
$whence = (int) $whence;
@@ -209,7 +211,7 @@ class Stream implements StreamInterface
}
}
public function read($length)
public function read($length): string
{
if (!isset($this->stream)) {
throw new \RuntimeException('Stream is detached');
@@ -225,7 +227,12 @@ class Stream implements StreamInterface
return '';
}
$string = fread($this->stream, $length);
try {
$string = fread($this->stream, $length);
} catch (\Exception $e) {
throw new \RuntimeException('Unable to read from stream', 0, $e);
}
if (false === $string) {
throw new \RuntimeException('Unable to read from stream');
}
@@ -233,7 +240,7 @@ class Stream implements StreamInterface
return $string;
}
public function write($string)
public function write($string): int
{
if (!isset($this->stream)) {
throw new \RuntimeException('Stream is detached');
@@ -253,6 +260,11 @@ class Stream implements StreamInterface
return $result;
}
/**
* {@inheritdoc}
*
* @return mixed
*/
public function getMetadata($key = null)
{
if (!isset($this->stream)) {
@@ -265,6 +277,6 @@ class Stream implements StreamInterface
$meta = stream_get_meta_data($this->stream);
return isset($meta[$key]) ? $meta[$key] : null;
return $meta[$key] ?? null;
}
}

View File

@@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace GuzzleHttp\Psr7;
use Psr\Http\Message\StreamInterface;
@@ -7,7 +9,7 @@ use Psr\Http\Message\StreamInterface;
/**
* Stream decorator trait
*
* @property StreamInterface stream
* @property StreamInterface $stream
*/
trait StreamDecoratorTrait
{
@@ -23,13 +25,11 @@ trait StreamDecoratorTrait
* Magic method used to create a new stream if streams are not added in
* the constructor of a decorator (e.g., LazyOpenStream).
*
* @param string $name Name of the property (allows "stream" only).
*
* @return StreamInterface
*/
public function __get($name)
public function __get(string $name)
{
if ($name == 'stream') {
if ($name === 'stream') {
$this->stream = $this->createStream();
return $this->stream;
}
@@ -37,22 +37,23 @@ trait StreamDecoratorTrait
throw new \UnexpectedValueException("$name not found on class");
}
public function __toString()
public function __toString(): string
{
try {
if ($this->isSeekable()) {
$this->seek(0);
}
return $this->getContents();
} catch (\Exception $e) {
// Really, PHP? https://bugs.php.net/bug.php?id=53648
trigger_error('StreamDecorator::__toString exception: '
. (string) $e, E_USER_ERROR);
} catch (\Throwable $e) {
if (\PHP_VERSION_ID >= 70400) {
throw $e;
}
trigger_error(sprintf('%s::__toString exception: %s', self::class, (string) $e), E_USER_ERROR);
return '';
}
}
public function getContents()
public function getContents(): string
{
return Utils::copyToString($this);
}
@@ -60,24 +61,28 @@ trait StreamDecoratorTrait
/**
* Allow decorators to implement custom methods
*
* @param string $method Missing method name
* @param array $args Method arguments
*
* @return mixed
*/
public function __call($method, array $args)
public function __call(string $method, array $args)
{
$result = call_user_func_array([$this->stream, $method], $args);
/** @var callable $callable */
$callable = [$this->stream, $method];
$result = call_user_func_array($callable, $args);
// Always return the wrapped object if the result is a return $this
return $result === $this->stream ? $this : $result;
}
public function close()
public function close(): void
{
$this->stream->close();
}
/**
* {@inheritdoc}
*
* @return mixed
*/
public function getMetadata($key = null)
{
return $this->stream->getMetadata($key);
@@ -88,52 +93,52 @@ trait StreamDecoratorTrait
return $this->stream->detach();
}
public function getSize()
public function getSize(): ?int
{
return $this->stream->getSize();
}
public function eof()
public function eof(): bool
{
return $this->stream->eof();
}
public function tell()
public function tell(): int
{
return $this->stream->tell();
}
public function isReadable()
public function isReadable(): bool
{
return $this->stream->isReadable();
}
public function isWritable()
public function isWritable(): bool
{
return $this->stream->isWritable();
}
public function isSeekable()
public function isSeekable(): bool
{
return $this->stream->isSeekable();
}
public function rewind()
public function rewind(): void
{
$this->seek(0);
}
public function seek($offset, $whence = SEEK_SET)
public function seek($offset, $whence = SEEK_SET): void
{
$this->stream->seek($offset, $whence);
}
public function read($length)
public function read($length): string
{
return $this->stream->read($length);
}
public function write($string)
public function write($string): int
{
return $this->stream->write($string);
}
@@ -141,11 +146,9 @@ trait StreamDecoratorTrait
/**
* Implement in subclasses to dynamically create streams when requested.
*
* @return StreamInterface
*
* @throws \BadMethodCallException
*/
protected function createStream()
protected function createStream(): StreamInterface
{
throw new \BadMethodCallException('Not implemented');
}

View File

@@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace GuzzleHttp\Psr7;
use Psr\Http\Message\StreamInterface;
@@ -7,9 +9,9 @@ use Psr\Http\Message\StreamInterface;
/**
* Converts Guzzle streams into PHP stream resources.
*
* @final
* @see https://www.php.net/streamwrapper
*/
class StreamWrapper
final class StreamWrapper
{
/** @var resource */
public $context;
@@ -42,14 +44,12 @@ class StreamWrapper
. 'writable, or both.');
}
return fopen('guzzle://stream', $mode, null, self::createStreamContext($stream));
return fopen('guzzle://stream', $mode, false, self::createStreamContext($stream));
}
/**
* Creates a stream context that can be used to open a stream as a php stream resource.
*
* @param StreamInterface $stream
*
* @return resource
*/
public static function createStreamContext(StreamInterface $stream)
@@ -62,14 +62,14 @@ class StreamWrapper
/**
* Registers the stream wrapper if needed
*/
public static function register()
public static function register(): void
{
if (!in_array('guzzle', stream_get_wrappers())) {
stream_wrapper_register('guzzle', __CLASS__);
}
}
public function stream_open($path, $mode, $options, &$opened_path)
public function stream_open(string $path, string $mode, int $options, string &$opened_path = null): bool
{
$options = stream_context_get_options($this->context);
@@ -83,41 +83,48 @@ class StreamWrapper
return true;
}
public function stream_read($count)
public function stream_read(int $count): string
{
return $this->stream->read($count);
}
public function stream_write($data)
public function stream_write(string $data): int
{
return (int) $this->stream->write($data);
return $this->stream->write($data);
}
public function stream_tell()
public function stream_tell(): int
{
return $this->stream->tell();
}
public function stream_eof()
public function stream_eof(): bool
{
return $this->stream->eof();
}
public function stream_seek($offset, $whence)
public function stream_seek(int $offset, int $whence): bool
{
$this->stream->seek($offset, $whence);
return true;
}
public function stream_cast($cast_as)
/**
* @return resource|false
*/
public function stream_cast(int $cast_as)
{
$stream = clone($this->stream);
$resource = $stream->detach();
return $stream->detach();
return $resource ?? false;
}
public function stream_stat()
/**
* @return array<int|string, int>
*/
public function stream_stat(): array
{
static $modeMap = [
'r' => 33060,
@@ -144,7 +151,10 @@ class StreamWrapper
];
}
public function url_stat($path, $flags)
/**
* @return array<int|string, int>
*/
public function url_stat(string $path, int $flags): array
{
return [
'dev' => 0,

View File

@@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace GuzzleHttp\Psr7;
use InvalidArgumentException;
@@ -9,10 +11,7 @@ use RuntimeException;
class UploadedFile implements UploadedFileInterface
{
/**
* @var int[]
*/
private static $errors = [
private const ERRORS = [
UPLOAD_ERR_OK,
UPLOAD_ERR_INI_SIZE,
UPLOAD_ERR_FORM_SIZE,
@@ -24,12 +23,12 @@ class UploadedFile implements UploadedFileInterface
];
/**
* @var string
* @var string|null
*/
private $clientFilename;
/**
* @var string
* @var string|null
*/
private $clientMediaType;
@@ -49,7 +48,7 @@ class UploadedFile implements UploadedFileInterface
private $moved = false;
/**
* @var int
* @var int|null
*/
private $size;
@@ -60,22 +59,18 @@ class UploadedFile implements UploadedFileInterface
/**
* @param StreamInterface|string|resource $streamOrFile
* @param int $size
* @param int $errorStatus
* @param string|null $clientFilename
* @param string|null $clientMediaType
*/
public function __construct(
$streamOrFile,
$size,
$errorStatus,
$clientFilename = null,
$clientMediaType = null
?int $size,
int $errorStatus,
string $clientFilename = null,
string $clientMediaType = null
) {
$this->setError($errorStatus);
$this->setSize($size);
$this->setClientFilename($clientFilename);
$this->setClientMediaType($clientMediaType);
$this->size = $size;
$this->clientFilename = $clientFilename;
$this->clientMediaType = $clientMediaType;
if ($this->isOk()) {
$this->setStreamOrFile($streamOrFile);
@@ -85,11 +80,11 @@ class UploadedFile implements UploadedFileInterface
/**
* Depending on the value set file or stream variable
*
* @param mixed $streamOrFile
* @param StreamInterface|string|resource $streamOrFile
*
* @throws InvalidArgumentException
*/
private function setStreamOrFile($streamOrFile)
private function setStreamOrFile($streamOrFile): void
{
if (is_string($streamOrFile)) {
$this->file = $streamOrFile;
@@ -105,19 +100,11 @@ class UploadedFile implements UploadedFileInterface
}
/**
* @param int $error
*
* @throws InvalidArgumentException
*/
private function setError($error)
private function setError(int $error): void
{
if (false === is_int($error)) {
throw new InvalidArgumentException(
'Upload file error status must be an integer'
);
}
if (false === in_array($error, UploadedFile::$errors)) {
if (false === in_array($error, UploadedFile::ERRORS, true)) {
throw new InvalidArgumentException(
'Invalid error status for UploadedFile'
);
@@ -126,88 +113,20 @@ class UploadedFile implements UploadedFileInterface
$this->error = $error;
}
/**
* @param int $size
*
* @throws InvalidArgumentException
*/
private function setSize($size)
{
if (false === is_int($size)) {
throw new InvalidArgumentException(
'Upload file size must be an integer'
);
}
$this->size = $size;
}
/**
* @param mixed $param
*
* @return bool
*/
private function isStringOrNull($param)
{
return in_array(gettype($param), ['string', 'NULL']);
}
/**
* @param mixed $param
*
* @return bool
*/
private function isStringNotEmpty($param)
private function isStringNotEmpty($param): bool
{
return is_string($param) && false === empty($param);
}
/**
* @param string|null $clientFilename
*
* @throws InvalidArgumentException
*/
private function setClientFilename($clientFilename)
{
if (false === $this->isStringOrNull($clientFilename)) {
throw new InvalidArgumentException(
'Upload file client filename must be a string or null'
);
}
$this->clientFilename = $clientFilename;
}
/**
* @param string|null $clientMediaType
*
* @throws InvalidArgumentException
*/
private function setClientMediaType($clientMediaType)
{
if (false === $this->isStringOrNull($clientMediaType)) {
throw new InvalidArgumentException(
'Upload file client media type must be a string or null'
);
}
$this->clientMediaType = $clientMediaType;
}
/**
* Return true if there is no upload error
*
* @return bool
*/
private function isOk()
private function isOk(): bool
{
return $this->error === UPLOAD_ERR_OK;
}
/**
* @return bool
*/
public function isMoved()
public function isMoved(): bool
{
return $this->moved;
}
@@ -215,7 +134,7 @@ class UploadedFile implements UploadedFileInterface
/**
* @throws RuntimeException if is moved or not ok
*/
private function validateActive()
private function validateActive(): void
{
if (false === $this->isOk()) {
throw new RuntimeException('Cannot retrieve stream due to upload error');
@@ -226,12 +145,7 @@ class UploadedFile implements UploadedFileInterface
}
}
/**
* {@inheritdoc}
*
* @throws RuntimeException if the upload was not successful.
*/
public function getStream()
public function getStream(): StreamInterface
{
$this->validateActive();
@@ -239,23 +153,13 @@ class UploadedFile implements UploadedFileInterface
return $this->stream;
}
return new LazyOpenStream($this->file, 'r+');
/** @var string $file */
$file = $this->file;
return new LazyOpenStream($file, 'r+');
}
/**
* {@inheritdoc}
*
* @see http://php.net/is_uploaded_file
* @see http://php.net/move_uploaded_file
*
* @param string $targetPath Path to which to move the uploaded file.
*
* @throws RuntimeException if the upload was not successful.
* @throws InvalidArgumentException if the $path specified is invalid.
* @throws RuntimeException on any error during the move operation, or on
* the second or subsequent call to the method.
*/
public function moveTo($targetPath)
public function moveTo($targetPath): void
{
$this->validateActive();
@@ -266,7 +170,7 @@ class UploadedFile implements UploadedFileInterface
}
if ($this->file) {
$this->moved = php_sapi_name() == 'cli'
$this->moved = PHP_SAPI === 'cli'
? rename($this->file, $targetPath)
: move_uploaded_file($this->file, $targetPath);
} else {
@@ -285,43 +189,22 @@ class UploadedFile implements UploadedFileInterface
}
}
/**
* {@inheritdoc}
*
* @return int|null The file size in bytes or null if unknown.
*/
public function getSize()
public function getSize(): ?int
{
return $this->size;
}
/**
* {@inheritdoc}
*
* @see http://php.net/manual/en/features.file-upload.errors.php
*
* @return int One of PHP's UPLOAD_ERR_XXX constants.
*/
public function getError()
public function getError(): int
{
return $this->error;
}
/**
* {@inheritdoc}
*
* @return string|null The filename sent by the client or null if none
* was provided.
*/
public function getClientFilename()
public function getClientFilename(): ?string
{
return $this->clientFilename;
}
/**
* {@inheritdoc}
*/
public function getClientMediaType()
public function getClientMediaType(): ?string
{
return $this->clientMediaType;
}

View File

@@ -1,7 +1,10 @@
<?php
declare(strict_types=1);
namespace GuzzleHttp\Psr7;
use GuzzleHttp\Psr7\Exception\MalformedUriException;
use Psr\Http\Message\UriInterface;
/**
@@ -11,7 +14,7 @@ use Psr\Http\Message\UriInterface;
* @author Tobias Schultze
* @author Matthew Weier O'Phinney
*/
class Uri implements UriInterface
class Uri implements UriInterface, \JsonSerializable
{
/**
* Absolute http and https URIs require a host per RFC 7230 Section 2.7
@@ -19,9 +22,9 @@ class Uri implements UriInterface
* we apply this default host when no host is given yet to form a
* valid URI.
*/
const HTTP_DEFAULT_HOST = 'localhost';
private const HTTP_DEFAULT_HOST = 'localhost';
private static $defaultPorts = [
private const DEFAULT_PORTS = [
'http' => 80,
'https' => 443,
'ftp' => 21,
@@ -35,9 +38,20 @@ class Uri implements UriInterface
'ldap' => 389,
];
private static $charUnreserved = 'a-zA-Z0-9_\-\.~';
private static $charSubDelims = '!\$&\'\(\)\*\+,;=';
private static $replaceQuery = ['=' => '%3D', '&' => '%26'];
/**
* Unreserved characters for use in a regex.
*
* @link https://tools.ietf.org/html/rfc3986#section-2.3
*/
private const CHAR_UNRESERVED = 'a-zA-Z0-9_\-\.~';
/**
* Sub-delims for use in a regex.
*
* @link https://tools.ietf.org/html/rfc3986#section-2.2
*/
private const CHAR_SUB_DELIMS = '!\$&\'\(\)\*\+,;=';
private const QUERY_SEPARATORS_REPLACEMENT = ['=' => '%3D', '&' => '%26'];
/** @var string Uri scheme. */
private $scheme = '';
@@ -60,21 +74,19 @@ class Uri implements UriInterface
/** @var string Uri fragment. */
private $fragment = '';
/**
* @param string $uri URI to parse
*/
public function __construct($uri = '')
/** @var string|null String representation */
private $composedComponents;
public function __construct(string $uri = '')
{
// weak type check to also accept null until we can add scalar type hints
if ($uri != '') {
if ($uri !== '') {
$parts = self::parse($uri);
if ($parts === false) {
throw new \InvalidArgumentException("Unable to parse URI: $uri");
throw new MalformedUriException("Unable to parse URI: $uri");
}
$this->applyParts($parts);
}
}
/**
* UTF-8 aware \parse_url() replacement.
*
@@ -88,19 +100,19 @@ class Uri implements UriInterface
* @see https://www.php.net/manual/en/function.parse-url.php#114817
* @see https://curl.haxx.se/libcurl/c/CURLOPT_URL.html#ENCODING
*
* @param string $url
*
* @return array|false
*/
private static function parse($url)
private static function parse(string $url)
{
// If IPv6
$prefix = '';
if (preg_match('%^(.*://\[[0-9:a-f]+\])(.*?)$%', $url, $matches)) {
/** @var array{0:string, 1:string, 2:string} $matches */
$prefix = $matches[1];
$url = $matches[2];
}
/** @var string */
$encodedUrl = preg_replace_callback(
'%[^:/@?&=#]+%usD',
static function ($matches) {
@@ -118,15 +130,19 @@ class Uri implements UriInterface
return array_map('urldecode', $result);
}
public function __toString()
public function __toString(): string
{
return self::composeComponents(
$this->scheme,
$this->getAuthority(),
$this->path,
$this->query,
$this->fragment
);
if ($this->composedComponents === null) {
$this->composedComponents = self::composeComponents(
$this->scheme,
$this->getAuthority(),
$this->path,
$this->query,
$this->fragment
);
}
return $this->composedComponents;
}
/**
@@ -145,17 +161,9 @@ class Uri implements UriInterface
* `file:///` is the more common syntax for the file scheme anyway (Chrome for example redirects to
* that format).
*
* @param string $scheme
* @param string $authority
* @param string $path
* @param string $query
* @param string $fragment
*
* @return string
*
* @link https://tools.ietf.org/html/rfc3986#section-5.3
*/
public static function composeComponents($scheme, $authority, $path, $query, $fragment)
public static function composeComponents(?string $scheme, ?string $authority, string $path, ?string $query, ?string $fragment): string
{
$uri = '';
@@ -186,15 +194,11 @@ class Uri implements UriInterface
*
* `Psr\Http\Message\UriInterface::getPort` may return null or the standard port. This method can be used
* independently of the implementation.
*
* @param UriInterface $uri
*
* @return bool
*/
public static function isDefaultPort(UriInterface $uri)
public static function isDefaultPort(UriInterface $uri): bool
{
return $uri->getPort() === null
|| (isset(self::$defaultPorts[$uri->getScheme()]) && $uri->getPort() === self::$defaultPorts[$uri->getScheme()]);
|| (isset(self::DEFAULT_PORTS[$uri->getScheme()]) && $uri->getPort() === self::DEFAULT_PORTS[$uri->getScheme()]);
}
/**
@@ -207,16 +211,12 @@ class Uri implements UriInterface
* - absolute-path references, e.g. '/path'
* - relative-path references, e.g. 'subpath'
*
* @param UriInterface $uri
*
* @return bool
*
* @see Uri::isNetworkPathReference
* @see Uri::isAbsolutePathReference
* @see Uri::isRelativePathReference
* @link https://tools.ietf.org/html/rfc3986#section-4
*/
public static function isAbsolute(UriInterface $uri)
public static function isAbsolute(UriInterface $uri): bool
{
return $uri->getScheme() !== '';
}
@@ -226,13 +226,9 @@ class Uri implements UriInterface
*
* A relative reference that begins with two slash characters is termed an network-path reference.
*
* @param UriInterface $uri
*
* @return bool
*
* @link https://tools.ietf.org/html/rfc3986#section-4.2
*/
public static function isNetworkPathReference(UriInterface $uri)
public static function isNetworkPathReference(UriInterface $uri): bool
{
return $uri->getScheme() === '' && $uri->getAuthority() !== '';
}
@@ -242,13 +238,9 @@ class Uri implements UriInterface
*
* A relative reference that begins with a single slash character is termed an absolute-path reference.
*
* @param UriInterface $uri
*
* @return bool
*
* @link https://tools.ietf.org/html/rfc3986#section-4.2
*/
public static function isAbsolutePathReference(UriInterface $uri)
public static function isAbsolutePathReference(UriInterface $uri): bool
{
return $uri->getScheme() === ''
&& $uri->getAuthority() === ''
@@ -261,13 +253,9 @@ class Uri implements UriInterface
*
* A relative reference that does not begin with a slash character is termed a relative-path reference.
*
* @param UriInterface $uri
*
* @return bool
*
* @link https://tools.ietf.org/html/rfc3986#section-4.2
*/
public static function isRelativePathReference(UriInterface $uri)
public static function isRelativePathReference(UriInterface $uri): bool
{
return $uri->getScheme() === ''
&& $uri->getAuthority() === ''
@@ -284,11 +272,9 @@ class Uri implements UriInterface
* @param UriInterface $uri The URI to check
* @param UriInterface|null $base An optional base URI to compare against
*
* @return bool
*
* @link https://tools.ietf.org/html/rfc3986#section-4.4
*/
public static function isSameDocumentReference(UriInterface $uri, UriInterface $base = null)
public static function isSameDocumentReference(UriInterface $uri, UriInterface $base = null): bool
{
if ($base !== null) {
$uri = UriResolver::resolve($base, $uri);
@@ -302,41 +288,6 @@ class Uri implements UriInterface
return $uri->getScheme() === '' && $uri->getAuthority() === '' && $uri->getPath() === '' && $uri->getQuery() === '';
}
/**
* Removes dot segments from a path and returns the new path.
*
* @param string $path
*
* @return string
*
* @deprecated since version 1.4. Use UriResolver::removeDotSegments instead.
* @see UriResolver::removeDotSegments
*/
public static function removeDotSegments($path)
{
return UriResolver::removeDotSegments($path);
}
/**
* Converts the relative URI into a new URI that is resolved against the base URI.
*
* @param UriInterface $base Base URI
* @param string|UriInterface $rel Relative URI
*
* @return UriInterface
*
* @deprecated since version 1.4. Use UriResolver::resolve instead.
* @see UriResolver::resolve
*/
public static function resolve(UriInterface $base, $rel)
{
if (!($rel instanceof UriInterface)) {
$rel = new self($rel);
}
return UriResolver::resolve($base, $rel);
}
/**
* Creates a new URI with a specific query string value removed.
*
@@ -345,10 +296,8 @@ class Uri implements UriInterface
*
* @param UriInterface $uri URI to use as a base.
* @param string $key Query string key to remove.
*
* @return UriInterface
*/
public static function withoutQueryValue(UriInterface $uri, $key)
public static function withoutQueryValue(UriInterface $uri, string $key): UriInterface
{
$result = self::getFilteredQueryString($uri, [$key]);
@@ -367,10 +316,8 @@ class Uri implements UriInterface
* @param UriInterface $uri URI to use as a base.
* @param string $key Key to set.
* @param string|null $value Value to set
*
* @return UriInterface
*/
public static function withQueryValue(UriInterface $uri, $key, $value)
public static function withQueryValue(UriInterface $uri, string $key, ?string $value): UriInterface
{
$result = self::getFilteredQueryString($uri, [$key]);
@@ -384,17 +331,15 @@ class Uri implements UriInterface
*
* It has the same behavior as withQueryValue() but for an associative array of key => value.
*
* @param UriInterface $uri URI to use as a base.
* @param array $keyValueArray Associative array of key and values
*
* @return UriInterface
* @param UriInterface $uri URI to use as a base.
* @param array<string, string|null> $keyValueArray Associative array of key and values
*/
public static function withQueryValues(UriInterface $uri, array $keyValueArray)
public static function withQueryValues(UriInterface $uri, array $keyValueArray): UriInterface
{
$result = self::getFilteredQueryString($uri, array_keys($keyValueArray));
foreach ($keyValueArray as $key => $value) {
$result[] = self::generateQueryString($key, $value);
$result[] = self::generateQueryString((string) $key, $value !== null ? (string) $value : null);
}
return $uri->withQuery(implode('&', $result));
@@ -403,15 +348,11 @@ class Uri implements UriInterface
/**
* Creates a URI from a hash of `parse_url` components.
*
* @param array $parts
*
* @return UriInterface
*
* @link http://php.net/manual/en/function.parse-url.php
*
* @throws \InvalidArgumentException If the components do not form a valid URI.
* @throws MalformedUriException If the components do not form a valid URI.
*/
public static function fromParts(array $parts)
public static function fromParts(array $parts): UriInterface
{
$uri = new self();
$uri->applyParts($parts);
@@ -420,12 +361,12 @@ class Uri implements UriInterface
return $uri;
}
public function getScheme()
public function getScheme(): string
{
return $this->scheme;
}
public function getAuthority()
public function getAuthority(): string
{
$authority = $this->host;
if ($this->userInfo !== '') {
@@ -439,37 +380,37 @@ class Uri implements UriInterface
return $authority;
}
public function getUserInfo()
public function getUserInfo(): string
{
return $this->userInfo;
}
public function getHost()
public function getHost(): string
{
return $this->host;
}
public function getPort()
public function getPort(): ?int
{
return $this->port;
}
public function getPath()
public function getPath(): string
{
return $this->path;
}
public function getQuery()
public function getQuery(): string
{
return $this->query;
}
public function getFragment()
public function getFragment(): string
{
return $this->fragment;
}
public function withScheme($scheme)
public function withScheme($scheme): UriInterface
{
$scheme = $this->filterScheme($scheme);
@@ -479,13 +420,14 @@ class Uri implements UriInterface
$new = clone $this;
$new->scheme = $scheme;
$new->composedComponents = null;
$new->removeDefaultPort();
$new->validateState();
return $new;
}
public function withUserInfo($user, $password = null)
public function withUserInfo($user, $password = null): UriInterface
{
$info = $this->filterUserInfoComponent($user);
if ($password !== null) {
@@ -498,12 +440,13 @@ class Uri implements UriInterface
$new = clone $this;
$new->userInfo = $info;
$new->composedComponents = null;
$new->validateState();
return $new;
}
public function withHost($host)
public function withHost($host): UriInterface
{
$host = $this->filterHost($host);
@@ -513,12 +456,13 @@ class Uri implements UriInterface
$new = clone $this;
$new->host = $host;
$new->composedComponents = null;
$new->validateState();
return $new;
}
public function withPort($port)
public function withPort($port): UriInterface
{
$port = $this->filterPort($port);
@@ -528,13 +472,14 @@ class Uri implements UriInterface
$new = clone $this;
$new->port = $port;
$new->composedComponents = null;
$new->removeDefaultPort();
$new->validateState();
return $new;
}
public function withPath($path)
public function withPath($path): UriInterface
{
$path = $this->filterPath($path);
@@ -544,12 +489,13 @@ class Uri implements UriInterface
$new = clone $this;
$new->path = $path;
$new->composedComponents = null;
$new->validateState();
return $new;
}
public function withQuery($query)
public function withQuery($query): UriInterface
{
$query = $this->filterQueryAndFragment($query);
@@ -559,11 +505,12 @@ class Uri implements UriInterface
$new = clone $this;
$new->query = $query;
$new->composedComponents = null;
return $new;
}
public function withFragment($fragment)
public function withFragment($fragment): UriInterface
{
$fragment = $this->filterQueryAndFragment($fragment);
@@ -573,16 +520,22 @@ class Uri implements UriInterface
$new = clone $this;
$new->fragment = $fragment;
$new->composedComponents = null;
return $new;
}
public function jsonSerialize(): string
{
return $this->__toString();
}
/**
* Apply parse_url parts to a URI.
*
* @param array $parts Array of parse_url parts to apply.
*/
private function applyParts(array $parts)
private function applyParts(array $parts): void
{
$this->scheme = isset($parts['scheme'])
? $this->filterScheme($parts['scheme'])
@@ -613,13 +566,11 @@ class Uri implements UriInterface
}
/**
* @param string $scheme
*
* @return string
* @param mixed $scheme
*
* @throws \InvalidArgumentException If the scheme is invalid.
*/
private function filterScheme($scheme)
private function filterScheme($scheme): string
{
if (!is_string($scheme)) {
throw new \InvalidArgumentException('Scheme must be a string');
@@ -629,33 +580,29 @@ class Uri implements UriInterface
}
/**
* @param string $component
*
* @return string
* @param mixed $component
*
* @throws \InvalidArgumentException If the user info is invalid.
*/
private function filterUserInfoComponent($component)
private function filterUserInfoComponent($component): string
{
if (!is_string($component)) {
throw new \InvalidArgumentException('User info must be a string');
}
return preg_replace_callback(
'/(?:[^%' . self::$charUnreserved . self::$charSubDelims . ']+|%(?![A-Fa-f0-9]{2}))/',
'/(?:[^%' . self::CHAR_UNRESERVED . self::CHAR_SUB_DELIMS . ']+|%(?![A-Fa-f0-9]{2}))/',
[$this, 'rawurlencodeMatchZero'],
$component
);
}
/**
* @param string $host
*
* @return string
* @param mixed $host
*
* @throws \InvalidArgumentException If the host is invalid.
*/
private function filterHost($host)
private function filterHost($host): string
{
if (!is_string($host)) {
throw new \InvalidArgumentException('Host must be a string');
@@ -665,13 +612,11 @@ class Uri implements UriInterface
}
/**
* @param int|null $port
*
* @return int|null
* @param mixed $port
*
* @throws \InvalidArgumentException If the port is invalid.
*/
private function filterPort($port)
private function filterPort($port): ?int
{
if ($port === null) {
return null;
@@ -688,12 +633,11 @@ class Uri implements UriInterface
}
/**
* @param UriInterface $uri
* @param array $keys
* @param string[] $keys
*
* @return array
* @return string[]
*/
private static function getFilteredQueryString(UriInterface $uri, array $keys)
private static function getFilteredQueryString(UriInterface $uri, array $keys): array
{
$current = $uri->getQuery();
@@ -708,27 +652,21 @@ class Uri implements UriInterface
});
}
/**
* @param string $key
* @param string|null $value
*
* @return string
*/
private static function generateQueryString($key, $value)
private static function generateQueryString(string $key, ?string $value): string
{
// Query string separators ("=", "&") within the key or value need to be encoded
// (while preventing double-encoding) before setting the query string. All other
// chars that need percent-encoding will be encoded by withQuery().
$queryString = strtr($key, self::$replaceQuery);
$queryString = strtr($key, self::QUERY_SEPARATORS_REPLACEMENT);
if ($value !== null) {
$queryString .= '=' . strtr($value, self::$replaceQuery);
$queryString .= '=' . strtr($value, self::QUERY_SEPARATORS_REPLACEMENT);
}
return $queryString;
}
private function removeDefaultPort()
private function removeDefaultPort(): void
{
if ($this->port !== null && self::isDefaultPort($this)) {
$this->port = null;
@@ -738,20 +676,18 @@ class Uri implements UriInterface
/**
* Filters the path of a URI
*
* @param string $path
*
* @return string
* @param mixed $path
*
* @throws \InvalidArgumentException If the path is invalid.
*/
private function filterPath($path)
private function filterPath($path): string
{
if (!is_string($path)) {
throw new \InvalidArgumentException('Path must be a string');
}
return preg_replace_callback(
'/(?:[^' . self::$charUnreserved . self::$charSubDelims . '%:@\/]++|%(?![A-Fa-f0-9]{2}))/',
'/(?:[^' . self::CHAR_UNRESERVED . self::CHAR_SUB_DELIMS . '%:@\/]++|%(?![A-Fa-f0-9]{2}))/',
[$this, 'rawurlencodeMatchZero'],
$path
);
@@ -760,31 +696,29 @@ class Uri implements UriInterface
/**
* Filters the query string or fragment of a URI.
*
* @param string $str
*
* @return string
* @param mixed $str
*
* @throws \InvalidArgumentException If the query or fragment is invalid.
*/
private function filterQueryAndFragment($str)
private function filterQueryAndFragment($str): string
{
if (!is_string($str)) {
throw new \InvalidArgumentException('Query and fragment must be a string');
}
return preg_replace_callback(
'/(?:[^' . self::$charUnreserved . self::$charSubDelims . '%:@\/\?]++|%(?![A-Fa-f0-9]{2}))/',
'/(?:[^' . self::CHAR_UNRESERVED . self::CHAR_SUB_DELIMS . '%:@\/\?]++|%(?![A-Fa-f0-9]{2}))/',
[$this, 'rawurlencodeMatchZero'],
$str
);
}
private function rawurlencodeMatchZero(array $match)
private function rawurlencodeMatchZero(array $match): string
{
return rawurlencode($match[0]);
}
private function validateState()
private function validateState(): void
{
if ($this->host === '' && ($this->scheme === 'http' || $this->scheme === 'https')) {
$this->host = self::HTTP_DEFAULT_HOST;
@@ -792,19 +726,13 @@ class Uri implements UriInterface
if ($this->getAuthority() === '') {
if (0 === strpos($this->path, '//')) {
throw new \InvalidArgumentException('The path of a URI without an authority must not start with two slashes "//"');
throw new MalformedUriException('The path of a URI without an authority must not start with two slashes "//"');
}
if ($this->scheme === '' && false !== strpos(explode('/', $this->path, 2)[0], ':')) {
throw new \InvalidArgumentException('A relative URI must not have a path beginning with a segment containing a colon');
throw new MalformedUriException('A relative URI must not have a path beginning with a segment containing a colon');
}
} elseif (isset($this->path[0]) && $this->path[0] !== '/') {
@trigger_error(
'The path of a URI with an authority must start with a slash "/" or be empty. Automagically fixing the URI ' .
'by adding a leading slash to the path is deprecated since version 1.4 and will throw an exception instead.',
E_USER_DEPRECATED
);
$this->path = '/' . $this->path;
//throw new \InvalidArgumentException('The path of a URI with an authority must start with a slash "/" or be empty');
throw new MalformedUriException('The path of a URI with an authority must start with a slash "/" or be empty');
}
}
}

View File

@@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace GuzzleHttp\Psr7;
use Psr\Http\Message\UriInterface;
@@ -14,10 +16,8 @@ final class UriComparator
/**
* Determines if a modified URL should be considered cross-origin with
* respect to an original URL.
*
* @return bool
*/
public static function isCrossOrigin(UriInterface $original, UriInterface $modified)
public static function isCrossOrigin(UriInterface $original, UriInterface $modified): bool
{
if (\strcasecmp($original->getHost(), $modified->getHost()) !== 0) {
return true;
@@ -34,10 +34,7 @@ final class UriComparator
return false;
}
/**
* @return int
*/
private static function computePort(UriInterface $uri)
private static function computePort(UriInterface $uri): int
{
$port = $uri->getPort();

View File

@@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace GuzzleHttp\Psr7;
use Psr\Http\Message\UriInterface;
@@ -15,18 +17,21 @@ final class UriNormalizer
{
/**
* Default normalizations which only include the ones that preserve semantics.
*
* self::CAPITALIZE_PERCENT_ENCODING | self::DECODE_UNRESERVED_CHARACTERS | self::CONVERT_EMPTY_PATH |
* self::REMOVE_DEFAULT_HOST | self::REMOVE_DEFAULT_PORT | self::REMOVE_DOT_SEGMENTS
*/
const PRESERVING_NORMALIZATIONS = 63;
public const PRESERVING_NORMALIZATIONS =
self::CAPITALIZE_PERCENT_ENCODING |
self::DECODE_UNRESERVED_CHARACTERS |
self::CONVERT_EMPTY_PATH |
self::REMOVE_DEFAULT_HOST |
self::REMOVE_DEFAULT_PORT |
self::REMOVE_DOT_SEGMENTS;
/**
* All letters within a percent-encoding triplet (e.g., "%3A") are case-insensitive, and should be capitalized.
*
* Example: http://example.org/a%c2%b1b → http://example.org/a%C2%B1b
*/
const CAPITALIZE_PERCENT_ENCODING = 1;
public const CAPITALIZE_PERCENT_ENCODING = 1;
/**
* Decodes percent-encoded octets of unreserved characters.
@@ -37,14 +42,14 @@ final class UriNormalizer
*
* Example: http://example.org/%7Eusern%61me/ → http://example.org/~username/
*/
const DECODE_UNRESERVED_CHARACTERS = 2;
public const DECODE_UNRESERVED_CHARACTERS = 2;
/**
* Converts the empty path to "/" for http and https URIs.
*
* Example: http://example.org → http://example.org/
*/
const CONVERT_EMPTY_PATH = 4;
public const CONVERT_EMPTY_PATH = 4;
/**
* Removes the default host of the given URI scheme from the URI.
@@ -57,14 +62,14 @@ final class UriNormalizer
*
* Example: file://localhost/myfile → file:///myfile
*/
const REMOVE_DEFAULT_HOST = 8;
public const REMOVE_DEFAULT_HOST = 8;
/**
* Removes the default port of the given URI scheme from the URI.
*
* Example: http://example.org:80/ → http://example.org/
*/
const REMOVE_DEFAULT_PORT = 16;
public const REMOVE_DEFAULT_PORT = 16;
/**
* Removes unnecessary dot-segments.
@@ -74,7 +79,7 @@ final class UriNormalizer
*
* Example: http://example.org/../a/b/../c/./d.html → http://example.org/a/c/d.html
*/
const REMOVE_DOT_SEGMENTS = 32;
public const REMOVE_DOT_SEGMENTS = 32;
/**
* Paths which include two or more adjacent slashes are converted to one.
@@ -85,7 +90,7 @@ final class UriNormalizer
*
* Example: http://example.org//foo///bar.html → http://example.org/foo/bar.html
*/
const REMOVE_DUPLICATE_SLASHES = 64;
public const REMOVE_DUPLICATE_SLASHES = 64;
/**
* Sort query parameters with their values in alphabetical order.
@@ -98,7 +103,7 @@ final class UriNormalizer
* Note: The sorting is neither locale nor Unicode aware (the URI query does not get decoded at all) as the
* purpose is to be able to compare URIs in a reproducible way, not to have the params sorted perfectly.
*/
const SORT_QUERY_PARAMETERS = 128;
public const SORT_QUERY_PARAMETERS = 128;
/**
* Returns a normalized URI.
@@ -114,11 +119,9 @@ final class UriNormalizer
* @param UriInterface $uri The URI to normalize
* @param int $flags A bitmask of normalizations to apply, see constants
*
* @return UriInterface The normalized URI
*
* @link https://tools.ietf.org/html/rfc3986#section-6.2
*/
public static function normalize(UriInterface $uri, $flags = self::PRESERVING_NORMALIZATIONS)
public static function normalize(UriInterface $uri, int $flags = self::PRESERVING_NORMALIZATIONS): UriInterface
{
if ($flags & self::CAPITALIZE_PERCENT_ENCODING) {
$uri = self::capitalizePercentEncoding($uri);
@@ -171,16 +174,14 @@ final class UriNormalizer
* @param UriInterface $uri2 An URI to compare
* @param int $normalizations A bitmask of normalizations to apply, see constants
*
* @return bool
*
* @link https://tools.ietf.org/html/rfc3986#section-6.1
*/
public static function isEquivalent(UriInterface $uri1, UriInterface $uri2, $normalizations = self::PRESERVING_NORMALIZATIONS)
public static function isEquivalent(UriInterface $uri1, UriInterface $uri2, int $normalizations = self::PRESERVING_NORMALIZATIONS): bool
{
return (string) self::normalize($uri1, $normalizations) === (string) self::normalize($uri2, $normalizations);
}
private static function capitalizePercentEncoding(UriInterface $uri)
private static function capitalizePercentEncoding(UriInterface $uri): UriInterface
{
$regex = '/(?:%[A-Fa-f0-9]{2})++/';
@@ -196,7 +197,7 @@ final class UriNormalizer
);
}
private static function decodeUnreservedCharacters(UriInterface $uri)
private static function decodeUnreservedCharacters(UriInterface $uri): UriInterface
{
$regex = '/%(?:2D|2E|5F|7E|3[0-9]|[46][1-9A-F]|[57][0-9A])/i';

View File

@@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace GuzzleHttp\Psr7;
use Psr\Http\Message\UriInterface;
@@ -16,13 +18,9 @@ final class UriResolver
/**
* Removes dot segments from a path and returns the new path.
*
* @param string $path
*
* @return string
*
* @link http://tools.ietf.org/html/rfc3986#section-5.2.4
*/
public static function removeDotSegments($path)
public static function removeDotSegments(string $path): string
{
if ($path === '' || $path === '/') {
return $path;
@@ -55,14 +53,9 @@ final class UriResolver
/**
* Converts the relative URI into a new URI that is resolved against the base URI.
*
* @param UriInterface $base Base URI
* @param UriInterface $rel Relative URI
*
* @return UriInterface
*
* @link http://tools.ietf.org/html/rfc3986#section-5.2
*/
public static function resolve(UriInterface $base, UriInterface $rel)
public static function resolve(UriInterface $base, UriInterface $rel): UriInterface
{
if ((string) $rel === '') {
// we can simply return the same base URI instance for this same-document reference
@@ -131,13 +124,8 @@ final class UriResolver
* relative-path reference will be returned as-is.
*
* echo UriResolver::relativize($base, new Uri('/a/b/c')); // prints 'c' as well
*
* @param UriInterface $base Base URI
* @param UriInterface $target Target URI
*
* @return UriInterface The relative URI reference
*/
public static function relativize(UriInterface $base, UriInterface $target)
public static function relativize(UriInterface $base, UriInterface $target): UriInterface
{
if ($target->getScheme() !== '' &&
($base->getScheme() !== $target->getScheme() || $target->getAuthority() === '' && $base->getAuthority() !== '')
@@ -174,6 +162,7 @@ final class UriResolver
// inherit the base query component when resolving.
if ($target->getQuery() === '') {
$segments = explode('/', $target->getPath());
/** @var string $lastSegment */
$lastSegment = end($segments);
return $emptyPathUri->withPath($lastSegment === '' ? './' : $lastSegment);
@@ -182,7 +171,7 @@ final class UriResolver
return $emptyPathUri;
}
private static function getRelativePath(UriInterface $base, UriInterface $target)
private static function getRelativePath(UriInterface $base, UriInterface $target): string
{
$sourceSegments = explode('/', $base->getPath());
$targetSegments = explode('/', $target->getPath());

View File

@@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace GuzzleHttp\Psr7;
use Psr\Http\Message\RequestInterface;
@@ -12,11 +14,9 @@ final class Utils
/**
* Remove the items given by the keys, case insensitively from the data.
*
* @param iterable<string> $keys
*
* @return array
* @param string[] $keys
*/
public static function caselessRemove($keys, array $data)
public static function caselessRemove(array $keys, array $data): array
{
$result = [];
@@ -25,7 +25,7 @@ final class Utils
}
foreach ($data as $k => $v) {
if (!in_array(strtolower($k), $keys)) {
if (!is_string($k) || !in_array(strtolower($k), $keys)) {
$result[$k] = $v;
}
}
@@ -44,7 +44,7 @@ final class Utils
*
* @throws \RuntimeException on error.
*/
public static function copyToStream(StreamInterface $source, StreamInterface $dest, $maxLen = -1)
public static function copyToStream(StreamInterface $source, StreamInterface $dest, int $maxLen = -1): void
{
$bufferSize = 8192;
@@ -76,19 +76,16 @@ final class Utils
* @param int $maxLen Maximum number of bytes to read. Pass -1
* to read the entire stream.
*
* @return string
*
* @throws \RuntimeException on error.
*/
public static function copyToString(StreamInterface $stream, $maxLen = -1)
public static function copyToString(StreamInterface $stream, int $maxLen = -1): string
{
$buffer = '';
if ($maxLen === -1) {
while (!$stream->eof()) {
$buf = $stream->read(1048576);
// Using a loose equality here to match on '' and false.
if ($buf == null) {
if ($buf === '') {
break;
}
$buffer .= $buf;
@@ -99,8 +96,7 @@ final class Utils
$len = 0;
while (!$stream->eof() && $len < $maxLen) {
$buf = $stream->read($maxLen - $len);
// Using a loose equality here to match on '' and false.
if ($buf == null) {
if ($buf === '') {
break;
}
$buffer .= $buf;
@@ -120,11 +116,9 @@ final class Utils
* @param string $algo Hash algorithm (e.g. md5, crc32, etc)
* @param bool $rawOutput Whether or not to use raw output
*
* @return string Returns the hash of the stream
*
* @throws \RuntimeException on error.
*/
public static function hash(StreamInterface $stream, $algo, $rawOutput = false)
public static function hash(StreamInterface $stream, string $algo, bool $rawOutput = false): string
{
$pos = $stream->tell();
@@ -137,7 +131,7 @@ final class Utils
hash_update($ctx, $stream->read(1048576));
}
$out = hash_final($ctx, (bool) $rawOutput);
$out = hash_final($ctx, $rawOutput);
$stream->seek($pos);
return $out;
@@ -160,10 +154,8 @@ final class Utils
*
* @param RequestInterface $request Request to clone and modify.
* @param array $changes Changes to apply.
*
* @return RequestInterface
*/
public static function modifyRequest(RequestInterface $request, array $changes)
public static function modifyRequest(RequestInterface $request, array $changes): RequestInterface
{
if (!$changes) {
return $request;
@@ -204,13 +196,11 @@ final class Utils
if ($request instanceof ServerRequestInterface) {
$new = (new ServerRequest(
isset($changes['method']) ? $changes['method'] : $request->getMethod(),
$changes['method'] ?? $request->getMethod(),
$uri,
$headers,
isset($changes['body']) ? $changes['body'] : $request->getBody(),
isset($changes['version'])
? $changes['version']
: $request->getProtocolVersion(),
$changes['body'] ?? $request->getBody(),
$changes['version'] ?? $request->getProtocolVersion(),
$request->getServerParams()
))
->withParsedBody($request->getParsedBody())
@@ -226,13 +216,11 @@ final class Utils
}
return new Request(
isset($changes['method']) ? $changes['method'] : $request->getMethod(),
$changes['method'] ?? $request->getMethod(),
$uri,
$headers,
isset($changes['body']) ? $changes['body'] : $request->getBody(),
isset($changes['version'])
? $changes['version']
: $request->getProtocolVersion()
$changes['body'] ?? $request->getBody(),
$changes['version'] ?? $request->getProtocolVersion()
);
}
@@ -241,17 +229,14 @@ final class Utils
*
* @param StreamInterface $stream Stream to read from
* @param int|null $maxLength Maximum buffer length
*
* @return string
*/
public static function readLine(StreamInterface $stream, $maxLength = null)
public static function readLine(StreamInterface $stream, ?int $maxLength = null): string
{
$buffer = '';
$size = 0;
while (!$stream->eof()) {
// Using a loose equality here to match on '' and false.
if (null == ($byte = $stream->read(1))) {
if ('' === ($byte = $stream->read(1))) {
return $buffer;
}
$buffer .= $byte;
@@ -294,18 +279,16 @@ final class Utils
* buffered and used in subsequent reads.
*
* @param resource|string|int|float|bool|StreamInterface|callable|\Iterator|null $resource Entity body data
* @param array $options Additional options
*
* @return StreamInterface
* @param array{size?: int, metadata?: array} $options Additional options
*
* @throws \InvalidArgumentException if the $resource arg is not valid.
*/
public static function streamFor($resource = '', array $options = [])
public static function streamFor($resource = '', array $options = []): StreamInterface
{
if (is_scalar($resource)) {
$stream = self::tryFopen('php://temp', 'r+');
if ($resource !== '') {
fwrite($stream, $resource);
fwrite($stream, (string) $resource);
fseek($stream, 0);
}
return new Stream($stream, $options);
@@ -317,15 +300,17 @@ final class Utils
* The 'php://input' is a special stream with quirks and inconsistencies.
* We avoid using that stream by reading it into php://temp
*/
$metaData = \stream_get_meta_data($resource);
if (isset($metaData['uri']) && $metaData['uri'] === 'php://input') {
/** @var resource $resource */
if ((\stream_get_meta_data($resource)['uri'] ?? '') === 'php://input') {
$stream = self::tryFopen('php://temp', 'w+');
fwrite($stream, stream_get_contents($resource));
stream_copy_to_stream($resource, $stream);
fseek($stream, 0);
$resource = $stream;
}
return new Stream($resource, $options);
case 'object':
/** @var object $resource */
if ($resource instanceof StreamInterface) {
return $resource;
} elseif ($resource instanceof \Iterator) {
@@ -338,7 +323,7 @@ final class Utils
return $result;
}, $options);
} elseif (method_exists($resource, '__toString')) {
return Utils::streamFor((string) $resource, $options);
return self::streamFor((string) $resource, $options);
}
break;
case 'NULL':
@@ -365,21 +350,22 @@ final class Utils
*
* @throws \RuntimeException if the file cannot be opened
*/
public static function tryFopen($filename, $mode)
public static function tryFopen(string $filename, string $mode)
{
$ex = null;
set_error_handler(function () use ($filename, $mode, &$ex) {
set_error_handler(static function (int $errno, string $errstr) use ($filename, $mode, &$ex): bool {
$ex = new \RuntimeException(sprintf(
'Unable to open "%s" using mode "%s": %s',
$filename,
$mode,
func_get_args()[1]
$errstr
));
return true;
});
try {
/** @var resource $handle */
$handle = fopen($filename, $mode);
} catch (\Throwable $e) {
$ex = new \RuntimeException(sprintf(
@@ -400,6 +386,53 @@ final class Utils
return $handle;
}
/**
* Safely gets the contents of a given stream.
*
* When stream_get_contents fails, PHP normally raises a warning. This
* function adds an error handler that checks for errors and throws an
* exception instead.
*
* @param resource $stream
*
* @throws \RuntimeException if the stream cannot be read
*/
public static function tryGetContents($stream): string
{
$ex = null;
set_error_handler(static function (int $errno, string $errstr) use (&$ex): bool {
$ex = new \RuntimeException(sprintf(
'Unable to read stream contents: %s',
$errstr
));
return true;
});
try {
/** @var string|false $contents */
$contents = stream_get_contents($stream);
if ($contents === false) {
$ex = new \RuntimeException('Unable to read stream contents');
}
} catch (\Throwable $e) {
$ex = new \RuntimeException(sprintf(
'Unable to read stream contents: %s',
$e->getMessage()
), 0, $e);
}
restore_error_handler();
if ($ex) {
/** @var $ex \RuntimeException */
throw $ex;
}
return $contents;
}
/**
* Returns a UriInterface for the given value.
*
@@ -409,11 +442,9 @@ final class Utils
*
* @param string|UriInterface $uri
*
* @return UriInterface
*
* @throws \InvalidArgumentException
*/
public static function uriFor($uri)
public static function uriFor($uri): UriInterface
{
if ($uri instanceof UriInterface) {
return $uri;

View File

@@ -1,422 +0,0 @@
<?php
namespace GuzzleHttp\Psr7;
use Psr\Http\Message\MessageInterface;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\StreamInterface;
use Psr\Http\Message\UriInterface;
/**
* Returns the string representation of an HTTP message.
*
* @param MessageInterface $message Message to convert to a string.
*
* @return string
*
* @deprecated str will be removed in guzzlehttp/psr7:2.0. Use Message::toString instead.
*/
function str(MessageInterface $message)
{
return Message::toString($message);
}
/**
* Returns a UriInterface for the given value.
*
* This function accepts a string or UriInterface and returns a
* UriInterface for the given value. If the value is already a
* UriInterface, it is returned as-is.
*
* @param string|UriInterface $uri
*
* @return UriInterface
*
* @throws \InvalidArgumentException
*
* @deprecated uri_for will be removed in guzzlehttp/psr7:2.0. Use Utils::uriFor instead.
*/
function uri_for($uri)
{
return Utils::uriFor($uri);
}
/**
* Create a new stream based on the input type.
*
* Options is an associative array that can contain the following keys:
* - metadata: Array of custom metadata.
* - size: Size of the stream.
*
* This method accepts the following `$resource` types:
* - `Psr\Http\Message\StreamInterface`: Returns the value as-is.
* - `string`: Creates a stream object that uses the given string as the contents.
* - `resource`: Creates a stream object that wraps the given PHP stream resource.
* - `Iterator`: If the provided value implements `Iterator`, then a read-only
* stream object will be created that wraps the given iterable. Each time the
* stream is read from, data from the iterator will fill a buffer and will be
* continuously called until the buffer is equal to the requested read size.
* Subsequent read calls will first read from the buffer and then call `next`
* on the underlying iterator until it is exhausted.
* - `object` with `__toString()`: If the object has the `__toString()` method,
* the object will be cast to a string and then a stream will be returned that
* uses the string value.
* - `NULL`: When `null` is passed, an empty stream object is returned.
* - `callable` When a callable is passed, a read-only stream object will be
* created that invokes the given callable. The callable is invoked with the
* number of suggested bytes to read. The callable can return any number of
* bytes, but MUST return `false` when there is no more data to return. The
* stream object that wraps the callable will invoke the callable until the
* number of requested bytes are available. Any additional bytes will be
* buffered and used in subsequent reads.
*
* @param resource|string|int|float|bool|StreamInterface|callable|\Iterator|null $resource Entity body data
* @param array $options Additional options
*
* @return StreamInterface
*
* @throws \InvalidArgumentException if the $resource arg is not valid.
*
* @deprecated stream_for will be removed in guzzlehttp/psr7:2.0. Use Utils::streamFor instead.
*/
function stream_for($resource = '', array $options = [])
{
return Utils::streamFor($resource, $options);
}
/**
* Parse an array of header values containing ";" separated data into an
* array of associative arrays representing the header key value pair data
* of the header. When a parameter does not contain a value, but just
* contains a key, this function will inject a key with a '' string value.
*
* @param string|array $header Header to parse into components.
*
* @return array Returns the parsed header values.
*
* @deprecated parse_header will be removed in guzzlehttp/psr7:2.0. Use Header::parse instead.
*/
function parse_header($header)
{
return Header::parse($header);
}
/**
* Converts an array of header values that may contain comma separated
* headers into an array of headers with no comma separated values.
*
* @param string|array $header Header to normalize.
*
* @return array Returns the normalized header field values.
*
* @deprecated normalize_header will be removed in guzzlehttp/psr7:2.0. Use Header::normalize instead.
*/
function normalize_header($header)
{
return Header::normalize($header);
}
/**
* Clone and modify a request with the given changes.
*
* This method is useful for reducing the number of clones needed to mutate a
* message.
*
* The changes can be one of:
* - method: (string) Changes the HTTP method.
* - set_headers: (array) Sets the given headers.
* - remove_headers: (array) Remove the given headers.
* - body: (mixed) Sets the given body.
* - uri: (UriInterface) Set the URI.
* - query: (string) Set the query string value of the URI.
* - version: (string) Set the protocol version.
*
* @param RequestInterface $request Request to clone and modify.
* @param array $changes Changes to apply.
*
* @return RequestInterface
*
* @deprecated modify_request will be removed in guzzlehttp/psr7:2.0. Use Utils::modifyRequest instead.
*/
function modify_request(RequestInterface $request, array $changes)
{
return Utils::modifyRequest($request, $changes);
}
/**
* Attempts to rewind a message body and throws an exception on failure.
*
* The body of the message will only be rewound if a call to `tell()` returns a
* value other than `0`.
*
* @param MessageInterface $message Message to rewind
*
* @throws \RuntimeException
*
* @deprecated rewind_body will be removed in guzzlehttp/psr7:2.0. Use Message::rewindBody instead.
*/
function rewind_body(MessageInterface $message)
{
Message::rewindBody($message);
}
/**
* Safely opens a PHP stream resource using a filename.
*
* When fopen fails, PHP normally raises a warning. This function adds an
* error handler that checks for errors and throws an exception instead.
*
* @param string $filename File to open
* @param string $mode Mode used to open the file
*
* @return resource
*
* @throws \RuntimeException if the file cannot be opened
*
* @deprecated try_fopen will be removed in guzzlehttp/psr7:2.0. Use Utils::tryFopen instead.
*/
function try_fopen($filename, $mode)
{
return Utils::tryFopen($filename, $mode);
}
/**
* Copy the contents of a stream into a string until the given number of
* bytes have been read.
*
* @param StreamInterface $stream Stream to read
* @param int $maxLen Maximum number of bytes to read. Pass -1
* to read the entire stream.
*
* @return string
*
* @throws \RuntimeException on error.
*
* @deprecated copy_to_string will be removed in guzzlehttp/psr7:2.0. Use Utils::copyToString instead.
*/
function copy_to_string(StreamInterface $stream, $maxLen = -1)
{
return Utils::copyToString($stream, $maxLen);
}
/**
* Copy the contents of a stream into another stream until the given number
* of bytes have been read.
*
* @param StreamInterface $source Stream to read from
* @param StreamInterface $dest Stream to write to
* @param int $maxLen Maximum number of bytes to read. Pass -1
* to read the entire stream.
*
* @throws \RuntimeException on error.
*
* @deprecated copy_to_stream will be removed in guzzlehttp/psr7:2.0. Use Utils::copyToStream instead.
*/
function copy_to_stream(StreamInterface $source, StreamInterface $dest, $maxLen = -1)
{
return Utils::copyToStream($source, $dest, $maxLen);
}
/**
* Calculate a hash of a stream.
*
* This method reads the entire stream to calculate a rolling hash, based on
* PHP's `hash_init` functions.
*
* @param StreamInterface $stream Stream to calculate the hash for
* @param string $algo Hash algorithm (e.g. md5, crc32, etc)
* @param bool $rawOutput Whether or not to use raw output
*
* @return string Returns the hash of the stream
*
* @throws \RuntimeException on error.
*
* @deprecated hash will be removed in guzzlehttp/psr7:2.0. Use Utils::hash instead.
*/
function hash(StreamInterface $stream, $algo, $rawOutput = false)
{
return Utils::hash($stream, $algo, $rawOutput);
}
/**
* Read a line from the stream up to the maximum allowed buffer length.
*
* @param StreamInterface $stream Stream to read from
* @param int|null $maxLength Maximum buffer length
*
* @return string
*
* @deprecated readline will be removed in guzzlehttp/psr7:2.0. Use Utils::readLine instead.
*/
function readline(StreamInterface $stream, $maxLength = null)
{
return Utils::readLine($stream, $maxLength);
}
/**
* Parses a request message string into a request object.
*
* @param string $message Request message string.
*
* @return Request
*
* @deprecated parse_request will be removed in guzzlehttp/psr7:2.0. Use Message::parseRequest instead.
*/
function parse_request($message)
{
return Message::parseRequest($message);
}
/**
* Parses a response message string into a response object.
*
* @param string $message Response message string.
*
* @return Response
*
* @deprecated parse_response will be removed in guzzlehttp/psr7:2.0. Use Message::parseResponse instead.
*/
function parse_response($message)
{
return Message::parseResponse($message);
}
/**
* Parse a query string into an associative array.
*
* If multiple values are found for the same key, the value of that key value
* pair will become an array. This function does not parse nested PHP style
* arrays into an associative array (e.g., `foo[a]=1&foo[b]=2` will be parsed
* into `['foo[a]' => '1', 'foo[b]' => '2'])`.
*
* @param string $str Query string to parse
* @param int|bool $urlEncoding How the query string is encoded
*
* @return array
*
* @deprecated parse_query will be removed in guzzlehttp/psr7:2.0. Use Query::parse instead.
*/
function parse_query($str, $urlEncoding = true)
{
return Query::parse($str, $urlEncoding);
}
/**
* Build a query string from an array of key value pairs.
*
* This function can use the return value of `parse_query()` to build a query
* string. This function does not modify the provided keys when an array is
* encountered (like `http_build_query()` would).
*
* @param array $params Query string parameters.
* @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986
* to encode using RFC3986, or PHP_QUERY_RFC1738
* to encode using RFC1738.
*
* @return string
*
* @deprecated build_query will be removed in guzzlehttp/psr7:2.0. Use Query::build instead.
*/
function build_query(array $params, $encoding = PHP_QUERY_RFC3986)
{
return Query::build($params, $encoding);
}
/**
* Determines the mimetype of a file by looking at its extension.
*
* @param string $filename
*
* @return string|null
*
* @deprecated mimetype_from_filename will be removed in guzzlehttp/psr7:2.0. Use MimeType::fromFilename instead.
*/
function mimetype_from_filename($filename)
{
return MimeType::fromFilename($filename);
}
/**
* Maps a file extensions to a mimetype.
*
* @param $extension string The file extension.
*
* @return string|null
*
* @link http://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x/conf/mime.types
* @deprecated mimetype_from_extension will be removed in guzzlehttp/psr7:2.0. Use MimeType::fromExtension instead.
*/
function mimetype_from_extension($extension)
{
return MimeType::fromExtension($extension);
}
/**
* Parses an HTTP message into an associative array.
*
* The array contains the "start-line" key containing the start line of
* the message, "headers" key containing an associative array of header
* array values, and a "body" key containing the body of the message.
*
* @param string $message HTTP request or response to parse.
*
* @return array
*
* @internal
*
* @deprecated _parse_message will be removed in guzzlehttp/psr7:2.0. Use Message::parseMessage instead.
*/
function _parse_message($message)
{
return Message::parseMessage($message);
}
/**
* Constructs a URI for an HTTP request message.
*
* @param string $path Path from the start-line
* @param array $headers Array of headers (each value an array).
*
* @return string
*
* @internal
*
* @deprecated _parse_request_uri will be removed in guzzlehttp/psr7:2.0. Use Message::parseRequestUri instead.
*/
function _parse_request_uri($path, array $headers)
{
return Message::parseRequestUri($path, $headers);
}
/**
* Get a short summary of the message body.
*
* Will return `null` if the response is not printable.
*
* @param MessageInterface $message The message to get the body summary
* @param int $truncateAt The maximum allowed size of the summary
*
* @return string|null
*
* @deprecated get_message_body_summary will be removed in guzzlehttp/psr7:2.0. Use Message::bodySummary instead.
*/
function get_message_body_summary(MessageInterface $message, $truncateAt = 120)
{
return Message::bodySummary($message, $truncateAt);
}
/**
* Remove the items given by the keys, case insensitively from the data.
*
* @param iterable<string> $keys
*
* @return array
*
* @internal
*
* @deprecated _caseless_remove will be removed in guzzlehttp/psr7:2.0. Use Utils::caselessRemove instead.
*/
function _caseless_remove($keys, array $data)
{
return Utils::caselessRemove($keys, $data);
}

View File

@@ -1,6 +0,0 @@
<?php
// Don't redefine the functions if included multiple times.
if (!function_exists('GuzzleHttp\Psr7\str')) {
require __DIR__ . '/functions.php';
}

View File

@@ -0,0 +1,5 @@
{
"ignore_php_platform_requirements": {
"8.1": true
}
}

View File

@@ -1,51 +0,0 @@
# Changelog
All notable changes to this project will be documented in this file, in reverse chronological order by release.
## 2.6.1 - 2019-09-04
### Added
- [zendframework/zend-loader#18](https://github.com/zendframework/zend-loader/pull/18) adds support for PHP 7.3.
### Changed
- Nothing.
### Deprecated
- Nothing.
### Removed
- Nothing.
### Fixed
- Nothing.
## 2.6.0 - 2018-04-30
### Added
- [zendframework/zend-loader#16](https://github.com/zendframework/zend-loader/pull/16) adds support for PHP 7.1 and 7.2.
- [zendframework/zend-loader#8](https://github.com/zendframework/zend-loader/pull/8) adds documentation at https://docs.laminas.dev/laminas-loader/
### Changed
- Nothing.
### Deprecated
- Nothing.
### Removed
- [zendframework/zend-loader#16](https://github.com/zendframework/zend-loader/pull/16) removes support for PHP 5.5.
- [zendframework/zend-loader#16](https://github.com/zendframework/zend-loader/pull/16) removes support for HHVM.
### Fixed
- Nothing.

View File

@@ -1,2 +1 @@
Copyright (c) 2019, Laminas Foundation.
All rights reserved. (https://getlaminas.org/)
Copyright (c) 2020 Laminas Project a Series of LF Projects, LLC. (https://getlaminas.org/)

View File

@@ -1,5 +1,4 @@
Copyright (c) 2019, Laminas Foundation
All rights reserved.
Copyright (c) 2020 Laminas Project a Series of LF Projects, LLC.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

View File

@@ -1,7 +1,11 @@
# laminas-loader
[![Build Status](https://travis-ci.org/laminas/laminas-loader.svg?branch=master)](https://travis-ci.org/laminas/laminas-loader)
[![Coverage Status](https://coveralls.io/repos/github/laminas/laminas-loader/badge.svg?branch=master)](https://coveralls.io/github/laminas/laminas-loader?branch=master)
> This package is considered feature-complete, and is now in **security-only** maintenance mode, following a [decision by the Technical Steering Committee](https://github.com/laminas/technical-steering-committee/blob/2b55453e172a1b8c9c4c212be7cf7e7a58b9352c/meetings/minutes/2020-08-03-TSC-Minutes.md#vote-on-components-to-mark-as-security-only).
> If you have a security issue, please [follow our security reporting guidelines](https://getlaminas.org/security/).
> If you wish to take on the role of maintainer, please [nominate yourself](https://github.com/laminas/technical-steering-committee/issues/new?assignees=&labels=Nomination&template=Maintainer_Nomination.md&title=%5BNOMINATION%5D%5BMAINTAINER%5D%3A+%7Bname+of+person+being+nominated%7D)
[![Build Status](https://github.com/laminas/laminas-loader/workflows/Continuous%20Integration/badge.svg)](https://github.com/laminas/laminas-loader/actions?query=workflow%3A"Continuous+Integration")
laminas-loader provides different strategies for autoloading PHP classes.

View File

@@ -18,19 +18,12 @@
"config": {
"sort-packages": true
},
"extra": {
"branch-alias": {
"dev-master": "2.6.x-dev",
"dev-develop": "2.7.x-dev"
}
},
"require": {
"php": "^5.6 || ^7.0",
"laminas/laminas-zendframework-bridge": "^1.0"
"php": "^7.3 || ~8.0.0 || ~8.1.0"
},
"require-dev": {
"laminas/laminas-coding-standard": "~1.0.0",
"phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1.4"
"laminas/laminas-coding-standard": "~2.2.1",
"phpunit/phpunit": "^9.3"
},
"autoload": {
"psr-4": {
@@ -52,7 +45,7 @@
"test": "phpunit --colors=always",
"test-coverage": "phpunit --colors=always --coverage-clover clover.xml"
},
"replace": {
"zendframework/zend-loader": "self.version"
"conflict": {
"zendframework/zend-loader": "*"
}
}

2460
lib/laminas/laminas-loader/composer.lock generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,32 @@
<?xml version="1.0"?>
<ruleset
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="./vendor/squizlabs/php_codesniffer/phpcs.xsd">
<arg name="basepath" value="."/>
<arg name="cache" value=".phpcs-cache"/>
<arg name="colors"/>
<arg name="extensions" value="php"/>
<arg name="parallel" value="80"/>
<!-- Show progress -->
<arg value="p"/>
<!-- Paths to check -->
<file>src</file>
<file>test</file>
<exclude-pattern>*/TestAsset/*</exclude-pattern>
<exclude-pattern>*/_files/*</exclude-pattern>
<!-- Include all rules from Laminas Coding Standard -->
<rule ref="LaminasCodingStandard"/>
<rule ref="PSR1.Files.SideEffects">
<exclude-pattern>/src/Exception/*</exclude-pattern>
<exclude-pattern>/src/SplAutoloader.php</exclude-pattern>
<exclude-pattern>/src/AutoloaderFactory.php</exclude-pattern>
<exclude-pattern>/src/ClassMapAutoloader.php</exclude-pattern>
<exclude-pattern>/src/ModuleAutoloader.php</exclude-pattern>
<exclude-pattern>/src/StandardAutoloader.php</exclude-pattern>
</rule>
</ruleset>

View File

@@ -1,26 +1,29 @@
<?php
/**
* @see https://github.com/laminas/laminas-loader for the canonical source repository
* @copyright https://github.com/laminas/laminas-loader/blob/master/COPYRIGHT.md
* @license https://github.com/laminas/laminas-loader/blob/master/LICENSE.md New BSD License
*/
namespace Laminas\Loader;
use Laminas\Loader\SplAutoloader;
use Laminas\Loader\StandardAutoloader;
use Traversable;
if (class_exists('Laminas\Loader\AutoloaderFactory')) {
use function class_exists;
use function is_array;
use function is_subclass_of;
use function spl_autoload_unregister;
use function sprintf;
use function strrchr;
use function substr;
if (class_exists(AutoloaderFactory::class)) {
return;
}
// phpcs:ignore WebimpressCodingStandard.NamingConventions.AbstractClass.Prefix
abstract class AutoloaderFactory
{
const STANDARD_AUTOLOADER = 'Laminas\Loader\StandardAutoloader';
public const STANDARD_AUTOLOADER = StandardAutoloader::class;
/**
* @var array All autoloaders registered using the factory
*/
/** @var array All autoloaders registered using the factory */
protected static $loaders = [];
/**
@@ -51,9 +54,9 @@ abstract class AutoloaderFactory
*
* @param array|Traversable $options (optional) options to use. Defaults to Laminas\Loader\StandardAutoloader
* @return void
* @throws Exception\InvalidArgumentException for invalid options
* @throws Exception\InvalidArgumentException for unloadable autoloader classes
* @throws Exception\DomainException for autoloader classes not implementing SplAutoloader
* @throws Exception\InvalidArgumentException For invalid options.
* @throws Exception\InvalidArgumentException For unloadable autoloader classes.
* @throws Exception\DomainException For autoloader classes not implementing SplAutoloader.
*/
public static function factory($options = null)
{
@@ -68,7 +71,7 @@ abstract class AutoloaderFactory
return;
}
if (! is_array($options) && ! ($options instanceof Traversable)) {
if (! is_array($options) && ! $options instanceof Traversable) {
require_once __DIR__ . '/Exception/InvalidArgumentException.php';
throw new Exception\InvalidArgumentException(
'Options provided must be an array or Traversable'
@@ -85,7 +88,7 @@ abstract class AutoloaderFactory
);
}
if (! is_subclass_of($class, 'Laminas\Loader\SplAutoloader')) {
if (! is_subclass_of($class, SplAutoloader::class)) {
require_once 'Exception/InvalidArgumentException.php';
throw new Exception\InvalidArgumentException(
sprintf('Autoloader class %s must implement Laminas\\Loader\\SplAutoloader', $class)
@@ -122,7 +125,7 @@ abstract class AutoloaderFactory
*
* @param string $class
* @return SplAutoloader
* @throws Exception\InvalidArgumentException for non-registered class
* @throws Exception\InvalidArgumentException For non-registered class.
*/
public static function getRegisteredAutoloader($class)
{
@@ -180,13 +183,12 @@ abstract class AutoloaderFactory
return static::$standardAutoloader;
}
if (! class_exists(static::STANDARD_AUTOLOADER)) {
// Extract the filename from the classname
$stdAutoloader = substr(strrchr(static::STANDARD_AUTOLOADER, '\\'), 1);
require_once __DIR__ . "/$stdAutoloader.php";
}
$loader = new StandardAutoloader();
$loader = new StandardAutoloader();
static::$standardAutoloader = $loader;
return static::$standardAutoloader;
}
@@ -194,11 +196,11 @@ abstract class AutoloaderFactory
/**
* Checks if the object has this class as one of its parents
*
* @deprecated since laminas 2.3 requires PHP >= 5.3.23
*
* @see https://bugs.php.net/bug.php?id=53727
* @see https://github.com/zendframework/zf2/pull/1807
*
* @deprecated since laminas 2.3 requires PHP >= 5.3.23
*
* @param string $className
* @param string $type
* @return bool

View File

@@ -1,15 +1,28 @@
<?php
/**
* @see https://github.com/laminas/laminas-loader for the canonical source repository
* @copyright https://github.com/laminas/laminas-loader/blob/master/COPYRIGHT.md
* @license https://github.com/laminas/laminas-loader/blob/master/LICENSE.md New BSD License
*/
namespace Laminas\Loader;
use Traversable;
use function array_filter;
use function array_values;
use function array_walk;
use function explode;
use function file_exists;
use function gettype;
use function implode;
use function in_array;
use function is_array;
use function is_string;
use function preg_match;
use function realpath;
use function spl_autoload_register;
use function sprintf;
use function str_pad;
use function str_replace;
use function strlen;
use function substr;
// Grab SplAutoloader interface
require_once __DIR__ . '/SplAutoloader.php';
@@ -22,12 +35,14 @@ class ClassMapAutoloader implements SplAutoloader
{
/**
* Registry of map files that have already been loaded
*
* @var array
*/
protected $mapsLoaded = [];
/**
* Class name/filename map
*
* @var array
*/
protected $map = [];
@@ -86,7 +101,7 @@ class ClassMapAutoloader implements SplAutoloader
require_once __DIR__ . '/Exception/InvalidArgumentException.php';
throw new Exception\InvalidArgumentException(sprintf(
'Map file provided does not return a map. Map file: "%s"',
(isset($location) && is_string($location) ? $location : 'unexpected type: ' . gettype($map))
isset($location) && is_string($location) ? $location : 'unexpected type: ' . gettype($map)
));
}
@@ -108,7 +123,7 @@ class ClassMapAutoloader implements SplAutoloader
*/
public function registerAutoloadMaps($locations)
{
if (! is_array($locations) && ! ($locations instanceof Traversable)) {
if (! is_array($locations) && ! $locations instanceof Traversable) {
require_once __DIR__ . '/Exception/InvalidArgumentException.php';
throw new Exception\InvalidArgumentException('Map list must be an array or implement Traversable');
}
@@ -161,7 +176,7 @@ class ClassMapAutoloader implements SplAutoloader
*
* @param string $location
* @return ClassMapAutoloader|mixed
* @throws Exception\InvalidArgumentException for nonexistent locations
* @throws Exception\InvalidArgumentException For nonexistent locations.
*/
protected function loadMapFromFile($location)
{
@@ -169,7 +184,7 @@ class ClassMapAutoloader implements SplAutoloader
require_once __DIR__ . '/Exception/InvalidArgumentException.php';
throw new Exception\InvalidArgumentException(sprintf(
'Map file provided does not exist. Map file: "%s"',
(is_string($location) ? $location : 'unexpected type: ' . gettype($location))
is_string($location) ? $location : 'unexpected type: ' . gettype($location)
));
}
@@ -182,15 +197,14 @@ class ClassMapAutoloader implements SplAutoloader
return $this;
}
$map = include $path;
return $map;
return include $path;
}
/**
* Resolve the real_path() to a file within a phar.
*
* @see https://bugs.php.net/bug.php?id=52769
*
* @param string $path
* @return string
*/
@@ -200,10 +214,10 @@ class ClassMapAutoloader implements SplAutoloader
return;
}
$prefixLength = 5 + strlen($match[1]);
$parts = explode('/', str_replace(['/', '\\'], '/', substr($path, $prefixLength)));
$parts = array_values(array_filter($parts, function ($p) {
return ($p !== '' && $p !== '.');
$prefixLength = 5 + strlen($match[1]);
$parts = explode('/', str_replace(['/', '\\'], '/', substr($path, $prefixLength)));
$parts = array_values(array_filter($parts, function ($p) {
return $p !== '' && $p !== '.';
}));
array_walk($parts, function ($value, $key) use (&$parts) {

View File

@@ -1,11 +1,5 @@
<?php
/**
* @see https://github.com/laminas/laminas-loader for the canonical source repository
* @copyright https://github.com/laminas/laminas-loader/blob/master/COPYRIGHT.md
* @license https://github.com/laminas/laminas-loader/blob/master/LICENSE.md New BSD License
*/
namespace Laminas\Loader\Exception;
require_once __DIR__ . '/ExceptionInterface.php';

View File

@@ -1,11 +1,5 @@
<?php
/**
* @see https://github.com/laminas/laminas-loader for the canonical source repository
* @copyright https://github.com/laminas/laminas-loader/blob/master/COPYRIGHT.md
* @license https://github.com/laminas/laminas-loader/blob/master/LICENSE.md New BSD License
*/
namespace Laminas\Loader\Exception;
require_once __DIR__ . '/ExceptionInterface.php';

View File

@@ -1,11 +1,5 @@
<?php
/**
* @see https://github.com/laminas/laminas-loader for the canonical source repository
* @copyright https://github.com/laminas/laminas-loader/blob/master/COPYRIGHT.md
* @license https://github.com/laminas/laminas-loader/blob/master/LICENSE.md New BSD License
*/
namespace Laminas\Loader\Exception;
interface ExceptionInterface

View File

@@ -1,11 +1,5 @@
<?php
/**
* @see https://github.com/laminas/laminas-loader for the canonical source repository
* @copyright https://github.com/laminas/laminas-loader/blob/master/COPYRIGHT.md
* @license https://github.com/laminas/laminas-loader/blob/master/LICENSE.md New BSD License
*/
namespace Laminas\Loader\Exception;
require_once __DIR__ . '/ExceptionInterface.php';

View File

@@ -1,15 +1,11 @@
<?php
/**
* @see https://github.com/laminas/laminas-loader for the canonical source repository
* @copyright https://github.com/laminas/laminas-loader/blob/master/COPYRIGHT.md
* @license https://github.com/laminas/laminas-loader/blob/master/LICENSE.md New BSD License
*/
namespace Laminas\Loader\Exception;
use Exception;
require_once __DIR__ . '/ExceptionInterface.php';
class InvalidPathException extends \Exception implements ExceptionInterface
class InvalidPathException extends Exception implements ExceptionInterface
{
}

View File

@@ -1,15 +1,11 @@
<?php
/**
* @see https://github.com/laminas/laminas-loader for the canonical source repository
* @copyright https://github.com/laminas/laminas-loader/blob/master/COPYRIGHT.md
* @license https://github.com/laminas/laminas-loader/blob/master/LICENSE.md New BSD License
*/
namespace Laminas\Loader\Exception;
use Exception;
require_once __DIR__ . '/ExceptionInterface.php';
class MissingResourceNamespaceException extends \Exception implements ExceptionInterface
class MissingResourceNamespaceException extends Exception implements ExceptionInterface
{
}

View File

@@ -1,11 +1,5 @@
<?php
/**
* @see https://github.com/laminas/laminas-loader for the canonical source repository
* @copyright https://github.com/laminas/laminas-loader/blob/master/COPYRIGHT.md
* @license https://github.com/laminas/laminas-loader/blob/master/LICENSE.md New BSD License
*/
namespace Laminas\Loader\Exception;
require_once __DIR__ . '/DomainException.php';

View File

@@ -1,11 +1,5 @@
<?php
/**
* @see https://github.com/laminas/laminas-loader for the canonical source repository
* @copyright https://github.com/laminas/laminas-loader/blob/master/COPYRIGHT.md
* @license https://github.com/laminas/laminas-loader/blob/master/LICENSE.md New BSD License
*/
namespace Laminas\Loader\Exception;
require_once __DIR__ . '/ExceptionInterface.php';

View File

@@ -1,11 +1,5 @@
<?php
/**
* @see https://github.com/laminas/laminas-loader for the canonical source repository
* @copyright https://github.com/laminas/laminas-loader/blob/master/COPYRIGHT.md
* @license https://github.com/laminas/laminas-loader/blob/master/LICENSE.md New BSD License
*/
namespace Laminas\Loader\Exception;
require_once __DIR__ . '/DomainException.php';

View File

@@ -1,52 +1,56 @@
<?php
/**
* @see https://github.com/laminas/laminas-loader for the canonical source repository
* @copyright https://github.com/laminas/laminas-loader/blob/master/COPYRIGHT.md
* @license https://github.com/laminas/laminas-loader/blob/master/LICENSE.md New BSD License
*/
namespace Laminas\Loader;
// Grab SplAutoloader interface
require_once __DIR__ . '/SplAutoloader.php';
use GlobIterator;
use InvalidArgumentException;
use Phar;
use PharFileInfo;
use SplFileInfo;
use Traversable;
use function array_map;
use function class_exists;
use function count;
use function extension_loaded;
use function getcwd;
use function gettype;
use function implode;
use function in_array;
use function is_array;
use function is_string;
use function pathinfo;
use function preg_match;
use function realpath;
use function rtrim;
use function spl_autoload_register;
use function spl_autoload_unregister;
use function sprintf;
use function str_replace;
use function strpos;
use function substr;
use const DIRECTORY_SEPARATOR;
class ModuleAutoloader implements SplAutoloader
{
/**
* @var array An array of module paths to scan
*/
/** @var array An array of module paths to scan */
protected $paths = [];
/**
* @var array An array of modulename => path
*/
/** @var array An array of modulename => path */
protected $explicitPaths = [];
/**
* @var array An array of namespaceName => namespacePath
*/
/** @var array An array of namespaceName => namespacePath */
protected $namespacedPaths = [];
/**
* @var string Will contain the absolute phar:// path to the executable when packaged as phar file
*/
/** @var string Will contain the absolute phar:// path to the executable when packaged as phar file */
protected $pharBasePath = "";
/**
* @var array An array of supported phar extensions (filled on constructor)
*/
/** @var array An array of supported phar extensions (filled on constructor) */
protected $pharExtensions = [];
/**
* @var array An array of module classes to their containing files
*/
/** @var array An array of module classes to their containing files */
protected $moduleClassMap = [];
/**
@@ -59,7 +63,7 @@ class ModuleAutoloader implements SplAutoloader
public function __construct($options = null)
{
if (extension_loaded('phar')) {
$this->pharBasePath = Phar::running(true);
$this->pharBasePath = Phar::running(true);
$this->pharExtensions = [
'phar',
'phar.tar',
@@ -130,7 +134,7 @@ class ModuleAutoloader implements SplAutoloader
/**
* Autoload a class
*
* @param $class
* @param string $class
* @return mixed
* False [if unable to load $class]
* get_class($class) [if $class is successfully loaded]
@@ -167,7 +171,7 @@ class ModuleAutoloader implements SplAutoloader
}
$moduleNameBuffer = str_replace($namespace . "\\", "", $moduleName);
$path .= DIRECTORY_SEPARATOR . $moduleNameBuffer . DIRECTORY_SEPARATOR;
$path .= DIRECTORY_SEPARATOR . $moduleNameBuffer . DIRECTORY_SEPARATOR;
$classLoaded = $this->loadModuleFromDir($path, $class);
if ($classLoaded) {
@@ -181,7 +185,7 @@ class ModuleAutoloader implements SplAutoloader
}
}
$moduleClassPath = str_replace('\\', DIRECTORY_SEPARATOR, $moduleName);
$moduleClassPath = str_replace('\\', DIRECTORY_SEPARATOR, $moduleName);
$pharSuffixPattern = null;
if ($this->pharExtensions) {
@@ -189,9 +193,9 @@ class ModuleAutoloader implements SplAutoloader
}
foreach ($this->paths as $path) {
$path = $path . $moduleClassPath;
$path .= $moduleClassPath;
if ($path == '.' || substr($path, 0, 2) == './' || substr($path, 0, 2) == '.\\') {
if ($path === '.' || substr($path, 0, 2) === './' || substr($path, 0, 2) === '.\\') {
if (! $basePath = $this->pharBasePath) {
$basePath = realpath('.');
}
@@ -248,7 +252,7 @@ class ModuleAutoloader implements SplAutoloader
$file = new SplFileInfo($modulePath);
}
if (($file->isReadable() && $file->isFile())) {
if ($file->isReadable() && $file->isFile()) {
// Found directory with Module.php in it
$absModulePath = $this->pharBasePath ? (string) $file : $file->getRealPath();
require_once $absModulePath;
@@ -272,7 +276,7 @@ class ModuleAutoloader implements SplAutoloader
protected function loadModuleFromPhar($pharPath, $class)
{
$pharPath = static::normalizePath($pharPath, false);
$file = new SplFileInfo($pharPath);
$file = new SplFileInfo($pharPath);
if (! $file->isReadable() || ! $file->isFile()) {
return false;
}
@@ -291,7 +295,7 @@ class ModuleAutoloader implements SplAutoloader
// Phase 1: Not executable phar, no stub, or stub did not provide Module class; try Module.php directly
$moduleClassFile = 'phar://' . $fileRealPath . '/Module.php';
$moduleFile = new SplFileInfo($moduleClassFile);
$moduleFile = new SplFileInfo($moduleClassFile);
if ($moduleFile->isReadable() && $moduleFile->isFile()) {
require_once $moduleClassFile;
if (class_exists($class)) {
@@ -303,9 +307,9 @@ class ModuleAutoloader implements SplAutoloader
// Phase 2: Check for nested module directory within archive
// Checks for /path/to/MyModule.tar/MyModule/Module.php
// (shell-integrated zip/tar utilities wrap directories like this)
$pharBaseName = $this->pharFileToModuleName($fileRealPath);
$moduleClassFile = 'phar://' . $fileRealPath . '/' . $pharBaseName . '/Module.php';
$moduleFile = new SplFileInfo($moduleClassFile);
$pharBaseName = $this->pharFileToModuleName($fileRealPath);
$moduleClassFile = 'phar://' . $fileRealPath . '/' . $pharBaseName . '/Module.php';
$moduleFile = new SplFileInfo($moduleClassFile);
if ($moduleFile->isReadable() && $moduleFile->isFile()) {
require_once $moduleClassFile;
if (class_exists($class)) {
@@ -341,7 +345,7 @@ class ModuleAutoloader implements SplAutoloader
* registerPaths
*
* @param array|Traversable $paths
* @throws \InvalidArgumentException
* @throws InvalidArgumentException
* @return ModuleAutoloader
*/
public function registerPaths($paths)
@@ -371,7 +375,7 @@ class ModuleAutoloader implements SplAutoloader
*
* @param string $path
* @param bool|string $moduleName
* @throws \InvalidArgumentException
* @throws InvalidArgumentException
* @return ModuleAutoloader
*/
public function registerPath($path, $moduleName = false)

View File

@@ -1,17 +1,21 @@
<?php
/**
* @see https://github.com/laminas/laminas-loader for the canonical source repository
* @copyright https://github.com/laminas/laminas-loader/blob/master/COPYRIGHT.md
* @license https://github.com/laminas/laminas-loader/blob/master/LICENSE.md New BSD License
*/
<?php // phpcs:disable SlevomatCodingStandard.Namespaces.UnusedUses.UnusedUse
namespace Laminas\Loader;
use ArrayIterator;
use IteratorAggregate;
use ReturnTypeWillChange;
use Traversable;
use function array_key_exists;
use function class_exists;
use function is_array;
use function is_int;
use function is_numeric;
use function is_object;
use function is_string;
use function strtolower;
/**
* Plugin class locator interface
*/
@@ -19,12 +23,14 @@ class PluginClassLoader implements PluginClassLocator
{
/**
* List of plugin name => class name pairs
*
* @var array
*/
protected $plugins = [];
/**
* Static map allow global seeding of plugin loader
*
* @var array
*/
protected static $staticMap = [];
@@ -107,7 +113,7 @@ class PluginClassLoader implements PluginClassLocator
if (! class_exists($map)) {
throw new Exception\InvalidArgumentException('Map class provided is invalid');
}
$map = new $map;
$map = new $map();
}
if (is_array($map)) {
$map = new ArrayIterator($map);
@@ -209,6 +215,7 @@ class PluginClassLoader implements PluginClassLocator
*
* @return ArrayIterator
*/
#[ReturnTypeWillChange]
public function getIterator()
{
return new ArrayIterator($this->plugins);

View File

@@ -1,10 +1,4 @@
<?php
/**
* @see https://github.com/laminas/laminas-loader for the canonical source repository
* @copyright https://github.com/laminas/laminas-loader/blob/master/COPYRIGHT.md
* @license https://github.com/laminas/laminas-loader/blob/master/LICENSE.md New BSD License
*/
<?php // phpcs:disable WebimpressCodingStandard.NamingConventions.Interface.Suffix
namespace Laminas\Loader;

View File

@@ -1,10 +1,4 @@
<?php
/**
* @see https://github.com/laminas/laminas-loader for the canonical source repository
* @copyright https://github.com/laminas/laminas-loader/blob/master/COPYRIGHT.md
* @license https://github.com/laminas/laminas-loader/blob/master/LICENSE.md New BSD License
*/
<?php // phpcs:disable WebimpressCodingStandard.NamingConventions.Interface.Suffix
namespace Laminas\Loader;

View File

@@ -1,16 +1,12 @@
<?php
/**
* @see https://github.com/laminas/laminas-loader for the canonical source repository
* @copyright https://github.com/laminas/laminas-loader/blob/master/COPYRIGHT.md
* @license https://github.com/laminas/laminas-loader/blob/master/LICENSE.md New BSD License
*/
<?php // phpcs:disable WebimpressCodingStandard.NamingConventions.Interface.Suffix
namespace Laminas\Loader;
use Traversable;
if (interface_exists('Laminas\Loader\SplAutoloader')) {
use function interface_exists;
if (interface_exists(SplAutoloader::class)) {
return;
}
@@ -43,7 +39,7 @@ interface SplAutoloader
/**
* Autoload a class
*
* @param $class
* @param string $class
* @return mixed
* False [if unable to load $class]
* get_class($class) [if $class is successfully loaded]

View File

@@ -1,13 +1,24 @@
<?php
/**
* @see https://github.com/laminas/laminas-loader for the canonical source repository
* @copyright https://github.com/laminas/laminas-loader/blob/master/COPYRIGHT.md
* @license https://github.com/laminas/laminas-loader/blob/master/LICENSE.md New BSD License
*/
namespace Laminas\Loader;
use Traversable;
use function dirname;
use function file_exists;
use function in_array;
use function is_array;
use function preg_match;
use function rtrim;
use function spl_autoload_register;
use function str_replace;
use function stream_resolve_include_path;
use function strlen;
use function strpos;
use function substr;
use const DIRECTORY_SEPARATOR;
// Grab SplAutoloader interface
require_once __DIR__ . '/SplAutoloader.php';
@@ -20,34 +31,28 @@ require_once __DIR__ . '/SplAutoloader.php';
*/
class StandardAutoloader implements SplAutoloader
{
const NS_SEPARATOR = '\\';
const PREFIX_SEPARATOR = '_';
const LOAD_NS = 'namespaces';
const LOAD_PREFIX = 'prefixes';
const ACT_AS_FALLBACK = 'fallback_autoloader';
public const NS_SEPARATOR = '\\';
public const PREFIX_SEPARATOR = '_';
public const LOAD_NS = 'namespaces';
public const LOAD_PREFIX = 'prefixes';
public const ACT_AS_FALLBACK = 'fallback_autoloader';
/** @deprecated Use AUTOREGISTER_LAMINAS instead */
const AUTOREGISTER_ZF = 'autoregister_laminas';
const AUTOREGISTER_LAMINAS = 'autoregister_laminas';
public const AUTOREGISTER_ZF = 'autoregister_laminas';
public const AUTOREGISTER_LAMINAS = 'autoregister_laminas';
/**
* @var array Namespace/directory pairs to search; Laminas library added by default
*/
/** @var array Namespace/directory pairs to search; Laminas library added by default */
protected $namespaces = [];
/**
* @var array Prefix/directory pairs to search
*/
/** @var array Prefix/directory pairs to search */
protected $prefixes = [];
/**
* @var bool Whether or not the autoloader should also act as a fallback autoloader
*/
/** @var bool Whether or not the autoloader should also act as a fallback autoloader */
protected $fallbackAutoloaderFlag = false;
/**
* Constructor
*
* @param null|array|\Traversable $options
* @param null|array|Traversable $options
*/
public function __construct($options = null)
{
@@ -74,13 +79,13 @@ class StandardAutoloader implements SplAutoloader
* )
* </code>
*
* @param array|\Traversable $options
* @param array|Traversable $options
* @throws Exception\InvalidArgumentException
* @return StandardAutoloader
*/
public function setOptions($options)
{
if (! is_array($options) && ! ($options instanceof \Traversable)) {
if (! is_array($options) && ! $options instanceof Traversable) {
require_once __DIR__ . '/Exception/InvalidArgumentException.php';
throw new Exception\InvalidArgumentException('Options must be either an array or Traversable');
}
@@ -93,12 +98,12 @@ class StandardAutoloader implements SplAutoloader
}
break;
case self::LOAD_NS:
if (is_array($pairs) || $pairs instanceof \Traversable) {
if (is_array($pairs) || $pairs instanceof Traversable) {
$this->registerNamespaces($pairs);
}
break;
case self::LOAD_PREFIX:
if (is_array($pairs) || $pairs instanceof \Traversable) {
if (is_array($pairs) || $pairs instanceof Traversable) {
$this->registerPrefixes($pairs);
}
break;
@@ -143,7 +148,7 @@ class StandardAutoloader implements SplAutoloader
*/
public function registerNamespace($namespace, $directory)
{
$namespace = rtrim($namespace, self::NS_SEPARATOR) . self::NS_SEPARATOR;
$namespace = rtrim($namespace, self::NS_SEPARATOR) . self::NS_SEPARATOR;
$this->namespaces[$namespace] = $this->normalizeDirectory($directory);
return $this;
}
@@ -157,7 +162,7 @@ class StandardAutoloader implements SplAutoloader
*/
public function registerNamespaces($namespaces)
{
if (! is_array($namespaces) && ! $namespaces instanceof \Traversable) {
if (! is_array($namespaces) && ! $namespaces instanceof Traversable) {
require_once __DIR__ . '/Exception/InvalidArgumentException.php';
throw new Exception\InvalidArgumentException('Namespace pairs must be either an array or Traversable');
}
@@ -177,7 +182,7 @@ class StandardAutoloader implements SplAutoloader
*/
public function registerPrefix($prefix, $directory)
{
$prefix = rtrim($prefix, self::PREFIX_SEPARATOR). self::PREFIX_SEPARATOR;
$prefix = rtrim($prefix, self::PREFIX_SEPARATOR) . self::PREFIX_SEPARATOR;
$this->prefixes[$prefix] = $this->normalizeDirectory($directory);
return $this;
}
@@ -191,7 +196,7 @@ class StandardAutoloader implements SplAutoloader
*/
public function registerPrefixes($prefixes)
{
if (! is_array($prefixes) && ! $prefixes instanceof \Traversable) {
if (! is_array($prefixes) && ! $prefixes instanceof Traversable) {
require_once __DIR__ . '/Exception/InvalidArgumentException.php';
throw new Exception\InvalidArgumentException('Prefix pairs must be either an array or Traversable');
}
@@ -257,8 +262,8 @@ class StandardAutoloader implements SplAutoloader
$matches = [];
preg_match('/(?P<namespace>.+\\\)?(?P<class>[^\\\]+$)/', $class, $matches);
$class = (isset($matches['class'])) ? $matches['class'] : '';
$namespace = (isset($matches['namespace'])) ? $matches['namespace'] : '';
$class = $matches['class'] ?? '';
$namespace = $matches['namespace'] ?? '';
return $directory
. str_replace(self::NS_SEPARATOR, '/', $namespace)

View File

@@ -0,0 +1,5 @@
{
"ignore_php_platform_requirements": {
"8.1": true
}
}

Some files were not shown because too many files have changed in this diff Show More