Telegram Group & Telegram Channel
Пакет 👩‍💻 phplrt/phplrt несомненно хорош! Спасибо @SerafimArts за крутой инструмент!

Что бы вы сделали, будь у вас AST для proto message? Я бы, например, только в нем схемы и описывал 😁

final class MessageDefNodeTest extends TestCase
{
public function testParse(): void
{
$node = $this->parser->parse(
<<<'PROTO'
syntax = "proto3";

package example;

message Person {
string name = 1;
int32 id = 2;
string email = 3;
}
PROTO,
);

$this->assertSame('proto3', $node->syntax->syntax);
$this->assertSame('example', $node->package->name);

$message = $node->topLevelDefs[0];

$this->assertSame('Person', $message->name);
$this->assertCount(3, $message->fields);

$this->assertSame('name', $message->fields[0]->name);
$this->assertSame('string', $message->fields[0]->type);
$this->assertSame(1, $message->fields[0]->number);

$this->assertSame('id', $message->fields[1]->name);
$this->assertSame('int32', $message->fields[1]->type);
$this->assertSame(2, $message->fields[1]->number);

$this->assertSame('email', $message->fields[2]->name);
$this->assertSame('string', $message->fields[2]->type);
$this->assertSame(3, $message->fields[2]->number);
}
}
Please open Telegram to view this post
VIEW IN TELEGRAM
10🔥3🤔21



tg-me.com/php_fart/99
Create:
Last Update:

Пакет 👩‍💻 phplrt/phplrt несомненно хорош! Спасибо @SerafimArts за крутой инструмент!

Что бы вы сделали, будь у вас AST для proto message? Я бы, например, только в нем схемы и описывал 😁

final class MessageDefNodeTest extends TestCase
{
public function testParse(): void
{
$node = $this->parser->parse(
<<<'PROTO'
syntax = "proto3";

package example;

message Person {
string name = 1;
int32 id = 2;
string email = 3;
}
PROTO,
);

$this->assertSame('proto3', $node->syntax->syntax);
$this->assertSame('example', $node->package->name);

$message = $node->topLevelDefs[0];

$this->assertSame('Person', $message->name);
$this->assertCount(3, $message->fields);

$this->assertSame('name', $message->fields[0]->name);
$this->assertSame('string', $message->fields[0]->type);
$this->assertSame(1, $message->fields[0]->number);

$this->assertSame('id', $message->fields[1]->name);
$this->assertSame('int32', $message->fields[1]->type);
$this->assertSame(2, $message->fields[1]->number);

$this->assertSame('email', $message->fields[2]->name);
$this->assertSame('string', $message->fields[2]->type);
$this->assertSame(3, $message->fields[2]->number);
}
}

BY PHP Fart Time




Share with your friend now:
tg-me.com/php_fart/99

View MORE
Open in Telegram


telegram Telegram | DID YOU KNOW?

Date: |

Telegram Gives Up On Crypto Blockchain Project

Durov said on his Telegram channel today that the two and a half year blockchain and crypto project has been put to sleep. Ironically, after leaving Russia because the government wanted his encryption keys to his social media firm, Durov’s cryptocurrency idea lost steam because of a U.S. court. “The technology we created allowed for an open, free, decentralized exchange of value and ideas. TON had the potential to revolutionize how people store and transfer funds and information,” he wrote on his channel. “Unfortunately, a U.S. court stopped TON from happening.”

Mr. Durov launched Telegram in late 2013 with his brother, Nikolai, just months before he was pushed out of VK, the Russian social-media platform he founded. Mr. Durov pitched his new app—funded with the proceeds from the VK sale—less as a business than as a way for people to send messages while avoiding government surveillance and censorship.

telegram from us


Telegram PHP Fart Time
FROM USA