-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
Signed-off-by: merlinwoff <merlin.woff@gmail.com>
- Loading branch information
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* @copyright Copyright (c) 2023 Your name <your@email.com> | ||
* | ||
* @author Your name <your@email.com> | ||
* | ||
* @license GNU AGPL version 3 or any later version | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as | ||
* published by the Free Software Foundation, either version 3 of the | ||
* License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
namespace OC\Core\Migrations; | ||
|
||
use Closure; | ||
use OCP\DB\ISchemaWrapper; | ||
use OCP\Migration\IOutput; | ||
use OCP\Migration\SimpleMigrationStep; | ||
|
||
class Version26000Date20230220105540 extends SimpleMigrationStep { | ||
|
||
/** | ||
* @param IOutput $output | ||
* @param Closure $schemaClosure | ||
* @psalm-param Closure(): ISchemaWrapper $schemaClosure | ||
* @param array $options | ||
*/ | ||
public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options) { | ||
} | ||
|
||
/** | ||
* @param IOutput $output | ||
* @param Closure $schemaClosure | ||
* @psalm-param Closure(): ISchemaWrapper $schemaClosure | ||
* @param array $options | ||
* @return null|ISchemaWrapper | ||
*/ | ||
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { | ||
return null; | ||
} | ||
|
||
/** | ||
* @param IOutput $output | ||
* @param Closure $schemaClosure | ||
* @psalm-param Closure(): ISchemaWrapper $schemaClosure | ||
* @param array $options | ||
*/ | ||
public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void { | ||
} | ||
} |
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<?php | ||
|
||
phpinfo(); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
|
||
The MIT License (MIT) | ||
|
||
Copyright (c) 2015-2019 amphp | ||
Copyright (c) 2016 PHP Asynchronous Interoperability Group | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
{ | ||
"name": "amphp/amp", | ||
"homepage": "http://amphp.org/amp", | ||
"description": "A non-blocking concurrency framework for PHP applications.", | ||
"keywords": [ | ||
"async", | ||
"asynchronous", | ||
"concurrency", | ||
"promise", | ||
"awaitable", | ||
"future", | ||
"non-blocking", | ||
"event", | ||
"event-loop" | ||
], | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Daniel Lowrey", | ||
"email": "rdlowrey@php.net" | ||
}, | ||
{ | ||
"name": "Aaron Piotrowski", | ||
"email": "aaron@trowski.com" | ||
}, | ||
{ | ||
"name": "Bob Weinand", | ||
"email": "bobwei9@hotmail.com" | ||
}, | ||
{ | ||
"name": "Niklas Keller", | ||
"email": "me@kelunik.com" | ||
} | ||
], | ||
"require": { | ||
"php": ">=7" | ||
}, | ||
"require-dev": { | ||
"ext-json": "*", | ||
"amphp/phpunit-util": "^1", | ||
"amphp/php-cs-fixer-config": "dev-master", | ||
"react/promise": "^2", | ||
"phpunit/phpunit": "^6.0.9 | ^7", | ||
"psalm/phar": "^3.11@dev", | ||
"jetbrains/phpstorm-stubs": "^2019.3" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Amp\\": "lib" | ||
}, | ||
"files": [ | ||
"lib/functions.php", | ||
"lib/Internal/functions.php" | ||
] | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"Amp\\Test\\": "test" | ||
} | ||
}, | ||
"support": { | ||
"issues": "https://github.com/amphp/amp/issues", | ||
"irc": "irc://irc.freenode.org/amphp" | ||
}, | ||
"extra": { | ||
"branch-alias": { | ||
"dev-master": "2.x-dev" | ||
} | ||
}, | ||
"scripts": { | ||
"test": "@php -dzend.assertions=1 -dassert.exception=1 ./vendor/bin/phpunit", | ||
"code-style": "@php ./vendor/bin/php-cs-fixer fix" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
<?php | ||
|
||
namespace Amp; | ||
|
||
// @codeCoverageIgnoreStart | ||
if (\PHP_VERSION_ID < 70100) { | ||
/** @psalm-suppress DuplicateClass */ | ||
trait CallableMaker | ||
{ | ||
/** @var \ReflectionClass */ | ||
private static $__reflectionClass; | ||
|
||
/** @var \ReflectionMethod[] */ | ||
private static $__reflectionMethods = []; | ||
|
||
/** | ||
* Creates a callable from a protected or private instance method that may be invoked by callers requiring a | ||
* publicly invokable callback. | ||
* | ||
* @param string $method Instance method name. | ||
* | ||
* @return callable | ||
* | ||
* @psalm-suppress MixedInferredReturnType | ||
*/ | ||
private function callableFromInstanceMethod(string $method): callable | ||
{ | ||
if (!isset(self::$__reflectionMethods[$method])) { | ||
if (self::$__reflectionClass === null) { | ||
self::$__reflectionClass = new \ReflectionClass(self::class); | ||
} | ||
self::$__reflectionMethods[$method] = self::$__reflectionClass->getMethod($method); | ||
} | ||
|
||
return self::$__reflectionMethods[$method]->getClosure($this); | ||
} | ||
|
||
/** | ||
* Creates a callable from a protected or private static method that may be invoked by methods requiring a | ||
* publicly invokable callback. | ||
* | ||
* @param string $method Static method name. | ||
* | ||
* @return callable | ||
* | ||
* @psalm-suppress MixedInferredReturnType | ||
*/ | ||
private static function callableFromStaticMethod(string $method): callable | ||
{ | ||
if (!isset(self::$__reflectionMethods[$method])) { | ||
if (self::$__reflectionClass === null) { | ||
self::$__reflectionClass = new \ReflectionClass(self::class); | ||
} | ||
self::$__reflectionMethods[$method] = self::$__reflectionClass->getMethod($method); | ||
} | ||
|
||
return self::$__reflectionMethods[$method]->getClosure(); | ||
} | ||
} | ||
} else { | ||
/** @psalm-suppress DuplicateClass */ | ||
trait CallableMaker | ||
{ | ||
/** | ||
* @deprecated Use \Closure::fromCallable() instead of this method in PHP 7.1. | ||
*/ | ||
private function callableFromInstanceMethod(string $method): callable | ||
{ | ||
return \Closure::fromCallable([$this, $method]); | ||
} | ||
|
||
/** | ||
* @deprecated Use \Closure::fromCallable() instead of this method in PHP 7.1. | ||
*/ | ||
private static function callableFromStaticMethod(string $method): callable | ||
{ | ||
return \Closure::fromCallable([self::class, $method]); | ||
} | ||
} | ||
} // @codeCoverageIgnoreEnd |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
|
||
namespace Amp; | ||
|
||
/** | ||
* Cancellation tokens are simple objects that allow registering handlers to subscribe to cancellation requests. | ||
*/ | ||
interface CancellationToken | ||
{ | ||
/** | ||
* Subscribes a new handler to be invoked on a cancellation request. | ||
* | ||
* This handler might be invoked immediately in case the token has already been cancelled. Returned generators will | ||
* automatically be run as coroutines. Any unhandled exceptions will be throw into the event loop. | ||
* | ||
* @param callable(CancelledException) $callback Callback to be invoked on a cancellation request. Will receive a | ||
* `CancelledException` as first argument that may be used to fail the operation's promise. | ||
* | ||
* @return string Identifier that can be used to cancel the subscription. | ||
*/ | ||
public function subscribe(callable $callback): string; | ||
|
||
/** | ||
* Unsubscribes a previously registered handler. | ||
* | ||
* The handler will no longer be called as long as this method isn't invoked from a subscribed callback. | ||
* | ||
* @param string $id | ||
* | ||
* @return void | ||
*/ | ||
public function unsubscribe(string $id); | ||
|
||
/** | ||
* Returns whether cancellation has been requested yet. | ||
* | ||
* @return bool | ||
*/ | ||
public function isRequested(): bool; | ||
|
||
/** | ||
* Throws the `CancelledException` if cancellation has been requested, otherwise does nothing. | ||
* | ||
* @return void | ||
* | ||
* @throws CancelledException | ||
*/ | ||
public function throwIfRequested(); | ||
} |