Skip to content

Commit

Permalink
[FEATURE] Add support for TYPO3 12
Browse files Browse the repository at this point in the history
Closes #68
  • Loading branch information
oliverklee committed Oct 18, 2022
1 parent 2ec248e commit ba0f18f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,18 @@ jobs:
- typo3-version: "^11.5"
php-version: "8.2"
composer-flags: " --prefer-lowest"
- typo3-version: "^12.0"
php-version: "8.1"
composer-flags: ""
- typo3-version: "^12.0"
php-version: "8.1"
composer-flags: " --prefer-lowest"
- typo3-version: "^12.0"
php-version: "8.2"
composer-flags: ""
- typo3-version: "^12.0"
php-version: "8.2"
composer-flags: " --prefer-lowest"

steps:
- name: "Checkout"
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"php": "^7.2 || ^8.0",
"phpstan/phpstan": "^1.8.9",
"nikic/php-parser": "^4.15.1",
"typo3/cms-core": "^10.4 || ^11.5",
"typo3/cms-extbase": "^10.4 || ^11.5"
"typo3/cms-core": "^10.4 || ^11.5 || ^12.0",
"typo3/cms-extbase": "^10.4 || ^11.5 || ^12.0"
},
"require-dev": {
"consistence-community/coding-standard": "^3.10.1",
Expand Down
9 changes: 7 additions & 2 deletions src/Type/ObjectManagerDynamicReturnTypeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,24 @@
use PHPStan\Type\ObjectType;
use PHPStan\Type\Type;

/**
* @deprecated This class will be dropped once support for TYPO3 <= 10 is dropped.
*/
class ObjectManagerDynamicReturnTypeExtension implements DynamicMethodReturnTypeExtension
{

public function getClass(): string
{
return \TYPO3\CMS\Extbase\Object\ObjectManagerInterface::class;
return interface_exists(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface::class)
? \TYPO3\CMS\Extbase\Object\ObjectManagerInterface::class : '';
}

public function isMethodSupported(
MethodReflection $methodReflection
): bool
{
return $methodReflection->getName() === 'get';
return interface_exists(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface::class)
&& $methodReflection->getName() === 'get';
}

public function getTypeFromMethodCall(
Expand Down

0 comments on commit ba0f18f

Please sign in to comment.