Earlier quoted context omitted.
Definitely some JS influence plus a little Swift and Java. PHP seems to be evolving faster than it has in years
It's actually becoming a problem keeping pace with PHP major updates
PHP 8.1.0
11–20 of 286 posts
Re: PHP 8.1.0
#12 class User
{
/**
* @Assert\All({
* @Assert\NotNull,
* @Assert\Length(min=5)
* })
*/
public string $name = '';
}
PHP 8.1
class User
{
#[\Assert\All(
new \Assert\NotNull,
new \Assert\Length(min: 6))
]
public string $name = '';
}Re: PHP 8.1.0
#13Fibers "allow blocking and non-blocking implementations to share the same API" That's an interesting contrast to Python where the need to use "value = await fn()" v.s. "value = fn()" depending on whether or not that function is awaitable causes all kinds of API design complexity, all the way up to the existence of tools like https://github.com/python-trio/unasync which can code-generate the non-async version of a lib…
result = fn()
if isawaitable(result):
result = await result
And turns out isawaitable is not that fast so things like GraphQL libraries that run above logic thousands of times per request get noticeably slow.Re: PHP 8.1.0
#14What is this? class User { /** * @Assert\All({ * @Assert\NotNull, * @Assert\Length(min=5) * }) */ public string $name = ''; } PHP 8.1 class User { #[\Assert\All( new \Assert\NotNull, new \Assert\Length(min: 6)) ] public string $name = ''; }
That piece of code is about data validation.
See more at https://www.php.net/manual/en/language.attributes.overview.p...
Re: PHP 8.1.0
#15What is this? class User { /** * @Assert\All({ * @Assert\NotNull, * @Assert\Length(min=5) * }) */ public string $name = ''; } PHP 8.1 class User { #[\Assert\All( new \Assert\NotNull, new \Assert\Length(min: 6)) ] public string $name = ''; }
Very similar to Java annotations.
Re: PHP 8.1.0
#16What is this? class User { /** * @Assert\All({ * @Assert\NotNull, * @Assert\Length(min=5) * }) */ public string $name = ''; } PHP 8.1 class User { #[\Assert\All( new \Assert\NotNull, new \Assert\Length(min: 6)) ] public string $name = ''; }
These are attributes which add metadata that can be programatically acessed by applications and tooling. That piece of code is about data validation. See more at https://www.php.net/manual/en/language.attributes.overview.p...
Re: PHP 8.1.0
#17What is this? class User { /** * @Assert\All({ * @Assert\NotNull, * @Assert\Length(min=5) * }) */ public string $name = ''; } PHP 8.1 class User { #[\Assert\All( new \Assert\NotNull, new \Assert\Length(min: 6)) ] public string $name = ''; }
https://front-line-php.com/cheat-sheet
It’s covered under “Attributes”.
Re: PHP 8.1.0
#18And by things I don't mean just web development.
The current limitations I see in PHP is that there is not an official multi-core coroutines solution.
Re: PHP 8.1.0
#19Re: PHP 8.1.0
#20Everyone laughing at PHP hasn't tried it for years, I'd bet. It started clumsy, true, but it became a solid and quite elegant way of doing things. And by things I don't mean just web development. The current limitations I see in PHP is that there is not an official multi-core coroutines solution.