Skip to content

Commit 0b01c09

Browse files
committed
feat: Add platform to composer.json
By default, phpstan bases the code checks it does on the current version of PHP that’s installed. Specifying the minimum version of PHP required allows you to catch errors that use more modern versions of the PHP than the minimum version of PHP required by your project (and Craft CMS). Adding `platform` to your `composer.json` is one way to accomplish this: https://phpstan.org/config-reference#phpversion It’s caught many regression errors for me when porting code between versions of Craft that have lower minimum requirements, and will do the same for you going forward. So if you use constructs that are only available in PHP 8.3 or 8.4 or later versions of PHP, it’ll catch those errors
1 parent 95b825c commit 0b01c09

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

composer.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@
4040
"yiisoft/yii2-composer": true
4141
},
4242
"optimize-autoloader": true,
43+
"platform": {
44+
"php": "8.2"
45+
},
46+
"platform-check": false,
4347
"sort-packages": true
4448
},
4549
"minimum-stability": "beta",

0 commit comments

Comments
 (0)