Skip to content

chore: update workflow to support PHP 8.4 #83

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/deptrac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ on:
- 'depfile.yaml'
- '.github/workflows/deptrac.yml'

permissions:
contents: read

jobs:
build:
name: Dependency Tracing
Expand All @@ -31,7 +34,7 @@ jobs:
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
php-version: '8.2'
extensions: intl, json, mbstring, xml
coverage: none
env:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/phpcpd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
php-version: '8.2'
tools: phpcpd
extensions: dom, mbstring
coverage: none

- name: Detect duplicate code
run: phpcpd app/ tests/
run: phpcpd src/
19 changes: 16 additions & 3 deletions .github/workflows/phpcsfixer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,22 @@ on:
- '**.php'
- '.github/workflows/phpcsfixer.yml'

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

permissions:
contents: read

jobs:
build:
name: Coding Standards
name: PHP ${{ matrix.php-versions }} Coding Standards
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]')"
if: (! contains(github.event.head_commit.message, '[ci skip]'))
strategy:
fail-fast: false
matrix:
php-versions: ['8.1', '8.2', '8.4']

steps:
- name: Checkout
Expand All @@ -27,7 +38,7 @@ jobs:
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
php-version: ${{ matrix.php-versions }}
extensions: json, tokenizer
coverage: none
env:
Expand All @@ -53,3 +64,5 @@ jobs:

- name: Check code for standards compliance
run: vendor/bin/php-cs-fixer fix --verbose --ansi --dry-run --using-cache=no --diff
env:
PHP_CS_FIXER_IGNORE_ENV: ${{ matrix.php-versions == '8.4' }}
2 changes: 1 addition & 1 deletion .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php-versions: ['8.1', '8.2', '8.3']
php-versions: ['8.1', '8.4']

steps:
- name: Checkout
Expand Down
22 changes: 19 additions & 3 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,30 @@ on:

jobs:
main:
name: PHP ${{ matrix.php-versions }} Unit Tests
name: PHP ${{ matrix.php-versions }}
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]')"
strategy:
matrix:
php-versions: ['8.1', '8.2', '8.3']
php-versions: ['8.1', '8.2', '8.3', '8.4']

steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: false

# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
android: true
dotnet: true
haskell: true
large-packages: false
docker-images: true
swap-storage: true

- name: Checkout
uses: actions/checkout@v4

Expand Down Expand Up @@ -65,7 +81,7 @@ jobs:
TERM: xterm-256color
TACHYCARDIA_MONITOR_GA: enabled

- if: matrix.php-versions == '8.0'
- if: matrix.php-versions == '8.2'
name: Run Coveralls
continue-on-error: true
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/psalm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
php-version: '8.2'
tools: phpstan, phpunit
extensions: intl, json, mbstring, xml
coverage: none
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/rector.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php-versions: ['8.1', '8.2', '8.3']
php-versions: ['8.2', '8.4']

steps:
- name: Checkout
Expand Down
1 change: 1 addition & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
cacheDirectory="build/psalm/"
findUnusedBaselineEntry="true"
findUnusedCode="false"
ensureOverrideAttribute="false"
>
<projectFiles>
<directory name="src/" />
Expand Down
2 changes: 1 addition & 1 deletion src/CodeIgniter.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function storePreviousURL($uri)
$uri->getAuthority(),
$uri->getPath(),
$uri->getQuery(),
$uri->getFragment()
$uri->getFragment(),
));
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Config/Services.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public static function incomingrequest(?App $config = null, bool $getShared = tr
$config,
AppServices::uri(),
'php://input',
new UserAgent()
new UserAgent(),
);
}

Expand Down
6 changes: 3 additions & 3 deletions src/Debug/Toolbar.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function prepare(?RequestInterface $request = null, ?ResponseInterface $r
$stats['startTime'],
$stats['totalTime'],
$request,
$response
$response,
);

helper('filesystem');
Expand Down Expand Up @@ -91,8 +91,8 @@ public function prepare(?RequestInterface $request = null, ?ResponseInterface $r
'/<head>/',
'<head>' . $script,
$response->getBody(),
1
)
1,
),
);

return;
Expand Down
2 changes: 1 addition & 1 deletion src/HTTP/HtmxTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ private function validateSwap(string $option, string $field = 'swap'): bool
'Option "%s" is not a valid variable for %s. A valid option has to be one of: %s',
$option,
$field,
implode(', ', $this->swapOptions)
implode(', ', $this->swapOptions),
));
}

