Skip to content

Reliability Analyzers

13 analyzers ensuring your application handles errors gracefully, maintains uptime, and prevents runtime failures.

Overview

Reliability analyzers focus on preventing runtime errors, ensuring proper configuration, validating dependencies, and maintaining application stability. These analyzers help catch issues before they cause production outages or user-facing errors.

Key Analyzers

Configuration & Environment

Infrastructure & Permissions

Queue & Database

Static Analysis

  • PHPStan Static Analysis Analyzer - Comprehensive static analysis detecting 13 categories of code reliability issues:
    • Dead Code - Unreachable statements, unused variables, and code with no effect
    • Deprecated Code - Usage of deprecated methods, classes, and functions
    • Foreach Iterable - Invalid foreach usage with non-iterable values
    • Invalid Function Calls - Calls to undefined or incorrectly parameterized functions
    • Invalid Imports - Invalid use statements for non-existent classes
    • Invalid Method Calls - Calls to undefined or incorrectly parameterized methods
    • Invalid Method Overrides - Incompatible method signature overrides
    • Invalid Offset Access - Invalid array offset access and type mismatches
    • Invalid Property Access - Access to undefined or inaccessible properties
    • Missing Model Relations - References to non-existent Eloquent relations
    • Missing Return Statements - Methods with missing return statements
    • Undefined Constants - References to undefined constants
    • Undefined Variables - References to undefined variables

How They Work

Reliability analyzers use a combination of:

  1. Static Analysis (PHPStan): Detects code-level issues like undefined variables, invalid method calls, and type mismatches
  2. Configuration Validation: Checks Laravel configuration files, environment variables, and Composer dependencies
  3. Runtime Checks: Validates that services (cache, database) are accessible and functioning
  4. File System Analysis: Verifies file permissions, existence of required files, and directory structure

Severity Levels

SeverityDescriptionExamples
CriticalIssues that will cause immediate runtime failuresUndefined variables, invalid method calls, missing environment files
HighIssues that may cause failures under certain conditionsMissing migrations, invalid queue configuration, cache connectivity issues
MediumIssues that reduce reliability or maintainabilityDeprecated code usage, dead code, missing return statements
LowBest practice violations that don't directly impact reliabilityCustom error pages, cache prefix configuration

Running Reliability Analyzers

Run All Reliability Analyzers

bash
php artisan shield:analyze --category=reliability

Run Specific Analyzer

bash
php artisan shield:analyze --analyzer=database-status
php artisan shield:analyze --analyzer=up-to-date-migrations
php artisan shield:analyze --analyzer=cache-status

Run Multiple Analyzers

bash
php artisan shield:analyze --analyzer=composer-validation,queue-timeout-configuration,maintenance-mode-status

Best Practices

Development

  • Run reliability analyzers before committing code
  • Fix Critical and High severity issues immediately
  • Use static analysis (PHPStan) to catch issues early

CI/CD

  • Run reliability analyzers on every pull request
  • Fail builds on Critical severity issues
  • Monitor reliability metrics over time

Production

  • Schedule periodic reliability checks
  • Monitor for configuration drift
  • Validate environment variables on deployment