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

Array of object as return type is reported to php as type, not array #1779

Closed
onshorechet opened this issue Dec 11, 2018 · 3 comments
Closed
Assignees
Labels

Comments

@onshorechet
Copy link

Returning an array of type in zephir is reported as just the type to php. Because of this is it impossible to correctly implement override methods in php. Below is the minimal example. You can also note the use of this in the cphalcon project in, https://github.com/phalcon/cphalcon/blob/master/phalcon/mvc/model.zep::1653.

Zephir-Lang

namespace Issue;
class Test
{
    public static function say() -> <Test[]>
    {
        return [];
    }
}

Php Class:

class PhpTest extends \Issue\Test
{
    //PHP Fatal error:  Declaration of PhpTest::say(): array must be compatible with Issue\Test::say(): Issue\Test in php shell code on line 8
    public static function say(): array
    {
        return [];
    }
}

Centos7 with Zephir@0.11.8 and Zephir-Parser@v1.1.4

@sergeyklay sergeyklay added the bug label Dec 11, 2018
@sergeyklay sergeyklay self-assigned this Dec 12, 2018
@sergeyklay
Copy link
Contributor

@chet0xhenry I found a bug. Working on possible solution

@sergeyklay
Copy link
Contributor

Fixed in the development branch. I'll release new version ASAP. Feel free to open a new issue if the problem appears again. And thank you for contributing.

sergeyklay added a commit that referenced this issue Feb 23, 2019
@dreamsxin
Copy link
Contributor

Fixed in the development branch. Feel free to open a new issue if the problem appears again. And thank you for contributing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants