Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions .no-header.php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Nexus\CsConfig\Factory;
use PhpCsFixer\Finder;
use Utils\PhpCsFixer\CodeIgniter4;
use Utils\PhpCsFixer\Fixer\Comment\SpaceAfterCommentStartFixer;

$finder = Finder::create()
->files()
Expand All @@ -26,8 +27,14 @@
$overrides = [];

$options = [
'cacheFile' => 'build/.no-header.php-cs-fixer.cache',
'finder' => $finder,
'cacheFile' => 'build/.no-header.php-cs-fixer.cache',
'finder' => $finder,
'customFixers' => [
new SpaceAfterCommentStartFixer(),
],
'customRules' => [
'CodeIgniter4/space_after_comment_start' => true,
],
];

return Factory::create(new CodeIgniter4(), $overrides, $options)->forProjects();
11 changes: 9 additions & 2 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Nexus\CsConfig\Factory;
use PhpCsFixer\Finder;
use Utils\PhpCsFixer\CodeIgniter4;
use Utils\PhpCsFixer\Fixer\Comment\SpaceAfterCommentStartFixer;

$finder = Finder::create()
->files()
Expand All @@ -34,8 +35,14 @@
$overrides = [];

$options = [
'cacheFile' => 'build/.php-cs-fixer.cache',
'finder' => $finder,
'cacheFile' => 'build/.php-cs-fixer.cache',
'finder' => $finder,
'customFixers' => [
new SpaceAfterCommentStartFixer(),
],
'customRules' => [
'CodeIgniter4/space_after_comment_start' => true,
],
];

return Factory::create(new CodeIgniter4(), $overrides, $options)->forLibrary(
Expand Down
2 changes: 1 addition & 1 deletion system/BaseModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -1327,7 +1327,7 @@ public function validate($data): bool
return true;
}

//Validation requires array, so cast away.
// Validation requires array, so cast away.
if (is_object($data)) {
$data = (array) $data;
}
Expand Down
2 changes: 1 addition & 1 deletion system/Cache/Handlers/MemcachedHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ public function decrement(string $key, int $offset = 1)

$key = static::validateKey($key, $this->prefix);

//FIXME: third parameter isn't other handler actions.
// FIXME: third parameter isn't other handler actions.
// @phpstan-ignore-next-line
return $this->memcached->decrement($key, $offset, $offset, 60);
}
Expand Down
4 changes: 2 additions & 2 deletions system/Common.php
Original file line number Diff line number Diff line change
Expand Up @@ -978,8 +978,8 @@ function single_service(string $name, ...$params)
}

