Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 21 additions & 15 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,32 @@ jobs:

# See https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#using-environment-variables-in-a-matrix
strategy:
# 8.6 is built from php-src master, so a failure there should not cancel
# the other versions.
fail-fast: false
matrix:
include:
# NOTE: If this is not quoted, the yaml parser will convert 8.0 to the number 8,
# and the docker image `php:8` is the latest minor version of php 8.x (8.1).
- PHP_VERSION: '7.2'
- PHP_VERSION: '7.3'
- PHP_VERSION: '7.4'
- PHP_VERSION: '8.0'
- PHP_VERSION: '8.1'
- PHP_VERSION: '8.2'
- PHP_VERSION: '8.3'
- PHP_VERSION: '8.4'
- PHP_VERSION: '8.5'
# NOTE: Quoted so the yaml parser does not turn e.g. 8.0 into the number 8.
PHP_VERSION: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5', '8.6']

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

# Runs a single command using the runners shell
- name: Build and test in docker
run: bash ci/test_dockerized.sh ${{ matrix.PHP_VERSION }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.PHP_VERSION }}
tools: pecl

- name: Build
run: |
phpize
EXTRA_CFLAGS='-Wall -Wextra -Wno-unused-parameter' ./configure
make -j2

- name: Test
run: NO_INTERACTION=1 REPORT_EXIT_STATUS=1 make test TESTS="--show-diff"

- name: Verify package.xml is valid
run: pecl package
13 changes: 0 additions & 13 deletions ci/Dockerfile

This file was deleted.

16 changes: 0 additions & 16 deletions ci/test_dockerized.sh

This file was deleted.

9 changes: 0 additions & 9 deletions ci/test_inner.sh

This file was deleted.

9 changes: 9 additions & 0 deletions php_ast.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,15 @@ extern ast_str_globals str_globals;
# define ZEND_AST_CLONE 0x1fc
#endif

#if PHP_VERSION_ID >= 80600
/* ZEND_AST_METHOD_REFERENCE was renamed to ZEND_AST_TRAIT_METHOD_REFERENCE. */
# define ZEND_AST_METHOD_REFERENCE ZEND_AST_TRAIT_METHOD_REFERENCE
/* The _throw() ZPP variants were removed; plain ZPP now always throws.
* ZEND_PARSE_PARAMS_THROW is gone, so a flag of 0 yields the throwing default. */
# define ZEND_PARSE_PARAMS_THROW 0
# define zend_parse_parameters_throw zend_parse_parameters
#endif

/* Pretend it still exists */
# define ZEND_AST_LIST ((1 << (ZEND_AST_IS_LIST_SHIFT + 1)) - 1)

Expand Down
105 changes: 105 additions & 0 deletions tests/php86_param_doc_comments.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
--TEST--
Doc comments on function/method parameters (PHP 8.6+)
--SKIPIF--
<?php if (PHP_VERSION_ID < 80600) die('skip PHP >=8.6 only'); ?>
--FILE--
<?php

require __DIR__ . '/../util.php';

$code = <<<'PHP'
<?php
function f(
/** doc for $a */
int $a,
$b,
/** doc for $c */
string $c = "x",
) {}

class C {
public string $p {
set(
/** doc for $value */
string $value
) { $this->p = $value; }
}
}
PHP;

echo ast_dump(ast\parse_code($code, $version=120)), "\n";
--EXPECT--
AST_STMT_LIST
0: AST_FUNC_DECL
name: "f"
docComment: null
params: AST_PARAM_LIST
0: AST_PARAM
type: AST_TYPE
flags: TYPE_LONG (4)
name: "a"
default: null
attributes: null
docComment: "/** doc for $a */"
hooks: null
1: AST_PARAM
type: null
name: "b"
default: null
attributes: null
docComment: null
hooks: null
2: AST_PARAM
type: AST_TYPE
flags: TYPE_STRING (6)
name: "c"
default: "x"
attributes: null
docComment: "/** doc for $c */"
hooks: null
stmts: AST_STMT_LIST
returnType: null
attributes: null
__declId: 0
1: AST_CLASS
name: "C"
docComment: null
extends: null
implements: null
stmts: AST_STMT_LIST
0: AST_PROP_GROUP
flags: MODIFIER_PUBLIC (1)
type: AST_TYPE
flags: TYPE_STRING (6)
props: AST_PROP_DECL
0: AST_PROP_ELEM
name: "p"
default: null
docComment: null
hooks: AST_STMT_LIST
0: AST_PROPERTY_HOOK
name: "set"
docComment: null
params: AST_PARAM_LIST
0: AST_PARAM
type: AST_TYPE
flags: TYPE_STRING (6)
name: "value"
default: null
attributes: null
docComment: "/** doc for $value */"
hooks: null
stmts: AST_STMT_LIST
0: AST_ASSIGN
var: AST_PROP
expr: AST_VAR
name: "this"
prop: "p"
expr: AST_VAR
name: "value"
attributes: null
__declId: 1
attributes: null
attributes: null
type: null
__declId: 2
Loading