diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 77b4d30d..aeeca167 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -82,7 +82,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macos-latest] - php: ['8.2', '8.3', '8.4', '8.5'] + php: ['8.1', '8.2', '8.3', '8.4', '8.5'] steps: - name: Checkout Code @@ -99,6 +99,10 @@ jobs: uses: ramsey/composer-install@v3 with: dependency-versions: ${{ matrix.php == '8.2' && 'lowest' || 'highest' }} + env: + # Pest 2 is the only line that runs on PHP 8.1 and it pins PHPUnit <= 10.5.36, which Composer + # blocks for a dev-only advisory (CVE-2026-24765). The Security Audit job still runs unfiltered. + COMPOSER_NO_SECURITY_BLOCKING: ${{ matrix.php == '8.1' && '1' || '0' }} - name: Warm Up TypePHP Cache run: php bin/typephp cache:warm diff --git a/src/Internal/Util/Config.php b/src/Internal/Util/Config.php index a80dd9f1..9bf293e6 100644 --- a/src/Internal/Util/Config.php +++ b/src/Internal/Util/Config.php @@ -585,11 +585,6 @@ public static function getProjectRoot(?string $startingDir = null): string return self::$projectRoot = '.'; } - /** - * Loads and caches global configuration from 'typephp.php', 'composer.json' extra, extensions, and base defaults. - * - * @return array - */ /** * Loads and caches global configuration from 'typephp.php', 'composer.json' extra, extensions, and base defaults. * diff --git a/tests/Fixtures/Readonly/ReadonlyClassWithPromotedProperty.php b/tests/Fixtures/Readonly/ReadonlyClassWithPromotedProperty.php new file mode 100644 index 00000000..2beefceb --- /dev/null +++ b/tests/Fixtures/Readonly/ReadonlyClassWithPromotedProperty.php @@ -0,0 +1,20 @@ + $adapters + */ + public function __construct(public iterable $adapters) + { + } +} diff --git a/tests/Fixtures/Types/TraitConstContainer.php b/tests/Fixtures/Types/TraitConstContainer.php new file mode 100644 index 00000000..32a0ec86 --- /dev/null +++ b/tests/Fixtures/Types/TraitConstContainer.php @@ -0,0 +1,16 @@ + */ -// $typeArray = [1, 2, 3, '1']; - -// expect($typeArray)->toBeArray(); -// }); diff --git a/tests/TypeChecking/ArraysAndShapes/ClassConstKeyShapeTest.php b/tests/TypeChecking/ArraysAndShapes/ClassConstKeyShapeTest.php index 2d99d902..a33913dc 100644 --- a/tests/TypeChecking/ArraysAndShapes/ClassConstKeyShapeTest.php +++ b/tests/TypeChecking/ArraysAndShapes/ClassConstKeyShapeTest.php @@ -4,22 +4,7 @@ use TypePHP\Tests\Fixtures\Types\ConstKeyContainer; use TypePHP\Tests\Fixtures\Types\MissingConstKeyContainer; - -trait TraitWithConstantFixture -{ - public const TRAIT_KEY = 'trait_action'; -} - -class TraitConstContainer -{ - /** - * @param array{TraitWithConstantFixture::TRAIT_KEY: positive-int} $payload - */ - public function process(array $payload): bool - { - return true; - } -} +use TypePHP\Tests\Fixtures\Types\TraitConstContainer; describe('Class Constant Keys in Array Shapes (array{self::CONST_KEY: T})', function () { diff --git a/tests/TypeChecking/Boundaries/PromotedReadonlyPropertyTest.php b/tests/TypeChecking/Boundaries/PromotedReadonlyPropertyTest.php index 87e1413d..32908e23 100644 --- a/tests/TypeChecking/Boundaries/PromotedReadonlyPropertyTest.php +++ b/tests/TypeChecking/Boundaries/PromotedReadonlyPropertyTest.php @@ -6,6 +6,7 @@ use Closure; use TypePHP\Exception\TypeError; +use TypePHP\Tests\Fixtures\Readonly\ReadonlyClassWithPromotedProperty; interface ReadonlyAdapterInterface { @@ -39,16 +40,6 @@ public function __construct(public readonly Closure $factory) } } -readonly class ReadonlyClassWithPromotedProperty -{ - /** - * @param iterable $adapters - */ - public function __construct(public iterable $adapters) - { - } -} - describe('Promoted Readonly Property Contracts', function () { test('instantiates class with promoted readonly iterable without throwing Cannot modify readonly property error', function () { $instance = new PromotedReadonlyIterable([new ReadonlyAdapterA()]); @@ -64,6 +55,12 @@ public function __construct(public iterable $adapters) }); test('instantiates PHP 8.2 readonly class with promoted property without throwing Cannot modify readonly property error', function () { + if (PHP_VERSION_ID < 80200) { + expect(true)->toBeTrue(); + + return; + } + $instance = new ReadonlyClassWithPromotedProperty([new ReadonlyAdapterA()]); expect($instance->adapters)->toHaveCount(1);