Home > PHP Framework > Laravel > Laravel 10 is coming with new features?

Laravel 10 is coming with new features?

藏色散人
Release: 2022-12-01 16:06:16
forward
2092 people have browsed it

Laravel 10 is coming? When will Laravel 10 be released?

According to the Support Policy document, Laravel 10 will be released on February 7, 2023.

This is a tall order considering the size of the Laravel ecosystem, and Laravel prioritizes backwards compatibility. [Recommended: laravel video tutorial]

Laravel 10 will use native PHP type declarations in any generated code that exists in user space:

Adding types brings the latest PHP type hinting capabilities to Laravel projects without breaking backward compatibility at the framework level:

  • Return types

  • Method arguments

  • Remove redundant comments where possible

  • ##Allow user land types in closure arguments

  • Do not include type attributes

For example, if the return type of a skeleton method is "array", there may be annotations to use it when it cannot be implemented through the native type. When providing clear types:

/**
 * Get the host patterns that should be trusted.
 *
 * @return array<int, string>
 */
public function hosts(): array
{
    return [
        &#39;laravel.test&#39;,
    ];
}
Copy after login

In the above example, the IDE will know the shape of the array, which is information that is not possible in PHP's native type design.

In addition, all code generated by the framework will follow the same type hinting guidelines mentioned above, which means that when you create files using the "make" command, they will include native type hints in the same way as above.

The above is the detailed content of Laravel 10 is coming with new features?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:learnku.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template