if (! function_exists('slash_item')) {
//Unlike CI3, this function is placed here because
//it's not a config, or part of a config.
// Unlike CI3, this function is placed here because
// it's not a config, or part of a config.
/**
* Fetch a config file item with slash appended (if not empty)
*
Expand Down
2 changes: 1 addition & 1 deletion system/Database/BaseConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ abstract public function reconnect();
*/
public function getConnection(?string $alias = null)
{
//@todo work with read/write connections
// @todo work with read/write connections
return $this->connID;
}

Expand Down
2 changes: 1 addition & 1 deletion system/Debug/Exceptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function __construct(ExceptionsConfig $config, IncomingRequest $request,
*/
public function initialize()
{
//Set the Exception Handler
// Set the Exception Handler
set_exception_handler([$this, 'exceptionHandler']);

// Set the Error Handler
Expand Down
4 changes: 2 additions & 2 deletions system/Entity/Entity.php
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ protected function castAs($value, string $attribute, string $method = 'get')
$type = substr($type, 1);
}

//In order not to create a separate handler for the
// In order not to create a separate handler for the
// json-array type, we transform the required one.
$type = $type === 'json-array' ? 'json[array]' : $type;

Expand All @@ -363,7 +363,7 @@ protected function castAs($value, string $attribute, string $method = 'get')

$params = [];

//Attempt to retrieve additional parameters if specified
// Attempt to retrieve additional parameters if specified
// type[param, param2,param3]
if (preg_match('/^(.+)\[(.+)\]$/', $type, $matches)) {
$type = $matches[1];
Expand Down
4 changes: 2 additions & 2 deletions system/HTTP/Files/UploadedFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public function __construct(string $path, string $originalName, ?string $mimeTyp
public function move(string $targetPath, ?string $name = null, bool $overwrite = false)
{
$targetPath = rtrim($targetPath, '/') . '/';
$targetPath = $this->setPath($targetPath); //set the target path
$targetPath = $this->setPath($targetPath); // set the target path

if ($this->hasMoved) {
throw HTTPException::forAlreadyMoved();
Expand Down Expand Up @@ -169,7 +169,7 @@ protected function setPath(string $path): string
{
if (! is_dir($path)) {
mkdir($path, 0777, true);
//create the index.html file
// create the index.html file
if (! is_file($path . 'index.html')) {
$file = fopen($path . 'index.html', 'x+b');
fclose($file);
Expand Down
2 changes: 1 addition & 1 deletion system/Helpers/inflector_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function singular(string $string): string
return $result;
}

//Arranged in order.
// Arranged in order.
$singularRules = [
'/(matr)ices$/' => '\1ix',
'/(vert|ind)ices$/' => '\1ex',
Expand Down
2 changes: 1 addition & 1 deletion system/Router/RouteCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -1155,7 +1155,7 @@ static function ($m) use ($i) {
$from = str_ireplace(':' . $tag, $pattern, $from);
}

//If is redirect, No processing
// If is redirect, No processing
if (! isset($options['redirect']) && is_string($to)) {
// If no namespace found, add the default namespace
if (strpos($to, '\\') === false || strpos($to, '\\') > 0) {
Expand Down
2 changes: 1 addition & 1 deletion system/Test/DOMParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function withString(string $content)
// converts all special characters to utf-8
$content = mb_convert_encoding($content, 'HTML-ENTITIES', 'UTF-8');

//turning off some errors
// turning off some errors
libxml_use_internal_errors(true);

if (! $this->dom->loadHTML($content)) {
Expand Down
2 changes: 1 addition & 1 deletion system/View/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ protected function parsePair(string $variable, array $data, string $template): a
$str .= $out;
}

//Escape | character from filters as it's handled as OR in regex
// Escape | character from filters as it's handled as OR in regex
$escapedMatch = preg_replace('/(?<!\\\\)\\|/', '\\|', $match[0]);

$replace['#' . $escapedMatch . '#s'] = $str;
Expand Down
2 changes: 1 addition & 1 deletion system/View/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ public function extend(string $layout)
*/
public function section(string $name)
{
//Saved to prevent BC.
// Saved to prevent BC.
$this->currentSection = $name;
$this->sectionStack[] = $name;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ public function up()
'value' => ['type' => 'VARCHAR', 'constraint' => 400, 'null' => true],
])->addKey('id', true)->createTable('misc', true);

//Database Type test table
//missing types :
//TINYINT,MEDIUMINT,BIT,YEAR,BINARY , VARBINARY, TINYTEXT,LONGTEXT,YEAR,JSON,Spatial data types
// Database Type test table
// missing types :
// TINYINT,MEDIUMINT,BIT,YEAR,BINARY , VARBINARY, TINYTEXT,LONGTEXT,YEAR,JSON,Spatial data types
// id must be interger else SQLite3 error on not null for autoinc field
$data_type_fields = [
'id' => ['type' => 'INTEGER', 'constraint' => 20, 'auto_increment' => true],
Expand Down
2 changes: 1 addition & 1 deletion tests/_support/Database/Seeds/CITestSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public function run()
],
];

//set SQL times to more correct format
// set SQL times to more correct format
if ($this->db->DBDriver === 'SQLite3') {
$data['type_test'][0]['type_date'] = '2020/01/11';
$data['type_test'][0]['type_time'] = '15:22:00';
Expand Down
6 changes: 3 additions & 3 deletions tests/system/Cache/CacheFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ protected function setUp(): void

$this->cacheFactory = new CacheFactory();

//Initialize path
// Initialize path
$this->config = new Cache();
$this->config->storePath .= self::$directory;
}
Expand Down Expand Up @@ -98,7 +98,7 @@ public function testGetDummyHandler()

$this->assertInstanceOf(DummyHandler::class, $this->cacheFactory->getHandler($this->config));

//Initialize path
// Initialize path
$this->config = new Cache();
$this->config->storePath .= self::$directory;
}
Expand All @@ -117,7 +117,7 @@ public function testHandlesBadHandler()
$this->assertInstanceOf(DummyHandler::class, $this->cacheFactory->getHandler($this->config, 'wincache', 'wincache'));
}

//Initialize path
// Initialize path
$this->config = new Cache();
$this->config->storePath .= self::$directory;
}
Expand Down
16 changes: 8 additions & 8 deletions tests/system/Cache/Handlers/RedisHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,14 @@ public function testDeleteMatchingSuffix()
$this->assertSame('keys=90', $dbInfo[0]);
}

//FIXME: I don't like all Hash logic very much. It's wasting memory.
//public function testIncrement()
//{
//}

//public function testDecrement()
//{
//}
// FIXME: I don't like all Hash logic very much. It's wasting memory.
// public function testIncrement()
// {
// }

// public function testDecrement()
// {
// }

public function testClean()
{
Expand Down
134 changes: 67 additions & 67 deletions tests/system/Database/Live/GetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,79 +93,79 @@ public function testGetFieldData()
$typeTest = $this->db->table('type_test')->get()->getFieldData();

if ($this->db->DBDriver === 'SQLite3') {
$this->assertSame('integer', $typeTest[0]->type_name); //INTEGER AUTO INC
$this->assertSame('text', $typeTest[1]->type_name); //VARCHAR
$this->assertSame('text', $typeTest[2]->type_name); //CHAR
$this->assertSame('text', $typeTest[3]->type_name); //TEXT
$this->assertSame('integer', $typeTest[4]->type_name); //SMALLINT
$this->assertSame('integer', $typeTest[5]->type_name); //INTEGER
$this->assertSame('float', $typeTest[6]->type_name); //FLOAT
$this->assertSame('float', $typeTest[7]->type_name); //NUMERIC
$this->assertSame('text', $typeTest[8]->type_name); //DATE
$this->assertSame('text', $typeTest[9]->type_name); //TIME
$this->assertSame('text', $typeTest[10]->type_name); //DATETIME
$this->assertSame('text', $typeTest[11]->type_name); //TIMESTAMP
$this->assertSame('integer', $typeTest[12]->type_name); //BIGINT
$this->assertSame('float', $typeTest[13]->type_name); //REAL
$this->assertSame('text', $typeTest[14]->type_name); //ENUM
$this->assertSame('text', $typeTest[15]->type_name); //SET
$this->assertSame('text', $typeTest[16]->type_name); //MEDIUMTEXT
$this->assertSame('float', $typeTest[17]->type_name); //DOUBLE
$this->assertSame('float', $typeTest[18]->type_name); //DECIMAL
$this->assertSame('text', $typeTest[19]->type_name); //BLOB
$this->assertSame('integer', $typeTest[0]->type_name); // INTEGER AUTO INC
$this->assertSame('text', $typeTest[1]->type_name); // VARCHAR
$this->assertSame('text', $typeTest[2]->type_name); // CHAR
$this->assertSame('text', $typeTest[3]->type_name); // TEXT
$this->assertSame('integer', $typeTest[4]->type_name); // SMALLINT
$this->assertSame('integer', $typeTest[5]->type_name); // INTEGER
$this->assertSame('float', $typeTest[6]->type_name); // FLOAT
$this->assertSame('float', $typeTest[7]->type_name); // NUMERIC
$this->assertSame('text', $typeTest[8]->type_name); // DATE
$this->assertSame('text', $typeTest[9]->type_name); // TIME
$this->assertSame('text', $typeTest[10]->type_name); // DATETIME
$this->assertSame('text', $typeTest[11]->type_name); // TIMESTAMP
$this->assertSame('integer', $typeTest[12]->type_name); // BIGINT
$this->assertSame('float', $typeTest[13]->type_name); // REAL
$this->assertSame('text', $typeTest[14]->type_name); // ENUM
$this->assertSame('text', $typeTest[15]->type_name); // SET
$this->assertSame('text', $typeTest[16]->type_name); // MEDIUMTEXT
$this->assertSame('float', $typeTest[17]->type_name); // DOUBLE
$this->assertSame('float', $typeTest[18]->type_name); // DECIMAL
$this->assertSame('text', $typeTest[19]->type_name); // BLOB
}
if ($this->db->DBDriver === 'MySQLi') {
$this->assertSame('long', $typeTest[0]->type_name); //INTEGER AUTOINC
$this->assertSame('var_string', $typeTest[1]->type_name); //VARCHAR
$this->assertSame('string', $typeTest[2]->type_name); //CHAR
$this->assertSame('blob', $typeTest[3]->type_name); //TEXT
$this->assertSame('short', $typeTest[4]->type_name); //SMALLINT
$this->assertSame('long', $typeTest[5]->type_name); //INTEGER
$this->assertSame('float', $typeTest[6]->type_name); //FLOAT
$this->assertSame('newdecimal', $typeTest[7]->type_name); //NUMERIC
$this->assertSame('date', $typeTest[8]->type_name); //DATE
$this->assertSame('time', $typeTest[9]->type_name); //TIME
$this->assertSame('datetime', $typeTest[10]->type_name); //DATETIME
$this->assertSame('timestamp', $typeTest[11]->type_name); //TIMESTAMP
$this->assertSame('longlong', $typeTest[12]->type_name); //BIGINT
$this->assertSame('double', $typeTest[13]->type_name); //REAL
$this->assertSame('string', $typeTest[14]->type_name); //ENUM
$this->assertSame('string', $typeTest[15]->type_name); //SET
$this->assertSame('blob', $typeTest[16]->type_name); //MEDIUMTEXT
$this->assertSame('double', $typeTest[17]->type_name); //DOUBLE
$this->assertSame('newdecimal', $typeTest[18]->type_name); //DECIMAL
$this->assertSame('blob', $typeTest[19]->type_name); //BLOB
$this->assertSame('long', $typeTest[0]->type_name); // INTEGER AUTOINC
$this->assertSame('var_string', $typeTest[1]->type_name); // VARCHAR
$this->assertSame('string', $typeTest[2]->type_name); // CHAR
$this->assertSame('blob', $typeTest[3]->type_name); // TEXT
$this->assertSame('short', $typeTest[4]->type_name); // SMALLINT
$this->assertSame('long', $typeTest[5]->type_name); // INTEGER
$this->assertSame('float', $typeTest[6]->type_name); // FLOAT
$this->assertSame('newdecimal', $typeTest[7]->type_name); // NUMERIC
$this->assertSame('date', $typeTest[8]->type_name); // DATE
$this->assertSame('time', $typeTest[9]->type_name); // TIME
$this->assertSame('datetime', $typeTest[10]->type_name); // DATETIME
$this->assertSame('timestamp', $typeTest[11]->type_name); // TIMESTAMP
$this->assertSame('longlong', $typeTest[12]->type_name); // BIGINT
$this->assertSame('double', $typeTest[13]->type_name); // REAL
$this->assertSame('string', $typeTest[14]->type_name); // ENUM
$this->assertSame('string', $typeTest[15]->type_name); // SET
$this->assertSame('blob', $typeTest[16]->type_name); // MEDIUMTEXT
$this->assertSame('double', $typeTest[17]->type_name); // DOUBLE
$this->assertSame('newdecimal', $typeTest[18]->type_name); // DECIMAL
$this->assertSame('blob', $typeTest[19]->type_name); // BLOB
}
if ($this->db->DBDriver === 'Postgre') {
$this->assertSame('int4', $typeTest[0]->type_name); //INTEGER AUTOINC
$this->assertSame('varchar', $typeTest[1]->type_name); //VARCHAR
$this->assertSame('bpchar', $typeTest[2]->type_name); //CHAR
$this->assertSame('text', $typeTest[3]->type_name); //TEXT
$this->assertSame('int2', $typeTest[4]->type_name); //SMALLINT
$this->assertSame('int4', $typeTest[5]->type_name); //INTEGER
$this->assertSame('float8', $typeTest[6]->type_name); //FLOAT
$this->assertSame('numeric', $typeTest[7]->type_name); //NUMERIC
$this->assertSame('date', $typeTest[8]->type_name); //DATE
$this->assertSame('time', $typeTest[9]->type_name); //TIME
$this->assertSame('timestamp', $typeTest[10]->type_name); //DATETIME
$this->assertSame('timestamp', $typeTest[11]->type_name); //TIMESTAMP
$this->assertSame('int8', $typeTest[12]->type_name); //BIGINT
$this->assertSame('int4', $typeTest[0]->type_name); // INTEGER AUTOINC
$this->assertSame('varchar', $typeTest[1]->type_name); // VARCHAR
$this->assertSame('bpchar', $typeTest[2]->type_name); // CHAR
$this->assertSame('text', $typeTest[3]->type_name); // TEXT
$this->assertSame('int2', $typeTest[4]->type_name); // SMALLINT
$this->assertSame('int4', $typeTest[5]->type_name); // INTEGER
$this->assertSame('float8', $typeTest[6]->type_name); // FLOAT
$this->assertSame('numeric', $typeTest[7]->type_name); // NUMERIC
$this->assertSame('date', $typeTest[8]->type_name); // DATE
$this->assertSame('time', $typeTest[9]->type_name); // TIME
$this->assertSame('timestamp', $typeTest[10]->type_name); // DATETIME
$this->assertSame('timestamp', $typeTest[11]->type_name); // TIMESTAMP
$this->assertSame('int8', $typeTest[12]->type_name); // BIGINT
}
if ($this->db->DBDriver === 'SQLSRV') {
$this->assertSame('int', $typeTest[0]->type_name); //INTEGER AUTOINC
$this->assertSame('varchar', $typeTest[1]->type_name); //VARCHAR
$this->assertSame('char', $typeTest[2]->type_name); //CHAR
$this->assertSame('text', $typeTest[3]->type_name); //TEXT
$this->assertSame('smallint', $typeTest[4]->type_name); //SMALLINT
$this->assertSame('int', $typeTest[5]->type_name); //INTEGER
$this->assertSame('float', $typeTest[6]->type_name); //FLOAT
$this->assertSame('numeric', $typeTest[7]->type_name); //NUMERIC
$this->assertNull($typeTest[8]->type_name); //DATE
$this->assertNull($typeTest[9]->type_name); //TIME
$this->assertNull($typeTest[10]->type_name); //DATETIME
$this->assertSame('bigint', $typeTest[11]->type_name); //BIGINT
$this->assertSame('real', $typeTest[12]->type_name); //REAL
$this->assertSame('decimal', $typeTest[13]->type_name); //DECIMAL
$this->assertSame('int', $typeTest[0]->type_name); // INTEGER AUTOINC
$this->assertSame('varchar', $typeTest[1]->type_name); // VARCHAR
$this->assertSame('char', $typeTest[2]->type_name); // CHAR
$this->assertSame('text', $typeTest[3]->type_name); // TEXT
$this->assertSame('smallint', $typeTest[4]->type_name); // SMALLINT
$this->assertSame('int', $typeTest[5]->type_name); // INTEGER
$this->assertSame('float', $typeTest[6]->type_name); // FLOAT
$this->assertSame('numeric', $typeTest[7]->type_name); // NUMERIC
$this->assertNull($typeTest[8]->type_name); // DATE
$this->assertNull($typeTest[9]->type_name); // TIME
$this->assertNull($typeTest[10]->type_name); // DATETIME
$this->assertSame('bigint', $typeTest[11]->type_name); // BIGINT
$this->assertSame('real', $typeTest[12]->type_name); // REAL
$this->assertSame('decimal', $typeTest[13]->type_name); // DECIMAL
}
}

Expand Down
Loading