Skip to content

Claude: init AI context and update minimum php version to php>=8.4#516

Merged
lisachenko merged 12 commits intomasterfrom
feature/ai-tools-initialization
Mar 21, 2026
Merged

Claude: init AI context and update minimum php version to php>=8.4#516
lisachenko merged 12 commits intomasterfrom
feature/ai-tools-initialization

Conversation

@lisachenko
Copy link
Copy Markdown
Member

No description provided.

lisachenko and others added 9 commits March 21, 2026 10:54
…entations

PHP 8.4 deprecated implicit nullable parameters (e.g. `Type $x = null`).
Update `Pointcut::matches()` interface and all 12 implementations to use
explicit `null|object|string` union and `?array` for nullable parameters.
Also fix `AndPointcut::__construct(?int $pointcutKind)`.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… ClassProxyGenerator

PHP 8.4 deprecation: add explicit `?` prefix to nullable `string` parameters
in three additional files.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…nTrait

Calling get_parent_class() without arguments is deprecated since PHP 8.3.
Pass \$this explicitly to get the parent class of the current object.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Symfony 5.4 reached EOL in November 2024 and doesn't support PHP 8.4.
Drop ^5.4 from symfony/finder constraint.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
PHPStan 2.x has full PHP 8.4 support.
PHPUnit 11 supports PHP 8.2+ and PHP 8.4.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- AbstractJoinpointTest: PHPUnit 11 requires static data providers; replace
  createMock() calls with anonymous class implementations (tag interfaces have
  no methods so no mocking needed)
- BaseInterceptorTest: PHP 8.5 changed closure name format from
  'Namespace\{closure}' to '{closure:Class::method():line}'; compute name
  dynamically via ReflectionFunction::getName()
- ContainerTest: fix brittle timestamp assertion — use time()+3600 instead
  of realMtime+3600, since Container constructor registers framework source
  files as resources (their mtime can be > First.php mtime)
- InterceptedMethodGeneratorTest: update expected signatures from ` : type`
  to `: type` (laminas-code changed return type spacing)
- php7-class-proxy.php fixture: same laminas-code return type format update

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Replace (integer) with (int) in WeavingTransformer (PHP 8.5 deprecation)
- Regenerate phpstan-baseline.php: Doctrine ClassMetadataInfo became
  ClassMetadata in PHPStan 2.x output; add trait.unused for
  PropertyInterceptionTrait and instanceof.alwaysTrue for WeavingTransformer

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- phpunit.yml: replace PHP 8.2/8.3 with 8.4/8.5; drop deprecated --no-suggest
- phpstan.yml: update PHP to 8.4; replace chindit/actions-phpstan@master
  (incompatible with PHPStan 2.x) with direct vendor/bin/phpstan run;
  add --memory-limit=512M to avoid OOM in parallel workers

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the project to target PHP 8.4+ (including dependency/tooling bumps) and adds repository guidance for Claude Code, while also adjusting code/tests/docs to align with newer PHP/PHPUnit/PHPStan expectations (eg, explicit nullable types and updated fixtures).

Changes:

  • Bump platform/tooling requirements (PHP ^8.4, PHPUnit ^11, PHPStan ^2) and adjust related tests/fixtures.
  • Make function signatures explicitly nullable to avoid implicit-nullable deprecations and update minor runtime logic/casts.
  • Update documentation (README) and add Claude Code context (CLAUDE.md + AGENTS.md).

Reviewed changes

Copilot reviewed 28 out of 30 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/Go/Proxy/Part/InterceptedMethodGeneratorTest.php Updates expected generated method signatures formatting.
tests/Go/Instrument/Transformer/_files/php7-class-proxy.php Aligns fixture method signatures formatting.
tests/Go/Core/ContainerTest.php Makes freshness test stable by using time() for a “future” timestamp.
tests/Go/Aop/Framework/BaseInterceptorTest.php Makes serialization expectation resilient to closure-name differences.
tests/Go/Aop/Framework/AbstractJoinpointTest.php Reworks data provider to be static and avoid mock usage.
src/Proxy/Part/PropertyInterceptionTrait.php Fixes parent magic-method detection to use the current instance’s parent class.
src/Proxy/ClassProxyGenerator.php Makes optional alias explicitly nullable in addUse().
src/Instrument/Transformer/WeavingTransformer.php Replaces (integer) casts with (int).
src/Instrument/Transformer/StreamMetaData.php Makes optional $source explicitly nullable.
src/Instrument/ClassLoading/CachePathManager.php Makes optional $resource explicitly nullable.
src/Aop/Pointcut.php Makes nullable parameters explicit in the Pointcut::matches() signature.
src/Aop/Pointcut/AndPointcut.php Makes nullable params explicit (constructor + matches() signature).
src/Aop/Pointcut/{True,ReturnType,PointcutReference,Or,Not,Name,Modifier,MatchInherited,MagicMethodDynamic,ClassInheritance,Attribute}Pointcut.php Aligns implementations with explicit-nullable matches() signature.
phpstan-baseline.php Updates baseline entries for new PHPStan output and adds new suppressions.
composer.json Raises minimum PHP to ^8.4 and bumps PHPUnit/PHPStan; tightens symfony/finder constraints.
README.md Updates min PHP badge, modernizes code fences, and updates docs to attribute-based examples.
CLAUDE.md Adds Claude Code repository context and workflow documentation.
AGENTS.md Adds AGENTS entry (currently as a symlink target reference).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

