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

Compilation error with inheritance of prototype interfaces #1758

Closed
sandrokeil opened this issue Nov 25, 2018 · 3 comments
Closed

Compilation error with inheritance of prototype interfaces #1758

sandrokeil opened this issue Nov 25, 2018 · 3 comments
Assignees
Labels

Comments

@sandrokeil
Copy link

I use Zephir Parser 1.1.4 and Zephir 0.11.6 with Docker image php:7.2-cli-alpine3.8 and I get the following error:

In ClassDefinition.php line 857:
Class ArangoDb\Exception\ConnectionException must implement a method called: "getMessage" as requirement of interface: "Psr\Http\Client\NetworkExceptionInterface"

This error occurs if prototype definitions are used. I have defined the following prototypes:

<?php
namespace Psr\Http\Client;

interface ClientInterface
{
    public function sendRequest(\Psr\Http\Message\RequestInterface $request) : \Psr\Http\Message\ResponseInterface;
}
interface ClientExceptionInterface extends \Throwable
{
}
interface NetworkExceptionInterface extends \Psr\Http\Client\ClientExceptionInterface
{
    public function getRequest() : \Psr\Http\Message\RequestInterface;
}
interface RequestExceptionInterface extends \Psr\Http\Client\ClientExceptionInterface
{
    public function getRequest() : \Psr\Http\Message\RequestInterface;
}

This is my zep file:

namespace ArangoDb\Exception;

use Psr\Http\Client\NetworkExceptionInterface;
use Psr\Http\Message\RequestInterface;

class ConnectionException extends \RuntimeException implements NetworkExceptionInterface
{
    /**
     * @var RequestInterface
     */
    private request;

    public function getRequest() -> <RequestInterface>
    {
        return this->request;
    }
}

If I replace the class definition with class ConnectionException extends \RuntimeException implements \Throwable it works. It looks like it can not validate the inheritance tree correctly.

@sergeyklay sergeyklay self-assigned this Nov 25, 2018
@sergeyklay
Copy link
Member

@sandrokeil Thank you for the report. I'll try to sort out ASAP.

@sergeyklay sergeyklay added the bug label Nov 28, 2018
@sergeyklay
Copy link
Member

@sandrokeil I found a bug. Thinking about a possible solution.

@sergeyklay
Copy link
Member

Fixed in current development branch. Thank you for the report, and for helping us make Zephir better.

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

2 participants