Skip to content
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

Drop PHP 8.2 Support #212

Merged
merged 6 commits into from
Jan 9, 2025
Merged
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ The set provides best practices to make development more fun and classes/service
| Requirement | Constraint | Supported by |
|--------------|---------------------|------------------|
| PHP | `^8.3` | `HEAD ⋯ 5.0.0` |
| | `^8.2` | `HEAD ⋯ 2.0.0` |
| | `^8.2` | `7.1.0 ⋯ 2.0.0` |
| | `^8.1` | `6.4.2 ⋯ 2.0.0` |
| | `^8.0` | `4.6.0 ⋯ 2.0.0` |
| | `^8.0.0` | `1.1.2 ⋯ 0.12.0` |
Expand Down
1 change: 0 additions & 1 deletion composer-dependency-analyser.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
// General
$config = (new Configuration())
->enableAnalysisOfUnusedDevDependencies()
->ignoreErrorsOnPackage('symfony/polyfill-php83', [ErrorType::UNUSED_DEPENDENCY])
->ignoreErrorsOnPackage('bamarni/composer-bin-plugin', [ErrorType::UNUSED_DEPENDENCY])
->ignoreErrorsOnPackage('laravel/scout', [ErrorType::DEV_DEPENDENCY_IN_PROD])
->ignoreUnknownClasses([
Expand Down
1 change: 1 addition & 0 deletions composer-require-checker.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"Mockery\\Adapter\\Phpunit\\MockeryPHPUnitIntegration",
"Orchestra\\Testbench\\TestCase",
"PHPStan\\Analyser\\Scope",
"PHPStan\\Node\\ClassConstantsNode",
"PHPStan\\Node\\InClassNode",
"PHPStan\\Reflection\\ClassReflection",
"PHPStan\\Reflection\\MethodReflection",
Expand Down
5 changes: 2 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"forum": "https://github.com/LastDragon-ru/lara-asp/discussions"
},
"require": {
"php": "^8.2|^8.3",
"php": "^8.3",
"ext-bcmath": "*",
"ext-dom": "*",
"ext-filter": "*",
Expand Down Expand Up @@ -65,7 +65,7 @@
"league/commonmark": "^2.6.0",
"league/config": "^1.1.1",
"mockery/mockery": "^1.6.5",
"nette/neon": "^3.4",
"nette/neon": "^3.4.1",
"nikic/php-parser": "^5.0",
"nuwave/lighthouse": "^6.36.0",
"opis/json-schema": "^2.3.0",
Expand All @@ -83,7 +83,6 @@
"symfony/http-foundation": "^7.0.0",
"symfony/http-kernel": "^7.0.0",
"symfony/mime": "^7.0.0",
"symfony/polyfill-php83": "^1.28",
"symfony/property-access": "^7.0.0",
"symfony/property-info": "^7.0.0",
"symfony/psr-http-message-bridge": "^7.0.0",
Expand Down
1 change: 1 addition & 0 deletions docs/Shared/Upgrade/FromV7.md
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
* [ ] PHP 8.2 is not supported anymore. Migrate to the newer version.
* [ ] Laravel v10 is not supported anymore. Migrate to the newer version.
3 changes: 1 addition & 2 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
"^11.0.8"
],
"php": [
"^8.3",
"^8.2"
"^8.3"
]
},
"7.1.0": {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ This package contains useful utilities and classes.
| Requirement | Constraint | Supported by |
|--------------|---------------------|------------------|
| PHP | `^8.3` | `HEAD ⋯ 5.0.0` |
| | `^8.2` | `HEAD ⋯ 2.0.0` |
| | `^8.2` | `7.1.0 ⋯ 2.0.0` |
| | `^8.1` | `6.4.2 ⋯ 2.0.0` |
| | `^8.0` | `4.6.0 ⋯ 2.0.0` |
| | `^8.0.0` | `1.1.2 ⋯ 0.12.0` |
Expand Down
1 change: 1 addition & 0 deletions packages/core/UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Please also see [changelog](https://github.com/LastDragon-ru/lara-asp/releases)
[//]: # (start: preprocess/c45228918cc92f69)
[//]: # (warning: Generated automatically. Do not edit.)

* [ ] PHP 8.2 is not supported anymore. Migrate to the newer version.
* [ ] Laravel v10 is not supported anymore. Migrate to the newer version.

[//]: # (end: preprocess/c45228918cc92f69)
Expand Down
5 changes: 2 additions & 3 deletions packages/core/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@
"forum": "https://github.com/LastDragon-ru/lara-asp/discussions"
},
"require": {
"php": "^8.2|^8.3",
"php": "^8.3",
"illuminate/console": "^11.0.8",
"illuminate/container": "^11.0.8",
"illuminate/contracts": "^11.0.8",
"illuminate/support": "^11.0.8",
"symfony/deprecation-contracts": "^3.0.0",
"symfony/filesystem": "^7.0.0",
"symfony/polyfill-php83": "^1.28"
"symfony/filesystem": "^7.0.0"
},
"require-dev": {
"phpunit/phpunit": "^10.5.0|^11.0.0",
Expand Down
3 changes: 1 addition & 2 deletions packages/core/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
"^11.0.8"
],
"php": [
"^8.3",
"^8.2"
"^8.3"
]
},
"7.1.0": {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/Package.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
namespace LastDragon_ru\LaraASP\Core;

final class Package {
public const Name = 'lara-asp-core';
public const string Name = 'lara-asp-core';
}
4 changes: 2 additions & 2 deletions packages/core/src/Utils/ConfigMerger.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ class ConfigMerger {
/**
* Array that has this mark may contains any keys/values.
*/
public const Strict = '__strict';
public const string Strict = '__strict';

/**
* Array that has this mark will be replaced completely.
*/
public const Replace = '__replace';
public const string Replace = '__replace';

private bool $strict = true;

Expand Down
1 change: 1 addition & 0 deletions packages/core/src/Utils/Scheduler.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use function sprintf;

/**
* @see https://github.com/mockery/mockery/issues/1317
* @phpstan-type SchedulableSettings array{
* cron: string,
* enabled?: bool,
Expand Down
2 changes: 1 addition & 1 deletion packages/dev/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Various internal tools and helpers to develop the package itself.
| Requirement | Constraint | Supported by |
|--------------|---------------------|------------------|
| PHP | `^8.3` | `HEAD ⋯ 6.2.0` |
| | `^8.2` | `HEAD ⋯ 6.2.0` |
| | `^8.2` | `7.1.0 ⋯ 6.2.0` |
| | `^8.1` | `6.4.2 ⋯ 6.2.0` |
| PHPStan | `^1.10` | `HEAD ⋯ 6.2.0` |

Expand Down
1 change: 1 addition & 0 deletions packages/dev/UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Please also see [changelog](https://github.com/LastDragon-ru/lara-asp/releases)
[//]: # (start: preprocess/c45228918cc92f69)
[//]: # (warning: Generated automatically. Do not edit.)

* [ ] PHP 8.2 is not supported anymore. Migrate to the newer version.
* [ ] Laravel v10 is not supported anymore. Migrate to the newer version.

[//]: # (end: preprocess/c45228918cc92f69)
Expand Down
4 changes: 2 additions & 2 deletions packages/dev/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
"forum": "https://github.com/LastDragon-ru/lara-asp/discussions"
},
"require": {
"php": "^8.2|^8.3",
"php": "^8.3",
"illuminate/contracts": "^11.0.8",
"illuminate/support": "^11.0.8",
"larastan/larastan": "^2.8.1",
"lastdragon-ru/lara-asp-core": "self.version",
"lastdragon-ru/lara-asp-documentator": "self.version",
"nikic/php-parser": "^5.0",
"nette/neon": "^3.4",
"nette/neon": "^3.4.1",
"phpstan/phpstan": "^1.10",
"symfony/var-dumper": "^7.0.0"
},
Expand Down
3 changes: 1 addition & 2 deletions packages/dev/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
"requirements": {
"HEAD": {
"php": [
"^8.3",
"^8.2"
"^8.3"
],
"phpstan/phpstan": [
"^1.10"
Expand Down
2 changes: 1 addition & 1 deletion packages/dev/src/Package.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
namespace LastDragon_ru\LaraASP\Dev;

final class Package {
public const Name = 'lara-asp-dev';
public const string Name = 'lara-asp-dev';
}
73 changes: 73 additions & 0 deletions packages/dev/src/PhpStan/ClassConstantMustBeTyped/Rule.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<?php declare(strict_types = 1);

namespace LastDragon_ru\LaraASP\Dev\PhpStan\ClassConstantMustBeTyped;

use Illuminate\Support\Str;
use LastDragon_ru\LaraASP\Dev\Package;
use Override;
use PhpParser\Node;
use PHPStan\Analyser\Scope;
use PHPStan\Node\ClassConstantsNode;
use PHPStan\Rules\Rule as RuleContract;
use PHPStan\Rules\RuleErrorBuilder;

use function reset;
use function sprintf;

/**
* Makes the `type` required for class constants (the type is required on level 10).
*
* @see https://github.com/slevomat/coding-standard/issues/1701
* @see https://github.com/slevomat/coding-standard/pull/1702
*
* @internal
* @implements RuleContract<ClassConstantsNode>
*/
readonly class Rule implements RuleContract {
public function __construct() {
// empty
}

#[Override]
public function getNodeType(): string {
return ClassConstantsNode::class;
}

/**
* @inheritDoc
*/
#[Override]
public function processNode(Node $node, Scope $scope): array {
// Typed?
$untyped = [];

foreach ($node->getConstants() as $constant) {
if ($constant->type === null) {
$untyped[] = $constant;
}
}

if ($untyped !== []) {
$id = Str::camel(Package::Name).'.classConstantMustBeTyped';
$class = $node->getClassReflection()->getName();
$message = 'Class constant `%s::%s` must be typed.';
$messages = [];

foreach ($untyped as $constant) {
$const = reset($constant->consts);
$name = $const !== false ? $const->name : 'Unknown O_O';
$messages[] = RuleErrorBuilder::message(
sprintf($message, $class, $name),
)
->line($constant->getLine())
->identifier($id)
->build();
}

return $messages;
}

// Nope
return [];
}
}
60 changes: 60 additions & 0 deletions packages/dev/src/PhpStan/ClassConstantMustBeTyped/RuleTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?php declare(strict_types = 1);

namespace LastDragon_ru\LaraASP\Dev\PhpStan\ClassConstantMustBeTyped;

use Override;
use PHPStan\Rules\Rule as RuleContract;
use PHPStan\Testing\RuleTestCase;
use PHPUnit\Framework\Attributes\CoversClass;

use function sprintf;

/**
* @internal
* @extends RuleTestCase<Rule>
*/
#[CoversClass(Rule::class)]
final class RuleTest extends RuleTestCase {
#[Override]
protected function getRule(): RuleContract {
return new Rule();
}

public function testRule(): void {
$this->analyse([__FILE__], [
[
sprintf('Class constant `%s::%s` must be typed.', RuleTest_Constants::class, 'PublicUntyped'),
49,
],
[
sprintf('Class constant `%s::%s` must be typed.', RuleTest_Constants::class, 'PrivateUntyped'),
50,
],
[
sprintf('Class constant `%s::%s` must be typed.', RuleTest_Constants::class, 'ProtectedUntyped'),
51,
],
]);
}
}

// @phpcs:disable PSR1.Classes.ClassDeclaration.MultipleClasses
// @phpcs:disable Squiz.Classes.ValidClassName.NotCamelCaps

/**
* @internal
* @noinspection PhpMultipleClassesDeclarationsInOneFile
*/
class RuleTest_Constants {
public const PublicUntyped = 123;
private const PrivateUntyped = 123;
protected const ProtectedUntyped = 123;
public const int PublicTyped = 123;
private const int PrivateTyped = 123;
protected const int ProtectedTyped = 123;

public function __construct() {
echo self::PrivateTyped;
echo self::PrivateUntyped;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
services:
-
class: LastDragon_ru\LaraASP\Dev\PhpStan\ClassConstantMustBeTyped\Rule
tags:
- phpstan.rules.rule
4 changes: 2 additions & 2 deletions packages/dev/src/PhpStan/ClassMustBeFinal/Rule.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
* @internal
* @implements RuleContract<InClassNode>
*/
class Rule implements RuleContract {
readonly class Rule implements RuleContract {
public function __construct(
/**
* @var array<array-key, class-string>
*/
protected readonly array $classes,
protected array $classes,
) {
// empty
}
Expand Down
6 changes: 3 additions & 3 deletions packages/dev/src/PhpStan/ClassMustBeInternal/Rule.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@
* @internal
* @implements RuleContract<InClassNode>
*/
class Rule implements RuleContract {
readonly class Rule implements RuleContract {
public function __construct(
/**
* @var array<array-key, class-string>
*/
protected readonly array $classes,
protected array $classes,
/**
* @var array<array-key, class-string>
*/
protected readonly array $ignored = [],
protected array $ignored = [],
) {
// empty
}
Expand Down
2 changes: 1 addition & 1 deletion packages/documentator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ This package provides various utilities for documentation generation such as Mar
| Requirement | Constraint | Supported by |
|--------------|---------------------|------------------|
| PHP | `^8.3` | `HEAD ⋯ 5.0.0` |
| | `^8.2` | `HEAD ⋯ 5.0.0-beta.1` |
| | `^8.2` | `7.1.0 ⋯ 5.0.0-beta.1` |
| | `^8.1` | `6.4.2 ⋯ 5.0.0-beta.1` |
| Laravel | `^11.0.8` | `HEAD` |
| | `^11.0.0` | `7.1.0 ⋯ 6.2.0` |
Expand Down
1 change: 1 addition & 0 deletions packages/documentator/UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Please also see [changelog](https://github.com/LastDragon-ru/lara-asp/releases)
[//]: # (start: preprocess/c45228918cc92f69)
[//]: # (warning: Generated automatically. Do not edit.)

* [ ] PHP 8.2 is not supported anymore. Migrate to the newer version.
* [ ] Laravel v10 is not supported anymore. Migrate to the newer version.

[//]: # (end: preprocess/c45228918cc92f69)
Expand Down
3 changes: 1 addition & 2 deletions packages/documentator/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"forum": "https://github.com/LastDragon-ru/lara-asp/discussions"
},
"require": {
"php": "^8.2|^8.3",
"php": "^8.3",
"ext-filter": "*",
"ext-intl": "*",
"ext-mbstring": "*",
Expand All @@ -35,7 +35,6 @@
"symfony/deprecation-contracts": "^3.0.0",
"symfony/filesystem": "^7.0.0",
"symfony/finder": "^7.0.0",
"symfony/polyfill-php83": "^1.28",
"symfony/serializer": "^7.0.0",
"lastdragon-ru/lara-asp-core": "self.version",
"lastdragon-ru/lara-asp-formatter": "self.version",
Expand Down
Loading
Loading