PHPYH Telegram 481
Пых
Ilija Tovilio, на текущий момент один из самых активных контрибьюторов в PHP, только что дал мне карму для публикации RFC и пожелал удачи! Буду считать это хорошим знаком! 💪 https://externals.io/message/122052#122053
📝 new MyClass()->method() без скобок

В конце прошлого года я придумал правку для синтаксиса PHP, которая позволит не оборачивать new выражения в cкобки для обращения к ним:


final class MyClass
{
const CONSTANT = 'constant';
public static $staticProperty = 'staticProperty';
public static function staticMethod(): string { return 'staticMethod'; }
public $property = 'property';
public function method(): string { return 'method'; }
public function __invoke(): string { return '__invoke'; }
}

var_dump(
new MyClass()::CONSTANT, // string(8) "constant"
new MyClass()::$staticProperty, // string(14) "staticProperty"
new MyClass()::staticMethod(), // string(12) "staticMethod"
new MyClass()->property, // string(8) "property"
new MyClass()->method(), // string(6) "method"
new MyClass()(), // string(8) "__invoke"
);


Только что я наконец-то опубликовал RFC через internals! В течение как минимум двух недель будет проходить обсуждение, потом открою голосование.

RFC: https://wiki.php.net/rfc/new_without_parentheses
Реализация и тесты: https://github.com/php/php-src/pull/13029
Можно следить за обсуждением на сайте, а можно подписаться на рассылку и принять в нём участие.



tgoop.com/phpyh/481
Create:
Last Update:

📝 new MyClass()->method() без скобок

В конце прошлого года я придумал правку для синтаксиса PHP, которая позволит не оборачивать new выражения в cкобки для обращения к ним:


final class MyClass
{
const CONSTANT = 'constant';
public static $staticProperty = 'staticProperty';
public static function staticMethod(): string { return 'staticMethod'; }
public $property = 'property';
public function method(): string { return 'method'; }
public function __invoke(): string { return '__invoke'; }
}

var_dump(
new MyClass()::CONSTANT, // string(8) "constant"
new MyClass()::$staticProperty, // string(14) "staticProperty"
new MyClass()::staticMethod(), // string(12) "staticMethod"
new MyClass()->property, // string(8) "property"
new MyClass()->method(), // string(6) "method"
new MyClass()(), // string(8) "__invoke"
);


Только что я наконец-то опубликовал RFC через internals! В течение как минимум двух недель будет проходить обсуждение, потом открою голосование.

RFC: https://wiki.php.net/rfc/new_without_parentheses
Реализация и тесты: https://github.com/php/php-src/pull/13029
Можно следить за обсуждением на сайте, а можно подписаться на рассылку и принять в нём участие.

BY Пых


Share with your friend now:
tgoop.com/phpyh/481

View MORE
Open in Telegram


Telegram News

Date: |

There have been several contributions to the group with members posting voice notes of screaming, yelling, groaning, and wailing in different rhythms and pitches. Calling out the “degenerate” community or the crypto obsessives that engage in high-risk trading, Co-founder of NFT renting protocol Rentable World emiliano.eth shared this group on his Twitter. He wrote: “hey degen, are you stressed? Just let it out all out. Voice only tg channel for screaming”. On June 7, Perekopsky met with Brazilian President Jair Bolsonaro, an avid user of the platform. According to the firm's VP, the main subject of the meeting was "freedom of expression." How to create a business channel on Telegram? (Tutorial) The optimal dimension of the avatar on Telegram is 512px by 512px, and it’s recommended to use PNG format to deliver an unpixelated avatar. The court said the defendant had also incited people to commit public nuisance, with messages calling on them to take part in rallies and demonstrations including at Hong Kong International Airport, to block roads and to paralyse the public transportation system. Various forms of protest promoted on the messaging platform included general strikes, lunchtime protests and silent sit-ins.
from us


Telegram Пых
FROM American