Skip to content

Commit

Permalink
Support Symfony 7 (#318)
Browse files Browse the repository at this point in the history
* Support Symfony 7 and php82

* chore: trigger ci

---------

Co-authored-by: Tobias Nyholm <[email protected]>
  • Loading branch information
Niiph and Nyholm authored Jul 27, 2024
1 parent 668dd79 commit 15fa597
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
- '7.3'
- '7.4'
- '8.0'
- '8.2'
variant: [normal]
include:
- php-version: '7.2'
Expand All @@ -32,6 +33,9 @@ jobs:
- php-version: '8.0'
dependencies: highest
variant: 'doctrine/orm:~2.7 symfony/property-access:^6.0'
- php-version: '8.2'
dependencies: highest
variant: 'doctrine/orm:~2.7 symfony/property-access:^7.0'
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
"require": {
"php": ">=7.2",
"doctrine/orm": "~2.5",
"symfony/property-access": "^4.0 || ^5.2 || ^6.0",
"symfony/property-access": "^4.0 || ^5.2 || ^6.0 || ^7.0",
"symfony/polyfill-php80": "^1.20"
},
"require-dev": {
"phpspec/phpspec": "~6.3"
"phpspec/phpspec": "~6.3 || ^7.0"
},
"autoload": {
"psr-4": {
Expand Down
4 changes: 4 additions & 0 deletions src/Operand/PlatformFunction/DateAdd.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ public function execute($candidate, ?string $context = null): \DateTimeImmutable

$new_date = new \DateTimeImmutable($date->format('Y-m-d H:i:s'), $date->getTimezone());

if (0 > (float) $value) {
return $new_date->modify(sprintf('%d %s', $value, $this->unit));
}

return $new_date->modify(sprintf('+%d %s', $value, $this->unit));
}
}
3 changes: 3 additions & 0 deletions src/Operand/PlatformFunction/DateSub.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ public function execute($candidate, ?string $context = null): \DateTimeImmutable

$new_date = new \DateTimeImmutable($date->format('Y-m-d H:i:s'), $date->getTimezone());

if (0 > (float) $value) {
return $new_date->modify(sprintf('+%d %s', abs((float) $value), $this->unit));
}
return $new_date->modify(sprintf('-%d %s', $value, $this->unit));
}
}

0 comments on commit 15fa597

Please sign in to comment.