Skip to content

DI inspection complains about a class suffixes with Factory #1607

@an2riy

Description

@an2riy

Describe the bug

If you create a class with the suffix Factory and then try to add it as an argument to another class the validation complains about:
The class "..\Model\ItemFactory" does not exist but it exists.
Example:

<type name="...\Model\DataProvider">
      <arguments>
          <argument name="itemFactory" xsi:type="object">...\Model\ItemFactory</argument>
      </arguments>
</type>

image

To Reproduce

  1. Create a new module
  2. Create a model with the suffix Factory
  3. Created another model which can accept the previously created model as an argument
  4. Add configuration to etc/di.xml
<type name="...\Model\DataProvider">
      <arguments>
          <argument name="itemFactory" xsi:type="object">...\Model\ItemFactory</argument>
      </arguments>
</type>
  1. The complaint appears

Expected behavior
No complaint.

Information:

PhpStorm 2023.1.2
Build #PS-231.9011.38, built on May 17, 2023
Runtime version: 17.0.6+10-b829.9 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Linux 5.15.0-72-generic
GC: G1 Young Generation, G1 Old Generation
Memory: 5120M
Cores: 12
Registry:
editor.focus.mode.color.light=5b595c
ide.editor.tab.selection.animation=true
debugger.watches.in.variables=false
debugger.new.tool.window.layout=true
editor.caret.width=1
run.processes.with.pty=true
vcs.new.widget=true
ide.new.editor.tabs.vertical.borders=true
ide.experimental.ui=true
ide.balloon.shadow.size=0
editor.focus.mode.color.dark=5b595c

Non-Bundled Plugins:
de.femtopedia.diffplugin (2.1.10)
intellij-awk (0.4.0)
org.toml.lang (231.8109.91)
com.nasller.CodeGlancePro (1.6.3)
com.ultrahob.zerolength.plugin (0.95)
org.elasticsearch4idea (2023.1.6-231)
com.intellij.properties (231.8770.3)
String Manipulation (9.7.1)
ir.msdehghan.plugins.ansible (0.92)
indent-rainbow.indent-rainbow (2.1.0)
com.intellij.grazie.pro (0.3.224)
com.kalessil.phpStorm.phpInspectionsEA (5.0.0.0)
ru.adelf.idea.dotenv (2023.1)
de.espend.idea.php.annotation (9.3.1)
com.virtuslab.git-machete (3.8.0)
izhangzhihao.rainbow.brackets (2023.2.8)
pro.bashsupport (3.2.2.231)
lv.midiana.misc.phpstorm-plugins.deep-keys (2022.08.03.001)
fr.adrienbrault.idea.symfony2plugin (2022.1.250)
com.chrisrm.idea.MaterialThemeUI (8.6.4)
com.intellij.lang.jsgraphql (4.0.1)
com.magento.idea.magento2plugin (5.1.1)
org.sonarlint.idea (8.2.0.68615)
com.mallowigi (90.0.0)
zielu.gittoolbox (500.0.8+213)
mobi.hsz.idea.gitignore (4.5.0)
com.github.blarc.gitlab-template-lint-plugin (1.13.0)

Current Desktop: ubuntu:GNOME

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions