Skip to main content
Glama
CheckNamespaceChangesTool.php1.48 kB
<?php declare(strict_types=1); namespace GoldenPathDigital\LaravelAscend\Tools\Code; use GoldenPathDigital\LaravelAscend\Tools\ProjectAwareTool; final class CheckNamespaceChangesTool extends ProjectAwareTool { public function getName(): string { return 'check_namespace_changes'; } public function getDescription(): string { return 'Detect classes under the app directory that use legacy namespaces.'; } public function getInputSchema(): array { return $this->buildSchema( $this->baseProjectProperties() ); } public function execute(array $payload): array { $startedAt = microtime(true); $context = $this->createContext($payload); $scanner = $this->createScanner($context); $phpFiles = $scanner->findByPatterns(['app/**/*.php']); $legacy = []; foreach ($phpFiles as $path) { $matches = $scanner->findRegexMatches($path, ['^namespace\s+(?!App\\\\)[^;]+;']); if ($matches === []) { continue; } $legacy[] = [ 'file' => $scanner->toRelativePath($path), 'namespace' => $matches[0]['evidence'] ?? null, ]; } return $this->success( [ 'legacy_namespaces' => $legacy, 'count' => count($legacy), ], [], $startedAt ); } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/aarongrtech/laravel-ascend'

If you have feedback or need assistance with the MCP directory API, please join our Discord server