Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6876801
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:31:23+00:00 2026-05-27T04:31:23+00:00

There seems to be quite a lot of static code analysis tools for PHP,

  • 0

There seems to be quite a lot of static code analysis tools for PHP, could you please suggest the one, which can detect exceptions, which are thrown in the PHP code, but are never caught? (the ones, which can theoretically stop the execution on the PHP script).

I would be happy enough to see only stuff like throw new SomeException(), where SomeException extends Exception.

I am not looking for something too sophisticated – just to warn me that if I run someFunctionThatCanThrow (’cause there is throw statement inside) from index.php (you get the point), I can get in trouble. Even if in the runtime that would never happen.

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T04:31:23+00:00Added an answer on May 27, 2026 at 4:31 am

    PHPLint seems to be the answer. For example, it parses

    <?php
    
    function some()
    {
        if (time() == 123) {
            throw new Exception("I can't happen");
        }
    }
    
    some();
    

    , which will never throw an exception (unless you’re in the past), into:

    BEGIN parsing of test-cSdHoW
    1:      <?php
    2:      
    3:      function some()
    4:      {
    5:       if (time() == 123) {
    6:        throw new Exception("I can't happen");
    
              throw new Exception("I can't happen");
                                                    \_ HERE
    ==== 6: notice: here generating exception(s) Exception
    
              throw new Exception("I can't happen");
                                                    \_ HERE
    ==== 6: ERROR: exception(s) must be caught or declared to be thrown: Exception
    7:       }
    8:      }
    9:      
    10:     some();
    ==== 3: notice: guessed signature of the function `some()' as void()
    
            some();
                 \_ HERE
    ==== 10: notice: here generating exception(s) Exception
    
            some();
                 \_ HERE
    ==== 10: Warning: uncaught exception(s): Exception
    END parsing of test-cSdHoW
    ==== ?: notice: unused package `dummy.php'
    ==== ?: notice: required module `standard'
    Overall test results: 1 errors, 1 warnings.
    

    So that’s exactly what I was asking for 🙂 Adding a docblock and catching the exception results in no more errors or warnings from PHPLint.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There seems to be quite a lot of confusion regarding integrating Maven with GWT
There seems to be quite a bit of folklore knowledge floating about in restricted
I've noticed that there seems to be quite a bit of hostility towards Linq
I want to use JOGL (for Clojure, not Java). There seems to be quite
Atomikos is quite verbose when used. There seems to be lots of INFO messages
There seems to be a lot of heated discussion on the net about the
I have a model class for which it makes quite a lot of sense
My project contains a lot of classes, a bunch of which can be described
There are quite a lot of unittesting frameworks out there for .NET. I found
There seems to be no good way to localize a WPF application. MSDN seems

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.