Skip to content
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
10 changes: 8 additions & 2 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ jobs:
spaze/phpstan-disallowed-calls

- if: matrix.php-version == '8.0'
run: composer remove --dev --no-update rector/rector
run: >
composer remove --dev --no-update
rector/rector
spaze/phpstan-disallowed-calls

- if: matrix.php-version == '7.4' || matrix.php-version == '8.0'
run: rm -rf src/Enum tests/Enum src/FluidXPlate/Scalars src/Microplate/Scalars tests/FluidXPlate/Scalars tests/Microplate/Scalars
Expand Down Expand Up @@ -102,7 +105,10 @@ jobs:
spaze/phpstan-disallowed-calls

- if: matrix.php-version == '8.0'
run: composer remove --dev --no-update rector/rector
run: >
composer remove --dev --no-update
rector/rector
spaze/phpstan-disallowed-calls

- if: matrix.php-version == '7.4' || matrix.php-version == '8.0'
run: rm -rf src/Enum tests/Enum src/FluidXPlate/Scalars src/Microplate/Scalars tests/FluidXPlate/Scalars tests/Microplate/Scalars
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"phpstan/phpstan-strict-rules": "^1 || ^2.0.3",
"phpunit/phpunit": "^9.6.22 || ^10.5.45 || ^11.5.10 || ^12.0.5",
"rector/rector": "^1.2.10 || ^2.0.9",
"spaze/phpstan-disallowed-calls": "^2 || ^4.4",
"spaze/phpstan-disallowed-calls": "^4.4",
"thecodingmachine/phpstan-safe-rule": "^1.2.0"
},
"suggest": {
Expand Down
4 changes: 1 addition & 3 deletions phpstan/include-by-php-version.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

$includes = [];

// PHP 8.0+ can use rules.neon (requires spaze/phpstan-disallowed-calls)
// PHP 7.4 has this package removed via composer, so skip rules.neon
if (version_compare(PHP_VERSION, '8.0', '>=')) {
if (class_exists(\Spaze\PHPStan\Rules\Disallowed\DisallowedHelper::class)) {
$includes[] = __DIR__ . '/../rules.neon';
}

Expand Down
4 changes: 4 additions & 0 deletions rules.neon
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ parameters:
- function: 'clock()'
message: 'it is just meant for debugging.'
errorTip: 'remove debugging code.'
disallowedClasses:
- class: 'Carbon\CarbonImmutable'
message: 'mixing mutable and immutable Carbon semantics makes code hard to reason about.'
errorTip: 'use Carbon\Carbon instead. See https://gitlab.mll/documentation/coding-guidelines/-/issues/313'
disallowedStaticCalls:
- method: 'Carbon\Carbon::create()'
message: 'it ignores errors.'
Expand Down
Loading