Move all files to tome/
This commit is contained in:
parent
5675bcfc36
commit
674daab35b
2874 changed files with 0 additions and 0 deletions
74
tome/content/node.8ee882f8-f25b-4ae7-9dc3-aedc78ee0998.yml
Normal file
74
tome/content/node.8ee882f8-f25b-4ae7-9dc3-aedc78ee0998.yml
Normal file
|
@ -0,0 +1,74 @@
|
|||
uuid:
|
||||
- value: 8ee882f8-f25b-4ae7-9dc3-aedc78ee0998
|
||||
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:07+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: 'Named arguments add context'
|
||||
created:
|
||||
- value: '2024-08-26T00:00:00+00:00'
|
||||
changed:
|
||||
- value: '2025-05-11T09:00:07+00:00'
|
||||
promote:
|
||||
- value: false
|
||||
sticky:
|
||||
- value: false
|
||||
default_langcode:
|
||||
- value: true
|
||||
revision_translation_affected:
|
||||
- value: true
|
||||
path:
|
||||
- alias: /daily/2024/08/26/named-arguments-add-context
|
||||
langcode: en
|
||||
body:
|
||||
- value: |
|
||||
<p>A couple of weeks ago, I wrote that <a href="/daily/2024/08/17/types-add-context">using types adds context to code</a>, making it easier to read and understand.</p>
|
||||
|
||||
<p>Something else that also adds context is <a href="https://www.php.net/manual/en/functions.arguments.php#functions.named-arguments">named arguments</a>, which were introduced to PHP in version 8.0.0.</p>
|
||||
|
||||
<p>I particularly like them when making assertions within tests, where getting the expected and actual values in the wrong order can create some confusing output.</p>
|
||||
|
||||
<p>For example:</p>
|
||||
|
||||
<pre><code class="php">self::assertSame(expected: 'My Drupal website', actual: $node->label());
|
||||
</code></pre>
|
||||
|
||||
<p>While I can tell from the assertion that I'm checking two values are the same, adding the argument names makes it clear which is the expected value and which is the actual value.</p>
|
||||
|
||||
<p>In fact, if you use named arguments, the order no longer matters, so I can put them in whichever order I want and it will work the same way.</p>
|
||||
|
||||
|
||||
format: full_html
|
||||
processed: |
|
||||
<p>A couple of weeks ago, I wrote that <a href="/daily/2024/08/17/types-add-context">using types adds context to code</a>, making it easier to read and understand.</p>
|
||||
|
||||
<p>Something else that also adds context is <a href="https://www.php.net/manual/en/functions.arguments.php#functions.named-arguments">named arguments</a>, which were introduced to PHP in version 8.0.0.</p>
|
||||
|
||||
<p>I particularly like them when making assertions within tests, where getting the expected and actual values in the wrong order can create some confusing output.</p>
|
||||
|
||||
<p>For example:</p>
|
||||
|
||||
<pre><code class="php">self::assertSame(expected: 'My Drupal website', actual: $node->label());
|
||||
</code></pre>
|
||||
|
||||
<p>While I can tell from the assertion that I'm checking two values are the same, adding the argument names makes it clear which is the expected value and which is the actual value.</p>
|
||||
|
||||
<p>In fact, if you use named arguments, the order no longer matters, so I can put them in whichever order I want and it will work the same way.</p>
|
||||
|
||||
|
||||
summary: null
|
||||
field_daily_email_cta: { }
|
Loading…
Add table
Add a link
Reference in a new issue