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: |

Here are some examples of PHP code from Drupal core:

/**
       * The weight of this role in administrative listings.
       *
       * @var int
       */
      protected $weight;
      
/**
       * Path of the image file.
       *
       * @var string
       */
      protected $source = '';
      
/**
       * Alter the list of mail backend plugin definitions.
       *
       * @param array $info
       *   The mail backend plugin definitions to be altered.
       */
      

These use some of the standard PHPDoc types of int, string and array.

Although they are comments, docblocks are checked by static analysis tools like PHPStan to parse the code and report any potential errors.

If you want to go deeper, PHPStan has its own PHPDoc types that you can use to add more information and context.

Instead of specifying an argument must be a string, you can specify it's a non-empty-string or a class-string.

You can specify whether an integer is a positive-int or negative-int, or within a certain range.

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.

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.

format: full_html processed: |

Here are some examples of PHP code from Drupal core:

/**
       * The weight of this role in administrative listings.
       *
       * @var int
       */
      protected $weight;
      
/**
       * Path of the image file.
       *
       * @var string
       */
      protected $source = '';
      
/**
       * Alter the list of mail backend plugin definitions.
       *
       * @param array $info
       *   The mail backend plugin definitions to be altered.
       */
      

These use some of the standard PHPDoc types of int, string and array.

Although they are comments, docblocks are checked by static analysis tools like PHPStan to parse the code and report any potential errors.

If you want to go deeper, PHPStan has its own PHPDoc types that you can use to add more information and context.

Instead of specifying an argument must be a string, you can specify it's a non-empty-string or a class-string.

You can specify whether an integer is a positive-int or negative-int, or within a certain range.

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.

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.

summary: null field_daily_email_cta: { }