Skip to content

Commit

Permalink
Fix compatible with PHP 8.1 (#17)
Browse files Browse the repository at this point in the history
* Fix compatible with PHP 8.1

There was an error in PHP 8.1: "...with message 'strtolower(): Passing null to parameter #1 ($string) of type string is deprecated..."
I fixed it.

* Added php 8.1 to unit tests

* Also adding workflow_dispatch to tigger gha

Co-authored-by: Aaron de Mello <314152+AaronDDM@users.noreply.github.com>
Co-authored-by: AaronDDM <aaron.d@nylas.com>
  • Loading branch information
3 people authored Oct 14, 2022
1 parent f238acc commit ceadf8b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/unit-test.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
name: unit-test

on: [push]
on: [workflow_dispatch,push]

jobs:
run:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ubuntu-latest]
php-versions: ['7.2', '7.3', '7.4', '8.0']
php-versions: ['7.2', '7.3', '7.4', '8.0', '8.1']
name: PHP v${{ matrix.php-versions }}
steps:
- name: Checkout
Expand Down
2 changes: 1 addition & 1 deletion lib/Writer/XMLWriterService.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ protected function buildXML($array, \XMLWriter &$xmlWriter)
$this->buildXML($element['value'], $xmlWriter);
} else {
if ($element['value'] !== null) {
switch (strtolower($element['type'])) {
switch (strtolower($element['type'] ?? '')) {
case 'cdata':
$xmlWriter->writeCdata($element['value']);
break;
Expand Down

0 comments on commit ceadf8b

Please sign in to comment.