Skip to content
Closed
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
11 changes: 8 additions & 3 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ jobs:
if: ${{ github.event.pull_request.base.ref == github.event.repository.default_branch }}
name: Performance Regression Check
runs-on: ubuntu-latest

# Disable TypePHP completely for phpbench runs
env:
TYPEPHP_DISABLE: "true"

timeout-minutes: 180

steps:
Expand All @@ -43,7 +48,7 @@ jobs:
coverage: none

- name: Install dependencies
uses: ramsey/composer-install@v3
run: composer update --no-interaction --prefer-dist --quiet

- name: Check out base branch
run: |
Expand Down Expand Up @@ -86,8 +91,8 @@ jobs:
echo "${{ github.event.pull_request.head.sha }}" > benchmark-artifact/head-sha.txt

- name: Upload benchmark artifact
uses: actions/upload-artifact@v6
uses: actions/upload-artifact@v4
with:
name: benchmark-result
path: benchmark-artifact/
retention-days: 1
retention-days: 1
82 changes: 59 additions & 23 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@ on:
paths-ignore:
- "docs/**"
- ".github/**"
push:
branches:
- main
workflow_dispatch:
schedule:
- cron: "0 0 * * *"

env:
POSTGRES_USER: runner
POSTGRES_PASSWORD: ""
Expand All @@ -18,26 +22,53 @@ concurrency:
cancel-in-progress: true

jobs:
vitest:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
php: [8.5]
os: [ubuntu-latest]
discover-domains:
name: "Discover Integration Domains"
runs-on: ubuntu-latest
outputs:
domains: ${{ steps.scan.outputs.domains }}
steps:
- name: Checkout code
uses: actions/checkout@v4

name: "Run tests: ${{ matrix.os }}"
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
coverage: none

- name: Scan Integration directories
id: scan
run: |
php -r '
$domains = [];
foreach (glob("tests/Integration/*", GLOB_ONLYDIR) as $dir) {
$it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir));
foreach ($it as $file) {
if (str_ends_with($file->getFilename(), "Test.php")) {
$domains[] = basename($dir);
break;
}
}
}
sort($domains);
echo "domains=" . json_encode(array_values(array_unique($domains))) . "\n";
' >> $GITHUB_OUTPUT


vitest:
runs-on: ubuntu-latest
name: "Run JS tests"
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
php-version: 8.5
extensions: dom, curl, libxml, mbstring, pcntl, fileinfo, pdo, sqlite, pdo_sqlite, pdo_mysql, pdo_pgsql, intl, ftp, zip
coverage: pcov
coverage: none

- name: Setup Bun
uses: oven-sh/setup-bun@v2
Expand All @@ -52,27 +83,29 @@ jobs:
run: bun run test

phpunit:
needs: discover-domains
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
php: [8.5]
database: [sqlite, mysql, postgres]
database: [sqlite]
stability: [prefer-stable]
domain: ${{ fromJson(needs.discover-domains.outputs.domains) }}
include:
- os: windows-latest
- os: ubuntu-latest
php: 8.5
database: sqlite
database: mysql
stability: prefer-stable
domain: Database
- os: ubuntu-latest
php: 8.5
database: sqlite
stability: prefer-lowest
env:
POSTGRES_USER: ${{ matrix.os == 'windows-latest' && 'postgres' || 'runner' }}
database: postgres
stability: prefer-stable
domain: Database

name: "Run tests: PHP ${{ matrix.php }} - ${{ matrix.database }} - ${{ matrix.stability }} - ${{ matrix.os }}"
name: "${{ matrix.domain }} (PHP ${{ matrix.php }} - ${{ matrix.database }})"

steps:
- name: Checkout code
Expand All @@ -83,18 +116,21 @@ jobs:
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, pcntl, fileinfo, pdo, sqlite, pdo_sqlite, pdo_mysql, pdo_pgsql, intl, ftp, zip
coverage: pcov
coverage: none

