Skip to content

Commit 7a10283

Browse files
committed
feat: add php base support
1 parent 75cd35f commit 7a10283

File tree

7 files changed

+72
-1
lines changed

7 files changed

+72
-1
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ platformVersion = 2025.1.1
1414

1515
# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
1616
# Example: platformPlugins = com.jetbrains.php:203.4449.22, org.intellij.scala:2023.3.27@EAP
17-
platformPlugins =
17+
platformPlugins = com.jetbrains.php:251.23774.16,com.jetbrains.hackathon.indices.viewer:1.30
1818
# Example: platformBundledPlugins = com.intellij.java
1919
platformBundledPlugins =
2020
# Example: platformBundledModules = intellij.spellchecker
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package com.github.xepozz.temporal.languages.php
2+
3+
object TemporalClasses {
4+
const val ACTIVITY = "\\Temporal\\Activity\\ActivityInterface"
5+
const val WORKFLOW = "\\Temporal\\Workflow\\WorkflowInterface"
6+
const val SIGNAL_METHOD = "\\Temporal\\Workflow\\SignalMethod"
7+
const val CHILD_WORKFLOW_STUB = "\\Temporal\\Workflow\\ChildWorkflowStubInterface"
8+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package com.github.xepozz.temporal.languages.php
2+
3+
import com.intellij.openapi.project.Project
4+
import com.intellij.psi.PsiElement
5+
import com.jetbrains.php.lang.psi.elements.PhpNamedElement
6+
import com.jetbrains.php.lang.psi.resolve.types.PhpType
7+
import com.jetbrains.php.lang.psi.resolve.types.PhpTypeProvider4
8+
9+
class TemporalTypeProvider : PhpTypeProvider4 {
10+
override fun getKey() = '\uBEB1'
11+
override fun getType(p0: PsiElement?): PhpType? {
12+
TODO("Not yet implemented")
13+
}
14+
15+
override fun complete(
16+
p0: String?,
17+
p1: Project?
18+
): PhpType? {
19+
TODO("Not yet implemented")
20+
}
21+
22+
override fun getBySignature(
23+
p0: String?,
24+
p1: Set<String?>?,
25+
p2: Int,
26+
p3: Project?
27+
): Collection<PhpNamedElement?>? {
28+
TODO("Not yet implemented")
29+
}
30+
31+
override fun interceptsNativeSignature() = true
32+
33+
34+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package com.github.xepozz.temporal.languages.php
2+
3+
object UtilClasses {
4+
const val REACT_PROMISE = "\\React\\Promise\\PromiseInterface"
5+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.github.xepozz.temporal.languages.php
2+
3+
import com.intellij.openapi.util.TextRange
4+
import com.intellij.psi.ElementManipulators
5+
import com.intellij.psi.PsiLanguageInjectionHost
6+
import com.jetbrains.php.lang.psi.elements.PhpAttributesOwner
7+
import com.jetbrains.php.lang.psi.elements.PhpClass
8+
9+
fun PhpClass.hasTrait(fqn: String): Boolean = traits.any { it.fqn == fqn }
10+
fun PhpAttributesOwner.hasAttribute(fqn: String): Boolean = attributes.any { it.fqn == fqn }
11+
fun PhpClass.hasInterface(fqn: String): Boolean = implementedInterfaces.any { it.fqn == fqn }
12+
fun PhpClass.hasSuperClass(fqn: String): Boolean = superClasses.any { it.fqn == fqn }
13+
val PsiLanguageInjectionHost.contentRange: TextRange
14+
get() = ElementManipulators.getValueTextRange(this).shiftRight(textRange.startOffset)
15+
16+
//fun PhpReference.getSignatures(): Collection<String> = signature.split('|')
17+
//fun PhpReference.hasSignature(signatureToFind: String): Boolean = getSignatures().any { it==signatureToFind }
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<idea-plugin>
2+
<extensions defaultExtensionNs="com.jetbrains.php">
3+
<typeProvider4
4+
implementation="com.github.xepozz.temporal.languages.php.TemporalTypeProvider"/>
5+
</extensions>
6+
</idea-plugin>

src/main/resources/META-INF/plugin.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<vendor email="[email protected]" url="https://github.com/xepozz">Dmitrii Derepko (@xepozz)</vendor>
66

77
<depends>com.intellij.modules.platform</depends>
8+
<depends optional="true" config-file="language-php.xml">com.jetbrains.php</depends>
89

910
<resource-bundle>messages.TemporalBundle</resource-bundle>
1011

0 commit comments

Comments
 (0)