Expand Down
2 changes: 1 addition & 1 deletion src/HTTP/RedirectResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function hxLocation(
?string $target = null,
?string $swap = null,
?array $values = null,
?array $headers = null
?array $headers = null,
): RedirectResponse {
if (str_starts_with($path, 'http://') || str_starts_with($path, 'https://')) {
$path = (string) service('uri', $path, false)->withScheme('')->setHost('');
Expand Down
4 changes: 2 additions & 2 deletions src/View/ErrorModalDecorator.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ public static function decorate(string $html): string
$script = sprintf(
'<script %s id="htmxErrorModalScript">%s</script>',
csp_script_nonce(),
file_get_contents(__DIR__ . '/error_modal_decorator.js')
file_get_contents(__DIR__ . '/error_modal_decorator.js'),
);

$html = preg_replace(
'/<\/head>/',
$script . '</head>',
$html,
1
1,
);
}

Expand Down
4 changes: 2 additions & 2 deletions src/View/ToolbarDecorator.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ public static function decorate(string $html): string
$script = sprintf(
'<script %s id="htmxToolbarScript">%s</script>',
csp_script_nonce(),
file_get_contents(__DIR__ . '/toolbar_decorator.js')
file_get_contents(__DIR__ . '/toolbar_decorator.js'),
);

$html = preg_replace(
'/<\/head>/',
$script . '</head>',
$html,
1
1,
);
}

Expand Down
21 changes: 18 additions & 3 deletions src/View/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,25 @@ public function render(string $view, ?array $options = null, ?bool $saveData = n

$output = $this->decorateOutput($output);

$this->logPerformance($this->renderVars['start'], microtime(true), $this->renderVars['view']);
$this->logPerformance(
$this->renderVars['start'],
microtime(true),
$this->renderVars['view'],
);

// Check if DebugToolbar is enabled.
$filters = service('filters');
$requiredAfterFilters = $filters->getRequiredFilters('after')[0];
if (in_array('toolbar', $requiredAfterFilters, true)) {
$debugBarEnabled = true;
} else {
$afterFilters = $filters->getFiltersClass()['after'];
$debugBarEnabled = in_array(DebugToolbar::class, $afterFilters, true);
}

if (($this->debug && (! isset($options['debug']) || $options['debug'] === true))
&& in_array(DebugToolbar::class, service('filters')->getFiltersClass()['after'], true)
if (
$this->debug && $debugBarEnabled
&& (! isset($options['debug']) || $options['debug'] === true)
&& empty($this->renderVars['options']['fragments'])
) {
$toolbarCollectors = config(Toolbar::class)->collectors;
Expand Down
10 changes: 5 additions & 5 deletions tests/HTTP/ResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function testTriggerClientEvent(): void

$this->assertSame(
'{"showMessage":""}',
$this->response->getHeaderLine('HX-Trigger')
$this->response->getHeaderLine('HX-Trigger'),
);
}

Expand All @@ -100,7 +100,7 @@ public function testTriggerClientEventAndPassDetails(): void

$this->assertSame(
'{"showMessage":{"level":"info","message":"Here Is A Message"}}',
$this->response->getHeaderLine('HX-Trigger')
$this->response->getHeaderLine('HX-Trigger'),
);
}

Expand All @@ -111,7 +111,7 @@ public function testTriggerClientEventAndPassDetailsMultipleCalls(): void

$this->assertSame(
'{"event1":"A message","event2":"Another message"}',
$this->response->getHeaderLine('HX-Trigger')
$this->response->getHeaderLine('HX-Trigger'),
);
}

Expand All @@ -121,7 +121,7 @@ public function testTriggerClientEventWithSettle(): void

$this->assertSame(
'{"showMessage":""}',
$this->response->getHeaderLine('HX-Trigger-After-Settle')
$this->response->getHeaderLine('HX-Trigger-After-Settle'),
);
}

Expand All @@ -131,7 +131,7 @@ public function testTriggerClientEventWithSwap(): void

$this->assertSame(
'{"showMessage":""}',
$this->response->getHeaderLine('HX-Trigger-After-Swap')
$this->response->getHeaderLine('HX-Trigger-After-Swap'),
);
}

Expand Down
Loading