Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: fix TypeError in strict mode #8270

Merged
merged 6 commits into from
Nov 30, 2023

Conversation

kenjis
Copy link
Member

@kenjis kenjis commented Nov 29, 2023

Description

Checklist:

  • Securely signed commits
  • [] Component(s) with PHPDoc blocks, only if necessary or adds value
  • [] Unit testing, with >80% coverage
  • [] User guide updated
  • Conforms to style guide

1) CodeIgniter\Commands\Database\ShowTableInfoTest::testDbTableMetadata
TypeError: CodeIgniter\Commands\Database\ShowTableInfo::setYesOrNo(): Argument #1 ($fieldValue) must be of type bool, int given, called in /home/runner/work/CodeIgniter4/CodeIgniter4/system/Commands/Database/ShowTableInfo.php on line 286

/home/runner/work/CodeIgniter4/CodeIgniter4/system/Commands/Database/ShowTableInfo.php:297
/home/runner/work/CodeIgniter4/CodeIgniter4/system/Commands/Database/ShowTableInfo.php:286
/home/runner/work/CodeIgniter4/CodeIgniter4/system/Commands/Database/ShowTableInfo.php:144
/home/runner/work/CodeIgniter4/CodeIgniter4/system/CLI/Commands.php:67
/home/runner/work/CodeIgniter4/CodeIgniter4/system/Common.php:198
/home/runner/work/CodeIgniter4/CodeIgniter4/tests/system/Commands/Database/ShowTableInfoTest.php:98
1) CodeIgniter\Models\InsertModelTest::testInsertPermitInsertNoData
TypeError: strcspn(): Argument #1 ($string) must be of type string, int given

/home/runner/work/CodeIgniter4/CodeIgniter4/system/Database/BaseConnection.php:1042
/home/runner/work/CodeIgniter4/CodeIgniter4/system/Database/BaseConnection.php:1029
/home/runner/work/CodeIgniter4/CodeIgniter4/system/Model.php:308
/home/runner/work/CodeIgniter4/CodeIgniter4/system/BaseModel.php:782
/home/runner/work/CodeIgniter4/CodeIgniter4/system/Model.php:707
/home/runner/work/CodeIgniter4/CodeIgniter4/tests/system/Models/InsertModelTest.php:255
1) CodeIgniter\Database\Live\DbUtilsTest::testUtilsCSVFromResult
TypeError: str_replace(): Argument #3 ($subject) must be of type array|string, int given

/home/runner/work/CodeIgniter4/CodeIgniter4/system/Database/BaseUtils.php:217
/home/runner/work/CodeIgniter4/CodeIgniter4/tests/system/Database/Live/DbUtilsTest.php:186

2) CodeIgniter\Database\Live\DbUtilsTest::testUtilsXMLFromResult
TypeError: xml_convert(): Argument #1 ($str) must be of type string, int given, called in /home/runner/work/CodeIgniter4/CodeIgniter4/system/Database/BaseUtils.php on line 249

/home/runner/work/CodeIgniter4/CodeIgniter4/system/Helpers/xml_helper.php:20
/home/runner/work/CodeIgniter4/CodeIgniter4/system/Database/BaseUtils.php:249
/home/runner/work/CodeIgniter4/CodeIgniter4/tests/system/Database/Live/DbUtilsTest.php:199
There were 2 errors:

1) CodeIgniter\Database\Live\UpsertTest::testUpsertWithMatchingDataOnUniqueIndexandPrimaryKey
TypeError: strtoupper(): Argument #1 ($string) must be of type string, int given

/home/runner/work/CodeIgniter4/CodeIgniter4/system/Database/Postgre/Builder.php:364
/home/runner/work/CodeIgniter4/CodeIgniter4/system/Database/BaseBuilder.php:1790
/home/runner/work/CodeIgniter4/CodeIgniter4/system/Database/BaseBuilder.php:1927
/home/runner/work/CodeIgniter4/CodeIgniter4/tests/system/Database/Live/UpsertTest.php:410

2) CodeIgniter\Database\Live\UpsertTest::testUpsertBatchOnPrimaryKey
TypeError: strtoupper(): Argument #1 ($string) must be of type string, int given

/home/runner/work/CodeIgniter4/CodeIgniter4/system/Database/Postgre/Builder.php:364
/home/runner/work/CodeIgniter4/CodeIgniter4/system/Database/BaseBuilder.php:1790
/home/runner/work/CodeIgniter4/CodeIgniter4/system/Database/BaseBuilder.php:1961
/home/runner/work/CodeIgniter4/CodeIgniter4/tests/system/Database/Live/UpsertTest.php:457

--

There was 1 failure:

1) CodeIgniter\Database\Live\UpsertTest::testUpsertCauseConstraintError
Failed asserting that exception of type "TypeError" matches expected exception "CodeIgniter\Database\Exceptions\DatabaseException". Message was: "trim(): Argument #1 ($string) must be of type string, CodeIgniter\Database\RawSql given" at
/home/runner/work/CodeIgniter4/CodeIgniter4/system/Database/Postgre/Builder.php:360
/home/runner/work/CodeIgniter4/CodeIgniter4/system/Database/BaseBuilder.php:1790
/home/runner/work/CodeIgniter4/CodeIgniter4/system/Database/BaseBuilder.php:1927
/home/runner/work/CodeIgniter4/CodeIgniter4/tests/system/Database/Live/UpsertTest.php:303
3) CodeIgniter\Database\Live\FabricatorLiveTest::testCreateAddsToDatabase
TypeError: CodeIgniter\Database\SQLSRV\Connection::insertID(): Return value must be of type int, string returned

/home/runner/work/CodeIgniter4/CodeIgniter4/system/Database/SQLSRV/Connection.php:195
/home/runner/work/CodeIgniter4/CodeIgniter4/system/Model.php:328
/home/runner/work/CodeIgniter4/CodeIgniter4/system/BaseModel.php:782
/home/runner/work/CodeIgniter4/CodeIgniter4/system/Model.php:707
/home/runner/work/CodeIgniter4/CodeIgniter4/system/Test/Fabricator.php:475
/home/runner/work/CodeIgniter4/CodeIgniter4/tests/system/Database/Live/FabricatorLiveTest.php:41
@kenjis kenjis added refactor Pull requests that refactor code 4.5 labels Nov 29, 2023
@kenjis kenjis merged commit 8584f1b into codeigniter4:4.5 Nov 30, 2023
45 checks passed
@kenjis kenjis deleted the fix-TypeError-in-strict-mode branch November 30, 2023 07:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4.5 refactor Pull requests that refactor code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants