Skip to content

Commit 768197f

Browse files
committed
temporary do tracing to test php specific 8.2 ci test failure
1 parent e55b032 commit 768197f

4 files changed

Lines changed: 67 additions & 19 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -46,20 +46,23 @@ jobs:
4646
run: php bin/typephp cache:warm
4747

4848
- name: Run Runtime Type Checking Engine Suite (Pest)
49-
run: ./vendor/bin/pest tests/TypeChecking --compact
49+
run: ./vendor/bin/pest tests/TypeChecking/Configuration/DocblockIgnoreTagsTest.php -v
5050

51-
- name: Run Full Test Suite with Coverage (Pest)
52-
run: ./vendor/bin/pest --coverage-clover=clover.xml --compact
53-
if: matrix.os == 'ubuntu-latest' && matrix.php == '8.4'
51+
# - name: Run Runtime Type Checking Engine Suite (Pest)
52+
# run: ./vendor/bin/pest tests/TypeChecking --compact
5453

55-
- name: Run Full Test Suite (Pest)
56-
run: ./vendor/bin/pest --compact
57-
if: "! (matrix.os == 'ubuntu-latest' && matrix.php == '8.4')"
54+
# - name: Run Full Test Suite with Coverage (Pest)
55+
# run: ./vendor/bin/pest --coverage-clover=clover.xml --compact
56+
# if: matrix.os == 'ubuntu-latest' && matrix.php == '8.4'
5857

59-
- name: Upload Coverage to Codecov
60-
uses: codecov/codecov-action@v5
61-
if: matrix.os == 'ubuntu-latest' && matrix.php == '8.4'
62-
with:
63-
token: ${{ secrets.CODECOV_TOKEN }}
64-
files: clover.xml
65-
fail_ci_if_error: false
58+
# - name: Run Full Test Suite (Pest)
59+
# run: ./vendor/bin/pest --compact
60+
# if: "! (matrix.os == 'ubuntu-latest' && matrix.php == '8.4')"
61+
62+
# - name: Upload Coverage to Codecov
63+
# uses: codecov/codecov-action@v5
64+
# if: matrix.os == 'ubuntu-latest' && matrix.php == '8.4'
65+
# with:
66+
# token: ${{ secrets.CODECOV_TOKEN }}
67+
# files: clover.xml
68+
# fail_ci_if_error: false

