Skip to content

[Step 1] Bump requirement to PHP 8.2 and parser-reflection 4.0.0-RC1 #492

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 40 commits into from
Mar 31, 2024
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
a0ea9b9
Bump requirement to PHP 8.2 and parser-reflection 4.0.0-RC1
samsonasik Feb 4, 2024
29ccdf1
bump github action to use php 8.2
samsonasik Feb 6, 2024
399213e
run github action on pull request
samsonasik Feb 6, 2024
7c5208a
bump to phpunit 10
samsonasik Feb 6, 2024
295a20f
bump to phpunit 10
samsonasik Feb 6, 2024
8dd74ee
migrate to new phpunit config
samsonasik Feb 6, 2024
5af067a
bump to phpunit 10 syntax
samsonasik Feb 6, 2024
f77096d
update signature params and returns
samsonasik Feb 6, 2024
a96572e
fixing signatures
samsonasik Feb 7, 2024
e71dd12
fix var_dump() signature
samsonasik Feb 7, 2024
584f523
remove ignore error
samsonasik Feb 7, 2024
9d55bcc
Fix AbstractJoinpointTest static usage
samsonasik Feb 7, 2024
626730e
Revert "Fix AbstractJoinpointTest static usage"
samsonasik Feb 7, 2024
febb3df
fix var_dumps() test
samsonasik Feb 7, 2024
c8a5be6
use phpstan baseline
samsonasik Feb 10, 2024
b57082d
ignore generated phpstan-baseline.php
samsonasik Feb 10, 2024
c675e82
bump laminas-code and add tracy for debugging
samsonasik Feb 10, 2024
869549e
bump to phpunit 10.5.10
samsonasik Feb 10, 2024
5f5dd7d
use AllowDynamicProperties on CachedAspectLoader
samsonasik Feb 10, 2024
1cd6f43
fix abstract test class warning
samsonasik Feb 10, 2024
b76ab5e
fix warning on abstract class BaseFunctionalTest
samsonasik Feb 10, 2024
a1d357c
update to use walterwoshid/dissect
samsonasik Feb 18, 2024
906890c
Remove deprecated Serializable interface.
lisachenko Feb 18, 2024
8b0786e
Switch to the goaop/dissect library
lisachenko Feb 18, 2024
f75614d
Enable AllowDynamicProperties for the LazyAdvisorAccessor to avoid de…
lisachenko Feb 18, 2024
1b78619
trigger CI
samsonasik Feb 18, 2024
d3df92a
use 4.x-dev of parser-reflection
samsonasik Feb 18, 2024
daae991
Bump the goaop/dissect to the stable ^3.0 version
lisachenko Feb 19, 2024
ff11d07
Implement PHP8.1 never return type
lisachenko Feb 29, 2024
41debc1
Switch to the PhpToken native tokens and migrate to php-parser version 5
lisachenko Mar 18, 2024
612add9
Fix deprecation warning on PHP8.3 version
lisachenko Mar 18, 2024
5c1341b
Remove unused setAccessible() call for Reflection
lisachenko Mar 18, 2024
5c85d48
[BC BREAK] Remove AnnotationAccess interface and implementations.
lisachenko Mar 18, 2024
f2d5c9e
Switch framework from matching annotations to attributes
lisachenko Mar 18, 2024
5854b55
Rename Lang\Annotation into Lang\Attribute namespace
lisachenko Mar 19, 2024
a8a5ada
[BC Break] Switch framework from annotations to attributes
lisachenko Mar 20, 2024
6f10288
Fix an error in test, array was used instead of PhpToken DTO
lisachenko Mar 21, 2024
a3e0e4b
Bump composer dev-master alias to 4.x
lisachenko Mar 26, 2024
67ed310
Remove deprecated ReflectionFunction->isDisabled() call
lisachenko Mar 26, 2024
872633c
Fix phpstan error with unknown property
lisachenko Mar 31, 2024
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
7 changes: 4 additions & 3 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: "PHPStan analysis"

on:
pull_request:
push:

jobs:
Expand All @@ -12,7 +13,7 @@ jobs:
- name: "Install PHP"
uses: shivammathur/setup-php@v2
with:
php-version: "7.4"
php-version: "8.2"
ini-values: memory_limit=-1
tools: composer:v2
- name: "Cache dependencies"
Expand All @@ -21,8 +22,8 @@ jobs:
path: |
~/.composer/cache
vendor
key: "php-7.4"
restore-keys: "php-7.4"
key: "php-8.2"
restore-keys: "php-8.2"
- name: "Install dependencies"
run: "composer install --no-interaction --no-progress --no-suggest"
- name: "Static analysis"
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: "PHPUnit tests"

