Files
michaelschiemer/src/Framework/Console/ExitCode.php
Michael Schiemer 9b74ade5b0 feat: Fix discovery system critical issues
Resolved multiple critical discovery system issues:

## Discovery System Fixes
- Fixed console commands not being discovered on first run
- Implemented fallback discovery for empty caches
- Added context-aware caching with separate cache keys
- Fixed object serialization preventing __PHP_Incomplete_Class

## Cache System Improvements
- Smart caching that only caches meaningful results
- Separate caches for different execution contexts (console, web, test)
- Proper array serialization/deserialization for cache compatibility
- Cache hit logging for debugging and monitoring

## Object Serialization Fixes
- Fixed DiscoveredAttribute serialization with proper string conversion
- Sanitized additional data to prevent object reference issues
- Added fallback for corrupted cache entries

## Performance & Reliability
- All 69 console commands properly discovered and cached
- 534 total discovery items successfully cached and restored
- No more __PHP_Incomplete_Class cache corruption
- Improved error handling and graceful fallbacks

## Testing & Quality
- Fixed code style issues across discovery components
- Enhanced logging for better debugging capabilities
- Improved cache validation and error recovery

Ready for production deployment with stable discovery system.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-13 12:04:17 +02:00

80 lines
2.4 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Framework\Console;
/**
* Standard Exit-Codes für Console-Anwendungen
*
* Basiert auf den POSIX-Standards und bewährten Praktiken:
* - 0: Erfolg
* - 1: Allgemeiner Fehler
* - 2: Falsche Verwendung (ungültige Argumente)
* - 64-78: Spezifische Fehler-Codes (sysexits.h Standard)
*/
enum ExitCode: int
{
case SUCCESS = 0;
case GENERAL_ERROR = 1;
case USAGE_ERROR = 2;
case COMMAND_NOT_FOUND = 64;
case INVALID_INPUT = 65;
case NO_INPUT = 66;
case UNAVAILABLE = 69;
case SOFTWARE_ERROR = 70;
case OS_ERROR = 71;
case OS_FILE_ERROR = 72;
case CANT_CREATE = 73;
case IO_ERROR = 74;
case TEMP_FAIL = 75;
case PROTOCOL_ERROR = 76;
case NO_PERMISSION = 77;
case CONFIG_ERROR = 78;
case PERMISSION_DENIED = 126;
case INTERRUPTED = 130;
/**
* Gibt eine menschenlesbare Beschreibung des Exit-Codes zurück
*/
public function getDescription(): string
{
return match($this) {
self::SUCCESS => 'Erfolgreich abgeschlossen',
self::GENERAL_ERROR => 'Allgemeiner Fehler',
self::USAGE_ERROR => 'Falsche Verwendung oder ungültige Argumente',
self::COMMAND_NOT_FOUND => 'Kommando nicht gefunden',
self::INVALID_INPUT => 'Ungültige Eingabedaten',
self::NO_INPUT => 'Keine Eingabe vorhanden',
self::UNAVAILABLE => 'Service nicht verfügbar',
self::SOFTWARE_ERROR => 'Interner Software-Fehler',
self::OS_ERROR => 'Betriebssystem-Fehler',
self::OS_FILE_ERROR => 'Datei-/Verzeichnis-Fehler',
self::CANT_CREATE => 'Kann Datei/Verzeichnis nicht erstellen',
self::IO_ERROR => 'Ein-/Ausgabe-Fehler',
self::TEMP_FAIL => 'Temporärer Fehler',
self::PROTOCOL_ERROR => 'Protokoll-Fehler',
self::NO_PERMISSION => 'Keine Berechtigung',
self::CONFIG_ERROR => 'Konfigurationsfehler',
self::PERMISSION_DENIED => 'Zugriff verweigert',
self::INTERRUPTED => 'Unterbrochen durch Signal (SIGINT/SIGTERM)',
};
}
/**
* Prüft, ob der Exit-Code einen Erfolg darstellt
*/
public function isSuccess(): bool
{
return $this === self::SUCCESS;
}
/**
* Prüft, ob der Exit-Code einen Fehler darstellt
*/
public function isError(): bool
{
return ! $this->isSuccess();
}
}