A practical guide for PHP and Magento teams
PhpStorm ships with two AI tools of very different reach: AI Assistant, which assists inside the editor, and Junie, which takes on tasks on its own. Anyone using both for code reviews and refactoring suggestions should understand their limits around context size and code confidentiality before feeding production PHP code through them.
Table of Contents
- 1. AI Assistant and Junie: two different tools
- 2. Installation and activation in a project
- 3. AI Assistant in everyday code review
- 4. Junie for autonomous refactoring tasks
- 5. Limits around context size
- 6. Confidentiality of code and customer data
- 7. Sensible use cases in daily work
- 8. Risky use cases and pitfalls
- 9. Integrating into the team workflow
- 10. Summary
- 11. FAQ
1. AI Assistant and Junie: two different tools
AI Assistant is designed as an assisting tool inside PhpStorm: it answers questions about selected code in a chat panel, suggests commit messages, explains unfamiliar methods, and produces refactoring suggestions on request that the developer reviews line by line and accepts or rejects individually. Every change stays a suggestion, never an automatic execution, and the human retains control at every step over what actually lands in the code.
Junie takes a decisive step further and acts as an autonomous coding agent: you phrase a task in natural language, such as adding a missing unit test or replacing an outdated API call, and Junie independently plans the necessary steps, reads relevant files, changes several files at once, and presents a finished change set for approval at the end. The difference lies in the degree of autonomy: assisting versus independently planning and executing.
2. Installation and activation in a project
Both tools ship as the AI Assistant plugin, preinstalled from PhpStorm 2024.1 onward or installable via Settings, Plugins, Marketplace. Activation happens through a JetBrains AI account, which either runs on a free tier with a limited number of requests per month or, as a paid AI Pro subscription, unlocks more requests and access to Junie. Sign-in happens under Settings, Tools, AI Assistant, where the preferred language model for chat requests can also be chosen.
For productive use in a team, a look at the project root before the first request pays off: an .aiignore file, analogous to .gitignore, explicitly excludes directories and files from every AI request. In a Magento project that typically means app/etc/env.php, all .env files, and directories with customer data fixtures, so that credentials or test-customer PII never accidentally get sent to a language model.
# Create .aiignore in the project root (analogous to .gitignore)
cat > .aiignore <<'EOF'
app/etc/env.php
*.env
var/log/
var/report/
pub/media/customer/
dev/tests/**/fixtures/*customer*
EOF
# Check AI Assistant status (Settings -> Tools -> AI Assistant)
# JetBrains account must be connected and the subscription active
3. AI Assistant in everyday code review
In day to day review work you select a diff or a single method and open Explain Code or Find Problems from the context menu to get a first automated read: potential null pointer access, unclear naming, missing type declarations, or unnecessary complexity. This does not replace a human review, but it delivers a second opinion within seconds that helps filter out obvious problems in larger pull requests before a colleague spends time on them.
The chat is especially valuable for targeted questions about unfamiliar code, such as a Magento observer class that has grown over years without comments: a question like what side effects does this method have on the cart returns a comprehensible summary that serves as a starting point for the actual functional review. It remains important to treat every answer as a hypothesis and to spot check it in the code itself rather than copying it unverified into a review comment.
4. Junie for autonomous refactoring tasks
Junie is particularly well suited for clearly scoped, mechanical tasks with a verifiable outcome: replacing a deprecated method with its successor, adding missing PHPDoc blocks according to project convention, or extending a set of similar repository classes with a new method. You describe the task in the Junie panel, the agent reads the affected files, creates a plan, executes the changes, and finally shows a complete diff across every touched file for approval.
After completion, Junie can be instructed to run the existing test suite and fix failures on its own, which noticeably speeds up iteration. In a Magento module where several plugin classes all share the same outdated constructor signature, a single Junie task can reach the goal faster than a manual search and replace across ten files, provided the result is subsequently secured through PHPStan and a human review.
Example prompt for Junie in a Magento module:
"Add missing PHPDoc blocks for every public and protected method
in all classes under app/code/Mironsoft/SeoSuite/Plugin/.
Use constructor property promotion wherever it is not yet used.
Then run 'bin/analyse app/code/Mironsoft/SeoSuite --level=5'
and fix any remaining errors."
Junie reads the files, plans the changes, executes them,
and shows a coherent diff for approval.
5. Limits around context size
Both AI Assistant and Junie work with a limited context window: only a slice of the project, usually the currently open file plus automatically detected related classes, flows into a single request. In a grown Magento monolith with hundreds of modules and deeply nested inheritance through plugins, preferences, and events, the model rarely knows the full call chain, even when the answer sounds confident.
In practice this means: for questions about the effect of a change on remote parts of the system, such as whether a changed event is also consumed by a third party module in the vendor directory, the relevant files should be explicitly added to the chat context or the answer verified through a Find Usages search. A model that does not know the context will, in doubt, hallucinate a plausible but wrong answer instead of honestly admitting uncertainty.
6. Confidentiality of code and customer data
Every request to AI Assistant or Junie leaves the local machine and is sent to the configured language model in the cloud, even though JetBrains contractually commits not to use customer data to train its own models. For projects with strict confidentiality clauses, for example clients in the finance or healthcare sector, this data transfer is itself a compliance topic that should be clarified with the client and legal counsel before use.
The already mentioned .aiignore file is the most important technical lever to limit the risk, but it does not replace an organizational rule: credentials, API keys, customer data exports, and payment provider configurations fundamentally do not belong in an AI request, even if a file was accidentally left off the ignore list. A brief glance at the selected code before sending a request is a simple habit that prevents many unnecessary data leaks.
7. Sensible use cases in daily work
AI Assistant and Junie are most reliable for tasks with a clearly verifiable outcome and a small blast radius: adding PHPDoc blocks, generating unit tests for existing, pure functions, stylistic reviews against the PSR-12 coding standard, translating error messages, or explaining unfamiliar legacy methods before a larger rewrite. Formulating an understandable commit message from an already finished diff is another case where the result is easy to verify.
The first pass over a large pull request is also a good fit: AI Assistant flags unusual patterns, duplicated code, or missing error handling before a human reviewer works through hundreds of lines of diff. That keeps human review time reserved for the genuinely hard questions, such as whether a business rule was implemented correctly, instead of spending it on spotting typos and formatting issues.
8. Risky use cases and pitfalls
Things get risky as soon as suggestions get adopted into security critical code without review: payment processing, authentication, price calculation, or discount logic are areas where a plausible sounding but subtly wrong suggestion can become expensive, for instance a mis-rounded tax calculation that only surfaces weeks later in reporting. In such areas AI suggestions should at most serve as a discussion starter, never as a substitute for a regular review by an experienced developer.
Junie's autonomy also carries its own risk: an overly broad instruction such as clean up the module can change files outside the actual intent, for example accidentally removing a method that looks dead but is actually used by a cron job. Narrow, clearly scoped tasks followed by a test run and a PHPStan pass reduce this risk considerably, while a blanket instruction without guardrails increases it.
9. Integrating into the team workflow
A team benefits from a written convention on when AI Assistant and Junie may be used: for example as a first pass before every pull request, but never as the sole approving reviewer, with the clear rule that every commit produced by Junie is flagged as AI assisted in the pull request title. This creates transparency for reviewers, who then know to pay particular attention to functional correctness rather than style.
In practice a three stage chain works well: Junie handles the mechanical groundwork, AI Assistant delivers an automated first pass over the resulting diff, and a human reviewer makes the final functional approval decision. The table below summarizes where the three approaches stand in comparison, measured by degree of autonomy, typical use, required control, and the risk of blindly trusting the outcome.
| Tool | Degree of autonomy | Typical use | Required control |
|---|---|---|---|
AI Assistant |
Assisting, suggestion per line | Explanations, reviews, PHPDoc | Review every suggestion individually |
Junie |
Autonomous, multi step plan | Mechanical refactorings, tests | Read through the entire diff |
| Manual review | No AI involved | Functional approval, security | Complete, as usual |
| Combination | Staged: Junie → AI Assistant → human | Large pull requests | Final human approval mandatory |
Mironsoft
PhpStorm setup, Docker integration, and team productivity
PhpStorm that actually runs optimally for Magento and PHP projects?
We review existing PhpStorm setups for slow indexing, unused Docker integration, and missing team conventions, then set up a configuration that is productive from the first second.
Setup Review
Optimizing indexing, interpreter, and memory settings for large Magento projects.
Docker Integration
Cleanly connecting Xdebug, PHPUnit, and database tools to the Docker setup.
Team Conventions
Standardizing inspection profiles, code style, and live templates project-wide.
10. Summary
AI Assistant and Junie: The Essentials at a Glance
AI Assistant
Assisting chat and editor suggestions, every change is confirmed individually.
Junie
Autonomous agent for multi step, mechanical tasks with a final approval diff.
Context limit
Limited context window, the model often does not fully know remote call chains.
Confidentiality
Use .aiignore for sensitive paths, never send credentials in an AI request.