Skip to content

Conversation

@michalsn
Copy link
Member

@michalsn michalsn commented Jan 2, 2026

Description
This PR excludes MockCommon.php from PHPStan scan for consistent results.

From my understanding, PHPStan scanned both function definitions, and depending on which it loaded first (or cached), it could detect different signatures.

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value (without duplication)
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@datamweb
Copy link
Contributor

datamweb commented Jan 3, 2026

Before anything else, it’s important to note that this script is not written in a cross-platform way.
The current Composer command relies on bash, which causes execution issues on Windows environments.

CodeIgniter4/composer.json

Lines 115 to 116 in 6f5c1d7

"bash -c \"rm -rf utils/phpstan-baseline/*.neon\"",
"bash -c \"touch utils/phpstan-baseline/loader.neon\"",

When using the php vendor/bin/phpstan commands, the script runs without any errors on Windows.

PS I:\work\Github\CodeIgniter4> php vendor/bin/phpstan
Note: Using configuration file I:\work\Github\CodeIgniter4\phpstan.neon.dist.
 895/895 [============================] 100%



 [OK] No errors

@paulbalandan
Copy link
Member

paulbalandan commented Jan 3, 2026

What do you mean? When I wrote that before, I considered it also for Windows. It can be written directly as rm -rf ... but the bash -c part ensures Windows can run it too. Of course, you need first to have Bash for Windows installed.

And that bash is usually installed if you installed the git for windows installed with all the cli tools included with it.

@datamweb
Copy link
Contributor

datamweb commented Jan 3, 2026

What do you mean? When I wrote that before, I considered it also for Windows. It can be written directly as rm -rf ... but the bash -c part ensures Windows can run it too. Of course, you need first to have Bash for Windows installed.

And that bash is usually installed if you installed the git for windows installed with all the cli tools included with it.

So, the command's successful execution depends on a specific user prerequisite and configuration having Git Bash installed and added to the system's PATH.

This is considered a hidden dependency. Just as I was unable to run it at first, other users are likely unaware of this requirement and will probably face the same issue.

@paulbalandan
Copy link
Member

As I remember it, when I was starting developing on Windows, one of the things I set up first is install git for windows including all its tools as that provides more or less the experience of working on unix. I think this is not a hidden dependency for this project but something expected when contributing.

However, if you think this can be improved, please feel free to propose a change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants