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

Preparation for PHP8.4 #2426

Open
noone-silent opened this issue May 2, 2024 · 0 comments
Open

Preparation for PHP8.4 #2426

noone-silent opened this issue May 2, 2024 · 0 comments
Assignees

Comments

@noone-silent
Copy link

Currently if we have a signature like this:

    public static function query(<DiInterface> container = null) -> <CriteriaInterface>

The stubs will generate a signature like this:

    /**
     * @param \Phalcon\Di\DiInterface $container
     * @return CriteriaInterface
     */
    public static function query(\Phalcon\Di\DiInterface $container = null): CriteriaInterface

First of, this is wrong, because null is missing as a allowed parameter. Second, it will raise deprecation warnings with PHP8.4. The produced code should be:

    /**
     * @param \Phalcon\Di\DiInterface|null $container
     * @return CriteriaInterface
     */
    public static function query(?\Phalcon\Di\DiInterface $container = null): CriteriaInterface

or

    /**
     * @param \Phalcon\Di\DiInterface|null $container
     * @return CriteriaInterface
     */
    public static function query(\Phalcon\Di\DiInterface | null $container = null): CriteriaInterface

This can already be included, because | null is allowed since PHP8.0.

I know they're only stubs, but event the stubs should be correct. Also probably check the generated C code, maybe the problem exists there too.

@Jeckerson Jeckerson transferred this issue from zephir-lang/php-zephir-parser May 2, 2024
@Jeckerson Jeckerson self-assigned this May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants