Skip to content

Latest commit

 

History

History
32 lines (23 loc) · 1.38 KB

how-transpiling-works.md

File metadata and controls

32 lines (23 loc) · 1.38 KB

How transpiling works

Transpiling converts code from PHP 8.0 to 7.1. Then,

  • The project uses PHP 8.0 for development
  • The code is converted to PHP 7.1 when generating the plugins for production

For instance, PHP 8.0's union types, are converted from this code in development:

interface CustomPostTypeAPIInterface
{
  public function createCustomPost(array $data): string | int | null | Error;
}

into this code for production:

interface CustomPostTypeAPIInterface
{
  public function createCustomPost(array $data)
}

Transpiling PHP code enables to use the latest PHP features for development, yet release the plugin with its code converted to an older PHP version for production, as to target a bigger user base.

Additional resources