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()) { if ($param->isOptional() && !$param->isVariadic()) {
$doc .= ' = '; $doc .= ' = ';
if ($param->isDefaultValueConstant()) { if ($param->isDefaultValueConstant()) {
$doc .= \str_replace(['NULL', 'self'], ['null', 'MTProto'], $param->getDefaultValueConstantName()); $doc .= '\\'.\str_replace(['NULL', 'self'], ['null', 'danog\\MadelineProto\\MTProto'], $param->getDefaultValueConstantName());
} else { } else {
$doc .= \str_replace('NULL', 'null', \var_export($param->getDefaultValue(), true)); $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}; return (yield $this)->{$offset};
})()); })());
} }
public function __call($name, $arguments)
public function __call(string $name, array $arguments)
{ {
return Tools::call((function () use ($name, $arguments) { $deferred = new Deferred;
return (yield $this)->{$name}(...$arguments); $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. * Get stacktrace from when the generator was started.

View File

@ -4018,7 +4018,7 @@ interface folders
class InternalDoc extends APIFactory 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]); return $this->__call(__FUNCTION__, [$param, $level, $file, $extra]);
} }
@ -4048,7 +4048,7 @@ class InternalDoc extends APIFactory
return $this->__call(__FUNCTION__, [$url, $extra]); 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]); return $this->__call(__FUNCTION__, [$a, $b, $c, $d, $e, $extra]);
} }

View File

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