Skip to content

Commit

Permalink
Compatibility with 5.2 (#32)
Browse files Browse the repository at this point in the history
* UI 5.2 compatibility fix

* fix type

* update testing scripts
  • Loading branch information
DarkSide666 authored Jan 21, 2025
1 parent ffe1d82 commit 9a6eb0e
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 21 deletions.
5 changes: 1 addition & 4 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,4 @@ categories:
labels:
- "BC-break"
- title: "Other changes"
template: |
## What’s Changed
$CHANGES
template: $CHANGES
2 changes: 1 addition & 1 deletion .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build Release
name: Build release

on:
push:
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/test-unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Setup cache 2/2
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-smoke-${{ matrix.php }}-${{ matrix.type }}-${{ hashFiles('composer.json') }}
Expand All @@ -46,15 +46,15 @@ jobs:
- name: Install PHP dependencies
run: |
if [ "${{ matrix.type }}" != "Phpunit" ] && [ "${{ matrix.type }}" != "StaticAnalysis" ]; then composer remove --no-interaction --no-update phpunit/phpunit johnkary/phpunit-speedtrap --dev; fi
if [ "${{ matrix.type }}" != "CodingStyle" ]; then composer remove --no-interaction --no-update friendsofphp/php-cs-fixer --dev; fi
if [ "${{ matrix.type }}" != "Phpunit" ] && [ "${{ matrix.type }}" != "StaticAnalysis" ]; then composer remove --no-interaction --no-update phpunit/phpunit ergebnis/phpunit-slow-test-detector --dev; fi
if [ "${{ matrix.type }}" != "CodingStyle" ]; then composer remove --no-interaction --no-update friendsofphp/php-cs-fixer ergebnis/composer-normalize --dev; fi
if [ "${{ matrix.type }}" != "StaticAnalysis" ]; then composer remove --no-interaction --no-update phpstan/\* behat/\* --dev; fi
composer update --ansi --prefer-dist --no-interaction --no-progress --optimize-autoloader
- name: "Run tests: SQLite (only for Phpunit)"
if: startsWith(matrix.type, 'Phpunit')
run: |
echo "not implemented" || vendor/bin/phpunit --exclude-group none --no-coverage -v
echo "not implemented" || vendor/bin/phpunit --exclude-group none --no-coverage --fail-on-warning --fail-on-risky $(if vendor/bin/phpunit --version | grep -q '^PHPUnit 9\.'; then echo -v; else echo --fail-on-notice --fail-on-deprecation --display-notices --display-deprecations --display-warnings --display-errors --display-incomplete --display-skipped; fi)
- name: Check Coding Style (only for CodingStyle)
if: matrix.type == 'CodingStyle'
Expand All @@ -68,4 +68,4 @@ jobs:
if: matrix.type == 'StaticAnalysis'
run: |
echo "memory_limit = 2G" > /usr/local/etc/php/conf.d/custom-memory-limit.ini
vendor/bin/phpstan analyse
vendor/bin/phpstan analyse -v
13 changes: 8 additions & 5 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
<?php

$finder = PhpCsFixer\Finder::create()
declare(strict_types=1);

use PhpCsFixer\Config;
use PhpCsFixer\Finder;

$finder = Finder::create()
->in([__DIR__])
->exclude(['vendor']);

return (new PhpCsFixer\Config())
return (new Config())
->setRiskyAllowed(true)
->setRules([
'@PhpCsFixer' => true,
Expand Down Expand Up @@ -33,6 +38,7 @@
'blank_line_before_statement' => [
'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'exit'],
],
'final_internal_class' => false,
'combine_consecutive_issets' => false,
'combine_consecutive_unsets' => false,
'multiline_whitespace_before_semicolons' => false,
Expand All @@ -46,9 +52,6 @@
'general_phpdoc_annotation_remove' => [
'annotations' => ['author', 'copyright', 'throws'],
],
'nullable_type_declaration_for_default_null_value' => [
'use_nullable_type_declaration' => false,
],

// fn => without curly brackets is less readable,
// also prevent bounding of unwanted variables for GC
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@
},
"require-release": {
"php": ">=7.4 <8.4",
"atk4/ui": "~5.0.0"
"atk4/ui": "~5.2.0"
},
"require-dev": {
"ergebnis/composer-normalize": "^2.13",
"ergebnis/phpunit-slow-test-detector": "^2.9",
"friendsofphp/php-cs-fixer": "^3.0",
"johnkary/phpunit-speedtrap": "^3.3",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan": "^1.0",
"phpstan/phpstan-deprecation-rules": "^1.0",
"phpstan/phpstan-strict-rules": "^1.3",
"phpunit/phpunit": "^9.5.5"
"phpunit/phpunit": "^9.5.5 || ^10.0"
},
"minimum-stability": "dev",
"prefer-stable": true,
Expand Down
3 changes: 2 additions & 1 deletion phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ includes:

parameters:
level: 6
checkMissingOverrideMethodAttribute: true
paths:
- .
excludePaths:
- vendor

ignoreErrors:
# relax strict rules
- '~^Only booleans are allowed in .+, .+ given( on the (left|right) side)?\.~'
- '~^Only booleans are allowed in .+, .+ given( on the (left|right) side)?\.$~'
7 changes: 6 additions & 1 deletion src/Chart.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,18 @@
use Atk4\Ui\Js\JsExpression;
use Atk4\Ui\Js\JsFunction;
use Atk4\Ui\View;
use Atk4\Ui\View\ModelTrait;

/**
* Chart.js 3.9.1 documentation: https://www.chartjs.org/docs/3.9.1/
* Examples https://www.chartjs.org/docs/latest/samples/information.html .
*/
class Chart extends View
{
use ModelTrait {
setModel as private _setModel;
}

public const TYPE_BAR = 'bar';
public const TYPE_LINE = 'line';
public const TYPE_PIE = 'pie';
Expand Down Expand Up @@ -162,7 +167,7 @@ public function setModel(Model $model, array $columns = []): void
}
$this->columns = $columns;

parent::setModel($model);
$this->_setModel($model);

$this->prepareDatasets();
}
Expand Down
2 changes: 1 addition & 1 deletion src/ScatterChart.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function prepareDatasets(): void
* @param string|null $xTitle X axis title
* @param string|null $yTitle Y axis title
*/
public function setAxisTitles(string $xTitle = null, string $yTitle = null): void
public function setAxisTitles(?string $xTitle = null, ?string $yTitle = null): void
{
$options = [
'scales' => [
Expand Down

0 comments on commit 9a6eb0e

Please sign in to comment.