Skip to content

Commit f183e46

Browse files
committed
chore: make updater.phar
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
1 parent 4b1318e commit f183e46

6 files changed

Lines changed: 116 additions & 6 deletions

File tree

updater.phar

4.63 KB
Binary file not shown.

vendor/composer/autoload_classmap.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,9 @@
156156
'Symfony\\Contracts\\Service\\Attribute\\Required' => $vendorDir . '/symfony/service-contracts/Attribute/Required.php',
157157
'Symfony\\Contracts\\Service\\Attribute\\SubscribedService' => $vendorDir . '/symfony/service-contracts/Attribute/SubscribedService.php',
158158
'Symfony\\Contracts\\Service\\ResetInterface' => $vendorDir . '/symfony/service-contracts/ResetInterface.php',
159+
'Symfony\\Contracts\\Service\\ServiceCollectionInterface' => $vendorDir . '/symfony/service-contracts/ServiceCollectionInterface.php',
159160
'Symfony\\Contracts\\Service\\ServiceLocatorTrait' => $vendorDir . '/symfony/service-contracts/ServiceLocatorTrait.php',
161+
'Symfony\\Contracts\\Service\\ServiceMethodsSubscriberTrait' => $vendorDir . '/symfony/service-contracts/ServiceMethodsSubscriberTrait.php',
160162
'Symfony\\Contracts\\Service\\ServiceProviderInterface' => $vendorDir . '/symfony/service-contracts/ServiceProviderInterface.php',
161163
'Symfony\\Contracts\\Service\\ServiceSubscriberInterface' => $vendorDir . '/symfony/service-contracts/ServiceSubscriberInterface.php',
162164
'Symfony\\Contracts\\Service\\ServiceSubscriberTrait' => $vendorDir . '/symfony/service-contracts/ServiceSubscriberTrait.php',

vendor/composer/autoload_static.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,9 @@ class ComposerStaticInit936ba63ded5d1b8248cdb4d5673af0ea
246246
'Symfony\\Contracts\\Service\\Attribute\\Required' => __DIR__ . '/..' . '/symfony/service-contracts/Attribute/Required.php',
247247
'Symfony\\Contracts\\Service\\Attribute\\SubscribedService' => __DIR__ . '/..' . '/symfony/service-contracts/Attribute/SubscribedService.php',
248248
'Symfony\\Contracts\\Service\\ResetInterface' => __DIR__ . '/..' . '/symfony/service-contracts/ResetInterface.php',
249+
'Symfony\\Contracts\\Service\\ServiceCollectionInterface' => __DIR__ . '/..' . '/symfony/service-contracts/ServiceCollectionInterface.php',
249250
'Symfony\\Contracts\\Service\\ServiceLocatorTrait' => __DIR__ . '/..' . '/symfony/service-contracts/ServiceLocatorTrait.php',
251+
'Symfony\\Contracts\\Service\\ServiceMethodsSubscriberTrait' => __DIR__ . '/..' . '/symfony/service-contracts/ServiceMethodsSubscriberTrait.php',
250252
'Symfony\\Contracts\\Service\\ServiceProviderInterface' => __DIR__ . '/..' . '/symfony/service-contracts/ServiceProviderInterface.php',
251253
'Symfony\\Contracts\\Service\\ServiceSubscriberInterface' => __DIR__ . '/..' . '/symfony/service-contracts/ServiceSubscriberInterface.php',
252254
'Symfony\\Contracts\\Service\\ServiceSubscriberTrait' => __DIR__ . '/..' . '/symfony/service-contracts/ServiceSubscriberTrait.php',

