Framework updates
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -146,6 +146,9 @@ class _Manifest_Cache_Helper
|
||||
}
|
||||
|
||||
file_put_contents($cache_file, $php_content);
|
||||
|
||||
// Write build key to separate file for non-PHP consumers (FPC proxy, etc.)
|
||||
file_put_contents(dirname($cache_file) . '/build_key', Manifest::$data['hash']);
|
||||
}
|
||||
|
||||
public static function _validate_cached_data()
|
||||
@@ -364,6 +367,68 @@ class _Manifest_Cache_Helper
|
||||
"To: public static function {$method_name}(...)\n"
|
||||
);
|
||||
}
|
||||
|
||||
// Check FPC attribute constraints
|
||||
$has_fpc = false;
|
||||
$has_spa = false;
|
||||
|
||||
foreach ($method_info['attributes'] as $attr_name => $attr_instances) {
|
||||
if ($attr_name === 'FPC' || str_ends_with($attr_name, '\\FPC')) {
|
||||
$has_fpc = true;
|
||||
}
|
||||
if ($attr_name === 'SPA' || str_ends_with($attr_name, '\\SPA')) {
|
||||
$has_spa = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($has_fpc) {
|
||||
$class_name = $metadata['class'] ?? 'Unknown';
|
||||
|
||||
if ($has_ajax_endpoint) {
|
||||
throw new \RuntimeException(
|
||||
"#[FPC] cannot be used on Ajax endpoints\n" .
|
||||
"Class: {$class_name}\n" .
|
||||
"Method: {$method_name}\n" .
|
||||
"File: {$file_path}\n\n" .
|
||||
"#[FPC] marks a route for full page caching. Ajax endpoints return JSON\n" .
|
||||
"data, not HTML pages.\n\n" .
|
||||
"Solution: Remove #[FPC] from this Ajax endpoint."
|
||||
);
|
||||
}
|
||||
|
||||
if ($has_spa) {
|
||||
throw new \RuntimeException(
|
||||
"#[FPC] cannot be used on #[SPA] methods\n" .
|
||||
"Class: {$class_name}\n" .
|
||||
"Method: {$method_name}\n" .
|
||||
"File: {$file_path}\n\n" .
|
||||
"SPA bootstrap methods return an empty shell that JavaScript populates.\n" .
|
||||
"Caching this shell serves the same empty page for all SPA routes.\n\n" .
|
||||
"Solution: Remove #[FPC] from this SPA method."
|
||||
);
|
||||
}
|
||||
|
||||
if ($has_task) {
|
||||
throw new \RuntimeException(
|
||||
"#[FPC] cannot be used on Task methods\n" .
|
||||
"Class: {$class_name}\n" .
|
||||
"Method: {$method_name}\n" .
|
||||
"File: {$file_path}\n\n" .
|
||||
"Solution: Remove #[FPC] from this Task method."
|
||||
);
|
||||
}
|
||||
|
||||
if (!$has_route) {
|
||||
throw new \RuntimeException(
|
||||
"#[FPC] requires #[Route] attribute\n" .
|
||||
"Class: {$class_name}\n" .
|
||||
"Method: {$method_name}\n" .
|
||||
"File: {$file_path}\n\n" .
|
||||
"#[FPC] can only be used on methods with a #[Route] attribute.\n\n" .
|
||||
"Solution: Add #[Route('/path')] to this method, or remove #[FPC]."
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user