Skip to content

Commit

Permalink
Merge pull request #8400 from kenjis/style-cs-fixer-3.46.0
Browse files Browse the repository at this point in the history
style: update coding style with php-cs-fixer 3.46.0
  • Loading branch information
kenjis authored Jan 7, 2024
2 parents bbd4f1b + 73cb246 commit c0d134a
Show file tree
Hide file tree
Showing 87 changed files with 220 additions and 62 deletions.
12 changes: 8 additions & 4 deletions .php-cs-fixer.user-guide.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,14 @@
]);

$overrides = [
'echo_tag_syntax' => false,
'php_unit_internal_class' => false,
'no_unused_imports' => false,
'class_attributes_separation' => false,
'echo_tag_syntax' => false,
'php_unit_internal_class' => false,
'no_unused_imports' => false,
'class_attributes_separation' => false,
'fully_qualified_strict_types' => [
'import_symbols' => false,
'leading_backslash_in_global_namespace' => true,
],
];

$options = [
Expand Down
2 changes: 0 additions & 2 deletions system/Helpers/text_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -702,8 +702,6 @@ function alternator(...$args): string
* @param int $radius The amount of characters returned around the phrase.
* @param string $ellipsis Ending that will be appended
*
* @return string
*
* If no $phrase is passed, will generate an excerpt of $radius characters
* from the beginning of $text.
*/
Expand Down
2 changes: 1 addition & 1 deletion tests/system/Config/fixtures/RegistrarConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* the LICENSE file that was distributed with this source code.
*/

class RegistrarConfig extends \CodeIgniter\Config\BaseConfig
class RegistrarConfig extends CodeIgniter\Config\BaseConfig
{
public $foo = 'bar';
public $bar = [
Expand Down
2 changes: 1 addition & 1 deletion tests/system/Config/fixtures/SimpleConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* the LICENSE file that was distributed with this source code.
*/

class SimpleConfig extends \CodeIgniter\Config\BaseConfig
class SimpleConfig extends CodeIgniter\Config\BaseConfig
{
public $QZERO;
public $QZEROSTR;
Expand Down
2 changes: 2 additions & 0 deletions user_guide_src/source/cli/cli_library/002.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<?php

use CodeIgniter\CLI\CLI;

$color = CLI::prompt('What is your favorite color?');
2 changes: 2 additions & 0 deletions user_guide_src/source/cli/cli_library/003.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<?php

use CodeIgniter\CLI\CLI;

$color = CLI::prompt('What is your favorite color?', 'blue');
2 changes: 2 additions & 0 deletions user_guide_src/source/cli/cli_library/004.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<?php

use CodeIgniter\CLI\CLI;

$overwrite = CLI::prompt('File exists. Overwrite?', ['y', 'n']);
2 changes: 2 additions & 0 deletions user_guide_src/source/cli/cli_library/005.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<?php

use CodeIgniter\CLI\CLI;

$email = CLI::prompt('What is your email?', null, 'required|valid_email');
2 changes: 2 additions & 0 deletions user_guide_src/source/cli/cli_library/006.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<?php

use CodeIgniter\CLI\CLI;

$email = CLI::prompt('What is your email?', null, ['required', 'valid_email']);
2 changes: 2 additions & 0 deletions user_guide_src/source/cli/cli_library/007.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

use CodeIgniter\CLI\CLI;

$fruit = CLI::promptByKey('These are your choices:', ['The red apple', 'The plump orange', 'The ripe banana']);
/*
* These are your choices:
Expand Down
2 changes: 2 additions & 0 deletions user_guide_src/source/cli/cli_library/008.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

use CodeIgniter\CLI\CLI;

$fruit = CLI::promptByKey(['These are your choices:', 'Which would you like?'], [
'apple' => 'The red apple',
'orange' => 'The plump orange',
Expand Down
2 changes: 2 additions & 0 deletions user_guide_src/source/cli/cli_library/009.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<?php

use CodeIgniter\CLI\CLI;

CLI::write('The rain in Spain falls mainly on the plains.');
2 changes: 2 additions & 0 deletions user_guide_src/source/cli/cli_library/010.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<?php

use CodeIgniter\CLI\CLI;

CLI::write('File created.', 'green');
2 changes: 2 additions & 0 deletions user_guide_src/source/cli/cli_library/011.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<?php

use CodeIgniter\CLI\CLI;

CLI::write('File overwritten.', 'light_red', 'dark_gray');
2 changes: 2 additions & 0 deletions user_guide_src/source/cli/cli_library/012.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

use CodeIgniter\CLI\CLI;

for ($i = 0; $i <= 10; $i++) {
CLI::print($i);
}
2 changes: 2 additions & 0 deletions user_guide_src/source/cli/cli_library/013.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<?php

use CodeIgniter\CLI\CLI;

CLI::write("fileA \t" . CLI::color('/path/to/file', 'white'), 'yellow');
2 changes: 2 additions & 0 deletions user_guide_src/source/cli/cli_library/014.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<?php

use CodeIgniter\CLI\CLI;

CLI::error('Cannot write to file: ' . $file);
2 changes: 2 additions & 0 deletions user_guide_src/source/cli/cli_library/015.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php

use CodeIgniter\CLI\CLI;

CLI::color("task1\t", 'yellow');
CLI::wrap('Some long description goes here that might be longer than the current window.');
2 changes: 2 additions & 0 deletions user_guide_src/source/cli/cli_library/016.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php

use CodeIgniter\CLI\CLI;

// Wrap the text at max 20 characters wide
CLI::wrap($description, 20);
2 changes: 2 additions & 0 deletions user_guide_src/source/cli/cli_library/017.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

use CodeIgniter\CLI\CLI;

$titles = [
'task1a',
'task1abc',
Expand Down
2 changes: 2 additions & 0 deletions user_guide_src/source/cli/cli_library/018.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<?php

use CodeIgniter\CLI\CLI;

CLI::newLine();
2 changes: 2 additions & 0 deletions user_guide_src/source/cli/cli_library/019.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<?php

use CodeIgniter\CLI\CLI;

CLI::clearScreen();
2 changes: 2 additions & 0 deletions user_guide_src/source/cli/cli_library/020.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

use CodeIgniter\CLI\CLI;

$totalSteps = count($tasks);
$currStep = 1;

Expand Down
2 changes: 2 additions & 0 deletions user_guide_src/source/cli/cli_library/021.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

use CodeIgniter\CLI\CLI;

$thead = ['ID', 'Title', 'Updated At', 'Active'];
$tbody = [
[7, 'A great item title', '2017-11-15 10:35:02', 1],
Expand Down
2 changes: 2 additions & 0 deletions user_guide_src/source/cli/cli_library/022.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

use CodeIgniter\CLI\CLI;

// wait for specified interval, with countdown displayed
CLI::wait($seconds, true);

Expand Down
2 changes: 2 additions & 0 deletions user_guide_src/source/cli/cli_library/023.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

use CodeIgniter\CLI\CLI;

$hobbies = CLI::promptByMultipleKeys('Select your hobbies:', ['Playing game', 'Sleep', 'Badminton']);
/*
* Select your hobbies:
Expand Down
2 changes: 2 additions & 0 deletions user_guide_src/source/concepts/factories/002.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

use CodeIgniter\Config\Factories;

$users = Factories::models('Blog\Models\UserModel');
// Or
$users = Factories::models(\Blog\Models\UserModel::class);
2 changes: 2 additions & 0 deletions user_guide_src/source/concepts/factories/004.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php

use CodeIgniter\Config\Factories;

$conn = db_connect('auth');
$users = Factories::models('UserModel', [], $conn);
3 changes: 3 additions & 0 deletions user_guide_src/source/concepts/factories/006.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?php

use CodeIgniter\Config\Factories;
use CodeIgniter\Filters\FilterInterface;

Factories::setOptions('filters', [
'instanceOf' => FilterInterface::class,
'prefersApp' => false,
Expand Down
2 changes: 2 additions & 0 deletions user_guide_src/source/concepts/factories/007.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php

use CodeIgniter\Config\Factories;

$users = Factories::models('UserModel', ['getShared' => true]); // Default; will always be the same instance
$other = Factories::models('UserModel', ['getShared' => false]); // Will always create a new instance
2 changes: 2 additions & 0 deletions user_guide_src/source/concepts/factories/010.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<?php

use CodeIgniter\Config\Factories;

$users = Factories::models('Blog\Models\UserModel', ['preferApp' => false]);
2 changes: 2 additions & 0 deletions user_guide_src/source/concepts/factories/013.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<?php

use CodeIgniter\Config\Factories;

$lib = Factories::libraries('Sub/SubLib');
2 changes: 2 additions & 0 deletions user_guide_src/source/concepts/factories/014.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<?php

use CodeIgniter\Config\Factories;

Factories::define('models', 'Myth\Auth\Models\UserModel', 'App\Models\UserModel');
16 changes: 12 additions & 4 deletions user_guide_src/source/database/query_builder.rst
Original file line number Diff line number Diff line change
Expand Up @@ -829,15 +829,17 @@ method. Here is an example using an array:

The first parameter is an associative array of values.

.. note:: All values except ``RawSql`` are escaped automatically producing safer queries.

.. warning:: When you use ``RawSql``, you MUST escape the data manually. Failure to do so could result in SQL injections.

Here is an example using an object:

.. literalinclude:: query_builder/077.php

The first parameter is an object.

.. note:: All values except ``RawSql`` are escaped automatically producing safer queries.
.. literalinclude:: query_builder/121.php

.. warning:: When you use ``RawSql``, you MUST escape the data manually. Failure to do so could result in SQL injections.
The first parameter is an object.

$builder->ignore()
------------------
Expand Down Expand Up @@ -922,6 +924,8 @@ The first parameter is an associative array of values.

Here is an example using an object:

.. literalinclude:: query_builder/122.php

.. literalinclude:: query_builder/113.php

The first parameter is an object.
Expand Down Expand Up @@ -1056,6 +1060,8 @@ You can also pass an associative array to this method:

Or an object:

.. literalinclude:: query_builder/077.php

.. literalinclude:: query_builder/087.php

$builder->update()
Expand All @@ -1069,6 +1075,8 @@ is an example using an array:

Or you can supply an object:

.. literalinclude:: query_builder/077.php

.. literalinclude:: query_builder/089.php

.. note:: All values except ``RawSql`` are escaped automatically producing safer queries.
Expand Down
8 changes: 3 additions & 5 deletions user_guide_src/source/database/query_builder/077.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
<?php

class Myclass
namespace App\Libraries;

class MyClass
{
public $title = 'My Title';
public $content = 'My Content';
public $date = 'My Date';
}

$object = new Myclass();
$builder->insert($object);
// Produces: INSERT INTO mytable (title, content, date) VALUES ('My Title', 'My Content', 'My Date')
9 changes: 2 additions & 7 deletions user_guide_src/source/database/query_builder/087.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
<?php

class Myclass
{
public $title = 'My Title';
public $content = 'My Content';
public $date = 'My Date';
}
use App\Libraries\MyClass;

$object = new Myclass();
$object = new MyClass();
$builder->set($object);
$builder->insert();
11 changes: 3 additions & 8 deletions user_guide_src/source/database/query_builder/089.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
<?php

class Myclass
{
public $title = 'My Title';
public $content = 'My Content';
public $date = 'My Date';
}
use App\Libraries\MyClass;

$object = new Myclass();
$object = new MyClass();
$builder->where('id', $id);
$builder->update($object);
/*
* Produces:
* UPDATE `mytable`
* SET `title` = '{$title}', `name` = '{$name}', `date` = '{$date}'
* SET `title` = '{$title}', `content` = '{$content}', `date` = '{$date}'
* WHERE id = `$id`
*/
2 changes: 2 additions & 0 deletions user_guide_src/source/database/query_builder/111.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

use CodeIgniter\Database\RawSql;

$data = [
[
'id' => 2,
Expand Down
9 changes: 2 additions & 7 deletions user_guide_src/source/database/query_builder/113.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
<?php

class Myclass
{
public $email = '[email protected]';
public $name = 'Ahmadinejad';
public $country = 'Iran';
}
use App\Libraries\MyClass;

$object = new Myclass();
$object = new MyClass();
$builder->upsert($object);
2 changes: 2 additions & 0 deletions user_guide_src/source/database/query_builder/115.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

use CodeIgniter\Database\RawSql;

$query = $this->db->table('user2')
->select('user2.name, user2.email, user2.country')
->join('user', 'user.email = user2.email', 'left')
Expand Down
2 changes: 2 additions & 0 deletions user_guide_src/source/database/query_builder/116.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

use CodeIgniter\Database\RawSql;

$query = $this->db->table('user2')
->select('user2.name, user2.email, user2.country')
->join('user', 'user.email = user2.email', 'inner')
Expand Down
7 changes: 7 additions & 0 deletions user_guide_src/source/database/query_builder/121.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

use App\Libraries\MyClass;

$object = new MyClass();
$builder->insert($object);
// Produces: INSERT INTO mytable (title, content, date) VALUES ('My Title', 'My Content', 'My Date')
Loading

0 comments on commit c0d134a

Please sign in to comment.