tea icon indicating copy to clipboard operation
tea copied to clipboard

1332 make plugin a ctype

Open kanow opened this issue 6 months ago • 7 comments

Started refactoring to use CTypes for plugins

kanow avatar Aug 04 '25 09:08 kanow

@oliverklee can you have a look into the phpstan error? I take the Class"AbstractListTypeToCTypeUpdate" from Lina Wolf https://github.com/linawolf/list-type-migration.

I try to ignore the Error directly in the phpstan.neon

    -
      # Ignore Interface not found for AbstractListTypeToCTypeUpdate.php
      identifier: interface.notFound
      path: Classes/Upgrades/AbstractListTypeToCTypeUpdate.php

did not work and I don't know how to handle this error.

linxpinx avatar Sep 16 '25 20:09 linxpinx

@linxpinx This error means that the interface does not exist. PHPStan is right - the interface is part of the install core package, which we currently don't require. So we need to add typo3/cms-install as a production dependency for the upgrade wizard to work.

oliverklee avatar Sep 16 '25 21:09 oliverklee

@oliverklee ah ok but the wizard works. I test it in a second TYPO3 Installation and the Wizard change from list_type to CType and the Plugin works after running the wizard. Is it possible that the Class tooks the interface from the Installation TYPO3 if there is no Interface in our Test TYPO3?

linxpinx avatar Sep 17 '25 09:09 linxpinx

@linxpinx With Composer, a class or interface is available at any place if the package providing the class/interface is installed. For Composer, it doesn't matter whether the corresponding package is a direct dependency of the package that needs the class/interface, or it happens to be installed as a dependency of some other package (which could also be the root package). My guess is that the install tool package is installed in your test installation anyway, and hence the upgrade wizard class can use that interface.

It is a best practice to have all packages that a package uses as direct dependencies (either production or development) to ensure the corresponding packages are loaded and the classes/interfaces are available.

oliverklee avatar Sep 17 '25 10:09 oliverklee

… and relying on transitive dependencies is recommended against as this can lead to breakage when another dependency changes their dependencies. This happened with Georg Ringer's news extension some time ago.

oliverklee avatar Sep 17 '25 11:09 oliverklee

Pull Request Test Coverage Report for Build 17919410001

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 0 of 172 (0.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-61.9%) to 38.129%

Changes Missing Coverage Covered Lines Changed/Added Lines %
Classes/Upgrades/ListTypeToCTypeUpdate.php 0 10 0.0%
Classes/Upgrades/AbstractListTypeToCTypeUpdate.php 0 162 0.0%
<!-- Total: 0 172
Totals Coverage Status
Change from base Build 17763885857: -61.9%
Covered Lines: 106
Relevant Lines: 278

💛 - Coveralls

coveralls avatar Sep 22 '25 11:09 coveralls

This PR could be closed when #1811 is done. I opened a new PR from a new Branch cause this one was rotten.

linxpinx avatar Sep 25 '25 14:09 linxpinx