‎src/Internal/RuntimeTypeChecker.php‎

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,21 @@ public static function checkProperty(mixed $value, mixed $objectOrClass, string
181181

182182
$res = InlineChecker::checkProperty($value, $objectOrClass, $propName, $file, self::getRegistry());
183183

184-
if ($res instanceof ErrorMessage && (IgnoreManager::isCallerIgnored() || CallerBoundaryResolver::shouldBypass($className . '::$' . $propName))) {
185-
return $value;
184+
if (str_contains($propName, 'Property')) {
185+
fwrite(STDERR, "[DEBUG checkProperty] Property: {$className}::\${$propName} | Result: " . ($res instanceof ErrorMessage ? $res->getMessage() : 'VALUE (no error)') . "\n");
186+
}
187+
188+
if ($res instanceof ErrorMessage) {
189+
$isIgnored = IgnoreManager::isCallerIgnored();
190+
$shouldBypass = CallerBoundaryResolver::shouldBypass($className . '::$' . $propName);
191+
192+
if (str_contains($propName, 'Property')) {
193+
fwrite(STDERR, "[DEBUG checkProperty] isCallerIgnored: " . ($isIgnored ? 'TRUE' : 'FALSE') . " | shouldBypass: " . ($shouldBypass ? 'TRUE' : 'FALSE') . "\n");
194+
}
195+
196+
if ($isIgnored || $shouldBypass) {
197+
return $value;
198+
}
186199
}
187200

188201
return $res;
@@ -233,8 +246,17 @@ public static function setupScope(string $function, array $vars, object|string|n
233246
$contract
234247
);
235248

249+
if (str_contains($function, 'normalMethod') || str_contains($function, 'ignoredMethod')) {
250+
fwrite(STDERR, "[DEBUG setupScope] Target: {$function} | Error: " . ($err instanceof ErrorMessage ? $err->getMessage() : 'NONE') . "\n");
251+
}
252+
236253
if ($err !== null) {
237-
if (IgnoreManager::isCallerIgnored()) {
254+
$isIgnored = IgnoreManager::isCallerIgnored();
255+
if (str_contains($function, 'normalMethod') || str_contains($function, 'ignoredMethod')) {
256+
fwrite(STDERR, "[DEBUG setupScope] isCallerIgnored returned: " . ($isIgnored ? 'TRUE (suppressed)' : 'FALSE (throwing)') . "\n");
257+
}
258+
259+
if ($isIgnored) {
238260
return null;
239261
}
240262

‎src/Internal/Util/IgnoreManager.php‎

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ public static function isFileIgnored(string $filePath): bool
7070
public static function isCallerIgnored(?string $callerClass = null, ?string $callerFunction = null): bool
7171
{
7272
if (! Config::isRespectIgnoreTagsEnabled()) {
73+
fwrite(STDERR, "[DEBUG IgnoreManager] respect_ignore_tags is disabled.\n");
7374
return false;
7475
}
7576

@@ -93,56 +94,74 @@ public static function isCallerIgnored(?string $callerClass = null, ?string $cal
9394
$depth = Config::getIgnoreTraceDepth();
9495
$trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, $depth);
9596

97+
fwrite(STDERR, "\n=======================================================\n");
98+
fwrite(STDERR, " [DEBUG IgnoreManager] Scanning trace (depth limit: {$depth}, actual frames: " . \count($trace) . ")\n");
99+
fwrite(STDERR, "=======================================================\n");
100+
96101
for ($i = 1; $i < \count($trace); $i++) {
97102
$frame = $trace[$i];
98103
$class = $frame['class'] ?? '';
99104
$function = $frame['function'];
100105
$file = $frame['file'] ?? '';
106+
$line = $frame['line'] ?? '?';
107+
108+
fwrite(STDERR, " #{$i} {$class}::{$function}() called at [{$file}:{$line}]\n");
101109

102110
if ($class !== '' && (str_starts_with($class, 'TypePHP\\Internal\\') || $class === 'TypePHP\\TypePHP')) {
111+
fwrite(STDERR, " -> skipped (internal engine frame)\n");
103112
continue;
104113
}
105114

106115
if ($class === '' && \in_array($function, ['call_user_func', 'call_user_func_array'], true)) {
116+
fwrite(STDERR, " -> skipped (call_user_func trampoline)\n");
107117
continue;
108118
}
109119

110-
if ($file !== '' && self::isFileIgnored($file)) {
111-
return true;
120+
if ($file !== '') {
121+
$fileIsIgnored = self::isFileIgnored($file);
122+
if ($fileIsIgnored) {
123+
fwrite(STDERR, " => [SUPPRESSED] File is registered in fileCache: {$file}\n");
124+
return true;
125+
}
112126
}
113127

114128
if ($class !== '') {
115129
$key = $class . '::' . $function;
116130
if (isset(self::$callerCache[$key])) {
117131
if (self::$callerCache[$key]) {
132+
fwrite(STDERR, " => [SUPPRESSED] Found cached ignored method: {$key}\n");
118133
return true;
119134
}
120135

121136
continue;
122137
}
123138

124139
if (self::checkMethodIgnored($class, $function)) {
140+
fwrite(STDERR, " => [SUPPRESSED] checkMethodIgnored returned TRUE for: {$key}\n");
125141
return self::$callerCache[$key] = true;
126142
}
127143

128144
self::$callerCache[$key] = false;
129145
} elseif (! str_contains($function, '{closure}')) {
130146
if (isset(self::$callerCache[$function])) {
131147
if (self::$callerCache[$function]) {
148+
fwrite(STDERR, " => [SUPPRESSED] Found cached ignored function: {$function}\n");
132149
return true;
133150
}
134151

135152
continue;
136153
}
137154

138155
if (self::checkFunctionIgnored($function)) {
156+
fwrite(STDERR, " => [SUPPRESSED] checkFunctionIgnored returned TRUE for: {$function}\n");
139157
return self::$callerCache[$function] = true;
140158
}
141159

142160
self::$callerCache[$function] = false;
143161
}
144162
}
145163

164+
fwrite(STDERR, " => [NOT SUPPRESSED] No ignore tags found in scanned frames.\n\n");
146165
return false;
147166
}
148167

‎tests/Fixtures/IgnoreTags/IgnoredMethod.php‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,13 @@ class IgnoredMethod
2424

2525
public function setNormalProperty(int $val): void
2626
{
27+
fwrite(STDERR, "[DEBUG IgnoredMethod::setNormalProperty] called with val: {$val}\n");
2728
$this->normalProperty = $val;
2829
}
2930

3031
public function setIgnoredProperty(int $val): void
3132
{
33+
fwrite(STDERR, "[DEBUG IgnoredMethod::setIgnoredProperty] called with val: {$val}\n");
3234
$this->ignoredProperty = $val;
3335
}
3436

@@ -39,6 +41,7 @@ public function setIgnoredProperty(int $val): void
3941
*/
4042
public function normalMethod(int $id): bool
4143
{
44+
fwrite(STDERR, "[DEBUG IgnoredMethod::normalMethod] called with id: {$id}\n");
4245
return true;
4346
}
4447

@@ -53,6 +56,7 @@ public function normalMethod(int $id): bool
5356
*/
5457
public function ignoredMethod(int $id): int
5558
{
59+
fwrite(STDERR, "[DEBUG IgnoredMethod::ignoredMethod] called with id: {$id}\n");
5660
return $id;
5761
}
5862
}

0 commit comments

Comments
 (0)