From b96378a82c5d910b71f42e29324dac0ff5d39344 Mon Sep 17 00:00:00 2001 From: mscherer Date: Fri, 30 Jan 2026 10:06:33 +0100 Subject: [PATCH] Fix code block indentation in docs. --- docs/en/controllers.md | 7 ++-- docs/en/core-libraries/collections.md | 42 +++++++++---------- docs/en/core-libraries/email.md | 24 +++++------ docs/en/orm/associations.md | 16 +++---- docs/en/orm/retrieving-data-and-resultsets.md | 10 ++--- 5 files changed, 49 insertions(+), 50 deletions(-) diff --git a/docs/en/controllers.md b/docs/en/controllers.md index 7e83a83f1d..0669521893 100644 --- a/docs/en/controllers.md +++ b/docs/en/controllers.md @@ -495,10 +495,9 @@ the controller's default one: ``` php // In a controller method. $recentArticles = $this->fetchTable('Articles')->find('all', - limit: 5, - order: 'Articles.created DESC', - ) - ->all(); + limit: 5, + order: 'Articles.created DESC', +)->all(); ``` ### fetchModel() diff --git a/docs/en/core-libraries/collections.md b/docs/en/core-libraries/collections.md index 5939ea8cc4..33603768a4 100644 --- a/docs/en/core-libraries/collections.md +++ b/docs/en/core-libraries/collections.md @@ -1245,19 +1245,19 @@ imagine a lengthy closure like this one: ``` php $collection - ->map(function ($row, $key) { - if (!empty($row['items'])) { - $row['total'] = collection($row['items'])->sumOf('price'); - } + ->map(function ($row, $key) { + if (!empty($row['items'])) { + $row['total'] = collection($row['items'])->sumOf('price'); + } - if (!empty($row['total'])) { - $row['tax_amount'] = $row['total'] * 0.25; - } + if (!empty($row['total'])) { + $row['tax_amount'] = $row['total'] * 0.25; + } - // More code here... + // More code here... - return $modifiedRow; - }); + return $modifiedRow; + }); ``` This can be refactored by creating another class: @@ -1265,20 +1265,20 @@ This can be refactored by creating another class: ``` php class TotalOrderCalculator { - public function __invoke($row, $key) - { - if (!empty($row['items'])) { - $row['total'] = collection($row['items'])->sumOf('price'); - } + public function __invoke($row, $key) + { + if (!empty($row['items'])) { + $row['total'] = collection($row['items'])->sumOf('price'); + } - if (!empty($row['total'])) { - $row['tax_amount'] = $row['total'] * 0.25; - } + if (!empty($row['total'])) { + $row['tax_amount'] = $row['total'] * 0.25; + } - // More code here... + // More code here... - return $modifiedRow; - } + return $modifiedRow; + } } // Use the logic in your map() call diff --git a/docs/en/core-libraries/email.md b/docs/en/core-libraries/email.md index 49dbe54603..aa50d23533 100644 --- a/docs/en/core-libraries/email.md +++ b/docs/en/core-libraries/email.md @@ -158,12 +158,12 @@ application. Mailer views can also use layouts and elements just like normal vie ``` php $mailer = new Mailer(); $mailer - ->setEmailFormat('html') - ->setTo('bob@example.com') - ->setFrom('app@domain.com') - ->viewBuilder() - ->setTemplate('welcome') - ->setLayout('fancy'); + ->setEmailFormat('html') + ->setTo('bob@example.com') + ->setFrom('app@domain.com') + ->viewBuilder() + ->setTemplate('welcome') + ->setLayout('fancy'); $mailer->deliver(); ``` @@ -175,12 +175,12 @@ send multipart templated email messages as well: ``` php $mailer = new Mailer(); $mailer - ->setEmailFormat('both') - ->setTo('bob@example.com') - ->setFrom('app@domain.com') - ->viewBuilder() - ->setTemplate('welcome') - ->setLayout('fancy'); + ->setEmailFormat('both') + ->setTo('bob@example.com') + ->setFrom('app@domain.com') + ->viewBuilder() + ->setTemplate('welcome') + ->setLayout('fancy'); $mailer->deliver(); ``` diff --git a/docs/en/orm/associations.md b/docs/en/orm/associations.md index 1aff3c2c06..4085d3f600 100644 --- a/docs/en/orm/associations.md +++ b/docs/en/orm/associations.md @@ -42,8 +42,8 @@ class ArticlesTable extends Table public function initialize(array $config): void { $this->belongsTo('Authors', [ - 'className' => 'Publishing.Authors', - ]) + 'className' => 'Publishing.Authors', + ]) ->setForeignKey('author_id') ->setProperty('author'); } @@ -81,8 +81,8 @@ class ArticlesTable extends Table ->setFinder('approved'); $this->hasMany('UnapprovedComments', [ - 'className' => 'Comments', - ]) + 'className' => 'Comments', + ]) ->setFinder('unapproved') ->setProperty('unapproved_comments'); } @@ -195,15 +195,15 @@ class UsersTable extends Table public function initialize(array $config): void { $this->hasOne('HomeAddresses', [ - 'className' => 'Addresses', - ]) + 'className' => 'Addresses', + ]) ->setProperty('home_address') ->setConditions(['HomeAddresses.label' => 'Home']) ->setDependent(true); $this->hasOne('WorkAddresses', [ - 'className' => 'Addresses', - ]) + 'className' => 'Addresses', + ]) ->setProperty('work_address') ->setConditions(['WorkAddresses.label' => 'Work']) ->setDependent(true); diff --git a/docs/en/orm/retrieving-data-and-resultsets.md b/docs/en/orm/retrieving-data-and-resultsets.md index f817affb29..5a429c00df 100644 --- a/docs/en/orm/retrieving-data-and-resultsets.md +++ b/docs/en/orm/retrieving-data-and-resultsets.md @@ -319,11 +319,11 @@ the Author entity. ``` php // In your finders/controller: $query = $articles->find('list', - keyField: 'id', - valueField: function ($article) { - return $article->author->get('label'); - } - ) + keyField: 'id', + valueField: function ($article) { + return $article->author->get('label'); + }, +) ->contain('Authors'); ```