Skip to content

Add PHPStan rule forbidding native exceptions and switch remaining ones #125

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 16, 2025

Conversation

chr-hertel
Copy link
Member

Q A
Bug fix? no
New feature? no
Docs? no
Issues
License MIT

This is only a POC by Claude, but wanted to check how easy it is since I'm already catching this as recurring pattern while reviewing incoming PRs.

WDYT?

@chr-hertel chr-hertel force-pushed the phpstan-exception-rule branch from 3225fa0 to de0dd9f Compare July 15, 2025 09:14
@chr-hertel chr-hertel changed the title Add PHPStan rule for catching native exceptions Add PHPStan rule forbidding native exceptions Jul 15, 2025
@valtzu
Copy link
Contributor

valtzu commented Jul 15, 2025

I wonder if it'd be possible to use cs fixer instead, to auto-replace \LogicException with Symfony\AI\Agent\Exception\LogicException under src/agent etc

Regardless, definitely a good idea to add it to the pipe 💯

@OskarStark
Copy link
Contributor

It is possible with rector from what I know

@chr-hertel chr-hertel force-pushed the phpstan-exception-rule branch 2 times, most recently from b051c28 to b12a3d9 Compare July 16, 2025 01:13
@chr-hertel chr-hertel marked this pull request as ready for review July 16, 2025 01:13
Copy link
Contributor

@OskarStark OskarStark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one 👏

@chr-hertel chr-hertel changed the title Add PHPStan rule forbidding native exceptions Add PHPStan rule forbidding native exceptions and switch remaining ones Jul 16, 2025
@chr-hertel chr-hertel force-pushed the phpstan-exception-rule branch from b12a3d9 to f1f378e Compare July 16, 2025 07:46
@chr-hertel chr-hertel merged commit bd106a0 into main Jul 16, 2025
24 checks passed
@chr-hertel chr-hertel deleted the phpstan-exception-rule branch July 16, 2025 07:47
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