oliverdavies.uk/content/node.48890c14-7b1f-4da2-8688-8f617f2fbe1d.json
2025-05-11 20:02:13 +01:00

100 lines
No EOL
4.2 KiB
JSON

{
"uuid": [
{
"value": "48890c14-7b1f-4da2-8688-8f617f2fbe1d"
}
],
"langcode": [
{
"value": "en"
}
],
"type": [
{
"target_id": "daily_email",
"target_type": "node_type",
"target_uuid": "8bde1f2f-eef9-4f2d-ae9c-96921f8193d7"
}
],
"revision_timestamp": [
{
"value": "2025-04-21T01:21:34+00:00"
}
],
"revision_uid": [
{
"target_type": "user",
"target_uuid": "b8966985-d4b2-42a7-a319-2e94ccfbb849"
}
],
"revision_log": [],
"status": [
{
"value": true
}
],
"uid": [
{
"target_type": "user",
"target_uuid": "b8966985-d4b2-42a7-a319-2e94ccfbb849"
}
],
"title": [
{
"value": "Making PHPStan stricter"
}
],
"created": [
{
"value": "2024-05-05T00:00:00+00:00"
}
],
"changed": [
{
"value": "2025-04-21T01:21:34+00:00"
}
],
"promote": [
{
"value": false
}
],
"sticky": [
{
"value": false
}
],
"default_langcode": [
{
"value": true
}
],
"revision_translation_affected": [
{
"value": true
}
],
"path": [
{
"alias": "\/daily\/2024\/05\/05\/making-phpstan-stricter",
"langcode": null
}
],
"body": [
{
"value": "\n <p>Continuing yesterday's thought on <a href=\"https:\/\/www.oliverdavies.uk\/daily\/2024\/05\/04\/strict-typing-in-php\">strictness in PHP<\/a>, today I want to talk about adding more strictness to PHPStan.<\/p>\n\n<p>Adding the <a href=\"https:\/\/github.com\/phpstan\/phpstan-strict-rules\">PHPStan Strict Rules extension<\/a> makes PHPStan stricter by adding new, more opinionated rules.<\/p>\n\n<p>For example:<\/p>\n\n<ul>\n<li>Require booleans in if, elseif, ternary operator, after !, and on both sides of &amp;&amp; and ||.<\/li>\n<li>Use the <code>$strict<\/code> parameter with <code>in_array<\/code>, <code>array_search<\/code>, <code>array_keys<\/code> and <code>base64_decode<\/code>.<\/li>\n<li>Disallow empty().<\/li>\n<li>Require calling parent constructor.<\/li>\n<\/ul>\n\n<p>You can enable and disable rules as needed but, like setting the PHPStan level, ideally I like to enable them all by default and see how strict I go.<\/p>\n\n<p>It depends on the code being tested and the preference of the team, though I find the stricter the rules, the less bugs there are.<\/p>\n\n ",
"format": "full_html",
"processed": "\n <p>Continuing yesterday's thought on <a href=\"https:\/\/www.oliverdavies.uk\/daily\/2024\/05\/04\/strict-typing-in-php\">strictness in PHP<\/a>, today I want to talk about adding more strictness to PHPStan.<\/p>\n\n<p>Adding the <a href=\"https:\/\/github.com\/phpstan\/phpstan-strict-rules\">PHPStan Strict Rules extension<\/a> makes PHPStan stricter by adding new, more opinionated rules.<\/p>\n\n<p>For example:<\/p>\n\n<ul>\n<li>Require booleans in if, elseif, ternary operator, after !, and on both sides of &amp;&amp; and ||.<\/li>\n<li>Use the <code>$strict<\/code> parameter with <code>in_array<\/code>, <code>array_search<\/code>, <code>array_keys<\/code> and <code>base64_decode<\/code>.<\/li>\n<li>Disallow empty().<\/li>\n<li>Require calling parent constructor.<\/li>\n<\/ul>\n\n<p>You can enable and disable rules as needed but, like setting the PHPStan level, ideally I like to enable them all by default and see how strict I go.<\/p>\n\n<p>It depends on the code being tested and the preference of the team, though I find the stricter the rules, the less bugs there are.<\/p>\n\n ",
"summary": null
}
],
"feeds_item": [
{
"imported": "2025-04-21T01:21:34+00:00",
"guid": null,
"hash": "2ff6c4f363c796e474dd5ad89dd20907",
"target_type": "feeds_feed",
"target_uuid": "90c85284-7ca8-4074-9178-97ff8384fe76"
}
]
}