Skip to content

Commit

Permalink
Merge pull request #137 from bearsunday/php8.3
Browse files Browse the repository at this point in the history
Add PHP 8.3 to GitHub Workflows and Drop PHP 8.0 support
  • Loading branch information
koriym authored May 17, 2024
2 parents 9ef5a2b + dc24b1f commit 6d804ff
Show file tree
Hide file tree
Showing 57 changed files with 202 additions and 279 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ jobs:
cs:
uses: ray-di/.github/.github/workflows/coding-standards.yml@v1
with:
php_version: 8.1
php_version: 8.3
12 changes: 8 additions & 4 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ jobs:
options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3
strategy:
matrix:
php-version:
- 8.0
dependencies: [highest, lowest]
os: [ubuntu-latest]
include:
Expand All @@ -34,10 +32,16 @@ jobs:
- php-version: 8.1
os: macos-latest
- php-version: 8.2
dependencies: lowest-ignore
dependencies: lowest
os: ubuntu-latest
- php-version: 8.2
dependencies: highest-ignore
dependencies: highest
os: ubuntu-latest
- php-version: 8.3
dependencies: highest
os: ubuntu-latest
- php-version: 8.3
dependencies: lowest
os: ubuntu-latest
steps:
- name: Checkout
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ jobs:
sa:
uses: ray-di/.github/.github/workflows/static-analysis.yml@v1
with:
php_version: 8.1
php_version: 8.3
has_crc_config: true
2 changes: 2 additions & 0 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ tools:
php_pdepend: true
php_analyzer: true
build:
image: default-bionic
nodes:
analysis:
tests:
Expand All @@ -14,5 +15,6 @@ build:
environment:
redis: true
php:
version: 8.2
pecl_extensions:
- redis
7 changes: 3 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
}
],
"require": {
"php": "^8.0",
"php": "^8.1",
"bear/fastly-module": "^0.1.1",
"bear/resource": "^1.16.1",
"bear/sunday": "^1.5",
"doctrine/annotations": "^1.8 || ^2.0",
"doctrine/cache": "^1.12 || ^2.0",
"mobiledetect/mobiledetectlib": "^2.8 || ^3.74",
"mobiledetect/mobiledetectlib": "^3.74",
"psr/cache": "^1.0 || ^2.0 || ^3.0",
"ray/aop": "^2.10",
"ray/di": "^2.13.1",
Expand All @@ -33,7 +33,6 @@
"phpstan/phpstan": "^1.9",
"phpunit/phpunit": "^9.5.28",
"psalm/plugin-phpunit": "^0.18.4",
"psr/log": "^1.1",
"ray/object-visual-grapher": "^1.0",
"ray/rector-ray": "^1.0",
"rector/rector": "^0.14.8",
Expand Down Expand Up @@ -81,7 +80,7 @@
"coverage": ["php -dzend_extension=xdebug.so -dxdebug.mode=coverage ./vendor/bin/phpunit --coverage-text --coverage-html=build/coverage"],
"pcov": ["php -dextension=pcov.so -d pcov.enabled=1 ./vendor/bin/phpunit --coverage-text --coverage-html=build/coverage --coverage-clover=coverage.xml"],
"cs": ["./vendor/bin/phpcs"],
"cs-fix": ["./vendor/bin/phpcbf src tests"],
"cs-fix": ["./vendor/bin/phpcbf src src-annotation tests"],
"clean": ["./vendor/bin/phpstan clear-result-cache", "./vendor/bin/psalm --clear-cache", "rm -rf tests/tmp/*.php"],
"sa": ["./vendor/bin/psalm --show-info=true", "./vendor/bin/phpstan analyse -c phpstan.neon"],
"metrics": ["./vendor/bin/phpmetrics --report-html=build/metrics --exclude=Exception --junit=build/junit.xml src"],
Expand Down
2 changes: 1 addition & 1 deletion phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

<!-- Directories to be checked -->
<file>src</file>
<file>src-annotation</file>
<file>tests</file>
<exclude-pattern>*/tests/tmp/*</exclude-pattern>

Expand All @@ -25,7 +26,6 @@
<!-- Exclude NativeTypeHintrule from interface and abstract class -->
<rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint">
<exclude-pattern>*/src/*Interface.php</exclude-pattern>
<exclude-pattern>*/src/Abstract*.php</exclude-pattern>
<exclude-pattern>*/src/ResourceObject.php</exclude-pattern>
<exclude-pattern>*/tests/SurrogateKeysTest.php</exclude-pattern>
</rule>
Expand Down
2 changes: 2 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config https://psalm.dev/schema/config"
findUnusedBaselineEntry="true"
findUnusedCode="false"
>
<projectFiles>
<directory name="src" />
Expand Down
3 changes: 2 additions & 1 deletion rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->paths([
__DIR__ . '/src',
__DIR__ . '/src-annotation',
__DIR__ . '/tests/*/*Test.php',
]);

Expand All @@ -18,6 +19,6 @@
$rectorConfig->rule(AnnotationBindingRector::class);
// define sets of rules
$rectorConfig->sets([
LevelSetList::UP_TO_PHP_80,
LevelSetList::UP_TO_PHP_81,
]);
};
6 changes: 3 additions & 3 deletions src-annotation/AbstractCacheControl.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

