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

ServiceProviderInterface add return type #50

Closed
wants to merge 1 commit into from

Conversation

fagai
Copy link
Contributor

@fagai fagai commented Jun 3, 2020

I added it because an error will occur if you do not write the return value.

@sergeyklay
Copy link
Member

@fagai Could you please explain a bit more the issue.

@fagai
Copy link
Contributor Author

fagai commented Jun 4, 2020

@sergeyklay

<?php

namespace App\Providers;

use Phalcon\Di\DiInterface;

class RouteServiceProvider implements \Phalcon\Di\ServiceProviderInterface
{
    public function register(DiInterface $di)
    {
          //
    }
}
$di->register(new \App\Providers\RouteServiceProvider);
Fatal error: Declaration of App\Providers\RouteServiceProvider::register(Phalcon\Di\DiInterface $di) must be compatible with Phalcon\Di\ServiceProviderInterface::register(Phalcon\Di\DiInterface $di): void in app/Providers/RouteServiceProvider.php on line 7

If you register the Service Provider as above, you will get an error with no return value.

@sergeyklay
Copy link
Member

@fagai What version of Phalcon do you use?

@fagai
Copy link
Contributor Author

fagai commented Jun 4, 2020

@sergeyklay ver 4.0.5

@ruudboon
Copy link
Member

ruudboon commented Jun 4, 2020

If we merge this pull it will be overwritten on the next stubs generation. I think we need to fix this upstream, we can leave it open to track the issue but don't think it makes sense to merge it.

@fagai
Copy link
Contributor Author

fagai commented Nov 25, 2020

Now it's 4.1, but it didn't solve this problem.
It looks like void aren't taken into account when creating ide-stubs.

@fagai
Copy link
Contributor Author

fagai commented Dec 18, 2020

@ruudboon Since I had void support merged into the library, can I recreate the stub?

@Jeckerson
Copy link
Member

Fixed in v5 versions. Closing.

@Jeckerson Jeckerson closed this Dec 27, 2021
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 this pull request may close these issues.

None yet

4 participants