- name: Setup problem matchers
run: |
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

- name: Install dependencies
run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction --ignore-platform-reqs
run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction --ignore-platform-reqs

- name: Warm Up TypePHP Cache
run: php vendor/bin/typephp cache:warm

- name: "Setup Redis"
if: ${{ matrix.os != 'windows-latest' }}
if: ${{ matrix.domain == 'Cache' || matrix.domain == 'Framework' }}
uses: supercharge/redis-github-action@1.8.1

- name: "Setup MySQL"
Expand Down Expand Up @@ -125,5 +161,5 @@ jobs:
- name: List discovered locations
run: php ./tempest discovery:status

- name: Execute tests
run: php -d"error_reporting = E_ALL & ~E_DEPRECATED" -dmemory_limit=2G vendor/bin/paratest --runner WrapperRunner --processes 4
- name: Execute domain tests
run: php -d"error_reporting = E_ALL & ~E_DEPRECATED" -dmemory_limit=2G vendor/bin/paratest --runner WrapperRunner --processes 4 tests/Integration/${{ matrix.domain }}
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
"tempest/blade": "dev-main",
"thenetworg/oauth2-azure": "^2.2",
"twig/twig": "^3.16",
"typephp/typephp" : "^0.7.1",
"vertisan/oauth2-twitch-helix": "^2.0",
"wohali/oauth2-discord-new": "^1.2"
},
Expand Down
5 changes: 3 additions & 2 deletions packages/auth/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"adam-paterson/oauth2-slack": "^1.1",
"wohali/oauth2-discord-new": "^1.2",
"smolblog/oauth2-twitter": "^1.0",
"vertisan/oauth2-twitch-helix": "^2.0"
"vertisan/oauth2-twitch-helix": "^2.0",
"typephp/typephp": "^0.7.1"
},
"autoload": {
"psr-4": {
Expand All @@ -44,4 +45,4 @@
},
"license": "MIT",
"minimum-stability": "dev"
}
}
4 changes: 2 additions & 2 deletions packages/auth/src/AccessControl/AccessControl.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
use UnitEnum;

/**
* @template TSubject of object
* @template TResource of object
* @template TSubject of object = object
* @template TResource of object = object
*/
interface AccessControl
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@
use UnitEnum;

