N°5809 Update laminas/laminas-servicemanager from 3.16.0 to 3.22.1

This commit is contained in:
Pierre Goiffon
2024-01-25 17:27:11 +01:00
parent 0f39ea8ac7
commit 5623decdb3
30 changed files with 1057 additions and 1468 deletions

39
composer.lock generated
View File

@@ -739,26 +739,26 @@
},
{
"name": "laminas/laminas-servicemanager",
"version": "3.16.0",
"version": "3.22.1",
"source": {
"type": "git",
"url": "https://github.com/laminas/laminas-servicemanager.git",
"reference": "863c66733740cd36ebf5e700f4258ef2c68a2a24"
"reference": "de98d297d4743956a0558a6d71616979ff779328"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laminas/laminas-servicemanager/zipball/863c66733740cd36ebf5e700f4258ef2c68a2a24",
"reference": "863c66733740cd36ebf5e700f4258ef2c68a2a24",
"url": "https://api.github.com/repos/laminas/laminas-servicemanager/zipball/de98d297d4743956a0558a6d71616979ff779328",
"reference": "de98d297d4743956a0558a6d71616979ff779328",
"shasum": ""
},
"require": {
"laminas/laminas-stdlib": "^3.2.1",
"php": "~7.4.0 || ~8.0.0 || ~8.1.0",
"laminas/laminas-stdlib": "^3.17",
"php": "~8.1.0 || ~8.2.0 || ~8.3.0",
"psr/container": "^1.0"
},
"conflict": {
"ext-psr": "*",
"laminas/laminas-code": "<3.3.1",
"laminas/laminas-code": "<4.10.0",
"zendframework/zend-code": "<3.3.1",
"zendframework/zend-servicemanager": "*"
},
@@ -769,20 +769,19 @@
"container-interop/container-interop": "^1.2.0"
},
"require-dev": {
"composer/package-versions-deprecated": "^1.0",
"laminas/laminas-coding-standard": "~2.3.0",
"laminas/laminas-container-config-test": "^0.7",
"laminas/laminas-dependency-plugin": "^2.1.2",
"mikey179/vfsstream": "^1.6.10@alpha",
"ocramius/proxy-manager": "^2.11",
"phpbench/phpbench": "^1.1",
"phpspec/prophecy-phpunit": "^2.0",
"phpunit/phpunit": "^9.5.5",
"psalm/plugin-phpunit": "^0.17.0",
"vimeo/psalm": "^4.8"
"composer/package-versions-deprecated": "^1.11.99.5",
"friendsofphp/proxy-manager-lts": "^1.0.14",
"laminas/laminas-code": "^4.10.0",
"laminas/laminas-coding-standard": "~2.5.0",
"laminas/laminas-container-config-test": "^0.8",
"mikey179/vfsstream": "^1.6.11",
"phpbench/phpbench": "^1.2.9",
"phpunit/phpunit": "^10.4",
"psalm/plugin-phpunit": "^0.18.4",
"vimeo/psalm": "^5.8.0"
},
"suggest": {
"ocramius/proxy-manager": "ProxyManager ^2.1.1 to handle lazy initialization of services"
"friendsofphp/proxy-manager-lts": "ProxyManager ^2.1.1 to handle lazy initialization of services"
},
"bin": [
"bin/generate-deps-for-config-factory",
@@ -826,7 +825,7 @@
"type": "community_bridge"
}
],
"time": "2022-07-27T14:58:17+00:00"
"time": "2023-10-24T11:19:47+00:00"
},
{
"name": "laminas/laminas-stdlib",

View File

@@ -4,15 +4,16 @@
/**
* Proxy PHP file generated by Composer
*
* 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
* 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
*
* @generated
*/
namespace Composer;
$binPath = __DIR__ . "/" . '../laminas/laminas-servicemanager/bin/generate-deps-for-config-factory';
$GLOBALS['_composer_bin_dir'] = __DIR__;
$GLOBALS['_composer_autoload_path'] = __DIR__ . '/..'.'/autoload.php';
if (PHP_VERSION_ID < 80000) {
if (!class_exists('Composer\BinProxyWrapper')) {
@@ -23,18 +24,17 @@ if (PHP_VERSION_ID < 80000) {
{
private $handle;
private $position;
private $realpath;
public function stream_open($path, $mode, $options, &$opened_path)
{
// 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);
// 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);
$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,6 +66,16 @@ 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;
@@ -78,20 +88,32 @@ if (PHP_VERSION_ID < 80000) {
public function stream_stat()
{
return fstat($this->handle);
return array();
}
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('composer-bin-proxy', 'Composer\BinProxyWrapper')) {
include("composer-bin-proxy://" . $binPath);
exit(0);
if (
(function_exists('stream_get_wrappers') && in_array('phpvfscomposer', stream_get_wrappers(), true))
|| (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper'))
) {
return include("phpvfscomposer://" . __DIR__ . '/..'.'/laminas/laminas-servicemanager/bin/generate-deps-for-config-factory');
}
}
include $binPath;
return include __DIR__ . '/..'.'/laminas/laminas-servicemanager/bin/generate-deps-for-config-factory';

View File

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

View File

@@ -4,15 +4,16 @@
/**
* Proxy PHP file generated by Composer
*
* 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
* 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
*
* @generated
*/
namespace Composer;
$binPath = __DIR__ . "/" . '../laminas/laminas-servicemanager/bin/generate-factory-for-class';
$GLOBALS['_composer_bin_dir'] = __DIR__;
$GLOBALS['_composer_autoload_path'] = __DIR__ . '/..'.'/autoload.php';
if (PHP_VERSION_ID < 80000) {
if (!class_exists('Composer\BinProxyWrapper')) {
@@ -23,18 +24,17 @@ if (PHP_VERSION_ID < 80000) {
{
private $handle;
private $position;
private $realpath;
public function stream_open($path, $mode, $options, &$opened_path)
{
// 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);
// 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);
$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,6 +66,16 @@ 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;
@@ -78,20 +88,32 @@ if (PHP_VERSION_ID < 80000) {
public function stream_stat()
{
return fstat($this->handle);
return array();
}
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('composer-bin-proxy', 'Composer\BinProxyWrapper')) {
include("composer-bin-proxy://" . $binPath);
exit(0);
if (
(function_exists('stream_get_wrappers') && in_array('phpvfscomposer', stream_get_wrappers(), true))
|| (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper'))
) {
return include("phpvfscomposer://" . __DIR__ . '/..'.'/laminas/laminas-servicemanager/bin/generate-factory-for-class');
}
}
include $binPath;
return include __DIR__ . '/..'.'/laminas/laminas-servicemanager/bin/generate-factory-for-class';

View File

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

View File

@@ -899,6 +899,7 @@ return array(
'Laminas\\ServiceManager\\Proxy\\LazyServiceFactory' => $vendorDir . '/laminas/laminas-servicemanager/src/Proxy/LazyServiceFactory.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',

View File

@@ -1274,6 +1274,7 @@ class ComposerStaticInit7f81b4a2a468a061c306af5e447a9a9f
'Laminas\\ServiceManager\\Proxy\\LazyServiceFactory' => __DIR__ . '/..' . '/laminas/laminas-servicemanager/src/Proxy/LazyServiceFactory.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',

View File

@@ -760,27 +760,27 @@
},
{
"name": "laminas/laminas-servicemanager",
"version": "3.16.0",
"version_normalized": "3.16.0.0",
"version": "3.22.1",
"version_normalized": "3.22.1.0",
"source": {
"type": "git",
"url": "https://github.com/laminas/laminas-servicemanager.git",
"reference": "863c66733740cd36ebf5e700f4258ef2c68a2a24"
"reference": "de98d297d4743956a0558a6d71616979ff779328"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laminas/laminas-servicemanager/zipball/863c66733740cd36ebf5e700f4258ef2c68a2a24",
"reference": "863c66733740cd36ebf5e700f4258ef2c68a2a24",
"url": "https://api.github.com/repos/laminas/laminas-servicemanager/zipball/de98d297d4743956a0558a6d71616979ff779328",
"reference": "de98d297d4743956a0558a6d71616979ff779328",
"shasum": ""
},
"require": {
"laminas/laminas-stdlib": "^3.2.1",
"php": "~7.4.0 || ~8.0.0 || ~8.1.0",
"laminas/laminas-stdlib": "^3.17",
"php": "~8.1.0 || ~8.2.0 || ~8.3.0",
"psr/container": "^1.0"
},
"conflict": {
"ext-psr": "*",
"laminas/laminas-code": "<3.3.1",
"laminas/laminas-code": "<4.10.0",
"zendframework/zend-code": "<3.3.1",
"zendframework/zend-servicemanager": "*"
},
@@ -791,22 +791,21 @@
"container-interop/container-interop": "^1.2.0"
},
"require-dev": {
"composer/package-versions-deprecated": "^1.0",
"laminas/laminas-coding-standard": "~2.3.0",
"laminas/laminas-container-config-test": "^0.7",
"laminas/laminas-dependency-plugin": "^2.1.2",
"mikey179/vfsstream": "^1.6.10@alpha",
"ocramius/proxy-manager": "^2.11",
"phpbench/phpbench": "^1.1",
"phpspec/prophecy-phpunit": "^2.0",
"phpunit/phpunit": "^9.5.5",
"psalm/plugin-phpunit": "^0.17.0",
"vimeo/psalm": "^4.8"
"composer/package-versions-deprecated": "^1.11.99.5",
"friendsofphp/proxy-manager-lts": "^1.0.14",
"laminas/laminas-code": "^4.10.0",
"laminas/laminas-coding-standard": "~2.5.0",
"laminas/laminas-container-config-test": "^0.8",
"mikey179/vfsstream": "^1.6.11",
"phpbench/phpbench": "^1.2.9",
"phpunit/phpunit": "^10.4",
"psalm/plugin-phpunit": "^0.18.4",
"vimeo/psalm": "^5.8.0"
},
"suggest": {
"ocramius/proxy-manager": "ProxyManager ^2.1.1 to handle lazy initialization of services"
"friendsofphp/proxy-manager-lts": "ProxyManager ^2.1.1 to handle lazy initialization of services"
},
"time": "2022-07-27T14:58:17+00:00",
"time": "2023-10-24T11:19:47+00:00",
"bin": [
"bin/generate-deps-for-config-factory",
"bin/generate-factory-for-class"

View File

@@ -3,7 +3,7 @@
'name' => 'combodo/itop',
'pretty_version' => 'dev-develop',
'version' => 'dev-develop',
'reference' => '23a187a4582feb216abfcb822e06e2d9d1cf3705',
'reference' => '1c7dbcb1e90113dbf3a3f61fdae6519e492f6d4f',
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
@@ -22,7 +22,7 @@
'combodo/itop' => array(
'pretty_version' => 'dev-develop',
'version' => 'dev-develop',
'reference' => '23a187a4582feb216abfcb822e06e2d9d1cf3705',
'reference' => '1c7dbcb1e90113dbf3a3f61fdae6519e492f6d4f',
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
@@ -107,9 +107,9 @@
'dev_requirement' => false,
),
'laminas/laminas-servicemanager' => array(
'pretty_version' => '3.16.0',
'version' => '3.16.0.0',
'reference' => '863c66733740cd36ebf5e700f4258ef2c68a2a24',
'pretty_version' => '3.22.1',
'version' => '3.22.1.0',
'reference' => 'de98d297d4743956a0558a6d71616979ff779328',
'type' => 'library',
'install_path' => __DIR__ . '/../laminas/laminas-servicemanager',
'aliases' => array(),
@@ -241,8 +241,8 @@
'psr/container-implementation' => array(
'dev_requirement' => false,
'provided' => array(
0 => '^1.0',
1 => '1.1|2.0',
0 => '1.1|2.0',
1 => '^1.0',
),
),
'psr/event-dispatcher' => array(

View File

@@ -13,73 +13,76 @@
],
"homepage": "https://laminas.dev",
"support": {
"docs": "https://docs.laminas.dev/laminas-servicemanager/",
"issues": "https://github.com/laminas/laminas-servicemanager/issues",
"source": "https://github.com/laminas/laminas-servicemanager",
"rss": "https://github.com/laminas/laminas-servicemanager/releases.atom",
"forum": "https://discourse.laminas.dev",
"chat": "https://laminas.dev/chat",
"forum": "https://discourse.laminas.dev"
},
"config": {
"platform": {
"php": "7.4.99"
},
"sort-packages": true,
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true,
"composer/package-versions-deprecated": true,
"laminas/laminas-dependency-plugin": true
}
"source": "https://github.com/laminas/laminas-servicemanager",
"docs": "https://docs.laminas.dev/laminas-servicemanager/",
"rss": "https://github.com/laminas/laminas-servicemanager/releases.atom"
},
"require": {
"php": "~7.4.0 || ~8.0.0 || ~8.1.0",
"laminas/laminas-stdlib": "^3.2.1",
"php": "~8.1.0 || ~8.2.0 || ~8.3.0",
"laminas/laminas-stdlib": "^3.17",
"psr/container": "^1.0"
},
"require-dev": {
"composer/package-versions-deprecated": "^1.0",
"laminas/laminas-coding-standard": "~2.3.0",
"laminas/laminas-container-config-test": "^0.7",
"laminas/laminas-dependency-plugin": "^2.1.2",
"mikey179/vfsstream": "^1.6.10@alpha",
"ocramius/proxy-manager": "^2.11",
"phpbench/phpbench": "^1.1",
"phpspec/prophecy-phpunit": "^2.0",
"phpunit/phpunit": "^9.5.5",
"psalm/plugin-phpunit": "^0.17.0",
"vimeo/psalm": "^4.8"
"composer/package-versions-deprecated": "^1.11.99.5",
"friendsofphp/proxy-manager-lts": "^1.0.14",
"laminas/laminas-code": "^4.10.0",
"laminas/laminas-coding-standard": "~2.5.0",
"laminas/laminas-container-config-test": "^0.8",
"mikey179/vfsstream": "^1.6.11",
"phpbench/phpbench": "^1.2.9",
"phpunit/phpunit": "^10.4",
"psalm/plugin-phpunit": "^0.18.4",
"vimeo/psalm": "^5.8.0"
},
"replace": {
"container-interop/container-interop": "^1.2.0"
},
"conflict": {
"ext-psr": "*",
"laminas/laminas-code": "<4.10.0",
"zendframework/zend-code": "<3.3.1",
"zendframework/zend-servicemanager": "*"
},
"provide": {
"psr/container-implementation": "^1.0"
},
"conflict": {
"ext-psr": "*",
"laminas/laminas-code": "<3.3.1",
"zendframework/zend-code": "<3.3.1",
"zendframework/zend-servicemanager": "*"
},
"suggest": {
"ocramius/proxy-manager": "ProxyManager ^2.1.1 to handle lazy initialization of services"
"friendsofphp/proxy-manager-lts": "ProxyManager ^2.1.1 to handle lazy initialization of services"
},
"autoload": {
"psr-4": {
"Laminas\\ServiceManager\\": "src/"
},
"files": ["src/autoload.php"]
"files": [
"src/autoload.php"
]
},
"autoload-dev": {
"files": [
"test/autoload.php"
],
"psr-4": {
"LaminasTest\\ServiceManager\\": "test/",
"LaminasBench\\ServiceManager\\": "benchmarks/"
}
},
"files": [
"test/autoload.php"
]
},
"bin": [
"bin/generate-deps-for-config-factory",
"bin/generate-factory-for-class"
],
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true,
"composer/package-versions-deprecated": true
},
"platform": {
"php": "8.1.99"
},
"sort-packages": true
},
"scripts": {
"benchmark": "phpbench run --revs=2 --iterations=2 --report=aggregate",
"check": [
@@ -88,11 +91,8 @@
],
"cs-check": "phpcs",
"cs-fix": "phpcbf",
"static-analysis": "psalm --shepherd --stats",
"test": "phpunit --colors=always",
"test-coverage": "phpunit --colors=always --coverage-clover clover.xml",
"static-analysis" : "psalm --shepherd --stats"
},
"replace": {
"container-interop/container-interop": "^1.2.0"
"test-coverage": "phpunit --colors=always --coverage-clover clover.xml"
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -36,9 +36,7 @@ final class ConfigAbstractFactory implements AbstractFactoryInterface
return is_array($dependencies) && array_key_exists($requestedName, $dependencies);
}
/**
* {@inheritDoc}
*/
/** {@inheritDoc} */
public function __invoke(ContainerInterface $container, $requestedName, ?array $options = null)
{
if (! $container->has('config')) {

View File

@@ -131,9 +131,7 @@ class ReflectionBasedAbstractFactory implements AbstractFactoryInterface
return new $requestedName(...$parameters);
}
/**
* {@inheritDoc}
*/
/** {@inheritDoc} */
public function canCreate(ContainerInterface $container, $requestedName)
{
return class_exists($requestedName) && $this->canCallConstructor($requestedName);

View File

@@ -9,7 +9,6 @@ use Laminas\ServiceManager\Exception\InvalidServiceException;
use Psr\Container\ContainerInterface;
use function class_exists;
use function get_class;
use function gettype;
use function is_object;
use function method_exists;
@@ -75,7 +74,7 @@ abstract class AbstractPluginManager extends ServiceManager implements PluginMan
'%s expects a ConfigInterface or ContainerInterface instance as the first argument; received %s',
self::class,
is_object($configInstanceOrParentLocator)
? get_class($configInstanceOrParentLocator)
? $configInstanceOrParentLocator::class
: gettype($configInstanceOrParentLocator)
));
}
@@ -118,7 +117,6 @@ abstract class AbstractPluginManager extends ServiceManager implements PluginMan
public function configure(array $config)
{
if (isset($config['services'])) {
/** @psalm-suppress MixedAssignment */
foreach ($config['services'] as $service) {
$this->validate($service);
}
@@ -147,7 +145,7 @@ abstract class AbstractPluginManager extends ServiceManager implements PluginMan
* @param class-string<InstanceType>|string $name Service name of plugin to retrieve.
* @param null|array<mixed> $options Options to use when creating the instance.
* @return mixed
* @psalm-return ($name is class-string ? InstanceType : mixed)
* @psalm-return ($name is class-string<InstanceType> ? InstanceType : mixed)
* @throws Exception\ServiceNotFoundException If the manager does not have
* a service definition for the instance, and the service is not
* auto-invokable.
@@ -178,7 +176,7 @@ abstract class AbstractPluginManager extends ServiceManager implements PluginMan
*
* @psalm-assert InstanceType $instance
*/
public function validate($instance)
public function validate(mixed $instance)
{
if (method_exists($this, 'validatePlugin')) {
trigger_error(sprintf(
@@ -197,7 +195,7 @@ abstract class AbstractPluginManager extends ServiceManager implements PluginMan
'Plugin manager "%s" expected an instance of type "%s", but "%s" was received',
self::class,
$this->instanceOf,
is_object($instance) ? get_class($instance) : gettype($instance)
is_object($instance) ? $instance::class : gettype($instance)
));
}

View File

@@ -23,6 +23,8 @@ use function array_keys;
* These features are advanced, and not typically used. If you wish to use them,
* you will need to require the laminas-stdlib package in your application.
*
* @deprecated Class will be removed as of v4.0
*
* @psalm-import-type ServiceManagerConfigurationType from ConfigInterface
*/
class Config implements ConfigInterface
@@ -92,11 +94,9 @@ class Config implements ConfigInterface
* @psalm-param ServiceManagerConfigurationType $a
* @psalm-param ServiceManagerConfigurationType $b
* @psalm-return ServiceManagerConfigurationType
* @psalm-suppress MixedReturnTypeCoercion
*/
private function merge(array $a, array $b)
{
/** @psalm-suppress MixedReturnTypeCoercion */
return ArrayUtils::merge($a, $b);
}
}

View File

@@ -8,6 +8,8 @@ use ArrayAccess;
use Psr\Container\ContainerInterface;
/**
* @deprecated Interface will be removed as of v4.0
*
* @see ContainerInterface
* @see ArrayAccess
*
@@ -26,7 +28,7 @@ use Psr\Container\ContainerInterface;
* @psalm-type FactoriesConfigurationType = array<
* string,
* (class-string<Factory\FactoryInterface>|Factory\FactoryInterface)
* |callable(ContainerInterface,string,array<mixed>|null):object
* |callable(ContainerInterface,?string,?array<mixed>|null):object
* >
* @psalm-type InitializersConfigurationType = array<
* array-key,
@@ -48,7 +50,8 @@ use Psr\Container\ContainerInterface;
* invokables?: array<string,string>,
* lazy_services?: LazyServicesConfigurationType,
* services?: array<string,object|array>,
* shared?:array<string,bool>
* shared?:array<string,bool>,
* ...
* }
*/
interface ConfigInterface

View File

@@ -43,7 +43,7 @@ class CyclicAliasException extends InvalidArgumentException
public static function fromAliasesMap(array $aliases)
{
$detectedCycles = array_filter(array_map(
static fn($alias) => self::getCycleFor($aliases, $alias),
static fn($alias): ?array => self::getCycleFor($aliases, $alias),
array_keys($aliases)
));

View File

@@ -8,7 +8,6 @@ use InvalidArgumentException as SplInvalidArgumentException;
use Laminas\ServiceManager\AbstractFactoryInterface;
use Laminas\ServiceManager\Initializer\InitializerInterface;
use function get_class;
use function gettype;
use function is_object;
use function sprintf;
@@ -18,29 +17,23 @@ use function sprintf;
*/
class InvalidArgumentException extends SplInvalidArgumentException implements ExceptionInterface
{
/**
* @param mixed $initializer
*/
public static function fromInvalidInitializer($initializer): self
public static function fromInvalidInitializer(mixed $initializer): self
{
return new self(sprintf(
'An invalid initializer was registered. Expected a callable or an'
. ' instance of "%s"; received "%s"',
InitializerInterface::class,
is_object($initializer) ? get_class($initializer) : gettype($initializer)
is_object($initializer) ? $initializer::class : gettype($initializer)
));
}
/**
* @param mixed $abstractFactory
*/
public static function fromInvalidAbstractFactory($abstractFactory): self
public static function fromInvalidAbstractFactory(mixed $abstractFactory): self
{
return new self(sprintf(
'An invalid abstract factory was registered. Expected an instance of or a valid'
. ' class name resolving to an implementation of "%s", but "%s" was received.',
AbstractFactoryInterface::class,
is_object($abstractFactory) ? get_class($abstractFactory) : gettype($abstractFactory)
is_object($abstractFactory) ? $abstractFactory::class : gettype($abstractFactory)
));
}
}

View File

@@ -24,7 +24,7 @@ interface DelegatorFactoryInterface
*
* @param string $name
* @psalm-param callable():mixed $callback
* @param null|array $options
* @param null|array<mixed> $options
* @return object
* @throws ServiceNotFoundException If unable to resolve the service.
* @throws ServiceNotCreatedException If an exception is raised when creating a service.

View File

@@ -19,9 +19,7 @@ use Psr\Container\ContainerInterface;
*/
final class InvokableFactory implements FactoryInterface
{
/**
* {@inheritDoc}
*/
/** {@inheritDoc} */
public function __invoke(ContainerInterface $container, $requestedName, ?array $options = null)
{
return null === $options ? new $requestedName() : new $requestedName($options);

View File

@@ -29,8 +29,7 @@ interface InitializerInterface extends Initializer\InitializerInterface
/**
* Initialize
*
* @param mixed $instance
* @return mixed
*/
public function initialize($instance, ServiceLocatorInterface $serviceLocator);
public function initialize(mixed $instance, ServiceLocatorInterface $serviceLocator);
}

View File

@@ -19,12 +19,11 @@ interface PluginManagerInterface extends ServiceLocatorInterface
/**
* Validate an instance
*
* @param mixed $instance
* @return void
* @throws InvalidServiceException If created instance does not respect the
* constraint on type imposed by the plugin manager.
* @throws ContainerExceptionInterface If any other error occurs.
* @psalm-assert InstanceType $instance
*/
public function validate($instance);
public function validate(mixed $instance);
}

View File

@@ -14,26 +14,19 @@ use Psr\Container\ContainerInterface;
use function sprintf;
/**
* Delegator factory responsible of instantiating lazy loading value holder proxies of
* Delegator factory responsible for instantiating lazy loading value holder proxies of
* given services at runtime
*
* @link https://github.com/Ocramius/ProxyManager/blob/master/docs/lazy-loading-value-holder.md
*/
final class LazyServiceFactory implements DelegatorFactoryInterface
{
private LazyLoadingValueHolderFactory $proxyFactory;
/** @var array<string, class-string> map of service names to class names */
private array $servicesMap;
/**
* @param array<string, class-string> $servicesMap A map of service names to
* class names of their respective classes
*/
public function __construct(LazyLoadingValueHolderFactory $proxyFactory, array $servicesMap)
public function __construct(private LazyLoadingValueHolderFactory $proxyFactory, private array $servicesMap)
{
$this->proxyFactory = $proxyFactory;
$this->servicesMap = $servicesMap;
}
/**
@@ -45,7 +38,7 @@ final class LazyServiceFactory implements DelegatorFactoryInterface
public function __invoke(ContainerInterface $container, $name, callable $callback, ?array $options = null)
{
if (isset($this->servicesMap[$name])) {
$initializer = function (&$wrappedInstance, LazyLoadingInterface $proxy) use ($callback) {
$initializer = static function (&$wrappedInstance, LazyLoadingInterface $proxy) use ($callback): bool {
$proxy->setProxyInitializer(null);
$wrappedInstance = $callback();

View File

@@ -19,7 +19,7 @@ interface ServiceLocatorInterface extends ContainerInterface
* @param string|class-string<T> $name
* @param null|array<mixed> $options
* @return mixed
* @psalm-return ($name is class-string ? T : mixed)
* @psalm-return ($name is class-string<T> ? T : mixed)
* @throws Exception\ServiceNotFoundException If no factory/abstract
* factory could be found to create the instance.
* @throws Exception\ServiceNotCreatedException If factory/delegator fails

View File

@@ -24,7 +24,6 @@ use function array_intersect;
use function array_key_exists;
use function array_keys;
use function class_exists;
use function get_class;
use function gettype;
use function in_array;
use function is_callable;
@@ -54,13 +53,47 @@ use const E_USER_DEPRECATED;
*
* @see ConfigInterface
*
* @psalm-import-type ServiceManagerConfigurationType from ConfigInterface
* @psalm-import-type AbstractFactoriesConfigurationType from ConfigInterface
* @psalm-import-type DelegatorsConfigurationType from ConfigInterface
* @psalm-import-type FactoriesConfigurationType from ConfigInterface
* @psalm-import-type InitializersConfigurationType from ConfigInterface
* @psalm-import-type LazyServicesConfigurationType from ConfigInterface
* @psalm-type ServiceManagerConfiguration = array{shared_by_default?:bool}&ServiceManagerConfigurationType
* @psalm-type AbstractFactoriesConfiguration = array<
* array-key,
* (class-string<Factory\AbstractFactoryInterface>|Factory\AbstractFactoryInterface)
* >
* @psalm-type DelegatorsConfiguration = array<
* string,
* array<
* array-key,
* (class-string<Factory\DelegatorFactoryInterface>|Factory\DelegatorFactoryInterface)
* |callable(ContainerInterface,string,callable():object,array<mixed>|null):object
* >
* >
* @psalm-type FactoriesConfiguration = array<
* string,
* (class-string<Factory\FactoryInterface>|Factory\FactoryInterface)
* |callable(ContainerInterface,?string,?array<mixed>|null):object
* >
* @psalm-type InitializersConfiguration = array<
* array-key,
* (class-string<Initializer\InitializerInterface>|Initializer\InitializerInterface)
* |callable(ContainerInterface,object):void
* >
* @psalm-type LazyServicesConfiguration = array{
* class_map?:array<string,class-string>,
* proxies_namespace?:non-empty-string,
* proxies_target_dir?:non-empty-string,
* write_proxy_files?:bool
* }
* @psalm-type ServiceManagerConfiguration = array{
* abstract_factories?: AbstractFactoriesConfiguration,
* aliases?: array<string,string>,
* delegators?: DelegatorsConfiguration,
* factories?: FactoriesConfiguration,
* initializers?: InitializersConfiguration,
* invokables?: array<string,string>,
* lazy_services?: LazyServicesConfiguration,
* services?: array<string,object|array<mixed>>,
* shared?:array<string,bool>,
* shared_by_default?:bool,
* ...
* }
*/
class ServiceManager implements ServiceLocatorInterface
{
@@ -88,7 +121,7 @@ class ServiceManager implements ServiceLocatorInterface
/**
* @var string[][]|Factory\DelegatorFactoryInterface[][]
* @psalm-var DelegatorsConfigurationType
* @psalm-var DelegatorsConfiguration
*/
protected $delegators = [];
@@ -96,19 +129,19 @@ class ServiceManager implements ServiceLocatorInterface
* A list of factories (either as string name or callable)
*
* @var string[]|callable[]
* @psalm-var FactoriesConfigurationType
* @psalm-var FactoriesConfiguration
*/
protected $factories = [];
/**
* @var Initializer\InitializerInterface[]|callable[]
* @psalm-var InitializersConfigurationType
* @psalm-var InitializersConfiguration
*/
protected $initializers = [];
/**
* @var array
* @psalm-var LazyServicesConfigurationType
* @psalm-var LazyServicesConfiguration
*/
protected $lazyServices = [];
@@ -158,7 +191,6 @@ class ServiceManager implements ServiceLocatorInterface
* See {@see \Laminas\ServiceManager\ServiceManager::configure()} for details
* on what $config accepts.
*
* @param array $config
* @psalm-param ServiceManagerConfiguration $config
*/
public function __construct(array $config = [])
@@ -186,9 +218,7 @@ class ServiceManager implements ServiceLocatorInterface
return $this->creationContext;
}
/**
* {@inheritDoc}
*/
/** {@inheritDoc} */
public function get($name)
{
// We start by checking if we have cached the requested service;
@@ -247,9 +277,7 @@ class ServiceManager implements ServiceLocatorInterface
return $object;
}
/**
* {@inheritDoc}
*/
/** {@inheritDoc} */
public function build($name, ?array $options = null)
{
// We never cache when using "build".
@@ -290,7 +318,6 @@ class ServiceManager implements ServiceLocatorInterface
}
/**
* @param array $config
* @psalm-param ServiceManagerConfiguration $config
* @return self
* @throws ContainerModificationsNotAllowedException If the allow
@@ -507,7 +534,7 @@ class ServiceManager implements ServiceLocatorInterface
/**
* Instantiate initializers for to avoid checks during service construction.
*
* @psalm-param InitializersConfigurationType $initializers
* @psalm-param InitializersConfiguration $initializers
*/
private function resolveInitializers(array $initializers): void
{
@@ -684,8 +711,8 @@ class ServiceManager implements ServiceLocatorInterface
* It works with strings and class instances.
* It's not possible to de-duple anonymous functions
*
* @psalm-param DelegatorsConfigurationType $config
* @psalm-return DelegatorsConfigurationType
* @psalm-param DelegatorsConfiguration $config
* @psalm-return DelegatorsConfiguration
*/
private function mergeDelegators(array $config): array
{
@@ -740,7 +767,7 @@ class ServiceManager implements ServiceLocatorInterface
* a given service name we do not have a service instance
* in the cache OR override is explicitly allowed.
*
* @psalm-param ServiceManagerConfigurationType $config
* @psalm-param ServiceManagerConfiguration $config
* @throws ContainerModificationsNotAllowedException If any
* service key is invalid.
*/
@@ -976,7 +1003,7 @@ class ServiceManager implements ServiceLocatorInterface
}
throw new ServiceNotCreatedException(sprintf(
'A non-callable delegator, "%s", was provided; expected a callable or instance of "%s"',
is_object($delegatorFactory) ? get_class($delegatorFactory) : gettype($delegatorFactory),
is_object($delegatorFactory) ? $delegatorFactory::class : gettype($delegatorFactory),
DelegatorFactoryInterface::class
));
}

View File

@@ -8,6 +8,7 @@ use Laminas\ServiceManager\AbstractFactory\ConfigAbstractFactory;
use Laminas\ServiceManager\Exception\InvalidArgumentException;
use Psr\Container\ContainerInterface;
use ReflectionClass;
use ReflectionNamedType;
use ReflectionParameter;
use Traversable;
@@ -38,15 +39,11 @@ class ConfigDumper
return %s;
EOC;
private ?ContainerInterface $container;
public function __construct(?ContainerInterface $container = null)
public function __construct(private ?ContainerInterface $container = null)
{
$this->container = $container;
}
/**
* @param array $config
* @param string $className
* @param bool $ignoreUnresolved
* @return array
@@ -83,7 +80,7 @@ EOC;
foreach ($constructorArguments as $constructorArgument) {
$type = $constructorArgument->getType();
$argumentType = null !== $type && ! $type->isBuiltin() ? $type->getName() : null;
$argumentType = $type instanceof ReflectionNamedType && ! $type->isBuiltin() ? $type->getName() : null;
if ($argumentType === null) {
if ($ignoreUnresolved) {
@@ -126,7 +123,6 @@ EOC;
}
/**
* @param array $config
* @param string $className
* @return array
*/
@@ -137,7 +133,6 @@ EOC;
}
/**
* @param array $config
* @return array
* @throws InvalidArgumentException If ConfigAbstractFactory configuration
* value is not an array.
@@ -163,7 +158,6 @@ EOC;
}
/**
* @param array $config
* @param string $className
* @return array
*/
@@ -184,7 +178,6 @@ EOC;
}
/**
* @param array $config
* @return string
*/
public function dumpConfigFile(array $config)
@@ -244,11 +237,10 @@ EOC;
}
/**
* @param mixed $value
* @param int $indentLevel
* @return string
*/
private function createConfigValue($value, $indentLevel)
private function createConfigValue(mixed $value, $indentLevel)
{
if (is_array($value) || $value instanceof Traversable) {
return $this->prepareConfig($value, $indentLevel + 1);

View File

@@ -68,14 +68,11 @@ EOH;
private ConsoleHelper $helper;
private string $scriptName;
/**
* @param string $scriptName
*/
public function __construct($scriptName = self::DEFAULT_SCRIPT_NAME, ?ConsoleHelper $helper = null)
public function __construct(private $scriptName = self::DEFAULT_SCRIPT_NAME, ?ConsoleHelper $helper = null)
{
$this->scriptName = $scriptName;
$this->helper = $helper ?: new ConsoleHelper();
}
@@ -128,7 +125,6 @@ EOH;
}
/**
* @param array $args
* @return object
*/
private function parseArgs(array $args)

View File

@@ -8,6 +8,7 @@ use Laminas\ServiceManager\Exception\InvalidArgumentException;
use Laminas\ServiceManager\Factory\FactoryInterface;
use Psr\Container\ContainerInterface;
use ReflectionClass;
use ReflectionNamedType;
use ReflectionParameter;
use function array_filter;
@@ -99,13 +100,13 @@ class FactoryCreator
$constructorParameters = array_filter(
$constructorParameters,
function (ReflectionParameter $argument): bool {
static function (ReflectionParameter $argument): bool {
if ($argument->isOptional()) {
return false;
}
$type = $argument->getType();
$class = null !== $type && ! $type->isBuiltin() ? $type->getName() : null;
$class = $type instanceof ReflectionNamedType && ! $type->isBuiltin() ? $type->getName() : null;
if (null === $class) {
throw new InvalidArgumentException(sprintf(
@@ -123,9 +124,9 @@ class FactoryCreator
return [];
}
return array_map(function (ReflectionParameter $parameter): ?string {
return array_map(static function (ReflectionParameter $parameter): ?string {
$type = $parameter->getType();
return null !== $type && ! $type->isBuiltin() ? $type->getName() : null;
return $type instanceof ReflectionNamedType && ! $type->isBuiltin() ? $type->getName() : null;
}, $constructorParameters);
}
@@ -135,7 +136,7 @@ class FactoryCreator
*/
private function createArgumentString($className)
{
$arguments = array_map(fn(string $dependency): string
$arguments = array_map(static fn(string $dependency): string
=> sprintf('$container->get(\\%s::class)', $dependency), $this->getConstructorParameters($className));
switch (count($arguments)) {

View File

@@ -45,14 +45,11 @@ EOH;
private ConsoleHelper $helper;
private string $scriptName;
/**
* @param string $scriptName
*/
public function __construct($scriptName = self::DEFAULT_SCRIPT_NAME, ?ConsoleHelper $helper = null)
public function __construct(private $scriptName = self::DEFAULT_SCRIPT_NAME, ?ConsoleHelper $helper = null)
{
$this->scriptName = $scriptName;
$this->helper = $helper ?: new ConsoleHelper();
}
@@ -98,7 +95,6 @@ EOH;
}
/**
* @param array $args
* @return ArgumentObject
*/
private function parseArgs(array $args)