mirror of
https://github.com/rectorphp/rector.git
synced 2024-05-28 23:10:51 +00:00
Updated Rector to commit f35326d7010fa42458b44d3896b4791dcc22f78a
f35326d701
[TypeDeclaration] Remove PhpDocTypeChanger->changeVarType() on TypedPropertyFromAssignsRector (#3163)
This commit is contained in:
parent
e1dd377fd8
commit
b2e081777a
2
vendor/autoload.php
vendored
2
vendor/autoload.php
vendored
|
@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) {
|
|||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInit4dbe839329300c7245762ec5d2500192::getLoader();
|
||||
return ComposerAutoloaderInitb071a849266a1439517ec2f9b787ae17::getLoader();
|
||||
|
|
2
vendor/composer/autoload_classmap.php
vendored
2
vendor/composer/autoload_classmap.php
vendored
|
@ -1026,8 +1026,6 @@ return array(
|
|||
'RectorPrefix202212\\Symfony\\Contracts\\Service\\ServiceSubscriberInterface' => $vendorDir . '/symfony/contracts/Service/ServiceSubscriberInterface.php',
|
||||
'RectorPrefix202212\\Symfony\\Contracts\\Service\\ServiceSubscriberTrait' => $vendorDir . '/symfony/contracts/Service/ServiceSubscriberTrait.php',
|
||||
'RectorPrefix202212\\Symfony\\Contracts\\Service\\Test\\ServiceLocatorTest' => $vendorDir . '/symfony/contracts/Service/Test/ServiceLocatorTest.php',
|
||||
'RectorPrefix202212\\Symfony\\Contracts\\Tests\\Cache\\CacheTraitTest' => $vendorDir . '/symfony/contracts/Tests/Cache/CacheTraitTest.php',
|
||||
'RectorPrefix202212\\Symfony\\Contracts\\Tests\\Service\\ServiceSubscriberTraitTest' => $vendorDir . '/symfony/contracts/Tests/Service/ServiceSubscriberTraitTest.php',
|
||||
'RectorPrefix202212\\Symfony\\Contracts\\Translation\\LocaleAwareInterface' => $vendorDir . '/symfony/contracts/Translation/LocaleAwareInterface.php',
|
||||
'RectorPrefix202212\\Symfony\\Contracts\\Translation\\Test\\TranslatorTest' => $vendorDir . '/symfony/contracts/Translation/Test/TranslatorTest.php',
|
||||
'RectorPrefix202212\\Symfony\\Contracts\\Translation\\TranslatableInterface' => $vendorDir . '/symfony/contracts/Translation/TranslatableInterface.php',
|
||||
|
|
14
vendor/composer/autoload_real.php
vendored
14
vendor/composer/autoload_real.php
vendored
|
@ -2,7 +2,7 @@
|
|||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInit4dbe839329300c7245762ec5d2500192
|
||||
class ComposerAutoloaderInitb071a849266a1439517ec2f9b787ae17
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
|
@ -22,19 +22,19 @@ class ComposerAutoloaderInit4dbe839329300c7245762ec5d2500192
|
|||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit4dbe839329300c7245762ec5d2500192', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInitb071a849266a1439517ec2f9b787ae17', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit4dbe839329300c7245762ec5d2500192', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitb071a849266a1439517ec2f9b787ae17', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit4dbe839329300c7245762ec5d2500192::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInitb071a849266a1439517ec2f9b787ae17::getInitializer($loader));
|
||||
|
||||
$loader->setClassMapAuthoritative(true);
|
||||
$loader->register(true);
|
||||
|
||||
$includeFiles = \Composer\Autoload\ComposerStaticInit4dbe839329300c7245762ec5d2500192::$files;
|
||||
$includeFiles = \Composer\Autoload\ComposerStaticInitb071a849266a1439517ec2f9b787ae17::$files;
|
||||
foreach ($includeFiles as $fileIdentifier => $file) {
|
||||
composerRequire4dbe839329300c7245762ec5d2500192($fileIdentifier, $file);
|
||||
composerRequireb071a849266a1439517ec2f9b787ae17($fileIdentifier, $file);
|
||||
}
|
||||
|
||||
return $loader;
|
||||
|
@ -46,7 +46,7 @@ class ComposerAutoloaderInit4dbe839329300c7245762ec5d2500192
|
|||
* @param string $file
|
||||
* @return void
|
||||
*/
|
||||
function composerRequire4dbe839329300c7245762ec5d2500192($fileIdentifier, $file)
|
||||
function composerRequireb071a849266a1439517ec2f9b787ae17($fileIdentifier, $file)
|
||||
{
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
||||
|
|
10
vendor/composer/autoload_static.php
vendored
10
vendor/composer/autoload_static.php
vendored
|
@ -4,7 +4,7 @@
|
|||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInit4dbe839329300c7245762ec5d2500192
|
||||
class ComposerStaticInitb071a849266a1439517ec2f9b787ae17
|
||||
{
|
||||
public static $files = array (
|
||||
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
||||
|
@ -1266,8 +1266,6 @@ class ComposerStaticInit4dbe839329300c7245762ec5d2500192
|
|||
'RectorPrefix202212\\Symfony\\Contracts\\Service\\ServiceSubscriberInterface' => __DIR__ . '/..' . '/symfony/contracts/Service/ServiceSubscriberInterface.php',
|
||||
'RectorPrefix202212\\Symfony\\Contracts\\Service\\ServiceSubscriberTrait' => __DIR__ . '/..' . '/symfony/contracts/Service/ServiceSubscriberTrait.php',
|
||||
'RectorPrefix202212\\Symfony\\Contracts\\Service\\Test\\ServiceLocatorTest' => __DIR__ . '/..' . '/symfony/contracts/Service/Test/ServiceLocatorTest.php',
|
||||
'RectorPrefix202212\\Symfony\\Contracts\\Tests\\Cache\\CacheTraitTest' => __DIR__ . '/..' . '/symfony/contracts/Tests/Cache/CacheTraitTest.php',
|
||||
'RectorPrefix202212\\Symfony\\Contracts\\Tests\\Service\\ServiceSubscriberTraitTest' => __DIR__ . '/..' . '/symfony/contracts/Tests/Service/ServiceSubscriberTraitTest.php',
|
||||
'RectorPrefix202212\\Symfony\\Contracts\\Translation\\LocaleAwareInterface' => __DIR__ . '/..' . '/symfony/contracts/Translation/LocaleAwareInterface.php',
|
||||
'RectorPrefix202212\\Symfony\\Contracts\\Translation\\Test\\TranslatorTest' => __DIR__ . '/..' . '/symfony/contracts/Translation/Test/TranslatorTest.php',
|
||||
'RectorPrefix202212\\Symfony\\Contracts\\Translation\\TranslatableInterface' => __DIR__ . '/..' . '/symfony/contracts/Translation/TranslatableInterface.php',
|
||||
|
@ -3020,9 +3018,9 @@ class ComposerStaticInit4dbe839329300c7245762ec5d2500192
|
|||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit4dbe839329300c7245762ec5d2500192::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit4dbe839329300c7245762ec5d2500192::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit4dbe839329300c7245762ec5d2500192::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInitb071a849266a1439517ec2f9b787ae17::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInitb071a849266a1439517ec2f9b787ae17::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInitb071a849266a1439517ec2f9b787ae17::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
|
24
vendor/composer/installed.json
vendored
24
vendor/composer/installed.json
vendored
|
@ -2058,12 +2058,12 @@
|
|||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/rectorphp\/rector-symfony.git",
|
||||
"reference": "ed4578530ae47d4227e6abdc824ecac434dfc633"
|
||||
"reference": "f77e49313ef90366441b9c0bb38943c14cdda46d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/ed4578530ae47d4227e6abdc824ecac434dfc633",
|
||||
"reference": "ed4578530ae47d4227e6abdc824ecac434dfc633",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/f77e49313ef90366441b9c0bb38943c14cdda46d",
|
||||
"reference": "f77e49313ef90366441b9c0bb38943c14cdda46d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2093,7 +2093,7 @@
|
|||
"symplify\/rule-doc-generator": "^11.1",
|
||||
"symplify\/vendor-patches": "^11.1"
|
||||
},
|
||||
"time": "2022-12-06T18:09:04+00:00",
|
||||
"time": "2022-12-07T13:31:03+00:00",
|
||||
"default-branch": true,
|
||||
"type": "rector-extension",
|
||||
"extra": {
|
||||
|
@ -2374,17 +2374,17 @@
|
|||
},
|
||||
{
|
||||
"name": "symfony\/contracts",
|
||||
"version": "v3.1.1",
|
||||
"version_normalized": "3.1.1.0",
|
||||
"version": "v3.2.0",
|
||||
"version_normalized": "3.2.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/symfony\/contracts.git",
|
||||
"reference": "8656c9e7f44435eaf428f2aa7f083c65297fb22f"
|
||||
"reference": "c47da22960a1eb5e39c1ad84120734e680265610"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/symfony\/contracts\/zipball\/8656c9e7f44435eaf428f2aa7f083c65297fb22f",
|
||||
"reference": "8656c9e7f44435eaf428f2aa7f083c65297fb22f",
|
||||
"url": "https:\/\/api.github.com\/repos\/symfony\/contracts\/zipball\/c47da22960a1eb5e39c1ad84120734e680265610",
|
||||
"reference": "c47da22960a1eb5e39c1ad84120734e680265610",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2414,11 +2414,11 @@
|
|||
"symfony\/service-implementation": "",
|
||||
"symfony\/translation-implementation": ""
|
||||
},
|
||||
"time": "2022-06-27T17:24:16+00:00",
|
||||
"time": "2022-11-25T10:21:52+00:00",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "3.1-dev"
|
||||
"dev-main": "3.3-dev"
|
||||
}
|
||||
},
|
||||
"installation-source": "dist",
|
||||
|
@ -2458,7 +2458,7 @@
|
|||
"standards"
|
||||
],
|
||||
"support": {
|
||||
"source": "https:\/\/github.com\/symfony\/contracts\/tree\/v3.1.1"
|
||||
"source": "https:\/\/github.com\/symfony\/contracts\/tree\/v3.2.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
|
2
vendor/composer/installed.php
vendored
2
vendor/composer/installed.php
vendored
File diff suppressed because one or more lines are too long
|
@ -9,7 +9,7 @@ namespace Rector\RectorInstaller;
|
|||
*/
|
||||
final class GeneratedConfig
|
||||
{
|
||||
public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main bf394ee'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main b1ca6d7'), 'rector/rector-php-parser' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-php-parser', 'relative_install_path' => '../../rector-php-parser', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 9ea5f62'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 3d0d84d'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main ed45785'));
|
||||
public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main bf394ee'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main b1ca6d7'), 'rector/rector-php-parser' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-php-parser', 'relative_install_path' => '../../rector-php-parser', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 9ea5f62'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 3d0d84d'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main f77e493'));
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -158,8 +158,9 @@ CODE_SAMPLE
|
|||
return null;
|
||||
}
|
||||
$newArgs = [$methodCall->args[0]];
|
||||
// When we had a custom message argument we want to add it to the new assert.
|
||||
if (isset($args[2])) {
|
||||
// When we had a $message argument we want to add it to the new assert together with $expectedCode null.
|
||||
$newArgs[] = null;
|
||||
$newArgs[] = $this->valueResolver->getValue($args[2]->value, \true);
|
||||
}
|
||||
if ($methodCall instanceof StaticCall) {
|
||||
|
|
5
vendor/symfony/contracts/CHANGELOG.md
vendored
5
vendor/symfony/contracts/CHANGELOG.md
vendored
|
@ -1,6 +1,11 @@
|
|||
CHANGELOG
|
||||
=========
|
||||
|
||||
3.2
|
||||
---
|
||||
|
||||
* Allow `ServiceSubscriberInterface::getSubscribedServices()` to return `SubscribedService[]`
|
||||
|
||||
3.0
|
||||
---
|
||||
|
||||
|
|
|
@ -44,9 +44,9 @@ interface CacheInterface
|
|||
*
|
||||
* @param string $key The key to delete
|
||||
*
|
||||
* @throws InvalidArgumentException When $key is not valid
|
||||
*
|
||||
* @return bool True if the item was successfully removed, false if there was any error
|
||||
*
|
||||
* @throws InvalidArgumentException When $key is not valid
|
||||
*/
|
||||
public function delete(string $key) : bool;
|
||||
}
|
||||
|
|
|
@ -22,16 +22,10 @@ use RectorPrefix202212\Psr\Log\LoggerInterface;
|
|||
*/
|
||||
trait CacheTrait
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get(string $key, callable $callback, float $beta = null, array &$metadata = null) : mixed
|
||||
{
|
||||
return $this->doGet($this, $key, $callback, $beta, $metadata);
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function delete(string $key) : bool
|
||||
{
|
||||
return $this->deleteItem($key);
|
||||
|
|
2
vendor/symfony/contracts/Cache/composer.json
vendored
2
vendor/symfony/contracts/Cache/composer.json
vendored
|
@ -37,7 +37,7 @@
|
|||
"minimum-stability": "dev",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "3.1-dev"
|
||||
"dev-main": "3.3-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony\/contracts",
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
"minimum-stability": "dev",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "3.1-dev"
|
||||
"dev-main": "3.3-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony\/contracts",
|
||||
|
|
|
@ -32,9 +32,6 @@ class Event implements StoppableEventInterface
|
|||
* @var bool
|
||||
*/
|
||||
private $propagationStopped = \false;
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isPropagationStopped() : bool
|
||||
{
|
||||
return $this->propagationStopped;
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
"minimum-stability": "dev",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "3.1-dev"
|
||||
"dev-main": "3.3-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony\/contracts",
|
||||
|
|
|
@ -796,7 +796,7 @@ abstract class HttpClientTestCase extends TestCase
|
|||
$client = $this->getHttpClient(__FUNCTION__);
|
||||
$client2 = $client->withOptions(['base_uri' => 'http://localhost:8057/']);
|
||||
$this->assertNotSame($client, $client2);
|
||||
$this->assertSame(\get_class($client), \get_class($client2));
|
||||
$this->assertSame($client::class, $client2::class);
|
||||
$response = $client2->request('GET', '/');
|
||||
$this->assertSame(200, $response->getStatusCode());
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
"minimum-stability": "dev",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "3.1-dev"
|
||||
"dev-main": "3.3-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony\/contracts",
|
||||
|
|
|
@ -10,8 +10,13 @@
|
|||
*/
|
||||
namespace RectorPrefix202212\Symfony\Contracts\Service\Attribute;
|
||||
|
||||
use RectorPrefix202212\Symfony\Contracts\Service\ServiceSubscriberInterface;
|
||||
use RectorPrefix202212\Symfony\Contracts\Service\ServiceSubscriberTrait;
|
||||
/**
|
||||
* For use as the return value for {@see ServiceSubscriberInterface}.
|
||||
*
|
||||
* @example new SubscribedService('http_client', HttpClientInterface::class, false, new Target('githubApi'))
|
||||
*
|
||||
* Use with {@see ServiceSubscriberTrait} to mark a method's return type
|
||||
* as a subscribed service.
|
||||
*
|
||||
|
@ -20,16 +25,31 @@ use RectorPrefix202212\Symfony\Contracts\Service\ServiceSubscriberTrait;
|
|||
#[\Attribute(\Attribute::TARGET_METHOD)]
|
||||
final class SubscribedService
|
||||
{
|
||||
/** @var object[] */
|
||||
public $attributes;
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
public $key;
|
||||
/**
|
||||
* @param string|null $key The key to use for the service
|
||||
* If null, use "ClassName::methodName"
|
||||
* @var class-string|null
|
||||
*/
|
||||
public function __construct(?string $key = null)
|
||||
public $type;
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
public $nullable = \false;
|
||||
/**
|
||||
* @param string|null $key The key to use for the service
|
||||
* @param class-string|null $type The service class
|
||||
* @param bool $nullable Whether the service is optional
|
||||
* @param object|object[] $attributes One or more dependency injection attributes to use
|
||||
*/
|
||||
public function __construct(?string $key = null, ?string $type = null, bool $nullable = \false, $attributes = [])
|
||||
{
|
||||
$this->key = $key;
|
||||
$this->type = $type;
|
||||
$this->nullable = $nullable;
|
||||
$this->attributes = \is_array($attributes) ? $attributes : [$attributes];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,15 +42,11 @@ trait ServiceLocatorTrait
|
|||
{
|
||||
$this->factories = $factories;
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function has(string $id) : bool
|
||||
{
|
||||
return isset($this->factories[$id]);
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* @return mixed
|
||||
*/
|
||||
public function get(string $id)
|
||||
|
@ -71,9 +67,6 @@ trait ServiceLocatorTrait
|
|||
unset($this->loading[$id]);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getProvidedServices() : array
|
||||
{
|
||||
if (!isset($this->providedTypes)) {
|
||||
|
|
|
@ -22,14 +22,9 @@ use RectorPrefix202212\Psr\Container\ContainerInterface;
|
|||
interface ServiceProviderInterface extends ContainerInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @return T
|
||||
*/
|
||||
public function get(string $id);
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function has(string $id) : bool;
|
||||
/**
|
||||
* Returns an associative array of service types keyed by the identifiers provided by the current container.
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
*/
|
||||
namespace RectorPrefix202212\Symfony\Contracts\Service;
|
||||
|
||||
use RectorPrefix202212\Symfony\Contracts\Service\Attribute\SubscribedService;
|
||||
/**
|
||||
* A ServiceSubscriber exposes its dependencies via the static {@link getSubscribedServices} method.
|
||||
*
|
||||
|
@ -28,7 +29,8 @@ namespace RectorPrefix202212\Symfony\Contracts\Service;
|
|||
interface ServiceSubscriberInterface
|
||||
{
|
||||
/**
|
||||
* Returns an array of service types required by such instances, optionally keyed by the service names used internally.
|
||||
* Returns an array of service types (or {@see SubscribedService} objects) required
|
||||
* by such instances, optionally keyed by the service names used internally.
|
||||
*
|
||||
* For mandatory dependencies:
|
||||
*
|
||||
|
@ -46,7 +48,13 @@ interface ServiceSubscriberInterface
|
|||
* * ['?Psr\Log\LoggerInterface'] is a shortcut for
|
||||
* * ['Psr\Log\LoggerInterface' => '?Psr\Log\LoggerInterface']
|
||||
*
|
||||
* @return string[] The required service types, optionally keyed by service names
|
||||
* additionally, an array of {@see SubscribedService}'s can be returned:
|
||||
*
|
||||
* * [new SubscribedService('logger', Psr\Log\LoggerInterface::class)]
|
||||
* * [new SubscribedService(type: Psr\Log\LoggerInterface::class, nullable: true)]
|
||||
* * [new SubscribedService('http_client', HttpClientInterface::class, attributes: new Target('githubApi'))]
|
||||
*
|
||||
* @return string[]|SubscribedService[] The required service types, optionally keyed by service names
|
||||
*/
|
||||
public static function getSubscribedServices() : array;
|
||||
}
|
||||
|
|
|
@ -23,9 +23,6 @@ trait ServiceSubscriberTrait
|
|||
{
|
||||
/** @var ContainerInterface */
|
||||
protected $container;
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function getSubscribedServices() : array
|
||||
{
|
||||
$services = \method_exists(\get_parent_class(self::class) ?: '', __FUNCTION__) ? parent::getSubscribedServices() : [];
|
||||
|
@ -42,11 +39,16 @@ trait ServiceSubscriberTrait
|
|||
if (!($returnType = $method->getReturnType())) {
|
||||
throw new \LogicException(\sprintf('Cannot use "%s" on methods without a return type in "%s::%s()".', SubscribedService::class, $method->name, self::class));
|
||||
}
|
||||
$serviceId = $returnType instanceof \ReflectionNamedType ? $returnType->getName() : (string) $returnType;
|
||||
if ($returnType->allowsNull()) {
|
||||
$serviceId = '?' . $serviceId;
|
||||
/* @var SubscribedService $attribute */
|
||||
$attribute = $attribute->newInstance();
|
||||
$attribute->key = $attribute->key ?? self::class . '::' . $method->name;
|
||||
$attribute->type = $attribute->type ?? ($returnType instanceof \ReflectionNamedType ? $returnType->getName() : (string) $returnType);
|
||||
$attribute->nullable = $returnType->allowsNull();
|
||||
if ($attribute->attributes) {
|
||||
$services[] = $attribute;
|
||||
} else {
|
||||
$services[$attribute->key] = ($attribute->nullable ? '?' : '') . $attribute->type;
|
||||
}
|
||||
$services[$attribute->newInstance()->key ?? self::class . '::' . $method->name] = $serviceId;
|
||||
}
|
||||
return $services;
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
"minimum-stability": "dev",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "3.1-dev"
|
||||
"dev-main": "3.3-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony\/contracts",
|
||||
|
|
|
@ -1,103 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
namespace RectorPrefix202212\Symfony\Contracts\Tests\Cache;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use RectorPrefix202212\Psr\Cache\CacheItemInterface;
|
||||
use RectorPrefix202212\Psr\Cache\CacheItemPoolInterface;
|
||||
use RectorPrefix202212\Symfony\Contracts\Cache\CacheTrait;
|
||||
/**
|
||||
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
|
||||
*/
|
||||
class CacheTraitTest extends TestCase
|
||||
{
|
||||
public function testSave()
|
||||
{
|
||||
$item = $this->createMock(CacheItemInterface::class);
|
||||
$item->method('set')->willReturn($item);
|
||||
$item->method('isHit')->willReturn(\false);
|
||||
$item->expects($this->once())->method('set')->with('computed data');
|
||||
$cache = $this->getMockBuilder(TestPool::class)->setMethods(['getItem', 'save'])->getMock();
|
||||
$cache->expects($this->once())->method('getItem')->with('key')->willReturn($item);
|
||||
$cache->expects($this->once())->method('save');
|
||||
$callback = function (CacheItemInterface $item) {
|
||||
return 'computed data';
|
||||
};
|
||||
$cache->get('key', $callback);
|
||||
}
|
||||
public function testNoCallbackCallOnHit()
|
||||
{
|
||||
$item = $this->createMock(CacheItemInterface::class);
|
||||
$item->method('isHit')->willReturn(\true);
|
||||
$item->expects($this->never())->method('set');
|
||||
$cache = $this->getMockBuilder(TestPool::class)->setMethods(['getItem', 'save'])->getMock();
|
||||
$cache->expects($this->once())->method('getItem')->with('key')->willReturn($item);
|
||||
$cache->expects($this->never())->method('save');
|
||||
$callback = function (CacheItemInterface $item) {
|
||||
$this->assertTrue(\false, 'This code should never be reached');
|
||||
};
|
||||
$cache->get('key', $callback);
|
||||
}
|
||||
public function testRecomputeOnBetaInf()
|
||||
{
|
||||
$item = $this->createMock(CacheItemInterface::class);
|
||||
$item->method('set')->willReturn($item);
|
||||
$item->method('isHit')->willReturn(\true);
|
||||
$item->expects($this->once())->method('set')->with('computed data');
|
||||
$cache = $this->getMockBuilder(TestPool::class)->setMethods(['getItem', 'save'])->getMock();
|
||||
$cache->expects($this->once())->method('getItem')->with('key')->willReturn($item);
|
||||
$cache->expects($this->once())->method('save');
|
||||
$callback = function (CacheItemInterface $item) {
|
||||
return 'computed data';
|
||||
};
|
||||
$cache->get('key', $callback, \INF);
|
||||
}
|
||||
public function testExceptionOnNegativeBeta()
|
||||
{
|
||||
$cache = $this->getMockBuilder(TestPool::class)->setMethods(['getItem', 'save'])->getMock();
|
||||
$callback = function (CacheItemInterface $item) {
|
||||
return 'computed data';
|
||||
};
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
$cache->get('key', $callback, -2);
|
||||
}
|
||||
}
|
||||
class TestPool implements CacheItemPoolInterface
|
||||
{
|
||||
use CacheTrait;
|
||||
public function hasItem($key) : bool
|
||||
{
|
||||
}
|
||||
public function deleteItem($key) : bool
|
||||
{
|
||||
}
|
||||
public function deleteItems(array $keys = []) : bool
|
||||
{
|
||||
}
|
||||
public function getItem($key) : CacheItemInterface
|
||||
{
|
||||
}
|
||||
public function getItems(array $key = []) : iterable
|
||||
{
|
||||
}
|
||||
public function saveDeferred(CacheItemInterface $item) : bool
|
||||
{
|
||||
}
|
||||
public function save(CacheItemInterface $item) : bool
|
||||
{
|
||||
}
|
||||
public function commit() : bool
|
||||
{
|
||||
}
|
||||
public function clear() : bool
|
||||
{
|
||||
}
|
||||
}
|
|
@ -1,105 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
namespace RectorPrefix202212\Symfony\Contracts\Tests\Service;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use RectorPrefix202212\Psr\Container\ContainerInterface;
|
||||
use RectorPrefix202212\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\OtherDir\Component1\Dir1\Service1;
|
||||
use RectorPrefix202212\Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\OtherDir\Component1\Dir2\Service2;
|
||||
use RectorPrefix202212\Symfony\Contracts\Service\Attribute\SubscribedService;
|
||||
use RectorPrefix202212\Symfony\Contracts\Service\ServiceLocatorTrait;
|
||||
use RectorPrefix202212\Symfony\Contracts\Service\ServiceSubscriberInterface;
|
||||
use RectorPrefix202212\Symfony\Contracts\Service\ServiceSubscriberTrait;
|
||||
class ServiceSubscriberTraitTest extends TestCase
|
||||
{
|
||||
public function testMethodsOnParentsAndChildrenAreIgnoredInGetSubscribedServices()
|
||||
{
|
||||
$expected = [TestService::class . '::aService' => Service2::class, TestService::class . '::nullableService' => '?' . Service2::class];
|
||||
$this->assertEquals($expected, ChildTestService::getSubscribedServices());
|
||||
}
|
||||
public function testSetContainerIsCalledOnParent()
|
||||
{
|
||||
$container = new class([]) implements ContainerInterface
|
||||
{
|
||||
use ServiceLocatorTrait;
|
||||
};
|
||||
$this->assertSame($container, (new TestService())->setContainer($container));
|
||||
}
|
||||
public function testParentNotCalledIfHasMagicCall()
|
||||
{
|
||||
$container = new class([]) implements ContainerInterface
|
||||
{
|
||||
use ServiceLocatorTrait;
|
||||
};
|
||||
$service = new class extends ParentWithMagicCall
|
||||
{
|
||||
use ServiceSubscriberTrait;
|
||||
};
|
||||
$this->assertNull($service->setContainer($container));
|
||||
$this->assertSame([], $service::getSubscribedServices());
|
||||
}
|
||||
public function testParentNotCalledIfNoParent()
|
||||
{
|
||||
$container = new class([]) implements ContainerInterface
|
||||
{
|
||||
use ServiceLocatorTrait;
|
||||
};
|
||||
$service = new class
|
||||
{
|
||||
use ServiceSubscriberTrait;
|
||||
};
|
||||
$this->assertNull($service->setContainer($container));
|
||||
$this->assertSame([], $service::getSubscribedServices());
|
||||
}
|
||||
}
|
||||
class ParentTestService
|
||||
{
|
||||
public function aParentService() : Service1
|
||||
{
|
||||
}
|
||||
public function setContainer(ContainerInterface $container)
|
||||
{
|
||||
return $container;
|
||||
}
|
||||
}
|
||||
class TestService extends ParentTestService implements ServiceSubscriberInterface
|
||||
{
|
||||
use ServiceSubscriberTrait;
|
||||
#[\Symfony\Contracts\Service\Attribute\SubscribedService]
|
||||
public function aService() : Service2
|
||||
{
|
||||
}
|
||||
#[\Symfony\Contracts\Service\Attribute\SubscribedService]
|
||||
public function nullableService() : ?Service2
|
||||
{
|
||||
}
|
||||
}
|
||||
class ChildTestService extends TestService
|
||||
{
|
||||
#[\Symfony\Contracts\Service\Attribute\SubscribedService]
|
||||
public function aChildService() : Service3
|
||||
{
|
||||
}
|
||||
}
|
||||
class ParentWithMagicCall
|
||||
{
|
||||
public function __call($method, $args)
|
||||
{
|
||||
throw new \BadMethodCallException('Should not be called.');
|
||||
}
|
||||
public static function __callStatic($method, $args)
|
||||
{
|
||||
throw new \BadMethodCallException('Should not be called.');
|
||||
}
|
||||
}
|
||||
class Service3
|
||||
{
|
||||
}
|
|
@ -214,7 +214,7 @@ class TranslatorTest extends TestCase
|
|||
['This is a text with a\\nnew-line in it. Selector = 0.', '{0}This is a text with a\\nnew-line in it. Selector = 0.|{1}This is a text with a\\nnew-line in it. Selector = 1.|[1,Inf]This is a text with a\\nnew-line in it. Selector > 1.', 0],
|
||||
// with double-quotes and id split accros lines
|
||||
["This is a text with a\nnew-line in it. Selector = 1.", "{0}This is a text with a\nnew-line in it. Selector = 0.|{1}This is a text with a\nnew-line in it. Selector = 1.|[1,Inf]This is a text with a\nnew-line in it. Selector > 1.", 1],
|
||||
// esacape pipe
|
||||
// escape pipe
|
||||
['This is a text with | in it. Selector = 0.', '{0}This is a text with || in it. Selector = 0.|{1}This is a text with || in it. Selector = 1.', 0],
|
||||
// Empty plural set (2 plural forms) from a .PO file
|
||||
['', '|', 1],
|
||||
|
|
|
@ -22,23 +22,14 @@ trait TranslatorTrait
|
|||
* @var string|null
|
||||
*/
|
||||
private $locale;
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setLocale(string $locale)
|
||||
{
|
||||
$this->locale = $locale;
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getLocale() : string
|
||||
{
|
||||
return $this->locale ?: (\class_exists(\Locale::class) ? \Locale::getDefault() : 'en');
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function trans(?string $id, array $parameters = [], string $domain = null, string $locale = null) : string
|
||||
{
|
||||
if (null === $id || '' === $id) {
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
"minimum-stability": "dev",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "3.1-dev"
|
||||
"dev-main": "3.3-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony\/contracts",
|
||||
|
|
2
vendor/symfony/contracts/composer.json
vendored
2
vendor/symfony/contracts/composer.json
vendored
|
@ -63,7 +63,7 @@
|
|||
"minimum-stability": "dev",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "3.1-dev"
|
||||
"dev-main": "3.3-dev"
|
||||
}
|
||||
}
|
||||
}
|
35
vendor/symfony/contracts/phpunit.xml.dist
vendored
35
vendor/symfony/contracts/phpunit.xml.dist
vendored
|
@ -1,35 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/9.3/phpunit.xsd"
|
||||
backupGlobals="false"
|
||||
colors="true"
|
||||
bootstrap="vendor/autoload.php"
|
||||
failOnRisky="true"
|
||||
failOnWarning="true"
|
||||
>
|
||||
<php>
|
||||
<ini name="error_reporting" value="-1" />
|
||||
</php>
|
||||
|
||||
<testsuites>
|
||||
<testsuite name="Symfony Contracts Test Suite">
|
||||
<directory>./Tests/</directory>
|
||||
<directory>./Service/Test/</directory>
|
||||
<directory>./Translation/Test/</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
|
||||
<coverage>
|
||||
<include>
|
||||
<directory>./</directory>
|
||||
</include>
|
||||
<exclude>
|
||||
<directory>./Tests</directory>
|
||||
<directory>./Service/Test/</directory>
|
||||
<directory>./Translation/Test/</directory>
|
||||
<directory>./vendor</directory>
|
||||
</exclude>
|
||||
</coverage>
|
||||
|
||||
</phpunit>
|
Loading…
Reference in New Issue
Block a user