Skip to content

Commit

Permalink
feat!: drop support for php 7.4 (#11)
Browse files Browse the repository at this point in the history
* build: updated PHP version to 8.0 in composer.json

* refactor: utilise null being a stand-alone type for applyCasts

* refactor: utilise named arguments in module class

* fix: updating workflows

* chore: trigger CI

* fix: removed named arguments for 3rd party function calls

* fix: coding standard
  • Loading branch information
gabrielg2020 authored Mar 19, 2024
1 parent 8a769e1 commit ef38609
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ on:
jobs:
security:
uses: dvsa/.github/.github/workflows/php-library-security.yml@main
with:
php-versions: "[\"7.4\", \"8.0\", \"8.1\", \"8.2\"]"
with:
php-versions: "[\"8.0\", \"8.1\", \"8.2\", \"8.3\"]"
secrets:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}

static-analysis:
uses: dvsa/.github/.github/workflows/php-library-static.yml@main
with:
php-version: '8.2'
php-version: '8.3'

tests:
uses: dvsa/.github/.github/workflows/php-library-tests.yml@main
with:
php-versions: "[\"7.4\", \"8.0\", \"8.1\", \"8.2\"]"
php-versions: "[\"8.0\", \"8.1\", \"8.2\", \"8.3\"]"
fail-fast: false
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
}
},
"require": {
"php": "^7.4 || ^8.0",
"php": "^8.0",
"ext-json": "*",
"laminas/laminas-modulemanager": "^2.4|^3.0",
"laminas/laminas-config": "^2.0|^3.0",
Expand Down
4 changes: 2 additions & 2 deletions src/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ private function applyCasts(array &$config, array $casts): void
$propertyAccessor = PropertyAccess::createPropertyAccessor();

foreach ($casts as $key => $type) {
if (!is_a($type, Cast\CastInterface::class, true)) {
if (!is_a($type, Cast\CastInterface::class, allow_string: true)) {
throw new InvalidCastException("Class {$type} must implement " . Cast\CastInterface::class . " interface.");
}

Expand All @@ -108,7 +108,7 @@ private function applyCasts(array &$config, array $casts): void

$value = $propertyAccessor->getValue($config, $property);

if (isset($value) && is_string($value)) {
if (is_string($value)) {
$propertyAccessor->setValue($config, $property, (new $type())($value));
}
}
Expand Down

0 comments on commit ef38609

Please sign in to comment.