oliverdavies.uk/content/node.1aa7a4d1-08a8-4cb0-99ba-62e279517b4b.json

91 lines
No EOL
4.8 KiB
JSON

{
"uuid": [
{
"value": "1aa7a4d1-08a8-4cb0-99ba-62e279517b4b"
}
],
"langcode": [
{
"value": "en"
}
],
"type": [
{
"target_id": "daily_email",
"target_type": "node_type",
"target_uuid": "8bde1f2f-eef9-4f2d-ae9c-96921f8193d7"
}
],
"revision_timestamp": [
{
"value": "2025-05-11T09:00:00+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": "Extra PHPDoc types with PHPStan"
}
],
"created": [
{
"value": "2025-03-21T00:00:00+00:00"
}
],
"changed": [
{
"value": "2025-05-11T09:00:00+00:00"
}
],
"promote": [
{
"value": false
}
],
"sticky": [
{
"value": false
}
],
"default_langcode": [
{
"value": true
}
],
"revision_translation_affected": [
{
"value": true
}
],
"path": [
{
"alias": "\/daily\/2025\/03\/21\/phpdoc",
"langcode": "en"
}
],
"body": [
{
"value": "\n <p>Here are some examples of PHP code from Drupal core:<\/p>\n\n<pre><code class=\"php\">\/**\n * The weight of this role in administrative listings.\n *\n * @var int\n *\/\nprotected $weight;\n<\/code><\/pre>\n\n<pre><code class=\"php\">\/**\n * Path of the image file.\n *\n * @var string\n *\/\nprotected $source = '';\n<\/code><\/pre>\n\n<pre><code class=\"php\">\/**\n * Alter the list of mail backend plugin definitions.\n *\n * @param array $info\n * The mail backend plugin definitions to be altered.\n *\/\n<\/code><\/pre>\n\n<p>These use some of the standard PHPDoc types of <code>int<\/code>, <code>string<\/code> and <code>array<\/code>.<\/p>\n\n<p>Although they are comments, docblocks are checked by static analysis tools like PHPStan to parse the code and report any potential errors.<\/p>\n\n<p>If you want to go deeper, PHPStan has <a href=\"https:\/\/phpstan.org\/writing-php-code\/phpdoc-types\">its own PHPDoc types<\/a> that you can use to add more information and context.<\/p>\n\n<p>Instead of specifying an argument must be a <code>string<\/code>, you can specify it's a <code>non-empty-string<\/code> or a <code>class-string<\/code>.<\/p>\n\n<p>You can specify whether an integer is a <code>positive-int<\/code> or <code>negative-int<\/code>, or within a certain range.<\/p>\n\n<p>You can define the shape of an array or object, whether an array is empty, or the types of keys and values in an array.<\/p>\n\n<p>All of this is used by PHPStan when analysing the code and will give better results and find more potential bugs before anyone else does.<\/p>\n\n ",
"format": "full_html",
"processed": "\n <p>Here are some examples of PHP code from Drupal core:<\/p>\n\n<pre><code class=\"php\">\/**\n * The weight of this role in administrative listings.\n *\n * @var int\n *\/\nprotected $weight;\n<\/code><\/pre>\n\n<pre><code class=\"php\">\/**\n * Path of the image file.\n *\n * @var string\n *\/\nprotected $source = '';\n<\/code><\/pre>\n\n<pre><code class=\"php\">\/**\n * Alter the list of mail backend plugin definitions.\n *\n * @param array $info\n * The mail backend plugin definitions to be altered.\n *\/\n<\/code><\/pre>\n\n<p>These use some of the standard PHPDoc types of <code>int<\/code>, <code>string<\/code> and <code>array<\/code>.<\/p>\n\n<p>Although they are comments, docblocks are checked by static analysis tools like PHPStan to parse the code and report any potential errors.<\/p>\n\n<p>If you want to go deeper, PHPStan has <a href=\"https:\/\/phpstan.org\/writing-php-code\/phpdoc-types\">its own PHPDoc types<\/a> that you can use to add more information and context.<\/p>\n\n<p>Instead of specifying an argument must be a <code>string<\/code>, you can specify it's a <code>non-empty-string<\/code> or a <code>class-string<\/code>.<\/p>\n\n<p>You can specify whether an integer is a <code>positive-int<\/code> or <code>negative-int<\/code>, or within a certain range.<\/p>\n\n<p>You can define the shape of an array or object, whether an array is empty, or the types of keys and values in an array.<\/p>\n\n<p>All of this is used by PHPStan when analysing the code and will give better results and find more potential bugs before anyone else does.<\/p>\n\n ",
"summary": null
}
]
}