Welcome Guest, Not a member yet? Register   Sign In
which linter to use (and how to setup)?
#1

Hi,
I am using codeigniter4 (first time). At work, I used laravel based project with a very good psalm support.

I am struggling to get psalm to work with ci4 -- out of box. A lot of errors are being thrown -- most of which is about missing functions and classes!
I tried tweaking settings a bit but I didn't get far.

Before I spend more time "having fun" fixing it, I was wondering if there is a tutorial/library that allows me to integrete psalm (or any other linter)?

In other words -- what is the recommended way to lint ci4 project?
best,
  Dilawar
Reply
#2

Hi Dilawar,
You're definitely not alone—Psalm can be tricky with CodeIgniter 4 due to how CI4 structures its services and uses magic methods. A lot of the missing function/class issues stem from that.

While there's no official support, some developers use PHPStan instead, since it handles dynamic code a bit better. For Psalm, you might have to create stub files or use ignoreIssueForFile pragmas to suppress false positives.

Setting a baseline with psalm --init and then selectively tweaking it has worked for some. Also, excluding the system/ folder from scanning helps reduce noise.

If you're not tied to Psalm, PHPStan with a custom config may get you linting faster with less hassle.

Hope this helps!
Hello I'm Mance Joan.
Reply
#3

You can try using the bootstrap file specifically for psalm. Look at https://github.com/codeigniter4/CodeIgniter4 then check psalm_autoload.php
Reply




Theme © iAndrew 2016 - Forum software by © MyBB