Problem/Motivation

It was discovered in #3379725: Make Block config entities fully validatable that the Block weight exported property is often null.

This seems to have been unintentional/an oversight, because

  • BlockInterface::getWeight() has a int return type
  • its implementation Block::getWeight()does not cast from null to int

Therefore null never makes sense, and it's only thanks to PHP's automatic typecasting that this has never been a problem 😅

Steps to reproduce

N/A

Proposed resolution

  1. Remove the nullable: true that #3379725: Make Block config entities fully validatable added.
  2. Provide an update path that converts a weight of null to 0 for all blocks.

Remaining tasks

User interface changes

None.

API changes

None.

Data model changes

None.

Release notes snippet

None.

Comments

Wim Leers created an issue. See original summary.

alexpott’s picture

Config schema casting on save is why this is never actually a NULL once a block is saved. I'm not sure that this should be a separate issue from #3379725: Make Block config entities fully validatable

phenaproxima’s picture

Title: [PP-1] Deprecate `null` as valid `weight` for Block config entities » Deprecate `null` as valid `weight` for Block config entities
Status: Postponed » Closed (duplicate)

Per #3379725-32: Make Block config entities fully validatable, this has to be handled over in that issue. Closing this out.