Skip to content

Conversation

@deviantintegral
Copy link
Owner

Previously, SplitCommand would call file_get_contents() without checking if the file exists, resulting in cryptic PHP warnings when the source HAR file is missing.

This commit adds proper error handling that:

  • Checks if the file exists before attempting to read it
  • Checks if file_get_contents() returns false (for permission issues)
  • Displays clear, user-friendly error messages via SymfonyStyle
  • Returns Command::FAILURE for error cases

Also adds a comprehensive test to verify the command fails gracefully when the source file doesn't exist.

claude and others added 2 commits December 15, 2025 01:41
Previously, SplitCommand would call file_get_contents() without
checking if the file exists, resulting in cryptic PHP warnings when
the source HAR file is missing.

This commit adds proper error handling that:
- Checks if the file exists before attempting to read it
- Checks if file_get_contents() returns false (for permission issues)
- Displays clear, user-friendly error messages via SymfonyStyle
- Returns Command::FAILURE for error cases

Also adds a comprehensive test to verify the command fails gracefully
when the source file doesn't exist.
@deviantintegral deviantintegral marked this pull request as ready for review December 15, 2025 01:49
deviantintegral and others added 2 commits December 14, 2025 20:54
Add test coverage for the directory path validation to ensure
all error handling paths are properly tested.

Changes:
- Add is_dir() check to catch directory paths early
- Add testSplitFailsWhenPathIsDirectory() test
- Improve error message clarity for directory paths

This ensures 100% coverage of the new error handling code.
@deviantintegral deviantintegral merged commit ed3fa82 into main Dec 15, 2025
8 checks passed
deviantintegral added a commit that referenced this pull request Dec 15, 2025
🤖 I have created a release *beep* *boop*
---


##
[0.5.0](v0.4.0...v0.5.0)
(2025-12-15)


### Features

* migrate from MacFJA/PharBuilder to Box
([#125](#125))
([b1187c2](b1187c2))


### Bug Fixes

* add directory validation in getIds() before scandir()
([22057e0](22057e0))
* add error handling for missing files in SplitCommand
([#122](#122))
([ed3fa82](ed3fa82))
* add type hints to SplitCommand::getSplitDestination parameters
([#123](#123))
([c62a75a](c62a75a))
* check if a HAR repository exists before loading
([93fbb57](93fbb57))
* correct inverted logic in hasBlocked() and hasDns() methods
([2285c23](2285c23))
* use strict comparison (===) instead of weak comparison (==) in
Serializer.php
([453d8f3](453d8f3))


### Miscellaneous Chores

* add missing call to SessionStart
([#119](#119))
([51b50a3](51b50a3))
* auto-install php-pear in SessionStart hook
([#116](#116))
([48acab5](48acab5))
* **deps:** pin ggilder/codecoverage action to 47c83da
([#118](#118))
([85aa78d](85aa78d))
* fix newlines
([f5ded8c](f5ded8c))
* install xdebug for claude sessions
([54f3138](54f3138))
* run composer install in claude
([233d999](233d999))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants