$this can not be used in static methods error after updating to kirby 3.3.0

Hey everyone,
Im relative new to Kirby and im a bit lost. After updating Kirby 3.1.0 to the latest Kirby (3.3.0) via composer, I got the error in my Browser, that i should use page->listed() instead of page->visible() in one of my templates. After changing that, my side together with the panel works just fine.

But now my VSCode is showing some problems inside the Kirby folder.

$this can not be used in static methods.

I downloaded the latest Kirby version and swapped the Kirby folder to update and also tried updating via composer. The error is still there.

Here is the code part i changed, but Im not sure if this has something to do with the appearing error.

 <?php $articles = $pages->find('journal')->children()->listed()->flip()->paginate(2) ?>
        <?php foreach($articles as $article): ?>


        <a id="articleanchor" href=" <?= $article->url() ?>">

            <article class="article">

                <h2 class="jorunal-article-title"><?= $article->title()->html() ?></h2>
                <div class="journal-article-alliteration"><?= $article->alliteration()->kt() ?></div>

                <figure class="cover">
                    <?php if ($cover = $article->cover()->toFile()): ?>
                    <img src="<?= $cover->url() ?>" alt="<?= $cover->alt() ?>">
                </figure>
                <?php endif ?>

                <div class="journal-article-intro"><?= $article->intro()->cover()->kt() ?></div>

            </article>
        </a>

        <?php endforeach ?>

Thanks for your help.

1 Like

They are called from callback methods.
This is normal, but I don’t know if it can be supressed.
@lukasbestle can help.

1 Like

Which VSCode plugin is this from?

Sorry, I totally forgot the plugins i had installed. I deactivated the PHP IntelliSense Plugin v2.3.13 and now everything looks fine. I think I do not have to worry then? Thanks for your help.

1 Like

Yes, there is no need to worry. Some static analysis tools like PHPStan and apparently IntelliSense flag that code as a false-positive because they don’t know about the PHP feature “bound closures”. Everything is fine though. :slight_smile:

1 Like