/**
* @template TSubject of object
* @template TResource of object
* @implements AccessControl<TSubject, TResource>
* @implements AccessControl<object, object>
*/
final readonly class PolicyBasedAccessControl implements AccessControl
{
Expand Down
3 changes: 3 additions & 0 deletions packages/auth/tests/AuthenticationAndOAuthSafetyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@

final class AuthenticationAndOAuthSafetyTest extends TestCase
{
/**
* @typephp-ignore
*/
#[Test]
public function database_authenticatable_resolver_rejects_non_authenticatable_classes(): void
{
Expand Down
3 changes: 2 additions & 1 deletion packages/cache/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"tempest/container": "3.x-dev"
},
"require-dev": {
"tempest/clock": "3.x-dev"
"tempest/clock": "3.x-dev",
"typephp/typephp": "^0.7.1"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 1 addition & 1 deletion packages/cache/src/Commands/CacheStatusCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function __invoke(bool $internal = true): void
$this->console->header('Internal caches');

foreach ([ConfigCache::class, ViewCache::class, IconCache::class] as $cacheName) {
/** @var Cache $cache */
/** @var ConfigCache|ViewCache|IconCache $cache */
$cache = $this->container->get($cacheName);

$this->console->keyValue(
Expand Down
3 changes: 3 additions & 0 deletions packages/clock/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
"psr/clock": "^1.0.0",
"tempest/datetime": "3.x-dev"
},
"require-dev": {
"typephp/typephp": "^0.7.1"
},
"autoload": {
"psr-4": {
"Tempest\\Clock\\": "src"
Expand Down
3 changes: 3 additions & 0 deletions packages/command-bus/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
"tempest/console": "3.x-dev",
"tempest/container": "3.x-dev"
},
"require-dev": {
"typephp/typephp": "^0.7.1"
},
"autoload": {
"files": [
"src/functions.php"
Expand Down
5 changes: 4 additions & 1 deletion packages/console/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
"tempest/validation": "3.x-dev",
"ext-readline": "*"
},
"require-dev": {
"typephp/typephp": "^0.7.1"
},
"suggest": {
"ext-pcntl": "Required to use some interactive console components.",
"ext-posix": "Required to use some interactive console components."
Expand All @@ -34,4 +37,4 @@
"bin/tempest",
"bin/tempest-complete"
]
}
}
2 changes: 1 addition & 1 deletion packages/console/src/Actions/ResolveConsoleInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
final readonly class ResolveConsoleInput
{
/**
* @param list<ConsoleArgumentDefinition> $argumentDefinitions
* @param ConsoleArgumentDefinition[] $argumentDefinitions
*
* @return array{0: list<ConsoleInputArgument>, 1: list<ConsoleArgumentDefinition>}
*/
Expand Down
2 changes: 1 addition & 1 deletion packages/console/src/Components/Option.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/
final class Option
{
/** @var T */
/** @var (T is UnitEnum ? string : T) */
public mixed $displayValue {
get {
if (! $this->value instanceof UnitEnum) {
Expand Down
2 changes: 1 addition & 1 deletion packages/console/src/Console.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function progressBar(iterable $data, Closure $handler): array;
/**
* Asks the user to select an option from a list using a closure.
*
* @param Closure(string $search): array $search
* @param Closure(?string $search): array $search
*/
public function search(string $label, Closure $search, bool $multiple = false, string|array|null $default = null): mixed;

Expand Down
2 changes: 1 addition & 1 deletion packages/console/src/ConsoleInputBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function __construct(
) {}

/**
* @return array<ConsoleInputArgument>
* @return list<mixed>
*/
public function build(): array
{
Expand Down
2 changes: 1 addition & 1 deletion packages/console/src/Input/ConsoleArgumentBag.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ final class ConsoleArgumentBag
/** @var ConsoleInputArgument[] */
private(set) array $arguments = [];

/** @var string[] */
/** @var (string|null)[] */
private array $path = [];

/**
Expand Down
5 changes: 4 additions & 1 deletion packages/container/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
"tempest/reflection": "3.x-dev",
"psr/container": "^2.0"
},
"require-dev": {
"typephp/typephp": "^0.7.1"
},
"autoload": {
"files": [
"src/functions.php"
Expand All @@ -21,4 +24,4 @@
"Tempest\\Container\\Tests\\": "tests"
}
}
}
}
1 change: 1 addition & 0 deletions packages/container/src/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public function singleton(string $className, mixed $definition, string|UnitEnum|
public function config(object $config): self;

/**
* @typephp-ignore
* @template TClassName of object
* @param class-string<TClassName> $className
* @return TClassName
Expand Down
3 changes: 2 additions & 1 deletion packages/container/src/GenericContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ public function config(object $config): self
}

/**
* @typephp-ignore
* @template TClassName of object
* @param class-string<TClassName> $className
* @return TClassName
Expand Down Expand Up @@ -533,7 +534,7 @@ private function autowire(string $className, string|UnitEnum|null $tag, mixed ..
}

/**
* @return ParameterReflector[]
* @return list<mixed>
*/
private function autowireDependencies(MethodReflector|FunctionReflector $method, array $parameters = []): array
{
Expand Down
3 changes: 2 additions & 1 deletion packages/core/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
},
"require-dev": {
"tempest/validation": "3.x-dev",
"tempest/intl": "3.x-dev"
"tempest/intl": "3.x-dev",
"typephp/typephp": "^0.7.1"
},
"autoload": {
"psr-4": {
Expand Down
Loading