Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate separete wrappers for multiple PHP versions #503

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft

Conversation

shish
Copy link
Collaborator

@shish shish commented Dec 5, 2024

tl;dr:

  1. replace
$function_list = read_docs();
generate_files($function_list, "../generated/");

with

foreach(["8.1", "8.2", "8.3", "8.4"] as $version) {
    exec("cd docs && git checkout $version");
    $function_list = read_docs();
    generate_files($function_list, "../generated/$version/");
}
  1. generate a bunch of stubs like generated/misc.php:
<?php
if(PHP_VERSION == "8.1") require_once __DIR__ . "/8.1/misc.php";
if(PHP_VERSION == "8.2") require_once __DIR__ . "/8.2/misc.php";
if(PHP_VERSION == "8.3") require_once __DIR__ . "/8.3/misc.php";
if(PHP_VERSION == "8.4") require_once __DIR__ . "/8.4/misc.php";

Currently the Exceptions are shared between all versions, which I think is a good idea?

This isn't even remotely tested, just a proof of concept to show what this kind of approach might look like

@shish shish changed the title regenerate Generate separete wrappers for multiple PHP versions Dec 5, 2024
@shish shish marked this pull request as draft December 5, 2024 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant