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
Fix PostIterator, if post is null #2918
Conversation
Thank you @rubas for this PR. We still support PHP 7.4 so |
The support for union type was only introduced in PHP 8.0. |
The failed coding standard test is outside of this PR. I'm happy to push a fix... 1) tests/test-timber-cache.php
---------- begin diff ----------
@@ -329,7 +329,7 @@
$clear = $loader->clear_cache_timber(Timber\Loader::CACHE_OBJECT);
$this->assertTrue($clear);
$works = true;
-
+
if (isset($wp_object_cache->cache[Timber\Loader::CACHEGROUP])
&& !empty($wp_object_cache->cache[Timber\Loader::CACHEGROUP])) {
$works = false;
----------- end diff -----------
Applied checkers:
* PhpCsFixer\Fixer\Whitespace\NoWhitespaceInBlankLineFixer |
for coding standards, you just need to run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @rubas. This is almost good for me.
Can you add the nullable type to $last_post
and a test case for this?
Co-authored-by: Nicolas Lemoine <nico.lemoine@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is all good, thanks @rubas!
Related: #2917
Issue
$post
can benull
, which breaks the code.