lisachenko and others added 2 commits March 21, 2026 15:25
…ormatting

Version 4.17.0 changed return type formatting from ` : type` to `: type`.
With --prefer-lowest on PHP 8.4, the old ^4.13 constraint would resolve to
4.15.0 or 4.16.0 which still used the old format, causing test failures.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…nt instanceof check

- Update CLAUDE.md PHP version (8.2 → 8.4) and PHPUnit version (10 → 11)
- Remove redundant `instanceof ReflectionMethod` guard in WeavingTransformer
  (getMethods() already returns ReflectionMethod instances)
- Drop the now-unnecessary instanceof.alwaysTrue PHPStan baseline entry

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@scrutinizer-notifier
Copy link
Copy Markdown

A new inspection was created.

Copy link
Copy Markdown

@lisachenko-indriver lisachenko-indriver left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All three comments addressed:\n- CLAUDE.md PHP version updated to 8.4+ and PHPUnit updated to 11\n- Removed redundant instanceof ReflectionMethod check in WeavingTransformer and dropped the baseline suppression

@lisachenko lisachenko merged commit 293a54e into master Mar 21, 2026
10 checks passed
@lisachenko lisachenko deleted the feature/ai-tools-initialization branch March 21, 2026 13:33
@marcovtwout
Copy link
Copy Markdown

@lisachenko Are there any specific changes done that require a minimum PHP version of 8.4 instead of 8.2? From PHP side, 8.2 is still supported. Bumping to 8.4 could cause problems for users that haven't/can't upgrade yet (for example Symfony 6.4 requires PHP 8.1 and Codeception/AspectMock v5 requires PHP 8.2).

If there is no specific reason, could you revert the PHP minimum version bump?

(I understand that Symfony 5.4 is no longer supported and changing that one seems fine.)

@lisachenko
Copy link
Copy Markdown
Member Author

@marcovtwout sorry, I'm not going to maintain the PHP8.2 version code anymore, check the https://www.php.net/supported-versions.php

image

If you are interested - then, switch to the 3.x branch, which may continue to work. I can backport some of the changes to 3.x-dev and even create a tag if needed.

4.0-dev is suited for all modern development and will use PHP>=8.4

@marcovtwout
Copy link
Copy Markdown

@lisachenko Thanks for responding, I understand your point of view. I agree in general actively supported PHP versions (8.4+) makes sense for latest development of a library, but the latest stable release (3.x) is quite old and only supports up to PHP 7.4. So anyone that wants to use your library on PHP 8 has to be at least on 8.4, where 8.2 and 8.3 are still within official PHP security support.

If you're not using any PHP 8.3+ specific features, you could consider lowering minimum support to 8.2 for your development version. Alternatively perhaps you can tag a new stable release with PHP 8 basic support (not sure if backporting or new 4.x versions is more appropiate here)

For now I pinned to 66d5028 which still support PHP 8.2

@lisachenko
Copy link
Copy Markdown
Member Author

@marcovtwout I've pushed 66d5028 to the 3.x branch and tagged 3.1.0, feel free to use it

@marcovtwout
Copy link
Copy Markdown

marcovtwout commented Apr 1, 2026

@lisachenko Thanks! Could you perhaps also tag a new stable for goaop/parser-reflection? Commit dcd0363 seems fit for a 4.0.0 there (since 3.1.0 is requiring 4.x: https://github.com/goaop/framework/blob/3.1.0/composer.json#L13)

@lisachenko
Copy link
Copy Markdown
Member Author

@marcovtwout yeap, tagged 3.1.0 for the goaop/parser-reflection https://github.com/goaop/parser-reflection/releases/tag/3.1.0 and also created a patch version of goaop/framework 3.1.1 which allows to install ^3.0 version of goaop/parser-reflection. Could you please check both of them?

@marcovtwout
Copy link
Copy Markdown

@lisachenko Works, thank you! Submitted PR for AspectMock: Codeception/AspectMock#219

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

5 participants