Skip to content

Commit d8d4613

Browse files
LordSimalmarkstory
andauthored
update stan + cleanup (#477)
* update stan * Fix potential type error Replace the vague type error on failure with a more explicit error message. * adjust CI --------- Co-authored-by: Mark Story <mark@mark-story.com>
1 parent 6dfe119 commit d8d4613

File tree

10 files changed

+12
-240
lines changed

10 files changed

+12
-240
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -15,56 +15,8 @@ permissions:
1515

1616
jobs:
1717
testsuite:
18-
runs-on: ubuntu-22.04
19-
continue-on-error: ${{ matrix.unstable }}
20-
strategy:
21-
fail-fast: false
22-
matrix:
23-
php-version: ['8.1']
24-
dependencies: [highest]
25-
unstable: [false]
26-
include:
27-
- php-version: '8.1'
28-
dependencies: lowest
29-
unstable: false
30-
- php-version: '8.2'
31-
dependencies: highest
32-
unstable: false
33-
- php-version: '8.3'
34-
dependencies: highest
35-
unstable: false
36-
- php-version: '8.4'
37-
dependencies: highest
38-
unstable: true
39-
40-
steps:
41-
- uses: actions/checkout@v4
42-
43-
- name: Setup PHP
44-
uses: shivammathur/setup-php@v2
45-
with:
46-
php-version: ${{ matrix.php-version }}
47-
extensions: mbstring, intl
48-
ini-values: zend.assertions=1
49-
coverage: pcov
50-
51-
- name: Composer install
52-
uses: ramsey/composer-install@v3
53-
with:
54-
dependency-versions: ${{ matrix.dependencies }}
55-
composer-options: ${{ matrix.composer-options }}
56-
57-
- name: Run PHPUnit
58-
run: |
59-
if [[ ${{ matrix.php-version }} == '8.1' && ${{ matrix.dependencies }} == 'highest' ]]; then
60-
export CODECOVERAGE=1 && vendor/bin/phpunit --display-deprecations --display-warnings --display-incomplete --display-skipped --coverage-clover=coverage.xml
61-
else
62-
vendor/bin/phpunit --display-deprecations --display-warnings
63-
fi
64-
65-
- name: Code Coverage Report
66-
if: success() && matrix.php-version == '8.1' && matrix.dependencies == 'highest'
67-
uses: codecov/codecov-action@v5
18+
uses: cakephp/.github/.github/workflows/testsuite-without-db.yml@5.x
19+
secrets: inherit
6820

6921
cs-stan:
7022
uses: cakephp/.github/.github/workflows/cs-stan.yml@5.x

.phive/phars.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phive xmlns="https://phar.io/phive">
3-
<phar name="phpstan" version="2.1.0" installed="2.1.0" location="./tools/phpstan" copy="false"/>
4-
<phar name="psalm" version="5.26.1" installed="5.26.1" location="./tools/psalm" copy="false"/>
3+
<phar name="phpstan" version="2.1.17" installed="2.1.17" location="./tools/phpstan" copy="false"/>
54
</phive>

.stickler.yml

Lines changed: 0 additions & 3 deletions
This file was deleted.

composer.json

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,7 @@
5959
"cs-check": "phpcs --colors --parallel=16 -p",
6060
"cs-fix": "phpcbf --colors --parallel=16 -p",
6161
"phpstan": "tools/phpstan analyse",
62-
"psalm": "tools/psalm --show-info=false",
63-
"psalm-baseline": "tools/psalm --set-baseline=psalm-baseline.xml",
64-
"stan": [
65-
"@phpstan",
66-
"@psalm"
67-
],
62+
"stan": "@phpstan",
6863
"stan-baseline": "tools/phpstan --generate-baseline",
6964
"stan-setup": "phive install",
7065
"test": "phpunit"

psalm-baseline.xml

Lines changed: 0 additions & 152 deletions
This file was deleted.

psalm.xml

Lines changed: 0 additions & 19 deletions
This file was deleted.

src/Chronos.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@
5656
* @property-read bool $utc checks if the timezone is UTC, true if UTC, false otherwise
5757
* @property-read string $timezoneName
5858
* @property-read string $tzName
59-
* @psalm-immutable
60-
* @psalm-consistent-constructor
59+
* @immutable
60+
* @phpstan-consistent-constructor
6161
*/
6262
class Chronos extends DateTimeImmutable implements Stringable
6363
{

src/ChronosDate.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@
4141
* @property-read int $age does a diffInYears() with default parameters
4242
* @property-read int<1, 4> $quarter the quarter of this instance, 1 - 4
4343
* @property-read int<1, 2> $half the half of the year, with 1 for months Jan...Jun and 2 for Jul...Dec.
44-
* @psalm-immutable
45-
* @psalm-consistent-constructor
44+
* @immutable
45+
* @phpstan-consistent-constructor
4646
*/
4747
class ChronosDate implements Stringable
4848
{
@@ -354,10 +354,11 @@ public function modify(string $modifier): static
354354
}
355355

356356
$new = clone $this;
357-
$new->native = $new->native->modify($modifier);
358-
if ($new->native === false) {
357+
$native = $new->native->modify($modifier);
358+
if ($native === false) {
359359
throw new InvalidArgumentException(sprintf('Unable to modify date using `%s`', $modifier));
360360
}
361+
$new->native = $native;
361362

362363
if ($new->format('H:i:s') !== '00:00:00') {
363364
$new->native = $new->native->setTime(0, 0, 0);

src/ChronosTime.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
use Stringable;
2222

2323
/**
24-
* @psalm-consistent-constructor
24+
* @phpstan-consistent-constructor
2525
*/
2626
class ChronosTime implements Stringable
2727
{

tests/TestCase/TestCase.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ protected function withTimezone(string $tz, Closure $cb)
138138
*/
139139
public function deprecated(Closure $callable): void
140140
{
141-
/** @var bool $deprecation Expand type for psalm */
142141
$deprecation = false;
143142

144143
$previousHandler = set_error_handler(

0 commit comments

Comments
 (0)