Skip to content

Conversation

@Morgy93
Copy link
Collaborator

@Morgy93 Morgy93 commented Jan 30, 2026

This pull request introduces several improvements across the codebase, focusing on error handling for filesystem operations, type safety, and code robustness. The main changes ensure that failures to determine the current working directory (getcwd()) are handled gracefully, preventing potential runtime errors. Additionally, there are updates to type handling and configuration for static analysis.

Error Handling Improvements

  • Added checks for getcwd() returning false in multiple places (NodePackageManager, ThemeBuilder, TailwindCSS Builder, and TokensCommand), with appropriate error messages and early returns to prevent further execution when the current directory cannot be determined. [1] [2] [3] [4] [5] [6]

Type Safety and Robustness

  • Improved type safety in injectInspectorAttributes() by checking for JSON encoding failures before proceeding, ensuring that invalid metadata does not break HTML output.
  • Updated getViewModel() to check if the returned value is an object before calling get_class(), preventing potential errors if the value is not an object.
  • Added a type hint for $latestLtsNodeVersion to clarify its expected type.
  • Improved handling of PDO query results in getMysqlVersionViaPdo() by checking for query failure and ensuring the returned version is a string.

Configuration Updates

  • Increased PHPStan static analysis level from 6 to 7 in phpstan.neon, enforcing stricter code checks.

@Morgy93 Morgy93 merged commit 7c84ae7 into main Jan 30, 2026
12 checks passed
@Morgy93 Morgy93 deleted the fix-phpstan-7 branch January 30, 2026 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants