Repository navigation
Fix dynamic property deprecation in BlocksDatasource - #75
Conversation
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
|
No actionable comments were generated in the recent review. Walkthrough
Estimated code review effort: 2 (Simple) | ~8 minutes Merge Risk:
|
Summary
BlocksDatasource::__construct()assigns$this->processor.Winter\Storm\Halcyon\Datasource\Datasourcedoesn't declare that property, so on PHP 8.2+ every request logsCreation 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 $postProcessoron stormdevelopandwip/1.3, so this PR assigns$postProcessorinstead. That also makesgetPostProcessor()return theBlockProcessor. Before, calling it would have thrown an uninitialised typed-property error. Nothing in the plugin calls it today:AutoDatasourceuses its own processor, andBlock::newQuery()creates its ownBlockProcessor. 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
BlocksDatasourceTestchecks that creating the datasource raises no deprecations and thatgetPostProcessor()returns aBlockProcessor. It fails without this PR and passes with it.develop.BlockManagerTest::testCanRegisterBlocksDirectlyfails both with and without this PR, because in my setup the plugin is symlinked and the test compares real paths with symlinked ones.wip/1.3site, 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