fix: validation change behavior regex match in `integer` and `numeric` to php function
Description Fixed #6489
Checklist:
- [x] Securely signed commits
- [x] Component(s) with PHPDoc blocks, only if necessary or adds value
- [ ] Unit testing, with >80% coverage
- [x] User guide updated
- [x] Conforms to style guide
I think that it would be more correct to remove typehint for passed values in all rules. Casting to the appropriate types within the method.
This PR brings a lot of breaking changes. Probably unacceptable.
There was 1 error:
1) CodeIgniter\Validation\FormatRulesTest::testInteger with data set #0 (1, true)
TypeError: Argument 1 passed to CodeIgniter\Validation\FormatRulesTest::testInteger() must be of the type string or null, int given, called in /home/runner/work/CodeIgniter4/CodeIgniter4/vendor/phpunit/phpunit/src/Framework/TestCase.php on line 1545
/home/runner/work/CodeIgniter4/CodeIgniter4/tests/system/Validation/FormatRulesTest.php:867
phpvfscomposer:///home/runner/work/CodeIgniter4/CodeIgniter4/vendor/phpunit/phpunit/phpunit:97
--
There were 6 failures:
1) CodeIgniter\Validation\FormatRulesTest::testIntegerWithInvalidTypeData with data set "bool true" (true, true)
Failed asserting that false is identical to true.
/home/runner/work/CodeIgniter4/CodeIgniter4/tests/system/Validation/FormatRulesTest.php:812
phpvfscomposer:///home/runner/work/CodeIgniter4/CodeIgniter4/vendor/phpunit/phpunit/phpunit:97
2) CodeIgniter\Validation\FormatRulesTest::testInteger with data set #2 ('42', true)
Failed asserting that false is identical to true.
/home/runner/work/CodeIgniter4/CodeIgniter4/tests/system/Validation/FormatRulesTest.php:877
phpvfscomposer:///home/runner/work/CodeIgniter4/CodeIgniter4/vendor/phpunit/phpunit/phpunit:97
3) CodeIgniter\Validation\FormatRulesTest::testInteger with data set #3 ('-1', true)
Failed asserting that false is identical to true.
/home/runner/work/CodeIgniter4/CodeIgniter4/tests/system/Validation/FormatRulesTest.php:877
phpvfscomposer:///home/runner/work/CodeIgniter4/CodeIgniter4/vendor/phpunit/phpunit/phpunit:97
4) CodeIgniter\Validation\StrictRules\FormatRulesTest::testInteger with data set #0 ('0', true)
Failed asserting that false is identical to true.
/home/runner/work/CodeIgniter4/CodeIgniter4/tests/system/Validation/StrictRules/FormatRulesTest.php:876
phpvfscomposer:///home/runner/work/CodeIgniter4/CodeIgniter4/vendor/phpunit/phpunit/phpunit:97
5) CodeIgniter\Validation\StrictRules\FormatRulesTest::testInteger with data set #1 ('42', true)
Failed asserting that false is identical to true.
/home/runner/work/CodeIgniter4/CodeIgniter4/tests/system/Validation/StrictRules/FormatRulesTest.php:876
phpvfscomposer:///home/runner/work/CodeIgniter4/CodeIgniter4/vendor/phpunit/phpunit/phpunit:97
6) CodeIgniter\Validation\StrictRules\FormatRulesTest::testInteger with data set #2 ('-1', true)
Failed asserting that false is identical to true.
/home/runner/work/CodeIgniter4/CodeIgniter4/tests/system/Validation/StrictRules/FormatRulesTest.php:876
phpvfscomposer:///home/runner/work/CodeIgniter4/CodeIgniter4/vendor/phpunit/phpunit/phpunit:97
I think that it would be more correct to remove typehint for passed values in all rules. Casting to the appropriate types within the method.
Yes. When we introduce declare(strict_types=1), many TypeError would occur.
I think that it would be more correct to remove typehint for passed values in all rules. Casting to the appropriate types within the method.
Yes. When we introduce
declare(strict_types=1), many TypeError would occur.
@kenjis this PR stuck on cache test php unit, i already adjusted in integerProvider
