Skip to content

Commit da4aea7

Browse files
authored
Merge pull request #5658 from kenjis/fix-docs-if
docs: update coding style of `if`
2 parents 1c455b5 + 19e3893 commit da4aea7

File tree

8 files changed

+11
-21
lines changed

8 files changed

+11
-21
lines changed

user_guide_src/source/database/queries.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ If you need to get the last error that has occurred, the ``error()`` method
189189
will return an array containing its code and message. Here's a quick
190190
example::
191191

192-
if ( ! $db->simpleQuery('SELECT `example_field` FROM `example_table`')) {
192+
if (! $db->simpleQuery('SELECT `example_field` FROM `example_table`')) {
193193
$error = $db->error(); // Has keys 'code' and 'message'
194194
}
195195

user_guide_src/source/general/common_functions.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,7 @@ Service Accessors
122122
Example::
123123

124124
// in controller, checking form submittal
125-
if (! $model->save($user))
126-
{
125+
if (! $model->save($user)) {
127126
// 'withInput' is what specifies "old data"
128127
// should be saved.
129128
return redirect()->back()->withInput();

user_guide_src/source/helpers/filesystem_helper.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ The following functions are available:
115115

116116
$data = 'Some file data';
117117

118-
if ( ! write_file('./path/to/file.php', $data)) {     
118+
if (! write_file('./path/to/file.php', $data)) {     
119119
echo 'Unable to write the file';
120120
} else {     
121121
echo 'File written!';

user_guide_src/source/incoming/request.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Class Reference
4646

4747
::
4848

49-
if ( ! $request->isValidIP($ip)) {
49+
if (! $request->isValidIP($ip)) {
5050
echo 'Not Valid';
5151
} else {
5252
echo 'Valid';

user_guide_src/source/installation/upgrade_file_upload.rst

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,11 @@ CodeIgniter Version 3.x
5454

5555
$this->load->library('upload', $config);
5656

57-
if ( ! $this->upload->do_upload('userfile'))
58-
{
57+
if (! $this->upload->do_upload('userfile')) {
5958
$error = array('error' => $this->upload->display_errors());
6059

6160
$this->load->view('upload_form', $error);
62-
}
63-
else
64-
{
61+
} else {
6562
$data = array('upload_data' => $this->upload->data());
6663

6764
$this->load->view('upload_success', $data);

user_guide_src/source/installation/upgrade_validations.rst

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,9 @@ Path: **application/controllers**::
9191

9292
// Set validation rules
9393

94-
if ($this->form_validation->run() == FALSE)
95-
{
94+
if ($this->form_validation->run() == FALSE) {
9695
$this->load->view('myform');
97-
}
98-
else
99-
{
96+
} else {
10097
$this->load->view('formsuccess');
10198
}
10299
}

user_guide_src/source/libraries/email.rst

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -336,16 +336,14 @@ Class Reference
336336
The e-mail sending method. Returns boolean true or false based on
337337
success or failure, enabling it to be used conditionally::
338338

339-
if (! $email->send())
340-
{
339+
if (! $email->send()) {
341340
// Generate error
342341
}
343342

344343
This method will automatically clear all parameters if the request was
345344
successful. To stop this behaviour pass false::
346345

347-
if ($email->send(false))
348-
{
346+
if ($email->send(false)) {
349347
// Parameters won't be cleared
350348
}
351349

user_guide_src/source/libraries/publisher.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,7 @@ the powerful ``Autoloader`` to locate any child classes primed for publication::
8989
{
9090
$result = $publisher->publish();
9191

92-
if ($result === false)
93-
{
92+
if ($result === false) {
9493
CLI::error(get_class($publisher) . ' failed to publish!', 'red');
9594
}
9695
}

0 commit comments

Comments
 (0)