From 049e1963dce920f7d5661e24563086804e8eae29 Mon Sep 17 00:00:00 2001 From: Corey Taylor Date: Tue, 4 Jul 2023 18:41:52 -0500 Subject: [PATCH 1/7] Upgrade to Sphinx 6 --- Dockerfile | 2 +- requirements.txt | 6 +++--- runtime.Dockerfile | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5a02571..8aaf8a5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ # This image provides the ability to build docs for CakePHP plugins # Plugins should use a multi-stage Dockerfile so that they only deploy # nginx without python and other build tooling. -FROM python:3.8-alpine +FROM python:3.11-alpine LABEL Description="Create an image to deploy the CakePHP plugin docs" diff --git a/requirements.txt b/requirements.txt index b6f89e2..8c8399c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -docutils==0.17.1 -sphinx==4.3.1 -sphinxcontrib-phpdomain==0.8.0 +docutils==0.18.1 +sphinx==6.2.1 +sphinxcontrib-phpdomain==0.11.0 cakephpsphinx>=0.1.55,<1.0 diff --git a/runtime.Dockerfile b/runtime.Dockerfile index 8c091f5..27f507a 100644 --- a/runtime.Dockerfile +++ b/runtime.Dockerfile @@ -1,5 +1,5 @@ # Build a small nginx container with just the static site in it. -FROM nginx:1.15-alpine +FROM nginx:1.25-alpine # We also need PHP to update elastic search. RUN apk add --update bash curl composer \ From bd2757c1bd60d483148fc57b3441e40218ecdc06 Mon Sep 17 00:00:00 2001 From: Mark Story Date: Wed, 5 Jul 2023 11:03:47 -0400 Subject: [PATCH 2/7] Remove fielddata from mappings. --- scripts/populate_search_index.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/populate_search_index.php b/scripts/populate_search_index.php index 5e22477..52b5888 100755 --- a/scripts/populate_search_index.php +++ b/scripts/populate_search_index.php @@ -204,14 +204,12 @@ function ensureIndex($indexName) 'properties' => [ 'contents' => [ 'type' => 'text', - 'fielddata' => true, ], 'title' => [ 'type' => 'text', ], 'url' => [ 'type' => 'text', - 'fielddata' => true, ], ], ]; From a926e1153f83bde2be7a22aadfad908749000f7b Mon Sep 17 00:00:00 2001 From: Kevin Pfeifer Date: Wed, 5 Jul 2023 17:28:20 +0200 Subject: [PATCH 3/7] remove fielddata from page_url --- console/src/Command/PopulateIndexCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/console/src/Command/PopulateIndexCommand.php b/console/src/Command/PopulateIndexCommand.php index 370e762..71d5bf1 100644 --- a/console/src/Command/PopulateIndexCommand.php +++ b/console/src/Command/PopulateIndexCommand.php @@ -201,7 +201,7 @@ protected function createBuildIndex(ConsoleIo $io, Manager $indexManager, string 'type' => ['type' => 'keyword', 'index' => false], 'priority' => ['type' => 'keyword', 'fielddata' => true], 'url' => ['type' => 'keyword', 'index' => false], - 'page_url' => ['type' => 'keyword', 'fielddata' => true], + 'page_url' => ['type' => 'keyword'], 'level' => ['type' => 'short'], 'max_level' => ['type' => 'short'], 'position' => ['type' => 'short'], From e925069081f7a2d4ddb9769b4d26f327945151f5 Mon Sep 17 00:00:00 2001 From: Kevin Pfeifer Date: Wed, 5 Jul 2023 17:38:34 +0200 Subject: [PATCH 4/7] remove fielddata from keyword --- console/src/Command/PopulateIndexCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/console/src/Command/PopulateIndexCommand.php b/console/src/Command/PopulateIndexCommand.php index 71d5bf1..2d7ba07 100644 --- a/console/src/Command/PopulateIndexCommand.php +++ b/console/src/Command/PopulateIndexCommand.php @@ -199,7 +199,7 @@ protected function createBuildIndex(ConsoleIo $io, Manager $indexManager, string ]; $properties = [ 'type' => ['type' => 'keyword', 'index' => false], - 'priority' => ['type' => 'keyword', 'fielddata' => true], + 'priority' => ['type' => 'keyword'], 'url' => ['type' => 'keyword', 'index' => false], 'page_url' => ['type' => 'keyword'], 'level' => ['type' => 'short'], From c9dc488f76c190401ad98f58745d3c6f67ee1976 Mon Sep 17 00:00:00 2001 From: Kevin Pfeifer Date: Wed, 5 Jul 2023 17:50:15 +0200 Subject: [PATCH 5/7] try re-add fielddata to creating mapping --- scripts/populate_search_index.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/populate_search_index.php b/scripts/populate_search_index.php index 52b5888..5e22477 100755 --- a/scripts/populate_search_index.php +++ b/scripts/populate_search_index.php @@ -204,12 +204,14 @@ function ensureIndex($indexName) 'properties' => [ 'contents' => [ 'type' => 'text', + 'fielddata' => true, ], 'title' => [ 'type' => 'text', ], 'url' => [ 'type' => 'text', + 'fielddata' => true, ], ], ]; From abb2fd73fd5ba5fbcae86d6d80eb1af76719da53 Mon Sep 17 00:00:00 2001 From: Kevin Pfeifer Date: Wed, 5 Jul 2023 17:52:34 +0200 Subject: [PATCH 6/7] update ci to use ubuntu 22.04 --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cef5eb0..99871c8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -77,7 +77,7 @@ jobs: --network host --no-cache . tests: - runs-on: ubuntu-18.04 + runs-on: ubuntu-22.04 defaults: run: working-directory: console @@ -138,7 +138,7 @@ jobs: cs-stan: name: Coding Standards & Static Analysis - runs-on: ubuntu-18.04 + runs-on: ubuntu-22.04 defaults: run: working-directory: console From 413e53a2a535f442909f277926d4f7e17adaa542 Mon Sep 17 00:00:00 2001 From: Kevin Pfeifer Date: Wed, 5 Jul 2023 19:22:23 +0200 Subject: [PATCH 7/7] update stan --- .github/workflows/ci.yml | 7 ++----- console/composer.json | 14 +++++--------- console/phpstan.neon | 10 ++++++++++ console/phpstan.src.neon | 3 --- console/phpstan.tests.neon | 4 ---- console/psalm-baseline.xml | 17 ++++++++++++----- console/psalm.xml.dist | 3 +++ console/tests/phpstan.php | 14 -------------- 8 files changed, 32 insertions(+), 40 deletions(-) create mode 100644 console/phpstan.neon delete mode 100644 console/phpstan.src.neon delete mode 100644 console/phpstan.tests.neon delete mode 100644 console/tests/phpstan.php diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 99871c8..759101d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -162,8 +162,5 @@ jobs: - name: Run psalm run: composer psalm -- --output-format=github - - name: Run phpstan (src) - run: composer phpstan-src -- --error-format=github - - - name: Run phpstan (tests) - run: composer phpstan-tests -- --error-format=github + - name: Run phpstan + run: composer phpstan -- --error-format=github diff --git a/console/composer.json b/console/composer.json index 900b08b..d3ed3bf 100644 --- a/console/composer.json +++ b/console/composer.json @@ -42,18 +42,14 @@ "cs-fix": "phpcbf --parallel=16 -p ./src ./tests", "test": "phpunit", "test-coverage": "phpunit --coverage-clover=coverage.xml", - "stan-setup": "cp composer.json composer.backup && composer require --dev \"phpstan/phpstan:^1.0\" \"psalm/phar:^4.0\" && mv composer.backup composer.json", + "stan-setup": "cp composer.json composer.backup && composer require --dev phpstan/phpstan:^1.10 psalm/phar:^5.13 && mv composer.backup composer.json", "stan": [ - "@phpstan-src", - "@phpstan-tests", + "@phpstan", "@psalm" ], - "phpstan": [ - "@phpstan-src", - "@phpstan-tests" - ], - "phpstan-src": "php ./vendor/phpstan/phpstan/phpstan.phar analyse -l 8 -c ./phpstan.src.neon ./src", - "phpstan-tests": "php ./vendor/phpstan/phpstan/phpstan.phar analyse -l 8 -c ./phpstan.tests.neon ./tests", + "phpstan": "php ./vendor/phpstan/phpstan/phpstan.phar analyse", + "stan-baseline": "php ./vendor/phpstan/phpstan/phpstan.phar --generate-baseline", + "psalm-baseline": "php ./vendor/psalm/phar/psalm.phar --set-baseline=psalm-baseline.xml", "psalm": "php ./vendor/psalm/phar/psalm.phar" } } diff --git a/console/phpstan.neon b/console/phpstan.neon new file mode 100644 index 0000000..d6303f2 --- /dev/null +++ b/console/phpstan.neon @@ -0,0 +1,10 @@ +parameters: + level: 6 + checkMissingIterableValueType: false + checkGenericClassInNonGenericObjectType: false + treatPhpDocTypesAsCertain: false + bootstrapFiles: + - tests/bootstrap.php + paths: + - src/ + - tests/ \ No newline at end of file diff --git a/console/phpstan.src.neon b/console/phpstan.src.neon deleted file mode 100644 index 6b2e8dc..0000000 --- a/console/phpstan.src.neon +++ /dev/null @@ -1,3 +0,0 @@ -parameters: - bootstrapFiles: - - tests/phpstan.php diff --git a/console/phpstan.tests.neon b/console/phpstan.tests.neon deleted file mode 100644 index 90c6ae9..0000000 --- a/console/phpstan.tests.neon +++ /dev/null @@ -1,4 +0,0 @@ -parameters: - bootstrapFiles: - - tests/phpstan.php - - tests/bootstrap.php diff --git a/console/psalm-baseline.xml b/console/psalm-baseline.xml index 89f1026..71ea704 100644 --- a/console/psalm-baseline.xml +++ b/console/psalm-baseline.xml @@ -1,9 +1,16 @@ - + - - !$node->attributes - !$node->attributes - + + $anchor + + + attributes->getNamedItem('id')->nodeValue]]> + + + + + end($aliases) + diff --git a/console/psalm.xml.dist b/console/psalm.xml.dist index 59b7f1a..aa3b339 100644 --- a/console/psalm.xml.dist +++ b/console/psalm.xml.dist @@ -5,6 +5,9 @@ xmlns="https://getpsalm.org/schema/config" xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd" errorBaseline="psalm-baseline.xml" + findUnusedPsalmSuppress="true" + findUnusedBaselineEntry="true" + findUnusedCode="false" > diff --git a/console/tests/phpstan.php b/console/tests/phpstan.php deleted file mode 100644 index 1c08c8f..0000000 --- a/console/tests/phpstan.php +++ /dev/null @@ -1,14 +0,0 @@ -