Skip to content

Perhaps a contract is incomplete when using a trait #1996

@Simbiat

Description

@Simbiat
Subject Details
Plugin Php Inspections (EA Ultimate), 2025.4
Language level e.g. PHP 8.5

Current behaviour

When I have contracts violations inspection enabled, and open a class like this one, which is not implementing any interfaces, but instead has a trait, the class is highlighted for the respective inspection:

Image

Expected behaviour

No highlights, since this class uses a trait, and it would not make sense for it to have just the trait functions.

Environment details

PhpStorm 2025.3.1
Build #PS-253.29346.151, built on December 19, 2025
Source revision: 266020cb797a8
Licensed to Dmitrii Kustov
You have a perpetual fallback license for this version.
Subscription is active until August 11, 2028.
Runtime version: 21.0.9+1-b1163.86 amd64 (JCEF 137.0.17)
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Toolkit: sun.awt.windows.WToolkit
Windows 11.0
GC: G1 Young Generation, G1 Concurrent GC, G1 Old Generation
Memory: 5120M
Cores: 16
Registry:
  debugger.new.tool.window.layout=true
  run.processes.with.pty=TRUE
  ide.experimental.ui=true
  llm.jcp.analytics.endpoint.url=https://api.jetbrains.cloud/analytics/events/push
  eslint.service.node.path=--max_old_space_size=12000
  terminal.new.ui=true
Non-Bundled Plugins:
  Subversion (253.29346.170)
  ru.adelf.idea.dotenv (253.29346.157)
  com.intellij.mermaid (0.0.26+IJ.252)
  org.jetbrains.plugins.remote-run (253.29346.170)
  com.jetbrains.restClient (253.29346.170)
  com.intellij.ml.llm (253.29346.157)
  de.espend.idea.php.annotation (12.0.2)
  fr.adrienbrault.idea.symfony2plugin (2025.1.282)
  com.kalessil.phpStorm.phpInspectionsUltimate-mp (2025.4)
  com.laravel_idea.plugin (12.0.0.253)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions