craftcms / docs

Documentation for Craft CMS, Craft Commerce, and other official products.
https://craftcms.com/docs
38 stars 144 forks source link

Update element-types.md #531

Closed criticalmash closed 10 months ago

criticalmash commented 11 months ago

$currency type needs an initial value

Description

Under Element Class using the given code example produces an error

Typed property my\plugin\elements\Product::$currency must not be accessed before initialization

This Stqackoverflow answer Updating to Craft 4 breaks plugin settings: must not be accessed before initialization states that Yii 2/Craft 4 uses typed variables must be intitalized.

netlify[bot] commented 11 months ago

Deploy request for craft-docs rejected.

Name Link
Latest commit e821bc81c92cc4389a72cf8fc1219bbbb8d33498
AugustMiller commented 10 months ago

Good catch, thanks! I've pushed a slight change to agree with our other uses, i.e. craft\models\EntryType::$handle.