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
1 change: 1 addition & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
- "8.2"
- "8.3"
- "8.4"
- "8.5"

steps:
- name: Checkout
Expand Down
2 changes: 1 addition & 1 deletion library/Exceptions/NestedValidationException.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public function getIterator(): SplObjectStorage
$lastDepth = $currentDepth;
$lastDepthOriginal = $currentDepthOriginal;

$childrenExceptions->attach($childException, $currentDepth);
$childrenExceptions->offsetSet($childException, $currentDepth);
}

return $childrenExceptions;
Expand Down
2 changes: 0 additions & 2 deletions library/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,6 @@ private function extractPropertiesValues(Validatable $validatable, ReflectionCla
{
$values = [];
foreach ($reflection->getProperties() as $property) {
$property->setAccessible(true);

$propertyValue = $property->getValue($validatable);
if ($propertyValue === null) {
continue;
Expand Down
1 change: 1 addition & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
bootstrap="vendor/autoload.php"
backupGlobals="false"
backupStaticAttributes="false"
convertDeprecationsToExceptions="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
Expand Down
1 change: 0 additions & 1 deletion tests/unit/Rules/EmailTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ private static function sut(): Email
$rule = new Email();

$reflection = new ReflectionProperty(Email::class, 'validator');
$reflection->setAccessible(true);
$reflection->setValue($rule, null);

return $rule;
Expand Down
28 changes: 27 additions & 1 deletion tests/unit/Rules/FactorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use function uniqid;

use const PHP_INT_MAX;
use const PHP_VERSION_ID;

/**
* @group rule
Expand All @@ -31,6 +32,32 @@
*/
final class FactorTest extends RuleTestCase
{
/**
* Some edge cases emit E_DEPRECATED on PHP >= 8.5.
*
* @test
*
* @dataProvider providerForInvalidInputEdgeCases
*/
public function shouldFailOnInvalidInputEdgeCases(Factor $rule, mixed $input): void
{
if (PHP_VERSION_ID >= 80500) {
$this->markTestSkipped('This test emits E_DEPRECATED on PHP >= 8.5');
}

self::assertInvalidInput($rule, $input);
}

/**
* @return array<string, array{0:Factor, 1:mixed}>
*/
public static function providerForInvalidInputEdgeCases(): array
{
return [
'mt_rand is not factor PHP_INT_MAX + 1' => [new Factor(mt_rand()), PHP_INT_MAX + 1],
];
}

/**
* {@inheritDoc}
*/
Expand Down Expand Up @@ -93,7 +120,6 @@ public static function providerForInvalidInput(): array
'mt_rand is not factor 1.5' => [new Factor(mt_rand()), 1.5],
'mt_rand is not factor -0.5' => [new Factor(mt_rand()), -0.5],
'mt_rand is not factor -1.5' => [new Factor(mt_rand()), -1.5],
'mt_rand is not factor PHP_INT_MAX + 1' => [new Factor(mt_rand()), PHP_INT_MAX + 1],
'mt_rand is not factor calc' => [new Factor(mt_rand()), mt_rand(1, mt_getrandmax() - 1) / mt_getrandmax()],
'mt_rand is not factor -calc' => [
new Factor(mt_rand()),
Expand Down
Loading