diff --git a/.github/workflows/codeception.yaml b/.github/workflows/codeception.yaml index 0fe6f24ee..b2ab52bf7 100644 --- a/.github/workflows/codeception.yaml +++ b/.github/workflows/codeception.yaml @@ -21,41 +21,10 @@ env: jobs: codeception-tests: - name: "Codeception tests" - runs-on: "ubuntu-20.04" - continue-on-error: ${{ matrix.experimental }} - strategy: - matrix: - include: - - { php-version: 8.2, dependencies: lowest, pimcore_version: "", experimental: false } - - steps: - - name: "Checkout code" - uses: "actions/checkout@v2" - - - name: "Install PHP" - uses: "shivammathur/setup-php@v2" - with: - coverage: xdebug - ini-values: display_errors=On, display_startup_errors=On, error_reporting=32767 - php-version: "${{ matrix.php-version }}" - - - name: Install SSH Key # this is necessary for Composer to be able to clone source from pimcore/ee-pimcore - uses: shimataro/ssh-key-action@v2 - with: - key: ${{ secrets.SSH_PRIVATE_KEY_PIMCORE_DEPLOYMENTS_USER }} - known_hosts: 'TBD' - - - name: "Add authentication for private pimcore packages" - run: | - composer config repositories.private-packagist composer https://repo.pimcore.com/github-actions/ - composer config --global --auth http-basic.repo.pimcore.com github-actions ${{ secrets.COMPOSER_PIMCORE_REPO_PACKAGIST_TOKEN }} - - - - name: "Install dependencies with Composer" - uses: "ramsey/composer-install@v2" - with: - dependency-versions: "${{ matrix.dependencies }}" - - - name: "Run Codeception" - run: "vendor/bin/codecept run -c . -vvv --xml --coverage-xml" \ No newline at end of file + uses: pimcore/workflows-collection-public/.github/workflows/reusable-codeception-tests-8-2-only.yaml@main + with: + APP_ENV: test + PIMCORE_TEST: 1 + secrets: + COMPOSER_PIMCORE_REPO_PACKAGIST_TOKEN: ${{ secrets.COMPOSER_PIMCORE_REPO_PACKAGIST_TOKEN }} + SSH_PRIVATE_KEY_PIMCORE_DEPLOYMENTS_USER: ${{ secrets.SSH_PRIVATE_KEY_PIMCORE_DEPLOYMENTS_USER }} \ No newline at end of file diff --git a/.github/workflows/php-cs-fixer.yaml b/.github/workflows/php-cs-fixer.yaml index 3d939199a..0b2a79f11 100644 --- a/.github/workflows/php-cs-fixer.yaml +++ b/.github/workflows/php-cs-fixer.yaml @@ -15,18 +15,10 @@ permissions: contents: read jobs: - php-cs-fixer: - permissions: - contents: write # for stefanzweifel/git-auto-commit-action to push code in repo - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - ref: ${{ github.head_ref }} - - - name: PHP-CS-Fixer - uses: docker://oskarstark/php-cs-fixer-ga:latest - - - uses: stefanzweifel/git-auto-commit-action@v4 - with: - commit_message: Apply php-cs-fixer changes \ No newline at end of file + php-style: + uses: pimcore/workflows-collection-public/.github/workflows/reusable-php-style.yaml@main + secrets: + PHP_CS_FIXER_GITHUB_TOKEN: ${{ secrets.PHP_CS_FIXER_GITHUB_TOKEN }} + with: + head_ref: ${{ github.ref }} + config_file: .php-cs-fixer.dist.php \ No newline at end of file diff --git a/.github/workflows/poeditor-export.yaml b/.github/workflows/poeditor-export.yaml index ecf9cb0a6..197581209 100644 --- a/.github/workflows/poeditor-export.yaml +++ b/.github/workflows/poeditor-export.yaml @@ -12,11 +12,7 @@ permissions: contents: read jobs: - poeditor: - runs-on: ubuntu-latest - steps: - - name: Trigger workflow in pimcore/poeditor-export-action - env: - GH_TOKEN: ${{ secrets.POEDITOR_ACTION_TRIGGER_TOKEN }} - run: | - gh workflow run -R pimcore/poeditor-export-action poeditor-export.yaml \ No newline at end of file + php-style: + uses: pimcore/workflows-collection-public/.github/workflows/reusable-poeditor.yaml@main + secrets: + POEDITOR_ACTION_TRIGGER_TOKEN: ${{ secrets.POEDITOR_ACTION_TRIGGER_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/static-analysis.yaml b/.github/workflows/static-analysis.yaml index 99f69f7e6..aee55f17a 100644 --- a/.github/workflows/static-analysis.yaml +++ b/.github/workflows/static-analysis.yaml @@ -18,62 +18,8 @@ on: - "*_actions" jobs: - static-analysis-phpstan: - name: "Static Analysis with PHPStan" - runs-on: "ubuntu-20.04" - strategy: - matrix: - include: - - { php-version: "8.2", dependencies: "highest", experimental: false } - - { php-version: "8.2", dependencies: "highest", pimcore_version: "11.x-dev as 11.99.9", experimental: true } - steps: - - name: "Checkout code" - uses: "actions/checkout@v2" - - - name: "Install PHP" - uses: "shivammathur/setup-php@v2" - with: - coverage: "none" - php-version: "${{ matrix.php-version }}" - - - name: Install SSH Key # this is necessary for Composer to be able to clone source from pimcore/ee-pimcore - uses: shimataro/ssh-key-action@v2 - with: - key: ${{ secrets.SSH_PRIVATE_KEY_PIMCORE_DEPLOYMENTS_USER }} - known_hosts: 'TBD' - - - name: "Add authentication for private pimcore packages" - run: | - composer config repositories.private-packagist composer https://repo.pimcore.com/github-actions/ - composer config --global --auth http-basic.repo.pimcore.com github-actions ${{ secrets.COMPOSER_PIMCORE_REPO_PACKAGIST_TOKEN }} - - - name: "Setup Pimcore environment" - run: | - .github/ci/scripts/setup-pimcore-environment.sh - - - name: "Update Pimcore version" - env: - PIMCORE_VERSION: "${{ matrix.pimcore_version }}" - run: | - if [ ! -z "$PIMCORE_VERSION" ]; then - composer require --no-update pimcore/pimcore:"${PIMCORE_VERSION}" - fi - - - name: "Install dependencies with Composer" - uses: "ramsey/composer-install@v2" - with: - dependency-versions: "${{ matrix.dependencies }}" - - - name: "Run a static analysis with phpstan/phpstan" - run: "vendor/bin/phpstan analyse --memory-limit=-1" - - - name: "Generate baseline file" - if: ${{ failure() }} - run: "vendor/bin/phpstan analyse --memory-limit=-1 --generate-baseline" - - - name: "Upload baseline file" - if: ${{ failure() }} - uses: actions/upload-artifact@v2 - with: - name: phpstan-baseline.neon - path: phpstan-baseline.neon \ No newline at end of file + static-analysis: + uses: pimcore/workflows-collection-public/.github/workflows/reusable-static-analysis-8-2-only.yaml@main + secrets: + COMPOSER_PIMCORE_REPO_PACKAGIST_TOKEN: ${{ secrets.COMPOSER_PIMCORE_REPO_PACKAGIST_TOKEN }} + SSH_PRIVATE_KEY_PIMCORE_DEPLOYMENTS_USER: ${{ secrets.SSH_PRIVATE_KEY_PIMCORE_DEPLOYMENTS_USER }} \ No newline at end of file diff --git a/src/DataIndex/Filter/DataObject/ClassNameFilter.php b/src/DataIndex/Filter/DataObject/ClassNameFilter.php index 7a317b34e..e70a59ff5 100644 --- a/src/DataIndex/Filter/DataObject/ClassNameFilter.php +++ b/src/DataIndex/Filter/DataObject/ClassNameFilter.php @@ -33,7 +33,7 @@ final class ClassNameFilter implements FilterInterface */ public function apply(CollectionParametersInterface $parameters, QueryInterface $query): QueryInterface { - if( + if ( !$parameters instanceof DataObjectParametersInterface || !$query instanceof DataObjectQuery || !$parameters->getClassName() diff --git a/src/DataIndex/Filter/ExcludeFolderFilter.php b/src/DataIndex/Filter/ExcludeFolderFilter.php index f9b0dbcac..ab5dc8f95 100644 --- a/src/DataIndex/Filter/ExcludeFolderFilter.php +++ b/src/DataIndex/Filter/ExcludeFolderFilter.php @@ -32,7 +32,7 @@ public function apply(CollectionParametersInterface $parameters, QueryInterface } $excludeFolders = $parameters->getExcludeFolders(); - if(!$excludeFolders) { + if (!$excludeFolders) { return $query; } diff --git a/src/DataIndex/Filter/IdSearchFilter.php b/src/DataIndex/Filter/IdSearchFilter.php index 56028cdf7..77d421742 100644 --- a/src/DataIndex/Filter/IdSearchFilter.php +++ b/src/DataIndex/Filter/IdSearchFilter.php @@ -33,7 +33,7 @@ public function apply(CollectionParametersInterface $parameters, QueryInterface $idSearchTerm = $parameters->getIdSearchTerm(); - if(!$idSearchTerm) { + if (!$idSearchTerm) { return $query; } diff --git a/src/DataIndex/Filter/ParentIdFilter.php b/src/DataIndex/Filter/ParentIdFilter.php index 81090a8be..627a31f26 100644 --- a/src/DataIndex/Filter/ParentIdFilter.php +++ b/src/DataIndex/Filter/ParentIdFilter.php @@ -33,7 +33,7 @@ public function apply(CollectionParametersInterface $parameters, QueryInterface $parentId = $parameters->getParentId(); - if(!$parentId) { + if (!$parentId) { return $query; } diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index 3493e3eb6..f3d4eccbd 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -92,22 +92,22 @@ private function addAllowedHostsForCorsNode(ArrayNodeDefinition $node): void ->prototype('scalar')->end() ->validate() ->always( - /** - * @throws InvalidHostException - */ function ($hosts) { - foreach ($hosts as $host) { - if (!filter_var($host)) { - throw new InvalidHostException( +/** + * @throws InvalidHostException + */ function ($hosts) { + foreach ($hosts as $host) { + if (!filter_var($host)) { + throw new InvalidHostException( sprintf( 'The host "%s" is not a valid url.', $host ) ); - } - } + } + } - return $hosts; - }) + return $hosts; +}) ->end() ->end(); } diff --git a/src/Filter/Service/FilterServiceProvider.php b/src/Filter/Service/FilterServiceProvider.php index 594b7052e..c5091de6d 100644 --- a/src/Filter/Service/FilterServiceProvider.php +++ b/src/Filter/Service/FilterServiceProvider.php @@ -24,14 +24,14 @@ final class FilterServiceProvider implements FilterServiceProviderInterface public function __construct(FilterServiceLoaderInterface $taggedIteratorAdapter) { - foreach($taggedIteratorAdapter->loadFilterServices() as $filterService) { + foreach ($taggedIteratorAdapter->loadFilterServices() as $filterService) { $this->filterServices[$filterService->getType()] = $filterService; } } public function create(string $type): mixed { - if(!array_key_exists($type, $this->filterServices)) { + if (!array_key_exists($type, $this->filterServices)) { throw new InvalidFilterServiceTypeException(400, "Unknown filter type: $type"); } diff --git a/src/Translation/Service/TranslatorService.php b/src/Translation/Service/TranslatorService.php index 2f38853a3..39fa3fc72 100644 --- a/src/Translation/Service/TranslatorService.php +++ b/src/Translation/Service/TranslatorService.php @@ -33,7 +33,7 @@ final class TranslatorService implements TranslatorServiceInterface public function __construct( TranslatorInterface $translator ) { - if(!$translator instanceof TranslatorBagInterface) { + if (!$translator instanceof TranslatorBagInterface) { throw new InvalidArgumentException('Translator must implement TranslatorBagInterface'); } diff --git a/src/Util/Traits/RequestTrait.php b/src/Util/Traits/RequestTrait.php index 8a5d66c85..664510e5e 100644 --- a/src/Util/Traits/RequestTrait.php +++ b/src/Util/Traits/RequestTrait.php @@ -36,7 +36,7 @@ trait RequestTrait private function getAuthToken(Request $request): string { $authToken = $request->headers->get(self::AUTHORIZATION_HEADER); - if($authToken === null) { + if ($authToken === null) { throw new NotAuthorizedException(); } @@ -50,7 +50,7 @@ private function getCurrentRequest(RequestStack $requestStack): Request { $request = $requestStack->getCurrentRequest(); - if(!$request) { + if (!$request) { throw new NoRequestException(); }