From b6454069b498be27a271f157c19db6c8814f96d6 Mon Sep 17 00:00:00 2001 From: David Buchmann Date: Fri, 22 Mar 2024 10:00:21 +0100 Subject: [PATCH 1/2] fix readthedocs interlinking and some reference bugs --- Resources/doc/conf.py | 3 ++- Resources/doc/includes/expression-language.rst | 4 ++-- Resources/doc/overview.rst | 2 +- Resources/doc/reference/configuration/tags.rst | 2 +- src/DependencyInjection/Configuration.php | 6 +++--- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Resources/doc/conf.py b/Resources/doc/conf.py index e8409124..7e61a655 100644 --- a/Resources/doc/conf.py +++ b/Resources/doc/conf.py @@ -14,6 +14,7 @@ extensions = [ 'sphinxcontrib.spelling', 'sphinx_rtd_theme', + "sphinx.ext.intersphinx", ] # Spelling configuration @@ -197,7 +198,7 @@ # -------------- -intersphinx_mapping = {'foshttpcache': ('http://foshttpcache.readthedocs.org/en/latest/', None)} +intersphinx_mapping = {'foshttpcache': ('http://foshttpcache.readthedocs.io/en/latest/', None)} rst_epilog = """ .. _expressions: https://symfony.com/doc/current/components/expression_language.html diff --git a/Resources/doc/includes/expression-language.rst b/Resources/doc/includes/expression-language.rst index fc88e781..980e60d0 100644 --- a/Resources/doc/includes/expression-language.rst +++ b/Resources/doc/includes/expression-language.rst @@ -4,8 +4,8 @@ **type**: ``string`` If your application is using a `custom expression language`_ which is extended -from Symfony's `expression language component`_, you can `define it as a service`_ -and include it in the configuration. +from Symfony's `expression language component`_, you need to `define it as a service`_ +and configure it as `expression_language` in the sections where you want to use it. .. _expression language component: https://symfony.com/doc/current/components/expression_language.html .. _define it as a service: https://symfony.com/doc/current/controller/service.html diff --git a/Resources/doc/overview.rst b/Resources/doc/overview.rst index 1ddec31c..283df6fb 100644 --- a/Resources/doc/overview.rst +++ b/Resources/doc/overview.rst @@ -71,7 +71,7 @@ And , if you don't use a recent version of Symfony, include it in your project:: ExpressionLanguage ~~~~~~~~~~~~~~~~~~ -If you wish to use expressions_ in your annotations , you also need Symfony’s +If you wish to use expressions in your annotations , you also need Symfony’s ExpressionLanguage_ component. If you’re not using full-stack Symfony 2.4 or later, you need to explicitly add the component: diff --git a/Resources/doc/reference/configuration/tags.rst b/Resources/doc/reference/configuration/tags.rst index f27f7166..e9a982ad 100644 --- a/Resources/doc/reference/configuration/tags.rst +++ b/Resources/doc/reference/configuration/tags.rst @@ -137,7 +137,7 @@ unsafe requests. **type**: ``array`` You can dynamically refer to request attributes using -:ref:`expressions `. Assume a route +:ref:`expressions `. Assume a route ``/articles/{id}``. A request to path ``/articles/123`` will set/invalidate tag ``articles-123`` with the following configuration: diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index 0b43b841..86afe546 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -809,7 +809,7 @@ private function addTagSection(ArrayNodeDefinition $rootNode) ->booleanNode('strict')->defaultFalse()->end() ->scalarNode('expression_language') ->defaultNull() - ->info('Service name of a custom ExpressionLanugage to use.') + ->info('Service name of a custom ExpressionLanguage to use.') ->end() ->scalarNode('response_header') ->defaultNull() @@ -831,7 +831,7 @@ private function addTagSection(ArrayNodeDefinition $rootNode) ->ifTrue(function ($v) { return !empty($v['tag_expressions']) && !class_exists(ExpressionLanguage::class); }) - ->thenInvalid('Configured a tag_expression but ExpressionLanugage is not available') + ->thenInvalid('Configured a tag_expression but ExpressionLanguage is not available') ->end() ->children() ; @@ -864,7 +864,7 @@ private function addInvalidationSection(ArrayNodeDefinition $rootNode) ->end() ->scalarNode('expression_language') ->defaultNull() - ->info('Service name of a custom ExpressionLanugage to use.') + ->info('Service name of a custom ExpressionLanguage to use.') ->end() ->arrayNode('rules') ->info('Set what requests should invalidate which target routes.') From 41169baf330c244c62e8fb515d189db018120e9e Mon Sep 17 00:00:00 2001 From: David Buchmann Date: Fri, 22 Mar 2024 10:00:21 +0100 Subject: [PATCH 2/2] fix expression language configuration to be consistent --- Resources/doc/overview.rst | 2 +- src/DependencyInjection/Configuration.php | 4 ++-- tests/Resources/Fixtures/config/full.php | 2 +- tests/Resources/Fixtures/config/full.xml | 2 +- tests/Resources/Fixtures/config/full.yml | 2 +- tests/Unit/DependencyInjection/ConfigurationTest.php | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Resources/doc/overview.rst b/Resources/doc/overview.rst index 7e798dc2..cc0a5b39 100644 --- a/Resources/doc/overview.rst +++ b/Resources/doc/overview.rst @@ -45,7 +45,7 @@ Optional Dependencies ExpressionLanguage ~~~~~~~~~~~~~~~~~~ -If you wish to use expressions in your :ref:`attributes `, +If you wish to use expressions in your :doc:`attributes `, you need Symfony’s ExpressionLanguage_ component. Make sure it is part of your application with: .. code-block:: bash diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index 5b68d9d2..80e093d5 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -426,8 +426,8 @@ private function addMatch(NodeBuilder $rules, $matchResponse = false) ->defaultNull() ->info('Expression to decide whether response should be matched. Replaces cacheable configuration.') ->end() - ->scalarNode('match_response_expression_service') - ->info('Service name of the expression language service to use for expression evaluation. If not specified, the default expression language is used') + ->scalarNode('expression_language') + ->info('Service name of a custom ExpressionLanguage to use.') ->end() ; } diff --git a/tests/Resources/Fixtures/config/full.php b/tests/Resources/Fixtures/config/full.php index c2c33c1a..a82d5860 100644 --- a/tests/Resources/Fixtures/config/full.php +++ b/tests/Resources/Fixtures/config/full.php @@ -29,7 +29,7 @@ 'ips' => ['1.2.3.4', '1.1.1.1'], 'attributes' => ['_controller' => 'fos.user_bundle.*'], 'match_response' => 'response.getStatusCode() == 404', - 'match_response_expression_service' => 'my.custom.expression-service', + 'expression_language' => 'my.custom.expression-service', ], 'headers' => [ 'overwrite' => false, diff --git a/tests/Resources/Fixtures/config/full.xml b/tests/Resources/Fixtures/config/full.xml index 3d025e83..715789dc 100644 --- a/tests/Resources/Fixtures/config/full.xml +++ b/tests/Resources/Fixtures/config/full.xml @@ -18,7 +18,7 @@ host="fos" query_string="(^|&)foo=" match_response="response.getStatusCode() == 404" - match_response_expression_service = "my.custom.expression-service" + expression_language = "my.custom.expression-service" > GET POST diff --git a/tests/Resources/Fixtures/config/full.yml b/tests/Resources/Fixtures/config/full.yml index 92e053f8..3156a958 100644 --- a/tests/Resources/Fixtures/config/full.yml +++ b/tests/Resources/Fixtures/config/full.yml @@ -24,7 +24,7 @@ fos_http_cache: attributes: _controller: fos.user_bundle.* match_response: "response.getStatusCode() == 404" - match_response_expression_service: my.custom.expression-service + expression_language: my.custom.expression-service headers: overwrite: false cache_control: diff --git a/tests/Unit/DependencyInjection/ConfigurationTest.php b/tests/Unit/DependencyInjection/ConfigurationTest.php index e48484d0..ba7177c7 100644 --- a/tests/Unit/DependencyInjection/ConfigurationTest.php +++ b/tests/Unit/DependencyInjection/ConfigurationTest.php @@ -72,7 +72,7 @@ public function testSupportsAllConfigFormats() 'ips' => ['1.2.3.4', '1.1.1.1'], 'attributes' => ['_controller' => 'fos.user_bundle.*'], 'match_response' => 'response.getStatusCode() == 404', - 'match_response_expression_service' => 'my.custom.expression-service', + 'expression_language' => 'my.custom.expression-service', 'additional_response_status' => [], ], 'headers' => [