oliverdavies.uk/content/node.cbc1e748-058a-407a-8f57-182f3e42bb48.json
2025-05-11 20:02:13 +01:00

100 lines
No EOL
3.8 KiB
JSON

{
"uuid": [
{
"value": "cbc1e748-058a-407a-8f57-182f3e42bb48"
}
],
"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:56+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": "Refactoring with readonly classes in PHP 8.2\n"
}
],
"created": [
{
"value": "2023-04-16T00:00:00+00:00"
}
],
"changed": [
{
"value": "2025-04-21T01:21:56+00:00"
}
],
"promote": [
{
"value": false
}
],
"sticky": [
{
"value": false
}
],
"default_langcode": [
{
"value": true
}
],
"revision_translation_affected": [
{
"value": true
}
],
"path": [
{
"alias": "\/daily\/2023\/04\/16\/refactoring-with-readonly-classes-in-php-8-2",
"langcode": "en"
}
],
"body": [
{
"value": "\n <p>Marian Kostadinov (<a href=\"https:\/\/twitter.com\/stochnagara\">stochnagara on Twitter<\/a>) replied to Friday's email about DTOs and value objects to tell me about <code>readonly<\/code> classes, which can be done in PHP 8.2.<\/p>\n\n<p>Looking at the previous class:<\/p>\n\n<pre><code class=\"language-php\">class AccountDetails {\n\n public function __construct(\n public readonly string $accountNumber,\n public readonly string $sortCode,\n ) {}\n\n}\n<\/code><\/pre>\n\n<p>Instead of setting each property as <code>readonly<\/code>, the whole class can instead be marked as <code>readonly<\/code>:<\/p>\n\n<pre><code class=\"language-php\">readonly class AccountDetails {\n\n public function __construct(\n public string $accountNumber,\n public string $sortCode,\n ) {}\n\n}\n<\/code><\/pre>\n\n<p>Thanks for the suggestion, Marian!<\/p>\n\n ",
"format": "full_html",
"processed": "\n <p>Marian Kostadinov (<a href=\"https:\/\/twitter.com\/stochnagara\">stochnagara on Twitter<\/a>) replied to Friday's email about DTOs and value objects to tell me about <code>readonly<\/code> classes, which can be done in PHP 8.2.<\/p>\n\n<p>Looking at the previous class:<\/p>\n\n<pre><code class=\"language-php\">class AccountDetails {\n\n public function __construct(\n public readonly string $accountNumber,\n public readonly string $sortCode,\n ) {}\n\n}\n<\/code><\/pre>\n\n<p>Instead of setting each property as <code>readonly<\/code>, the whole class can instead be marked as <code>readonly<\/code>:<\/p>\n\n<pre><code class=\"language-php\">readonly class AccountDetails {\n\n public function __construct(\n public string $accountNumber,\n public string $sortCode,\n ) {}\n\n}\n<\/code><\/pre>\n\n<p>Thanks for the suggestion, Marian!<\/p>\n\n ",
"summary": null
}
],
"feeds_item": [
{
"imported": "2025-04-21T01:21:56+00:00",
"guid": null,
"hash": "9297110388cf153de83397c7246c18c5",
"target_type": "feeds_feed",
"target_uuid": "90c85284-7ca8-4074-9178-97ff8384fe76"
}
]
}