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

PHP version clash? #56

Open
Jelte-ten-Holt opened this issue May 10, 2022 · 4 comments
Open

PHP version clash? #56

Jelte-ten-Holt opened this issue May 10, 2022 · 4 comments

Comments

@Jelte-ten-Holt
Copy link

Jelte-ten-Holt commented May 10, 2022

Hi, I'm trying to integrate your package with my project and I got the following errors in PHP. I was doing so well until then! Thanks for all your hard work. I'm running PHP 8.1.2

PHP Deprecated: Return type of Dymantic\InstagramFeed\InstagramFeed::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/forge/test.cyclotour.ch/vendor/dymantic/laravel-instagram-feed/src/InstagramFeed.php on line 42

PHP Deprecated: Return type of Dymantic\InstagramFeed\InstagramFeed::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/forge/test.cyclotour.ch/vendor/dymantic/laravel-instagram-feed/src/InstagramFeed.php on line 47

PHP Error: Class name must be a valid object or a string in /home/forge/test.cyclotour.ch/vendor/dymantic/laravel-instagram-feed/src/InstagramFeed.php on line 22

@veceraj
Copy link

veceraj commented May 10, 2022

@Jelte-ten-Holt Hi, I've been just now trying to implement this package too and ran into same error. If I understand correctly, this has nothing to do with the version of PHP.

For me, it was caused because the $profile was null and therefore creating new from null threw an error.

I recommend to try and validate that your instagram credentials are correct/up to date with todays api.

if (is_string($profile)) {
    $profile = Profile::for($profile);
}

return new $profile ? $profile->feed($limit) : self::empty();

Anyway, using the Profile::for and then the feed method gives you more options to handle this kind of an error in my opinion, you could also try to implement that.

$profile = Profile::for('profile');

$feed = $profile?->feed();

@Jelte-ten-Holt
Copy link
Author

Hi @veceraj!

Thanks! And sorry for the slow response. I've been sick for the last few days. I'll try that! Cheers.

@michaeljoyner
Copy link
Contributor

Hi @Jelte-ten-Holt have you managed to resolve your issue? If you are still having trouble, let me know and we can see if we can get it resolved.

@veceraj, thanks for helping out, it is appreciated.

@Jelte-ten-Holt
Copy link
Author

Hi @michaeljoyner.

Thanks for taking an interest!

Yes, I did manage to resolve it. Though the PHP error does still show in some situations, it can be avoided with @veceraj 's suggestion. Also, even if the error is there, it does not impede the actual use of your wonderful package.

Cheers!

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

No branches or pull requests

3 participants