cedricziel / idea-php-typo3-plugin

TYPO3 CMS Plugins for IntelliJ IDEA / PhpStorm
MIT License
96 stars 8 forks source link

Type inference for objectManager::get does not work #305

Closed liayn closed 4 years ago

liayn commented 4 years ago

PhpStorm 2020.1 Build #PS-201.6668.153, built on April 13, 2020 Plugin version: 201.5.0

Demo code in an extbase repository:

$dataMapper = $this->objectManager->get(\TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper::class);

$dataMapper is of type object.

cedricziel commented 4 years ago

Is the objectmanager inferred as being of type ObjectManagerInterface/ObjectManager?

liayn commented 4 years ago

It shows ObjectManagerInterface

cedricziel commented 4 years ago

Checked with 9d84e9b9f198a506e8d1b45214f32382f4319bd2, but I cant seem to reproduce the behaviour.. is the plugin activated?

liayn commented 4 years ago

Double-checked the settings, yes it is activated

liayn commented 4 years ago

Updated to 201.5.1 today, still the same problem.

liayn commented 4 years ago

I think I finally found the main reason: The problem occurs if the Core is only added via Include Path (External Libraries). If the Core is present in the current project directly everything works.

What does not work: Open extension as project and set core as Include Path.

What seems to work: Open a whole website project where the Core source is part of the project.

nitori commented 4 years ago

I have the same issue, but I can't get it to work even if I include the typo3 source directly in the project.

GeneralUtility::makeInstance has the same issue for me.

liayn commented 4 years ago

Thanks for the update.

I updated to PhpStorm 2020.1.1 (Build #PS-201.7223.96, built on April 30, 2020) and the plugin (201.5.4) and I can confirm that #306 is indeed resolved.

Unfortunately not this one here.

Using $uriBuilder = $this->objectManager->get(UriBuilder::class); inside an Extbase controller within a project with TYPO3 v8 core source present only yields object as type for $uriBuilder.

cedricziel commented 4 years ago

Hmm. Neverending issue... re-opening for further tracking :)

cedricziel commented 4 years ago

I am absolutely out of luck (this is a v8 core in the libraries):

PhpStorm 2020.1.1
Build #PS-201.7223.96, built on April 30, 2020
Licensed to TYPO3 CMS Plugins for IntelliJ IDEA / PhpStorm / Cedric Ziel
Subscription is active until November 19, 2020
For non-commercial open source development only.
Runtime version: 11.0.6+8-b765.40 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.15.4
GC: ParNew, ConcurrentMarkSweep
Memory: 1979M
Cores: 12
Registry: run.processes.with.pty=TRUE
Non-Bundled Plugins: PsiViewer, com.cedricziel.idea.typo3
Bildschirmfoto 2020-05-02 um 10 25 57
cedricziel commented 4 years ago

Any other non-bundled plugins that might break it?

liayn commented 4 years ago
PhpStorm 2020.1.1
Build #PS-201.7223.96, built on April 30, 2020
....
Runtime version: 11.0.6+8-b765.40 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0
GC: ParNew, ConcurrentMarkSweep
Memory: 3891M
Cores: 12
Registry: run.processes.with.pty=TRUE, ide.tooltip.initialDelay=720
Non-Bundled Plugins: com.urswolfer.intellij.plugin.gerrit, YAML/Ansible support, com.intellij.ideolog, ru.adelf.idea.dotenv, com.cedricziel.idea.typo3, de.espend.idea.php.annotation, de.sgalinski.fluid.plugin.id, de.sgalinski.typoscript.enterprise.plugin.id
liayn commented 4 years ago

grafik

liayn commented 4 years ago

I disabled all non-builtin plugins and invalidated caches and restarted... still no change :-(

liayn commented 4 years ago

datetimetest.zip Here is a demo extension where I use an include to the Core master-sources (External libraries). Inside HistoryRepository the type "calculation" fails. Maybe this helps.

froemken commented 4 years ago

Interesting: I have just deactivated the PHP Inspections (EA Extended) Plugin, restarted PhpStorm, and wow, I was asked if I want to use auto-settings of your TYPO3-Plugin suddenly. After activating them (again), auto-completion works correctly.

liayn commented 4 years ago

I don't know what happened, but suddenly it's working again. Closing this again.

rlvk-tc commented 3 years ago

This is still an issue. We are multiple people experiencing it still. We have the core code mapped in external libraries, which is basically the only way we can work. It once worked, but it's been a while since it worked correctly.

It would be great to open this issue again 😄