Multiple bugfixes

This commit is contained in:
Daniil Gentili 2019-09-21 16:52:27 +02:00
parent 11a939c403
commit 2356d0b14a
4 changed files with 18 additions and 11 deletions

View File

@ -204,7 +204,7 @@ class AnnotationsBuilder
if ($param->isOptional() && !$param->isVariadic()) {
$doc .= ' = ';
if ($param->isDefaultValueConstant()) {
$doc .= \str_replace(['NULL', 'self'], ['null', 'MTProto'], $param->getDefaultValueConstantName());
$doc .= '\\'.\str_replace(['NULL', 'self'], ['null', 'danog\\MadelineProto\\MTProto'], $param->getDefaultValueConstantName());
} else {
$doc .= \str_replace('NULL', 'null', \var_export($param->getDefaultValue(), true));
}

View File

@ -223,11 +223,17 @@ final class Coroutine implements Promise, \ArrayAccess
return (yield $this)->{$offset};
})());
}
public function __call($name, $arguments)
public function __call(string $name, array $arguments)
{
return Tools::call((function () use ($name, $arguments) {
return (yield $this)->{$name}(...$arguments);
})());
$deferred = new Deferred;
$this->onResolve(static function ($e, $v) use ($deferred, $name, $arguments) {
if ($e) {
return $deferred->fail($e);
}
$deferred->resolve($v->{$name}(...$arguments));
});
return $deferred->promise();
}
/**
* Get stacktrace from when the generator was started.

View File

@ -4018,7 +4018,7 @@ interface folders
class InternalDoc extends APIFactory
{
public function logger($param, $level = danog\MadelineProto\Logger::NOTICE, $file = null, array $extra = [])
public function logger($param, $level = \danog\MadelineProto\Logger::NOTICE, $file = null, array $extra = [])
{
return $this->__call(__FUNCTION__, [$param, $level, $file, $extra]);
}
@ -4048,7 +4048,7 @@ class InternalDoc extends APIFactory
return $this->__call(__FUNCTION__, [$url, $extra]);
}
public function a(callable $a, ?string $b = null, $c = null, $d = 2, $e = MTProto::METHOD_BEFORE_CALLBACK, array $extra = []): ?string
public function a(callable $a, ?string $b = null, $c = null, $d = 2, $e = \danog\MadelineProto\MTProto::METHOD_BEFORE_CALLBACK, array $extra = []): ?string
{
return $this->__call(__FUNCTION__, [$a, $b, $c, $d, $e, $extra]);
}

View File

@ -3,6 +3,7 @@
# Configure
PHP_MAJOR_VERSION=$(php -r 'echo PHP_MAJOR_VERSION;')
PHP_MINOR_VERSION=$(php -r 'echo PHP_MINOR_VERSION;')
REAL_COMMIT=$(git rev-parse "$TRAVIS_COMMIT" 2>/dev/null)
# Clean up
rm -rf phar7 phar5 MadelineProtoPhar
@ -88,6 +89,9 @@ cd ..
find phar5 -type f -exec sed 's/\w* \.\.\./.../' -i {} +
curl -s https://api.telegram.org/bot$BOT_TOKEN/sendDocument -F chat_id=101374607 -F document="@$TRAVIS_PHAR"
# Make sure conversion worked
for f in $(find phar5 -type f -name '*.php'); do php -l $f;done
@ -101,9 +105,6 @@ export TEST_USERNAME=danogentili
export TEST_DESTINATION_GROUPS='["@danogentili"]'
export MTPROTO_SETTINGS='{"logger":{"logger_level":5}}'
curl -s https://api.telegram.org/bot$BOT_TOKEN/sendDocument -F chat_id=101374607 -F document="@$TRAVIS_PHAR"
tests/testing.php <<EOF
m
$API_ID
@ -134,7 +135,7 @@ cp "../madeline$php$branch.phar" .
cp ../phar.php ../mtproxyd .
echo -n $TRAVIS_COMMIT > release$php$branch
[ "$TRAVIS_COMMIT" != "$(git rev-parse "$TRAVIS_COMMIT" 2>/dev/null)" ] && {
[ "$TRAVIS_COMMIT" != "$REAL_COMMIT" ] && {
cp release$php$branch release$php
cp madeline$php$branch.phar madeline$php.phar
}