diff --git a/.github/ci/files/config/packages/security.yaml b/.github/ci/files/config/packages/security.yaml index 68372de..f141726 100644 --- a/.github/ci/files/config/packages/security.yaml +++ b/.github/ci/files/config/packages/security.yaml @@ -4,6 +4,7 @@ security: id: Pimcore\Security\User\UserProvider firewalls: + pimcore_studio: '%pimcore_studio_backend.firewall_settings%' dev: pattern: ^/(_(profiler|wdt)|css|images|js)/ security: false @@ -15,16 +16,10 @@ security: http_basic: ~ access_control: - # Pimcore admin ACl // DO NOT CHANGE! - - { path: ^/admin/settings/display-custom-logo, roles: PUBLIC_ACCESS } - - { path: ^/admin/login/2fa-verify, roles: IS_AUTHENTICATED_2FA_IN_PROGRESS } - - { path: ^/admin/login/2fa-setup, roles: ROLE_PIMCORE_USER } - - { path: ^/admin/login/2fa, roles: IS_AUTHENTICATED_2FA_IN_PROGRESS } - - { path: ^/admin/login$, roles: PUBLIC_ACCESS } - - { path: ^/admin/login/(login|lostpassword|deeplink|csrf-token)$, roles: PUBLIC_ACCESS } - - { path: ^/admin, roles: ROLE_PIMCORE_USER } + - { path: ^/pimcore-studio/api/(docs|docs/json|translations|user/reset-password)$, roles: PUBLIC_ACCESS } + - { path: ^/pimcore-studio/api, roles: ROLE_PIMCORE_USER } - { path: ^/asset/webdav, roles: ROLE_PIMCORE_USER } role_hierarchy: # Pimcore admin // DO NOT CHANGE! - ROLE_PIMCORE_ADMIN: [ROLE_PIMCORE_USER] \ No newline at end of file + ROLE_PIMCORE_ADMIN: [ROLE_PIMCORE_USER] diff --git a/composer.json b/composer.json index 616b1cf..0824edc 100644 --- a/composer.json +++ b/composer.json @@ -28,12 +28,12 @@ "friendsofphp/proxy-manager-lts": "^1" }, "require-dev": { - "phpstan/phpstan": "1.12.15", - "phpstan/phpstan-symfony": "^1.2.20", + "phpstan/phpstan": "2.1.40", + "phpstan/phpstan-symfony": "^2.0", "phpunit/phpunit": "^10.2", - "codeception/codeception": "^5.0.10", - "codeception/module-symfony":"^3.1.1", - "codeception/phpunit-wrapper": "^9", + "codeception/codeception": "^5.3.1", + "codeception/module-symfony":"^3.7.1", + "codeception/phpunit-wrapper": "^10", "codeception/module-asserts": "^2", "fakerphp/faker": "^1.23" }, diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 9738db5..7281640 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -6,7 +6,7 @@ parameters: path: src/Proxy/Events/ProxyEvent.php - - message: "#^Parameter \\#1 \\$returnType of method Pimcore\\\\Bundle\\\\StaticResolverBundle\\\\Proxy\\\\Events\\\\ProxyEvent\\:\\:getTypeArray\\(\\) expects ReflectionIntersectionType\\|ReflectionNamedType\\|ReflectionUnionType\\|null, ReflectionType\\|null given\\.$#" + message: "#^Parameter \\#1 \\$returnType of method Pimcore\\\\Bundle\\\\StaticResolverBundle\\\\Proxy\\\\Events\\\\ProxyEvent\\:\\:getTypeArray\\(\\) expects ReflectionIntersectionType\\|ReflectionNamedType\\|ReflectionUnionType\\|null, ReflectionType(\\|null)? given\\.$#" count: 1 path: src/Proxy/Events/ProxyEvent.php @@ -16,7 +16,7 @@ parameters: path: src/Proxy/Events/ProxyPreInterceptor.php - - message: "#^Parameter \\#1 \\$returnType of method Pimcore\\\\Bundle\\\\StaticResolverBundle\\\\Proxy\\\\Events\\\\ProxyPreInterceptor\\:\\:getTypeArray\\(\\) expects ReflectionIntersectionType\\|ReflectionNamedType\\|ReflectionUnionType\\|null, ReflectionType\\|null given\\.$#" + message: "#^Parameter \\#1 \\$returnType of method Pimcore\\\\Bundle\\\\StaticResolverBundle\\\\Proxy\\\\Events\\\\ProxyPreInterceptor\\:\\:getTypeArray\\(\\) expects ReflectionIntersectionType\\|ReflectionNamedType\\|ReflectionUnionType\\|null, ReflectionType(\\|null)? given\\.$#" count: 1 path: src/Proxy/Events/ProxyPreInterceptor.php @@ -28,4 +28,17 @@ parameters: - message: "#^Unable to resolve the template type RealObjectType in call to method ProxyManager\\\\Factory\\\\RemoteObjectFactory\\:\\:createProxy\\(\\)$#" count: 2 - path: src/Proxy/Factory/RemoteObject/RemoteObjectFactory.php \ No newline at end of file + path: src/Proxy/Factory/RemoteObject/RemoteObjectFactory.php + + - + message: "#^Method Pimcore\\\\Bundle\\\\StaticResolverBundle\\\\DependencyInjection\\\\Configuration\\:\\:getConfigTreeBuilder\\(\\) return type with generic class Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\TreeBuilder does not specify its types\\: T$#" + count: 1 + path: DependencyInjection/Configuration.php + + - + message: "#^Method Pimcore\\\\Bundle\\\\StaticResolverBundle\\\\.* has parameter .* with no value type specified in iterable type array\\.$#" + path: ** + + - + message: "#^Method Pimcore\\\\Bundle\\\\StaticResolverBundle\\\\.* return type has no value type specified in iterable type array\\.$#" + path: ** \ No newline at end of file diff --git a/phpstan.neon b/phpstan.neon index afac18f..82642e6 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,8 +1,6 @@ parameters: level: 6 reportUnmatchedIgnoredErrors: false - checkMissingIterableValueType: false - checkGenericClassInNonGenericObjectType: false paths: - src bootstrapFiles: diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index 5634938..ea782e7 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -25,6 +25,8 @@ class Configuration implements ConfigurationInterface { /** * {@inheritdoc} + * + * @return TreeBuilder<'array'> */ public function getConfigTreeBuilder(): TreeBuilder { diff --git a/src/PimcoreStaticResolverBundle.php b/src/PimcoreStaticResolverBundle.php index 115b5b8..df73c8b 100644 --- a/src/PimcoreStaticResolverBundle.php +++ b/src/PimcoreStaticResolverBundle.php @@ -16,14 +16,10 @@ use function dirname; use Pimcore\Bundle\StaticResolverBundle\DependencyInjection\PimcoreStaticResolverExtension; use Pimcore\Extension\Bundle\AbstractPimcoreBundle; -use Pimcore\Extension\Bundle\PimcoreBundleAdminClassicInterface; -use Pimcore\Extension\Bundle\Traits\BundleAdminClassicTrait; use Symfony\Component\DependencyInjection\Extension\ExtensionInterface; -class PimcoreStaticResolverBundle extends AbstractPimcoreBundle implements PimcoreBundleAdminClassicInterface +class PimcoreStaticResolverBundle extends AbstractPimcoreBundle { - use BundleAdminClassicTrait; - public function getContainerExtension(): ExtensionInterface { return new PimcoreStaticResolverExtension(); diff --git a/src/Proxy/Adapter/Remote/StrictObjectAdapter.php b/src/Proxy/Adapter/Remote/StrictObjectAdapter.php index 202d4a6..e0c0ef3 100644 --- a/src/Proxy/Adapter/Remote/StrictObjectAdapter.php +++ b/src/Proxy/Adapter/Remote/StrictObjectAdapter.php @@ -64,6 +64,6 @@ private function methodIsPublic(string $method): bool // @codeCoverageIgnoreEnd } - return !(!is_object($reflection) || !$reflection->isPublic()); + return $reflection->isPublic(); } } diff --git a/src/Proxy/Events/ProxyEvent.php b/src/Proxy/Events/ProxyEvent.php index 2407b27..259891e 100644 --- a/src/Proxy/Events/ProxyEvent.php +++ b/src/Proxy/Events/ProxyEvent.php @@ -81,7 +81,7 @@ private function checkReturnType(mixed $response): void $returnType = $method->getReturnType(); - if ($response === null && $returnType?->allowsNull()) { + if ($response === null && $returnType->allowsNull()) { return; } @@ -137,7 +137,7 @@ private function addSpecialTypes(array $returnTypeArray): array * @return array */ private function getTypeArray( - ReflectionIntersectionType|ReflectionNamedType|ReflectionUnionType|null $returnType + \ReflectionType|null $returnType ): array { $returnTypeArray = []; if ($returnType instanceof ReflectionUnionType || $returnType instanceof ReflectionIntersectionType) { diff --git a/src/Proxy/Events/ProxyPreInterceptor.php b/src/Proxy/Events/ProxyPreInterceptor.php index 55f6ec4..43a16ed 100644 --- a/src/Proxy/Events/ProxyPreInterceptor.php +++ b/src/Proxy/Events/ProxyPreInterceptor.php @@ -99,7 +99,7 @@ private function checkReturnType(mixed $response): void $returnType = $method->getReturnType(); - if ($response === null && $returnType?->allowsNull()) { + if ($response === null && $returnType->allowsNull()) { return; } @@ -155,7 +155,7 @@ private function addSpecialTypes(array $returnTypeArray): array * @return array */ private function getTypeArray( - ReflectionIntersectionType|ReflectionNamedType|ReflectionUnionType|null $returnType + \ReflectionType|null $returnType ): array { $returnTypeArray = []; if ($returnType instanceof ReflectionUnionType || $returnType instanceof ReflectionIntersectionType) {