Jump to content
Sign in to follow this  
PapaKai

PHPStan / Static Code Analysis

Recommended Posts

Posted (edited)

Hi there,

I am interested in using phpstan for static code analysis, but wasn't able to get WHMCS source files bootstrapped.
Does anyone of you guys have experience and a working setup?

If I try to load/bootstrap the init.php, I am ending in "Fatal error: Uncaught Error: Class 'Hoa\Event\Bucket' not found ...". This is independent of dealing just with freshly unzipped archive or using source files of a installed whmcs system.
When just loading files from includes directory, not all functions I am looking for are finally present.

ioncube loader is installed and up & working in our setup.

Thanks

Kai

Edited by PapaKai

Share this post


Link to post
Share on other sites

Hello. Just a quick question for verification:

- You want to code analysis encrypted commercial files ? 

Share this post


Link to post
Share on other sites
Posted (edited)

No, we are writing Modules/Addons for WHMCS. The code is finally a mixture of our produced code that is in some cases using functions / classes of WHMCS (e.g. https://classdocs.whmcs.com/8.5/index.html).
Therefore, it is necessary to bootstrap the necessary underlying system (or a subset of files or so), so that phpstan is able to identify return types, parameter types etc. and to use it for validation.

I am not interested in analysing WHMCS itself (that would even mean doing reverse engineering - which is prohibited by WHMCS' EULA.

Edited by PapaKai

Share this post


Link to post
Share on other sites
1 hour ago, PapaKai said:

No, we are writing Modules/Addons for WHMCS. The code is finally a mixture of our produced code that is in some cases using functions / classes of WHMCS (e.g. https://classdocs.whmcs.com/8.5/index.html).
Therefore, it is necessary to bootstrap the necessary underlying system (or a subset of files or so), so that phpstan is able to identify return types, parameter types etc. and to use it for validation.

I am not interested in analysing WHMCS itself (that would even mean doing reverse engineering - which is prohibited by WHMCS' EULA.

Thank you for your confirmation.

2 minutes ago, PapaKai said:

Looks like I got it working.

Happy to hear that.

As this is a community board, please post your solution to assist other users, dealing with the same issue. If you like to.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated