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
2 changes: 0 additions & 2 deletions .github/workflows/test-coding-standards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,3 @@ jobs:

- name: Run lint
run: composer cs
env:
PHP_CS_FIXER_IGNORE_ENV: ${{ matrix.php-version == '8.4' }}
10 changes: 2 additions & 8 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@

use CodeIgniter\CodingStandard\CodeIgniter4;
use Nexus\CsConfig\Factory;
use Nexus\CsConfig\Fixer\Comment\NoCodeSeparatorCommentFixer;
use Nexus\CsConfig\FixerGenerator;
use PhpCsFixer\Finder;

$finder = Finder::create()
Expand Down Expand Up @@ -44,12 +42,8 @@
];

$options = [
'cacheFile' => 'build/.php-cs-fixer.cache',
'finder' => $finder,
'customFixers' => FixerGenerator::create('utils/vendor/nexusphp/cs-config/src/Fixer', 'Nexus\\CsConfig\\Fixer'),
'customRules' => [
NoCodeSeparatorCommentFixer::name() => true,
],
'cacheFile' => 'build/.php-cs-fixer.cache',
'finder' => $finder,
];

return Factory::create(new CodeIgniter4(), $overrides, $options)->forLibrary(
Expand Down
56 changes: 24 additions & 32 deletions system/BaseModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -532,9 +532,8 @@ abstract protected function doOnlyDeleted();
* Compiles a replace and runs the query.
* This method works only with dbCalls.
*
* @param array|null $row Row data
* @phpstan-param row_array|null $row
* @param bool $returnSQL Set to true to return Query String
* @param row_array|null $row Row data
* @param bool $returnSQL Set to true to return Query String
*
* @return BaseResult|false|Query|string
*/
Expand All @@ -552,8 +551,7 @@ abstract protected function doErrors();
* Public getter to return the id value using the idValue() method.
* For example with SQL this will return $data->$this->primaryKey.
*
* @param array|object $row Row data
* @phpstan-param row_array|object $row
* @param object|row_array $row Row data
*
* @return array|int|string|null
*/
Expand Down Expand Up @@ -737,8 +735,7 @@ public function first()
* you must ensure that the class will provide access to the class
* variables, even if through a magic method.
*
* @param array|object $row Row data
* @phpstan-param row_array|object $row
* @param object|row_array $row Row data
*
* @throws ReflectionException
*/
Expand Down Expand Up @@ -789,9 +786,8 @@ public function getInsertID()
* Inserts data into the database. If an object is provided,
* it will attempt to convert it to an array.
*
* @param array|object|null $row Row data
* @phpstan-param row_array|object|null $row
* @param bool $returnID Whether insert ID should be returned or not.
* @param object|row_array|null $row Row data
* @param bool $returnID Whether insert ID should be returned or not.
*
* @return ($returnID is true ? false|int|string : bool)
*
Expand Down Expand Up @@ -866,8 +862,8 @@ public function insert($row = null, bool $returnID = true)
/**
* Set datetime to created field.
*
* @phpstan-param row_array $row
* @param int|string $date timestamp or datetime string
* @param row_array $row
* @param int|string $date timestamp or datetime string
*/
protected function setCreatedField(array $row, $date): array
{
Expand All @@ -881,8 +877,8 @@ protected function setCreatedField(array $row, $date): array
/**
* Set datetime to updated field.
*
* @phpstan-param row_array $row
* @param int|string $date timestamp or datetime string
* @param row_array $row
* @param int|string $date timestamp or datetime string
*/
protected function setUpdatedField(array $row, $date): array
{
Expand All @@ -896,11 +892,10 @@ protected function setUpdatedField(array $row, $date): array
/**
* Compiles batch insert runs the queries, validating each row prior.
*
* @param list<array|object>|null $set an associative array of insert values
* @phpstan-param list<row_array|object>|null $set
* @param bool|null $escape Whether to escape values
* @param int $batchSize The size of the batch to run
* @param bool $testing True means only number of records is returned, false will execute the query
* @param list<object|row_array>|null $set an associative array of insert values
* @param bool|null $escape Whether to escape values
* @param int $batchSize The size of the batch to run
* @param bool $testing True means only number of records is returned, false will execute the query
*
* @return bool|int Number of rows inserted or FALSE on failure
*
Expand Down Expand Up @@ -1042,11 +1037,10 @@ public function update($id = null, $row = null): bool
/**
* Compiles an update and runs the query.
*
* @param list<array|object>|null $set an associative array of insert values
* @phpstan-param list<row_array|object>|null $set
* @param string|null $index The where key
* @param int $batchSize The size of the batch to run
* @param bool $returnSQL True means SQL is returned, false will execute the query
* @param list<object|row_array>|null $set an associative array of insert values
* @param string|null $index The where key
* @param int $batchSize The size of the batch to run
* @param bool $returnSQL True means SQL is returned, false will execute the query
*
* @return false|int|list<string> Number of rows affected or FALSE on failure, SQL array when testMode
*
Expand Down Expand Up @@ -1125,8 +1119,8 @@ public function updateBatch(?array $set = null, ?string $index = null, int $batc
/**
* Deletes a single record from the database where $id matches.
*
* @param array|int|string|null $id The rows primary key(s)
* @param bool $purge Allows overriding the soft deletes setting.
* @param int|list<int|string>|string|null $id The rows primary key(s)
* @param bool $purge Allows overriding the soft deletes setting.
*
* @return BaseResult|bool
*
Expand Down Expand Up @@ -1214,9 +1208,8 @@ public function onlyDeleted()
/**
* Compiles a replace and runs the query.
*
* @param array|null $row Row data
* @phpstan-param row_array|null $row
* @param bool $returnSQL Set to true to return Query String
* @param row_array|null $row Row data
* @param bool $returnSQL Set to true to return Query String
*
* @return BaseResult|false|Query|string
*/
Expand Down Expand Up @@ -1810,9 +1803,8 @@ protected function objectToRawArray($object, bool $onlyChanged = true, bool $rec
/**
* Transform data to array.
*
* @param array|object|null $row Row data
* @phpstan-param row_array|object|null $row
* @param string $type Type of data (insert|update)
* @param object|row_array|null $row Row data
* @param string $type Type of data (insert|update)
*
* @throws DataException
* @throws InvalidArgumentException
Expand Down
10 changes: 4 additions & 6 deletions system/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -551,9 +551,8 @@ protected function doOnlyDeleted()
* Compiles a replace into string and runs the query
* This method works only with dbCalls.
*
* @param array|null $row Data
* @phpstan-param row_array|null $row
* @param bool $returnSQL Set to true to return Query String
* @param row_array|null $row Data
* @param bool $returnSQL Set to true to return Query String
*
* @return BaseResult|false|Query|string
*/
Expand Down Expand Up @@ -774,9 +773,8 @@ protected function shouldUpdate($row): bool
* Inserts data into the database. If an object is provided,
* it will attempt to convert it to an array.
*
* @param array|object|null $row
* @phpstan-param row_array|object|null $row
* @param bool $returnID Whether insert ID should be returned or not.
* @param object|row_array|null $row
* @param bool $returnID Whether insert ID should be returned or not.
*
* @return ($returnID is true ? false|int|string : bool)
*
Expand Down
7 changes: 3 additions & 4 deletions system/Test/Interfaces/FabricatorModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,16 @@ interface FabricatorModel
*
* @param int|list<int|string>|string|null $id One primary key or an array of primary keys
*
* @phpstan-return ($id is int|string ? row_array|object|null : list<row_array|object>)
* @return ($id is int|string ? object|row_array|null : list<object|row_array>)
*/
public function find($id = null);

/**
* Inserts data into the current table. If an object is provided,
* it will attempt to convert it to an array.
*
* @param array|object|null $row
* @phpstan-param row_array|object|null $row
* @param bool $returnID Whether insert ID should be returned or not.
* @param object|row_array|null $row
* @param bool $returnID Whether insert ID should be returned or not.
*
* @return bool|int|string
*
Expand Down
4 changes: 2 additions & 2 deletions utils/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"php": "^8.1",
"codeigniter/coding-standard": "^1.7",
"ergebnis/composer-normalize": "^2.28",
"friendsofphp/php-cs-fixer": "^3.63.2",
"nexusphp/cs-config": "^3.6",
"friendsofphp/php-cs-fixer": "^3.76",
"nexusphp/cs-config": "^3.26",
"phpmetrics/phpmetrics": "^2.8 || ^3.0rc6",
"vimeo/psalm": "^5.0"
},
Expand Down
2 changes: 1 addition & 1 deletion utils/phpstan-baseline/loader.neon
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# total 2866 errors
# total 2865 errors
includes:
- argument.type.neon
- assign.propertyType.neon
Expand Down
7 changes: 1 addition & 6 deletions utils/phpstan-baseline/missingType.iterableValue.neon
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# total 1436 errors
# total 1435 errors

parameters:
ignoreErrors:
Expand Down Expand Up @@ -27,11 +27,6 @@ parameters:
count: 1
path: ../../system/BaseModel.php

-
message: '#^Method CodeIgniter\\BaseModel\:\:delete\(\) has parameter \$id with no value type specified in iterable type array\.$#'
count: 1
path: ../../system/BaseModel.php

-
message: '#^Method CodeIgniter\\BaseModel\:\:doDelete\(\) has parameter \$id with no value type specified in iterable type array\.$#'
count: 1
Expand Down
Loading