Skip to content

Fix dynamic property deprecation in BlocksDatasource - #75

Merged
LukeTowers merged 1 commit into
mainfrom
fix/blocks-datasource-processor
Nov 11, 2026
Merged

LukeTowers merged 1 commit into
mainfrom
fix/blocks-datasource-processor

Conversation

@LukeTowers

@LukeTowers LukeTowers commented Nov 8, 2026 •

Copy link
Copy Markdown
Member

Summary

BlocksDatasource::__construct() assigns $this->processor. Winter\Storm\Halcyon\Datasource\Datasource doesn't declare that property, so on PHP 8.2+ every request logs Creation of dynamic property Winter\Blocks\Classes\BlocksDatasource::$processor is deprecated (twice per request on a real site, because the datasource is created once per theme registration).

The parent class declares protected Processor $postProcessor on storm develop and wip/1.3, so this PR assigns $postProcessor instead. That also makes getPostProcessor() return the BlockProcessor. Before, calling it would have thrown an uninitialised typed-property error. Nothing in the plugin calls it today: AutoDatasource uses its own processor, and Block::newQuery() creates its own BlockProcessor. So nothing that works now behaves differently.

This is the companion to wintercms/winter#1595, which fixes the core deprecations from the same logs.

Testing

  • New BlocksDatasourceTest checks that creating the datasource raises no deprecations and that getPostProcessor() returns a BlockProcessor. It fails without this PR and passes with it.
  • Ran the plugin suite against Winter develop. BlockManagerTest::testCanRegisterBlocksDirectly fails both with and without this PR, because in my setup the plugin is symlinked and the test compares real paths with symlinked ones.
  • On a production wip/1.3 site, this was the only deprecation left on every page after the core PR.

🤖 Generated with Claude Code

https://claude.ai/code/session_01GMxdgnfSMHKFs7MZiNzC9R

Summary by CodeRabbit

  • Bug Fixes
    • Corrected block processing configuration to prevent deprecation notices during datasource construction.
    • Verified that block processing remains available after the correction.

The constructor assigned $this->processor, which Datasource does not declare, so it
raised a dynamic property deprecation on every request and left getPostProcessor()
uninitialised. Datasource declares $postProcessor.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GMxdgnfSMHKFs7MZiNzC9R
@coderabbitai

coderabbitai Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

BlocksDatasource now assigns its BlockProcessor instance to postProcessor. A test checks that construction produces no deprecation notices and that getPostProcessor() returns a BlockProcessor.

Estimated code review effort: 2 (Simple) | ~8 minutes

Merge Risk: Minimal · up to 7f827

The datasource change appears ready to merge after normal checks.

Pre-merge checks: Passed 5

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "Fix dynamic property deprecation in BlocksDatasource" matches the main change. The constructor now assigns the BlockProcessor to the declared parent property $postProcessor instead of the u…
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "Fix dynamic property deprecation in BlocksDatasource" matches the main change. The constructor now assigns the BlockProcessor to the declared parent property $postProcessor instead of the undeclared $processor, which removes the PHP 8.2+ dynamic property deprecation. The new test checks for deprecations during construction and verifies getPostProcessor() returns a BlockProcessor.

Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 2 files.

Finishing Touches

Generate docstrings

  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Some tools did not complete. Review the errors below.

PHPStan (2.3.1)

PHPStan reported 2 non-file analysis error(s); analysis is incomplete

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 44e70b68-a1b1-497d-89b6-af9572fbbf9c
Commits

Reviewing files that changed from the base of the PR and between 8679386 and 7f827b9.

Files selected for processing: 2

  • classes/BlocksDatasource.php
  • tests/classes/BlocksDatasourceTest.php

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@LukeTowers
LukeTowers merged commit 27ba970 into main Nov 11, 2026
10 checks passed
@LukeTowers
LukeTowers deleted the fix/blocks-datasource-processor branch November 11, 2026 03:22
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.

1 participant