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

'void' return type hint is ignored #1908

Closed
JellyBrick opened this issue Aug 23, 2019 · 2 comments
Closed

'void' return type hint is ignored #1908

JellyBrick opened this issue Aug 23, 2019 · 2 comments

Comments

@JellyBrick
Copy link
Contributor

Log

Fatal error: Declaration of Pocketmine\Utils\BinaryStream::setOffset(int $offset) must be compatible with pocketmine\network\mcpe\protocol\Packet::setOffset(int $offset): void in /develop/pocketmine/src/network/mcpe/protocol/DataPacket.php on line 38

Code

interface Packet{
        public function setOffset(int $offset) : void
        //...
}

Packet.php

abstract class DataPacket extends BinaryStream implements Packet{
     //....
}

DataPacket.php

    public function setOffset(int offset) -> void
    {
        let this->offset = offset;
    }

binarystream.zep

However, the generated code has no type hints.
(Stubs included)

    /**
     * @param int $offset
     */
    public function setOffset(int $offset) {}

binarystream.zep stub

@Jurigag
Copy link
Contributor

Jurigag commented Aug 23, 2019

I'm guessing stubs generations wasn't made when 7.1 was released, that's why we ignore void. I guess someone would need to update it and add check for php 7.1

@JellyBrick JellyBrick changed the title 'void' return type hint is ignored. 'void' return type hint is ignored Aug 23, 2019
JellyBrick added a commit to organization/RapidPM that referenced this issue Aug 24, 2019
JellyBrick added a commit to organization/RapidPM that referenced this issue Aug 25, 2019
JellyBrick added a commit to organization/zephir that referenced this issue Aug 25, 2019
@JellyBrick JellyBrick mentioned this issue Aug 25, 2019
3 tasks
@JellyBrick
Copy link
Contributor Author

@Jurigag #1910

dreamsxin pushed a commit to dreamsxin/zephir that referenced this issue Nov 6, 2019
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