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

Error when using PHP 8 named parameters #90

Open
Chi-teck opened this issue Jan 18, 2021 · 2 comments
Open

Error when using PHP 8 named parameters #90

Chi-teck opened this issue Jan 18, 2021 · 2 comments

Comments

@Chi-teck
Copy link

Code example

function hello(string $name): void {
    echo "Hello $name!";
}

$example = function () {
    hello(name: 'Foo');
};

$wrapper = new SerializableClosure($example);
$result = unserialize(serialize($wrapper));

Result

PHP Parse error:  syntax error, unexpected token ":", expecting ")" in closure://function (): void {
    \hello(\name: 'Foo');
} on line 3
@GrahamCampbell
Copy link
Contributor

GrahamCampbell commented Jan 18, 2021

Opis 3.6.1 does not support all new PHP 8 syntax. It supports all PHP 7.4 syntax on PHP 8.0, but not all new 8.0 syntax on 8.0 (it does support union types, but not named parameters).

@GrahamCampbell
Copy link
Contributor

This repo is open to PRs if you'd like to implement it.

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 a pull request may close this issue.

2 participants