8000 minor #40586 [Config][FrameworkBundle] Hint to use PHP 8+ or to insta… · symfony/symfony@481222f · GitHub
[go: up one dir, main page]

Skip to content

Commit 481222f

Browse files
committed
minor #40586 [Config][FrameworkBundle] Hint to use PHP 8+ or to install Annotations for using attributes/annots (dunglas)
This PR was merged into the 5.2 branch. Discussion ---------- [Config][FrameworkBundle] Hint to use PHP 8+ or to install Annotations for using attributes/annots …s to use attributes/annots | Q | A | ------------- | --- | Branch? | 5.2 | Bug fix? | no | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | See symfony/recipes#916 | License | MIT | Doc PR | n/a Improve the error message to hint that you can upgrade to PHP 8 instead of using `doctrine/annotations`. Commits ------- af6f3c2 [Config][FrameworkBundle] Hint to use PHP 8+ or to install Annotations to use attributes/annots
2 parents 87a67be + af6f3c2 commit 481222f

File tree

6 files changed

+5
-10
lines changed

6 files changed

+5
-10
lines changed

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1319,7 +1319,7 @@ private function registerValidationConfiguration(array $config, ContainerBuilder
13191319

13201320
if (\array_key_exists('enable_annotations', $config) && $config['enable_annotations']) {
13211321
if (!$this->annotationsConfigEnabled && \PHP_VERSION_ID < 80000) {
1322-
throw new \LogicException('"enable_annotations" on the validator cannot be set as Doctrine Annotations support is disabled.');
1322+
throw new \LogicException('"enable_annotations" on the validator cannot be set as the PHP version is lower than 8 and Doctrine Annotations support is disabled. Consider upgrading PHP.');
13231323
}
13241324

13251325
$validatorBuilder->addMethodCall('enableAnnotationMapping', [true]);
@@ -1583,7 +1583,7 @@ private function registerSerializerConfiguration(array $config, ContainerBuilder
15831583
$serializerLoaders = [];
15841584
if (isset($config['enable_annotations']) && $config['enable_annotations']) {
15851585
if (\PHP_VERSION_ID < 80000 && !$this->annotationsConfigEnabled) {
1586-
throw new \LogicException('"enable_annotations" on the serializer cannot be set as Annotations support is disabled.');
1586+
throw new \LogicException('"enable_annotations" on the serializer cannot be set as the PHP version is lower than 8 and Annotations support is disabled. Consider upgrading PHP.');
15871587
}
15881588

15891589
$annotationLoader = new Definition(

src/Symfony/Component/Config/Exception/LoaderLoadException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function __construct(string $resource, string $sourceResource = null, ?in
6464
} elseif (null !== $type) {
6565
// maybe there is no loader for this specific type
6666
if ('annotation' === $type) {
67-
$message .= ' Make sure annotations are installed and enabled.';
67+
$message .= ' Make sure to use PHP 8+ or that annotations are installed and enabled.';
6868
} else {
6969
$message .= sprintf(' Make sure there is a loader supporting the "%s" type.', $type);
7070
}

src/Symfony/Component/Config/Tests/Exception/LoaderLoadExceptionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function testMessageCannotLoadResourceWithType()
3131
public function testMessageCannotLoadResourceWithAnnotationType()
3232
{
3333
$exception = new LoaderLoadException('resource', null, 0, null, 'annotation');
34-
$this->assertEquals('Cannot load resource "resource". Make sure annotations are installed and enabled.', $exception->getMessage());
34+
$this->assertEquals('Cannot load resource "resource". Make sure to use PHP 8+ or that annotations are installed and enabled.', $exception->getMessage());
3535
}
3636

3737
public function testMessageCannotImportResourceFromSource()

src/Symfony/Component/Routing/composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@
3838
"symfony/http-foundation": "For using a Symfony Request object",
3939
"symfony/config": "For using the all-in-one router or any loader",
4040
"symfony/yaml": "For using the YAML loader",
41-
"symfony/expression-language": "For using expression matching",
42-
"doctrine/annotations": "For using the annotation loader"
41+
"symfony/expression-language": "For using expression matching"
4342
},
4443
"autoload": {
4544
"psr-4": { "Symfony\\Component\\Routing\\": "" },

src/Symfony/Component/Serializer/composer.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,6 @@
5555
"symfony/config": "For using the XML mapping loader.",
5656
"symfony/property-access": "For using the ObjectNormalizer.",
5757
"symfony/mime": "For using a MIME type guesser within the DataUriNormalizer.",
58-
"doctrine/annotations": "For using the annotation mapping. You will also need doctrine/cache.",
59-
"doctrine/cache": "For using the default cached annotation reader and metadata cache.",
6058
"symfony/var-exporter": "For using the metadata compiler."
6159
},
6260
"autoload": {

src/Symfony/Component/Validator/composer.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,6 @@
5656
},
5757
"suggest": {
5858
"psr/cache-implementation": "For using the mapping cache.",
59-
"doctrine/annotations": "For using the annotation mapping. You will also need doctrine/cache.",
60-
"doctrine/cache": "For using the default cached annotation reader.",
6159
"symfony/http-foundation": "",
6260
"symfony/intl": "",
6361
"symfony/translation": "For translating validation errors.",

0 commit comments

Comments
 (0)
0