Skip to content

Commit

Permalink
Merge pull request #69 from APY/annotation-deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
rvanlaak authored Nov 16, 2021
2 parents 1e3fdf2 + 2c16199 commit 8d342db
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
strategy:
max-parallel: 10
matrix:
php: ['7.2', '7.3', '7.4']
php: ['7.2', '7.3', '7.4', '8.0']

steps:
- name: Set up PHP
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# v1.7

- support breadcrumbs via PHP Attributes
- deprecate annotations, to be removed in v2.0

#2020-06-10
- Add PHPUnit to integration test bundle

Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"require": {
"php": ">=7.2",
"symfony/framework-bundle": "^3.4|^4.0|^5.0",
"twig/twig": "^1.41|^2.0|^3.0"
"twig/twig": "^1.41|^2.0|^3.0",
"symfony/deprecation-contracts": "^2.4"
},
"scripts": {
"test": "vendor/bin/simple-phpunit --testdox"
Expand Down
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<ini name="intl.default_locale" value="en" />
<ini name="intl.error_level" value="0" />
<ini name="memory_limit" value="-1" />
<env name="SYMFONY_DEPRECATIONS_HELPER" value="max[self]=0" />
<env name="SYMFONY_DEPRECATIONS_HELPER" value="max[self]=4" />
<env name="SYMFONY_PHPUNIT_REMOVE_RETURN_TYPEHINT " value="1" />
</php>

Expand Down
6 changes: 6 additions & 0 deletions src/EventListener/BreadcrumbListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ public function onKernelController(KernelEvent $event)
$classBreadcrumbs = $this->reader->getClassAnnotations($class);
if ($this->supportsLoadingAttributes()) {
$classAttributeBreadcrumbs = $this->getAttributes($class);
if (count($classBreadcrumbs) > 0) {
trigger_deprecation('apy/breadcrumb-bundle', '1.7', 'Please replace the annotations in "%s" with attributes. Adding Breadcrumbs via annotations is deprecated and will be removed in v2.0, but luckily your platform supports using Attributes.', $class->name);
}
if (count($classAttributeBreadcrumbs) > 0) {
if (count($classBreadcrumbs) > 0) {
throw MixedAnnotationWithAttributeBreadcrumbsException::forClass($class->name);
Expand All @@ -85,6 +88,9 @@ public function onKernelController(KernelEvent $event)
$methodBreadcrumbs = $this->reader->getMethodAnnotations($method);
if ($this->supportsLoadingAttributes()) {
$methodAttributeBreadcrumbs = $this->getAttributes($method);
if (count($methodBreadcrumbs) > 0) {
trigger_deprecation('apy/breadcrumb-bundle', '1.7', 'Please replace the annotations in "%s" with attributes. Adding Breadcrumbs via annotations is deprecated and will be removed in v2.0, but luckily your platform supports using Attributes.', $class->name.'::'.$method->name);
}
if (count($methodAttributeBreadcrumbs) > 0) {
if (count($methodBreadcrumbs) > 0) {
throw MixedAnnotationWithAttributeBreadcrumbsException::forClassMethod($class->name, $method->name);
Expand Down

0 comments on commit 8d342db

Please sign in to comment.