on:
pull_request:
push:

jobs:
Expand All @@ -15,7 +16,7 @@ jobs:
- "lowest"
- "highest"
php-version:
- "7.4"
- "8.2"
operating-system:
- "ubuntu-latest"

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ composer.lock
phpunit.xml
tests/Fixtures/project/var/cache/*
build/
/.phpunit.result.cache
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
"license": "MIT",

"require": {
"php": "^7.4.0",
"php": "^8.2.0",
"doctrine/annotations": "^1.11.1",
"doctrine/cache": "^1.10",
"goaop/parser-reflection": "^3.0.1",
"goaop/parser-reflection": "^4.0.0-RC1",
"jakubledl/dissect": "~1.0",
"laminas/laminas-code": "^4.0",
"symfony/finder": "^4.4|^5.1"
Expand All @@ -20,8 +20,8 @@
"require-dev": {
"adlawson/vfs": "^0.12.1",
"doctrine/orm": "^2.5",
"phpstan/phpstan": "^0.12.64",
"phpunit/phpunit": "^9.5",
"phpstan/phpstan": "^1.10.57",
"phpunit/phpunit": "^10.5.8",
"symfony/console": "^4.4|^5.1",
"symfony/filesystem": "^4.4|^5.1",
"symfony/process": "^4.4|^5.1",
Expand Down
20 changes: 20 additions & 0 deletions phpstan-baseline.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php declare(strict_types = 1);

$ignoreErrors = [];
$ignoreErrors[] = [
'message' => '#^Instanceof between stdClass and Go\\\\ParserReflection\\\\ReflectionFileNamespace will always evaluate to false\\.$#',
'count' => 1,
'path' => __DIR__ . '/src/Aop/Support/SimpleNamespaceFilter.php',
];
$ignoreErrors[] = [
'message' => '#^Property Doctrine\\\\ORM\\\\Mapping\\\\ClassMetadataInfo\\<object\\>\\:\\:\\$table \\(array\\{name\\: string, schema\\?\\: string, indexes\\?\\: array, uniqueConstraints\\?\\: array, options\\?\\: array\\<string, mixed\\>, quoted\\?\\: bool\\}\\) does not accept array\\{\\}\\.$#',
'count' => 1,
'path' => __DIR__ . '/src/Bridge/Doctrine/MetadataLoadInterceptor.php',
];
$ignoreErrors[] = [
'message' => '#^Call to function file_get_contents\\(\\) on a separate line has no effect\\.$#',
'count' => 1,
'path' => __DIR__ . '/src/Instrument/ClassLoading/CacheWarmer.php',
];

return ['parameters' => ['ignoreErrors' => $ignoreErrors]];
3 changes: 3 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
includes:
- phpstan-baseline.php

parameters:
level: 4
paths:
Expand Down
47 changes: 21 additions & 26 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,28 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
colors="true"
bootstrap="./vendor/autoload.php">
<testsuites>
<testsuite name="Go! AOP Test Suite">
<directory>./tests/Go/</directory>
</testsuite>
</testsuites>

<coverage>
<include>
<directory>./src/</directory>
</include>
<report>
<clover outputFile="./build/logs/clover.xml"/>
<crap4j outputFile="./build/logs/crap4j.xml"/>
<xml outputDirectory="./build/coverage/xml"/>
</report>
</coverage>


<logging>
<junit outputFile="./build/logs/junit.xml"/>
</logging>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" colors="true" bootstrap="./vendor/autoload.php">
<testsuites>
<testsuite name="Go! AOP Test Suite">
<directory>./tests/Go/</directory>
</testsuite>
</testsuites>
<coverage>
<report>
<clover outputFile="./build/logs/clover.xml"/>
<crap4j outputFile="./build/logs/crap4j.xml"/>
<xml outputDirectory="./build/coverage/xml"/>
</report>
</coverage>
<logging>
<junit outputFile="./build/logs/junit.xml"/>
</logging>
<source>
<include>
<directory>./src/</directory>
</include>
</source>
</phpunit>
1 change: 0 additions & 1 deletion src/Instrument/ClassLoading/SourceTransformingLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ public function filter($in, $out, &$consumed, $closing): int
$this->data .= $bucket->data;
}

/** @phpstan-ignore-next-line PhpStan uses old version of phpstorm-stubs, $bucket can be nullable */
if ($closing || feof($this->stream)) {
$consumed = strlen($this->data);

Expand Down
4 changes: 2 additions & 2 deletions tests/Go/Aop/Bridge/Doctrine/MetadataLoadInterceptorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function testItWillNotModifyClassMetadataForNonProxiedClasses(): void
];

$metadataInterceptor = new MetadataLoadInterceptor();
$entityManager = $this->getMockBuilder(EntityManager::class)->disableOriginalConstructor()->getMock();
$entityManager = $this->createMock(EntityManager::class);

/**
* @var ClassMetadata $metadata
Expand All @@ -46,7 +46,7 @@ public function testItWillModifyClassMetadataForNonProxiedClasses(): void
{
$metadata = new ClassMetadata(Entity__AopProxied::class);
$metadataInterceptor = new MetadataLoadInterceptor();
$entityManager = $this->getMockBuilder(EntityManager::class)->disableOriginalConstructor()->getMock();
$entityManager = $this->createMock(EntityManager::class);

$metadata->isMappedSuperclass = false;
$metadata->isEmbeddedClass = true;
Expand Down
2 changes: 1 addition & 1 deletion tests/Go/Aop/Framework/AbstractInterceptorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ protected function getAdvice(array &$sequenceRecorder): Closure
*/
protected function getInvocation(array &$sequenceRecorder, bool $throwException = false): Invocation
{
$invocation = $this->getMockBuilder(static::INVOCATION_CLASS)->getMock();
$invocation = $this->createMock(static::INVOCATION_CLASS);
$invocation
->expects($this->any())
->method('proceed')
Expand Down
2 changes: 1 addition & 1 deletion tests/Go/Aop/Framework/AbstractJoinpointTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ class AbstractJoinpointTest extends TestCase
protected AbstractJoinpoint $joinpoint;

/**
* @dataProvider sortingTestSource
* @param array $advices
* @param array $order
*/
#[\PHPUnit\Framework\Attributes\DataProvider('sortingTestSource')]
public function testSortingLogic(array $advices, array $order = []): void
{
$advices = AbstractJoinpoint::sortAdvices($advices);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ class DynamicClosureSplatMethodInvocationTest extends TestCase
{
/**
* Tests dynamic method invocations
*
* @dataProvider dynamicMethodsBatch
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dynamicMethodsBatch')]
public function testDynamicMethodInvocation(string $methodName, int $expectedResult): void
{
$child = $this->createMock(First::class);
Expand Down Expand Up @@ -103,7 +102,7 @@ public function testInterceptorIsCalledForInvocation(): void
$this->assertEquals(T_PUBLIC, $result);
}

public function dynamicMethodsBatch(): array
public static function dynamicMethodsBatch(): array
{
return [
['publicMethod', T_PUBLIC],
Expand Down
8 changes: 4 additions & 4 deletions tests/Go/Aop/Framework/StaticClosureMethodInvocationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ class StaticClosureMethodInvocationTest extends TestCase
/**
* Tests static method invocations with self
*
* @dataProvider staticSelfMethodsBatch
* @param string $methodName Method to invoke
* @param int $expectedResult Expected result
*/
#[\PHPUnit\Framework\Attributes\DataProvider('staticSelfMethodsBatch')]
public function testStaticSelfMethodInvocation(string $methodName, int $expectedResult): void
{
$invocation = new StaticClosureMethodInvocation([],First::class, $methodName);
Expand All @@ -30,9 +30,9 @@ public function testStaticSelfMethodInvocation(string $methodName, int $expected
/**
* Tests static method invocations with Late Static Binding
*
* @dataProvider staticLsbMethodsBatch
* @param string $methodName Method to invoke
*/
#[\PHPUnit\Framework\Attributes\DataProvider('staticLsbMethodsBatch')]
public function testStaticLsbIsWorking($methodName): void
{
$invocation = new StaticClosureMethodInvocation([], First::class, $methodName);
Expand Down Expand Up @@ -101,7 +101,7 @@ public function testInvocationWithVariadicArguments(): void
}
}

public function staticSelfMethodsBatch(): array
public static function staticSelfMethodsBatch(): array
{
return [
['staticSelfPublic', T_PUBLIC],
Expand All @@ -110,7 +110,7 @@ public function staticSelfMethodsBatch(): array
];
}

public function staticLsbMethodsBatch(): array
public static function staticLsbMethodsBatch(): array
{
return [
['staticLsbPublic'],
Expand Down
5 changes: 2 additions & 3 deletions tests/Go/Aop/Pointcut/PointcutParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,16 @@ protected function setUp(): void

/**
* Tests parsing
*
* @dataProvider validPointcutDefinitions
*/
#[\PHPUnit\Framework\Attributes\DataProvider('validPointcutDefinitions')]
public function testParsingExpression(string $pointcutExpression): void
{
$stream = $this->lexer->lex($pointcutExpression);
$result = $this->parser->parse($stream);
$this->assertNotNull($result);
}

public function validPointcutDefinitions(): array
public static function validPointcutDefinitions(): array
{
return [
// Execution pointcuts
Expand Down
6 changes: 2 additions & 4 deletions tests/Go/Aop/Support/AndPointFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,15 @@ public function testKindIsIntersected(): void
$this->assertEquals(PointFilter::KIND_METHOD, $filter->getKind());
}

/**
* @dataProvider logicCases
*/
#[\PHPUnit\Framework\Attributes\DataProvider('logicCases')]
public function testMatches(PointFilter $first, PointFilter $second, $expected): void
{
$filter = new AndPointFilter($first, $second);
$result = $filter->matches(new ReflectionClass(__CLASS__) /* anything */);
$this->assertSame($expected, $result);
}

public function logicCases(): array
public static function logicCases(): array
{
$true = TruePointFilter::getInstance();
$false = new NotPointFilter($true);
Expand Down
6 changes: 2 additions & 4 deletions tests/Go/Aop/Support/NotPointFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,15 @@

class NotPointFilterTest extends TestCase
{
/**
* @dataProvider logicCases
*/
#[\PHPUnit\Framework\Attributes\DataProvider('logicCases')]
public function testMatches(PointFilter $first, bool $expected): void
{
$filter = new NotPointFilter($first);
$result = $filter->matches(new ReflectionClass(self::class));
$this->assertSame($expected, $result);
}

public function logicCases(): array
public static function logicCases(): array
{
$true = TruePointFilter::getInstance();
$false = new NotPointFilter($true);
Expand Down
6 changes: 2 additions & 4 deletions tests/Go/Aop/Support/OrPointFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,15 @@ public function testKindIsCombined(): void
$this->assertEquals($expected, $filter->getKind());
}

/**
* @dataProvider logicCases
*/
#[\PHPUnit\Framework\Attributes\DataProvider('logicCases')]
public function testMatches(PointFilter $first, PointFilter $second, bool $expected): void
{
$filter = new OrPointFilter($first, $second);
$result = $filter->matches(new \ReflectionClass(__CLASS__) /* anything */);
$this->assertSame($expected, $result);
}

public function logicCases(): array
public static function logicCases(): array
{
$true = TruePointFilter::getInstance();
$false = new NotPointFilter($true);
Expand Down
5 changes: 2 additions & 3 deletions tests/Go/Core/GoAspectContainerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,15 @@ protected function setUp(): void

/**
* Tests that all services are registered
*
* @dataProvider internalServicesList
*/
#[\PHPUnit\Framework\Attributes\DataProvider('internalServicesList')]
public function testAllServicesAreConfigured(string $serviceId): void
{
$service = $this->container->get($serviceId);
$this->assertNotNull($service);
}

public function internalServicesList(): array
public static function internalServicesList(): array
{
return [
['aspect.loader'],
Expand Down
4 changes: 2 additions & 2 deletions tests/Go/Instrument/FileSystem/EnumeratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public static function tearDownAfterClass(): void
static::$fileSystem->unmount();
}

public function pathsProvider(): array
public static function pathsProvider(): array
{
return [
[
Expand Down Expand Up @@ -92,12 +92,12 @@ public function pathsProvider(): array
/**
* Test wildcard path matching for Enumerator.
*
* @dataProvider pathsProvider
*
* @throws \InvalidArgumentException
* @throws \LogicException
* @throws \UnexpectedValueException
*/
#[\PHPUnit\Framework\Attributes\DataProvider('pathsProvider')]
public function testExclude(array $expectedPaths, array $includePaths, array $excludePaths): void
{
$testPaths = [];
Expand Down
Loading