namespace BEAR\RepositoryModule\Annotation;

use Doctrine\Common\Annotations\NamedArgumentConstructorAnnotation;
use Stringable;

abstract class AbstractCacheControl
abstract class AbstractCacheControl implements Stringable
{
abstract function __toString();
abstract function __toString(): string;
}
15 changes: 4 additions & 11 deletions src-annotation/AbstractCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,10 @@

namespace BEAR\RepositoryModule\Annotation;

use Doctrine\Common\Annotations\NamedArgumentConstructorAnnotation;

abstract class AbstractCommand implements NamedArgumentConstructorAnnotation
abstract class AbstractCommand
{
/**
* @var string
*/
public $uri = false;

public function __construct(string $uri)
{
$this->uri = $uri;
public function __construct(
public string $uri,
) {
}
}
19 changes: 8 additions & 11 deletions src-annotation/CacheEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,21 @@
namespace BEAR\RepositoryModule\Annotation;

use Attribute;
use Doctrine\Common\Annotations\NamedArgumentConstructorAnnotation;
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
use Ray\Di\Di\Qualifier;

/**
* @Annotation
* @Target("METHOD")
* @Qualifier()
* @NamedArgumentConstructor()
*/
#[Attribute(Attribute::TARGET_METHOD | Attribute::TARGET_PROPERTY), Qualifier]
final class CacheEngine implements NamedArgumentConstructorAnnotation
#[Attribute(Attribute::TARGET_METHOD | Attribute::TARGET_PROPERTY)]
#[Qualifier]
final class CacheEngine
{
/**
* @var string
*/
public $value;

public function __construct(string $value)
{
$this->value = $value;
public function __construct(
public string $value,
) {
}
}
49 changes: 10 additions & 39 deletions src-annotation/Cacheable.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,57 +5,28 @@
namespace BEAR\RepositoryModule\Annotation;

use Attribute;

use BEAR\QueryRepository\CacheInterceptor;
use Doctrine\Common\Annotations\NamedArgumentConstructorAnnotation;
use function is_string;
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;

/**
* @Annotation
* @Target("CLASS")
*
* @see CacheInterceptor
* @NamedArgumentConstructor()
*/
#[Attribute(Attribute::TARGET_CLASS)]
final class Cacheable implements NamedArgumentConstructorAnnotation
final class Cacheable
{
/**
* @var 'short'|'medium'|'long'|'never'
* @Enum({"short", "medium", "long", "never"})
*/
public $expiry;

/**
* @var int
*/
public $expirySecond;

/**
* @var string
*/
public $expiryAt;

/**
* @var bool
*/
public $update;

/**
* @var 'value'|'view'
* @Enum({"value", "view"})
*/
public $type;

/**
* @param 'short'|'medium'|'long'|'never' $expiry
* @param 'value'|'view' $type
*/
public function __construct(string $expiry = 'never', int $expirySecond = 0, string $expiryAt = '', bool $update = false, string $type = 'value')
{
$this->expiry = $expiry;
$this->expirySecond = $expirySecond;
$this->expiryAt = $expiryAt;
$this->update = $update;
$this->type = $type;
public function __construct(
public string $expiry = 'never',
public int $expirySecond = 0,
public string $expiryAt = '',
public bool $update = false,
public string $type = 'value',
) {
}
}
3 changes: 1 addition & 2 deletions src-annotation/CacheableResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@
/**
* @Annotation
* @Target({"METHOD","CLASS"})
*
* @see DonutCacheModule
* @see DonutCacheableResponseInterceptor
* @see DonutCommandInterceptor
*/
#[Attribute(Attribute::TARGET_METHOD|Attribute::TARGET_CLASS)]
#[Attribute(Attribute::TARGET_METHOD | Attribute::TARGET_CLASS)]
final class CacheableResponse
{
}
3 changes: 2 additions & 1 deletion src-annotation/Commands.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
* @Target("METHOD")
* @Qualifier
*/
#[Attribute(Attribute::TARGET_METHOD | Attribute::TARGET_PARAMETER) , Qualifier]
#[Attribute(Attribute::TARGET_METHOD | Attribute::TARGET_PARAMETER)]
#[Qualifier]
final class Commands
{
}
3 changes: 1 addition & 2 deletions src-annotation/DonutCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@
/**
* @Annotation
* @Target({"METHOD","CLASS"})
*
* @see DonutCacheModule
* @see DonutCacheInterceptor
* @see DonutCommandInterceptor
*/
#[Attribute(Attribute::TARGET_METHOD|Attribute::TARGET_CLASS)]
#[Attribute(Attribute::TARGET_METHOD | Attribute::TARGET_CLASS)]
final class DonutCache
{
}
12 changes: 5 additions & 7 deletions src-annotation/EtagPool.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@
* @Qualifier
* @NamedArgumentConstructor
*/
#[Attribute(Attribute::TARGET_PARAMETER | Attribute::TARGET_METHOD), Qualifier]
#[Attribute(Attribute::TARGET_PARAMETER | Attribute::TARGET_METHOD)]
#[Qualifier]
final class EtagPool
{
/** @var string */
public $value;

public function __construct(string $value = '')
{
$this->value = $value;
public function __construct(
public string $value = '',
) {
}
}
Loading

0 comments on commit 6d804ff

Please sign in to comment.