vendor/composer/installed.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
<?php return array(
22
'root' => array(
33
'name' => '__root__',
4-
'pretty_version' => '1.0.0+no-version-set',
5-
'version' => '1.0.0.0',
6-
'reference' => null,
4+
'pretty_version' => 'dev-master',
5+
'version' => 'dev-master',
6+
'reference' => 'e61eef380007181745af0732f1e2e29fb9c0ebb5',
77
'type' => 'library',
88
'install_path' => __DIR__ . '/../../',
99
'aliases' => array(),
1010
'dev' => true,
1111
),
1212
'versions' => array(
1313
'__root__' => array(
14-
'pretty_version' => '1.0.0+no-version-set',
15-
'version' => '1.0.0.0',
16-
'reference' => null,
14+
'pretty_version' => 'dev-master',
15+
'version' => 'dev-master',
16+
'reference' => 'e61eef380007181745af0732f1e2e29fb9c0ebb5',
1717
'type' => 'library',
1818
'install_path' => __DIR__ . '/../../',
1919
'aliases' => array(),
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Contracts\Service;
13+
14+
/**
15+
* A ServiceProviderInterface that is also countable and iterable.
16+
*
17+
* @author Kevin Bond <kevinbond@gmail.com>
18+
*
19+
* @template-covariant T of mixed
20+
*
21+
* @extends ServiceProviderInterface<T>
22+
* @extends \IteratorAggregate<string, T>
23+
*/
24+
interface ServiceCollectionInterface extends ServiceProviderInterface, \Countable, \IteratorAggregate
25+
{
26+
}
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Contracts\Service;
13+
14+
use Psr\Container\ContainerInterface;
15+
use Symfony\Contracts\Service\Attribute\Required;
16+
use Symfony\Contracts\Service\Attribute\SubscribedService;
17+
18+
/**
19+
* Implementation of ServiceSubscriberInterface that determines subscribed services
20+
* from methods that have the #[SubscribedService] attribute.
21+
*
22+
* Service ids are available as "ClassName::methodName" so that the implementation
23+
* of subscriber methods can be just `return $this->container->get(__METHOD__);`.
24+
*
25+
* @author Kevin Bond <kevinbond@gmail.com>
26+
*/
27+
trait ServiceMethodsSubscriberTrait
28+
{
29+
protected ContainerInterface $container;
30+
31+
public static function getSubscribedServices(): array
32+
{
33+
$services = method_exists(get_parent_class(self::class) ?: '', __FUNCTION__) ? parent::getSubscribedServices() : [];
34+
35+
foreach ((new \ReflectionClass(self::class))->getMethods() as $method) {
36+
if (self::class !== $method->getDeclaringClass()->name) {
37+
continue;
38+
}
39+
40+
if (!$attribute = $method->getAttributes(SubscribedService::class)[0] ?? null) {
41+
continue;
42+
}
43+
44+
if ($method->isStatic() || $method->isAbstract() || $method->isGenerator() || $method->isInternal() || $method->getNumberOfRequiredParameters()) {
45+
throw new \LogicException(sprintf('Cannot use "%s" on method "%s::%s()" (can only be used on non-static, non-abstract methods with no parameters).', SubscribedService::class, self::class, $method->name));
46+
}
47+
48+
if (!$returnType = $method->getReturnType()) {
49+
throw new \LogicException(sprintf('Cannot use "%s" on methods without a return type in "%s::%s()".', SubscribedService::class, $method->name, self::class));
50+
}
51+
52+
/* @var SubscribedService $attribute */
53+
$attribute = $attribute->newInstance();
54+
$attribute->key ??= self::class.'::'.$method->name;
55+
$attribute->type ??= $returnType instanceof \ReflectionNamedType ? $returnType->getName() : (string) $returnType;
56+
$attribute->nullable = $returnType->allowsNull();
57+
58+
if ($attribute->attributes) {
59+
$services[] = $attribute;
60+
} else {
61+
$services[$attribute->key] = ($attribute->nullable ? '?' : '').$attribute->type;
62+
}
63+
}
64+
65+
return $services;
66+
}
67+
68+
#[Required]
69+
public function setContainer(ContainerInterface $container): ?ContainerInterface
70+
{
71+
$ret = null;
72+
if (method_exists(get_parent_class(self::class) ?: '', __FUNCTION__)) {
73+
$ret = parent::setContainer($container);
74+
}
75+
76+
$this->container = $container;
77+
78+
return $ret;
79+
}
80+
}

0 commit comments

Comments
 (0)