diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index b2fb0f1..a5c3e67 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -10,9 +10,9 @@ Parser Reflection is a **deprecated** PHP library that provides reflection capab **CRITICAL: Set timeouts of 30+ minutes for all composer commands. NEVER CANCEL composer operations.** -1. **Verify PHP version**: Requires PHP >=8.2 +1. **Verify PHP version**: Requires PHP >=8.5 ```bash - php --version # Should show PHP 8.2+ + php --version # Should show PHP 8.5+ ``` 2. **Install dependencies** (takes 15-25 minutes due to GitHub API rate limits): @@ -85,10 +85,10 @@ php /tmp/test_reflection.php - `vendor/` - Dependencies (created during build) ### Important Files -- `composer.json` - Dependencies: php >=8.2, nikic/php-parser ^5.0 +- `composer.json` - Dependencies: php >=8.5, nikic/php-parser ^5.0 - `phpunit.xml.dist` - Test configuration (1536M memory limit) - `rector.php` - Code quality rules -- `.github/workflows/phpunit.yml` - CI pipeline (PHP 8.2, 8.3, 8.4) +- `.github/workflows/phpunit.yml` - CI pipeline (PHP 8.5, with 8.6 as experimental) ## Common Issues and Troubleshooting @@ -143,12 +143,12 @@ php /tmp/test_reflection.php - Core functionality requires nikic/php-parser for AST generation - Tests use Composer's autoloader for class location - Memory usage can be high for large codebases (configure php.ini accordingly) -- Compatible with PHP 8.2+ (tested on 8.2, 8.3, 8.4) +- Compatible with PHP 8.5+ (tested on 8.5, with 8.6 as experimental) ## CI/Build Pipeline Reference The GitHub Actions pipeline (`.github/workflows/phpunit.yml`) runs: -- Matrix testing: PHP 8.2, 8.3, 8.4 on Ubuntu +- Matrix testing: PHP 8.5 on Ubuntu, plus PHP 8.6 as an experimental (allowed-to-fail) job - Dependency variations: lowest, highest - Standard `composer install` (works in CI with GitHub tokens) - PHPUnit test suite execution \ No newline at end of file diff --git a/.github/workflows/copilot-setup-steps.yml b/.github/workflows/copilot-setup-steps.yml index f590975..ea4032b 100644 --- a/.github/workflows/copilot-setup-steps.yml +++ b/.github/workflows/copilot-setup-steps.yml @@ -29,10 +29,10 @@ jobs: - name: Checkout code uses: actions/checkout@v7 - - name: Setup PHP 8.4 + - name: Setup PHP 8.5 uses: shivammathur/setup-php@v2 with: - php-version: '8.4' + php-version: '8.5' github-token: ${{ secrets.GH_PAT_TOKEN || github.token }} tools: composer:v2 coverage: none diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index 03fecfe..a62f6db 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -11,7 +11,7 @@ on: jobs: build: - name: "PHPStan analysis - PHP8.4" + name: "PHPStan analysis - PHP8.5" runs-on: ubuntu-latest steps: - name: "Checkout" @@ -19,7 +19,7 @@ jobs: - name: "Install PHP" uses: shivammathur/setup-php@v2 with: - php-version: "8.4" + php-version: "8.5" ini-values: memory_limit=-1 tools: composer:v2 - name: "Cache dependencies" @@ -28,8 +28,8 @@ jobs: path: | ~/.composer/cache vendor - key: "php-8.4" - restore-keys: "php-8.4" + key: "php-8.5" + restore-keys: "php-8.5" - name: "Install dependencies" run: "composer install --no-interaction --no-progress" - name: "Static analysis" diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index 701b322..5f58136 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -25,7 +25,6 @@ jobs: - "highest" php-version: - "8.5" - - "8.4" operating-system: - "ubuntu-latest" experimental: diff --git a/CLAUDE.md b/CLAUDE.md index 6d10e60..25a65a5 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -6,12 +6,12 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co Parser Reflection is a PHP library that extends PHP's internal reflection classes using nikic/PHP-Parser for static analysis. It reflects PHP code without loading classes into memory by parsing source files into an AST. -Requires PHP >=8.4. Namespace: `Go\ParserReflection\`. +Requires PHP >=8.5. Namespace: `Go\ParserReflection\`. ## Agent runtime requirement -- Agents must run on PHP **8.4 or higher**. -- If the runtime is PHP **8.3.x**, agents should not attempt dependency installation or test validation and should report that PHP **8.4+** is required. +- Agents must run on PHP **8.5 or higher**. +- If the runtime is PHP **8.4.x or lower**, agents should not attempt dependency installation or test validation and should report that PHP **8.5+** is required. ## Commands @@ -68,4 +68,4 @@ Tests in `tests/` mirror the reflection class names (e.g. `ReflectionClassTest.p ### CI -GitHub Actions (`.github/workflows/phpunit.yml`) runs PHPUnit on PHP 8.4 and 8.5 with both lowest and highest dependency versions, plus PHP 8.6 as an experimental (allowed-to-fail) job. A separate workflow (`.github/workflows/phpstan.yml`) runs PHPStan at level 10 on PHP 8.4. +GitHub Actions (`.github/workflows/phpunit.yml`) runs PHPUnit on PHP 8.5 with both lowest and highest dependency versions, plus PHP 8.6 as an experimental (allowed-to-fail) job. A separate workflow (`.github/workflows/phpstan.yml`) runs PHPStan at level 10 on PHP 8.5. diff --git a/README.md b/README.md index e6723a3..a5ada02 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ Forget autoloading. This library parses your PHP source files directly into an A [![GitHub release](https://img.shields.io/github/release/goaop/parser-reflection.svg)](https://github.com/goaop/parser-reflection/releases/latest) [![Total Downloads](https://img.shields.io/packagist/dt/goaop/parser-reflection.svg)](https://packagist.org/packages/goaop/parser-reflection) [![Daily Downloads](https://img.shields.io/packagist/dd/goaop/parser-reflection.svg)](https://packagist.org/packages/goaop/parser-reflection) -[![PHP Version](https://img.shields.io/badge/php-%3E%3D%208.4-8892BF.svg)](https://php.net/) +[![PHP Version](https://img.shields.io/badge/php-%3E%3D%208.5-8892BF.svg)](https://php.net/) [![License](https://img.shields.io/packagist/l/goaop/parser-reflection.svg)](https://packagist.org/packages/goaop/parser-reflection) [![Sponsor](https://img.shields.io/badge/Sponsor-❤️-lightgray?style=flat&logo=github)](https://github.com/sponsors/lisachenko) diff --git a/composer.json b/composer.json index 6fde840..b765f8c 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ } }, "require": { - "php": ">=8.4", + "php": ">=8.5", "nikic/php-parser": "^5.4" }, "require-dev": { @@ -33,7 +33,7 @@ }, "extra": { "branch-alias": { - "dev-master": "4.x-dev" + "dev-master": "8.5-dev" } } } diff --git a/src/Resolver/TypeExpressionResolver.php b/src/Resolver/TypeExpressionResolver.php index 1de81f2..06dbe5d 100644 --- a/src/Resolver/TypeExpressionResolver.php +++ b/src/Resolver/TypeExpressionResolver.php @@ -157,14 +157,12 @@ private function resolveName(Name $node): ReflectionNamedType $typeName = $node->toString(); // PHP 8.5+ changed ReflectionNamedType::getName() to return the actual FQCN for 'self' - // and 'parent', whereas PHP 8.4 and earlier preserve the keywords as-is. + // and 'parent' instead of preserving the keywords as-is. // 'static' is always kept as-is (late static binding, preserved by native reflection). - if (PHP_VERSION_ID >= 80500) { - if ($typeName === 'self') { - $typeName = $this->selfClassName ?? $typeName; - } elseif ($typeName === 'parent') { - $typeName = $this->parentClassName ?? $typeName; - } + if ($typeName === 'self') { + $typeName = $this->selfClassName ?? $typeName; + } elseif ($typeName === 'parent') { + $typeName = $this->parentClassName ?? $typeName; } return new ReflectionNamedType($typeName, $this->hasDefaultNull, false);