• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

diego-ninja / granite / 18469785058

13 Oct 2025 02:54PM UTC coverage: 83.133% (-0.5%) from 83.671%
18469785058

Pull #14

github

web-flow
Merge 3af2fda9d into 5f47fe5d1
Pull Request #14: feature: deep comparison feature for granite objects

83 of 119 new or added lines in 2 files covered. (69.75%)

2563 of 3083 relevant lines covered (83.13%)

17.49 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

50.0
/src/Exceptions/ComparisonException.php
1
<?php
2

3
namespace Ninja\Granite\Exceptions;
4

5
/**
6
 * Exception thrown when object comparison fails.
7
 */
8
class ComparisonException extends GraniteException
9
{
10
    /**
11
     * Create exception for type mismatch during comparison.
12
     */
13
    public static function typeMismatch(string $expectedType, string $actualType): self
1✔
14
    {
15
        return new self(
1✔
16
            sprintf(
1✔
17
                'Cannot compare objects of different types: expected %s, got %s',
1✔
18
                $expectedType,
1✔
19
                $actualType,
1✔
20
            ),
1✔
21
            context: [
1✔
22
                'expected_type' => $expectedType,
1✔
23
                'actual_type' => $actualType,
1✔
24
            ],
1✔
25
        );
1✔
26
    }
27

28
    /**
29
     * Create exception for uncomparable values.
30
     */
NEW
31
    public static function uncomparableValue(string $propertyName, mixed $value): self
×
32
    {
NEW
33
        return new self(
×
NEW
34
            sprintf(
×
NEW
35
                'Property "%s" contains uncomparable value of type "%s"',
×
NEW
36
                $propertyName,
×
NEW
37
                get_debug_type($value),
×
NEW
38
            ),
×
NEW
39
            context: [
×
NEW
40
                'property_name' => $propertyName,
×
NEW
41
                'value_type' => get_debug_type($value),
×
NEW
42
            ],
×
NEW
43
        );
×
44
    }
45
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc