Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: goaop/parser-reflection
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 1.1.0
Choose a base ref
...
head repository: goaop/parser-reflection
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref

Commits on Dec 6, 2016

  1. Copy the full SHA
    50a0b2f View commit details

Commits on Dec 7, 2016

  1. [NodeResolver] allow parsing of scalar expressions (#47)

    Add support for resolving scalar expressions, resolves #45
    lisachenko authored Dec 7, 2016
    Copy the full SHA
    b573575 View commit details
  2. Fix NodeExpressionResolver to reflect system classes (#50)

    Use `\ReflectionClass` for system classes as they have no file to parse, resolves #48
    pdelre authored and lisachenko committed Dec 7, 2016
    Copy the full SHA
    0d5b500 View commit details

Commits on Dec 8, 2016

  1. Parse top level “define” statements in a root namespace (#46)

    Alexander Obuhovich authored and lisachenko committed Dec 8, 2016
    Copy the full SHA
    e6ea71f View commit details

Commits on Dec 12, 2016

  1. Copy the full SHA
    d7ad8a3 View commit details
  2. Copy the full SHA
    ab5fb45 View commit details
  3. Change logic of collecting constants to have an ability to resolve se…

    …lf constants recursively
    lisachenko committed Dec 12, 2016
    Copy the full SHA
    640aa5b View commit details
  4. Merge pull request #53 from goaop/fix/resolve-self-constants-properly

    Change logic of collecting self constants, resolves #49
    lisachenko authored Dec 12, 2016
    Copy the full SHA
    579c677 View commit details
  5. Copy the full SHA
    5ecb262 View commit details

Commits on Dec 15, 2016

  1. Copy the full SHA
    3ffb95a View commit details
  2. Copy the full SHA
    226799f View commit details
  3. Copy the full SHA
    f8a1413 View commit details
  4. Copy the full SHA
    a3640f6 View commit details
  5. Copy the full SHA
    6c82f8d View commit details
  6. Copy the full SHA
    5fccc46 View commit details
  7. Copy the full SHA
    208bc24 View commit details
  8. Copy the full SHA
    89840f5 View commit details
  9. Copy the full SHA
    71a1a8a View commit details

Commits on Dec 16, 2016

  1. Copy the full SHA
    8777e08 View commit details
  2. Copy the full SHA
    ee1b4d7 View commit details
  3. Copy the full SHA
    319ff00 View commit details
  4. Copy the full SHA
    cf9ac8e View commit details
  5. Copy the full SHA
    dbf350c View commit details
  6. Copy the full SHA
    dc0efde View commit details
  7. Copy the full SHA
    e1f0b94 View commit details
  8. Copy the full SHA
    b912e7b View commit details
  9. Copy the full SHA
    e5a4246 View commit details
  10. Merge pull request #57 from goaop/feature/php-71-parser

    Allow to use PHP7.1-compatible parser for reflection, fixed several bugs
    lisachenko authored Dec 16, 2016
    Copy the full SHA
    a152246 View commit details

Commits on Dec 19, 2016

  1. Copy the full SHA
    1a1ee57 View commit details
  2. Fixed wrong identation

    lisachenko committed Dec 19, 2016
    Copy the full SHA
    663b6d3 View commit details
  3. Merge pull request #58 from goaop/feature/support-nullable-types

    Add support for the nullable types
    lisachenko authored Dec 19, 2016
    Copy the full SHA
    c4d2d4f View commit details

Commits on Dec 27, 2016

  1. Copy the full SHA
    b2761ae View commit details
  2. Merge pull request #60 from goaop/feature/is-strict-type

    Implement ReflectionFile->isStrictMode check for the strict_types
    lisachenko authored Dec 27, 2016
    Copy the full SHA
    eae51e1 View commit details
  3. Copy the full SHA
    9e604e6 View commit details

Commits on Dec 29, 2016

  1. Update docs

    lisachenko authored Dec 29, 2016
    Copy the full SHA
    8a60ed9 View commit details
  2. Copy the full SHA
    b996fd3 View commit details

Commits on Jan 30, 2017

  1. Copy the full SHA
    e8368c5 View commit details

Commits on Feb 1, 2017

  1. Copy the full SHA
    371ad1f View commit details
  2. Copy the full SHA
    6c02632 View commit details

Commits on Feb 3, 2017

  1. Merge pull request #67 from Fedott/dev-fix-namespace-with-starting-slash

    Fixed namespaces with starting slash
    lisachenko authored Feb 3, 2017
    Copy the full SHA
    4897038 View commit details

Commits on Feb 4, 2017

  1. RootNamespaceNormalizer: empty namespace is null, not ''

    Otherwise it prepends leading `\` to class references inside namespace.
    dg committed Feb 4, 2017
    Copy the full SHA
    4f261c2 View commit details

Commits on Jun 27, 2017

  1. Change the signature of ReflectionClass::newInstance to be compatible…

    … across all PHP versions, resolves #70
    lisachenko committed Jun 27, 2017
    Copy the full SHA
    49e6cb8 View commit details

Commits on Aug 8, 2017

  1. Scrutinizer fixes (#76)

    Fixing issues, reported by Scrutinizer CI
    
    1. most of issues addressed
    2. normalized typecast operator look
    3. replaced magic numbers with PHP constants
    4. added parameter type checks for `ReflectionFile` and `ReflectionFileNamespace` classes
    loren-osborn authored and aik099 committed Aug 8, 2017
    Copy the full SHA
    c60371e View commit details

Commits on Aug 27, 2017

  1. 1
    Copy the full SHA
    d7b8b71 View commit details
  2. Merge pull request #78 from goaop/fix/use-lexer-for-new-parser

    Configure lexer to capture token positions for new parser
    lisachenko authored Aug 27, 2017
    Copy the full SHA
    34991a5 View commit details

Commits on Sep 3, 2017

  1. Copy the full SHA
    6acf920 View commit details
  2. Merge pull request #79 from goaop/feature/returning-ast-nodes

    Introduce ability to return underlying AST nodes from reflection
    lisachenko authored Sep 3, 2017
    Copy the full SHA
    adfc38f View commit details

Commits on Oct 21, 2017

  1. Add LICENSE file

    siwinski committed Oct 21, 2017
    Copy the full SHA
    633260e View commit details

Commits on Oct 27, 2017

  1. Merge pull request #85 from siwinski/pr-add-license-file

    Add LICENSE file
    lisachenko authored Oct 27, 2017
    Copy the full SHA
    31bd6b5 View commit details

Commits on Nov 15, 2017

  1. Copy the full SHA
    9e8dffc View commit details
Showing with 5,821 additions and 2,213 deletions.
  1. +8 −0 .github/dependabot.yml
  2. +58 −0 .github/workflows/phpunit.yml
  3. +1 −0 .gitignore
  4. +0 −5 .travis.coverage.sh
  5. +0 −20 .travis.yml
  6. +19 −0 LICENSE
  7. +29 −26 README.md
  8. +7 −4 composer.json
  9. +2 −2 docs/README.md
  10. +4 −1 docs/reflection_file.md
  11. +7 −0 nitpick.json
  12. +14 −34 phpunit.xml.dist
  13. +32 −0 rector.php
  14. +13 −9 src/Instrument/PathResolver.php
  15. +5 −4 src/Locator/CallableLocator.php
  16. +12 −11 src/Locator/ComposerLocator.php
  17. +3 −4 src/LocatorInterface.php
  18. +5 −9 src/NodeVisitor/GeneratorDetector.php
  19. +16 −5 src/NodeVisitor/RootNamespaceNormalizer.php
  20. +16 −13 src/NodeVisitor/StaticVariablesCollector.php
  21. +114 −0 src/ReflectionAttribute.php
  22. +66 −30 src/ReflectionClass.php
  23. +285 −0 src/ReflectionClassConstant.php
  24. +101 −80 src/ReflectionEngine.php
  25. +1 −0 src/ReflectionException.php
  26. +49 −28 src/ReflectionFile.php
  27. +142 −110 src/ReflectionFileNamespace.php
  28. +31 −21 src/ReflectionFunction.php
  29. +73 −0 src/ReflectionIntersectionType.php
  30. +193 −75 src/ReflectionMethod.php
  31. +64 −0 src/ReflectionNamedType.php
  32. +143 −119 src/ReflectionParameter.php
  33. +288 −77 src/ReflectionProperty.php
  34. +30 −20 src/ReflectionType.php
  35. +113 −0 src/ReflectionUnionType.php
  36. +678 −0 src/Resolver/NodeExpressionResolver.php
  37. +164 −0 src/Resolver/TypeExpressionResolver.php
  38. +85 −0 src/Traits/AttributeResolverTrait.php
  39. +6 −10 src/Traits/InitializationTrait.php
  40. +5 −5 src/Traits/InternalPropertiesEmulationTrait.php
  41. +291 −217 src/Traits/ReflectionClassLikeTrait.php
  42. +84 −71 src/Traits/ReflectionFunctionLikeTrait.php
  43. +0 −331 src/ValueResolver/NodeExpressionResolver.php
  44. +5 −1 src/bootstrap.php
  45. +182 −0 tests/AbstractTestCase.php
  46. +8 −5 tests/Locator/CallableLocatorTest.php
  47. +18 −2 tests/Locator/ComposerLocatorTest.php
  48. +182 −0 tests/ReflectionAttributesTest.php
  49. +94 −0 tests/ReflectionClassConstantTest.php
  50. +231 −208 tests/ReflectionClassTest.php
  51. +124 −41 tests/ReflectionFileNamespaceTest.php
  52. +56 −16 tests/ReflectionFileTest.php
  53. +86 −101 tests/ReflectionFunctionTest.php
  54. +132 −103 tests/ReflectionMethodTest.php
  55. +163 −182 tests/ReflectionParameterTest.php
  56. +132 −66 tests/ReflectionPropertyTest.php
  57. +102 −0 tests/ReflectionTypeTest.php
  58. +68 −0 tests/Resolver/NodeExpressionResolverTest.php
  59. +0 −75 tests/Stub/AbstractClassWithMethods.php
  60. +0 −19 tests/Stub/ClassWithProperties.php
  61. +132 −29 tests/Stub/FileWithClasses55.php
  62. +73 −3 tests/Stub/FileWithClasses56.php
  63. +36 −0 tests/Stub/FileWithClasses70.php
  64. +93 −0 tests/Stub/FileWithClasses71.php
  65. +45 −0 tests/Stub/FileWithClasses72.php
  66. +45 −0 tests/Stub/FileWithClasses74.php
  67. +131 −0 tests/Stub/FileWithClasses80.php
  68. +119 −0 tests/Stub/FileWithClasses81.php
  69. +94 −0 tests/Stub/FileWithClasses82.php
  70. +33 −0 tests/Stub/FileWithClasses83.php
  71. +17 −0 tests/Stub/FileWithFunction80.php
  72. +1 −1 tests/Stub/FileWithFunctions55.php
  73. +2 −1 tests/Stub/FileWithFunctions70.php
  74. +22 −0 tests/Stub/FileWithGlobalNamespace.php
  75. +4 −0 tests/Stub/FileWithNamespaces.php
  76. +14 −8 tests/Stub/{FileWithParameters.php → FileWithParameters55.php}
  77. +16 −0 tests/Stub/FileWithParameters56.php
  78. +23 −0 tests/Stub/FileWithParameters70.php
  79. +19 −0 tests/Stub/FileWithParameters80.php
  80. +8 −0 tests/Stub/Issue44/ClassWithNamespace.php
  81. +6 −0 tests/Stub/Issue44/ClassWithoutNamespace.php
  82. +21 −0 tests/Stub/Issue44/Locator.php
  83. +27 −0 tests/Stub/RandomClassWithAttribute.php
  84. +0 −11 tests/bootstrap.php
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: 2
updates:
- package-ecosystem: composer
directory: "/"
schedule:
interval: daily
time: "22:00"
open-pull-requests-limit: 10
58 changes: 58 additions & 0 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: "PHPUnit tests"

on:
pull_request:
push:

jobs:
phpunit:
name: "PHPUnit tests"

runs-on: ${{ matrix.operating-system }}

strategy:
matrix:
dependencies:
- "lowest"
- "highest"
php-version:
- "8.2"
- "8.3"
operating-system:
- "ubuntu-latest"

steps:
- name: "Checkout"
uses: "actions/checkout@v2"

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "pcov"
php-version: "${{ matrix.php-version }}"
ini-values: memory_limit=-1
tools: composer:v2, cs2pr

- name: "Cache dependencies"
uses: "actions/cache@v2"
with:
path: |
~/.composer/cache
vendor
key: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}"
restore-keys: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}"

- name: "Install lowest dependencies"
if: ${{ matrix.dependencies == 'lowest' }}
run: "composer update --prefer-lowest --no-interaction --no-progress --no-suggest"

- name: "Install highest dependencies"
if: ${{ matrix.dependencies == 'highest' }}
run: "composer update --no-interaction --no-progress --no-suggest"

- name: "Install locked dependencies"
if: ${{ matrix.dependencies == 'locked' }}
run: "composer install --no-interaction --no-progress --no-suggest"

- name: "Tests"
run: "vendor/bin/phpunit"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/vendor/
composer.lock
/.phpunit.result.cache
5 changes: 0 additions & 5 deletions .travis.coverage.sh

This file was deleted.

20 changes: 0 additions & 20 deletions .travis.yml

This file was deleted.

19 changes: 19 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2015-2024 Alexander Lisachenko

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
55 changes: 29 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
Parser Reflection API Library
-----------------
This library is **deprecated**. Please use [BetterReflection](https://github.com/Roave/BetterReflection).

Parser Reflection API library provides a set of classes that extend original internal Reflection classes, but powered by [PHP-Parser](https://github.com/nikic/PHP-Parser) library thus allowing to create a reflection instance without loading classes into the memory.

This library can be used for analysing the source code for PHP versions 5.5, 5.6, 7.0; for automatic proxy creation and much more.
This library can be used for analysing the source code; for automatic proxy creation and much more.

[![Build Status](https://scrutinizer-ci.com/g/goaop/parser-reflection/badges/build.png?b=master)](https://scrutinizer-ci.com/g/goaop/parser-reflection/build-status/master)
[![Code Coverage](https://scrutinizer-ci.com/g/goaop/parser-reflection/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/goaop/parser-reflection/?branch=master)
[![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)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/goaop/parser-reflection/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/goaop/parser-reflection/?branch=master)
[![SensioLabs Insight](https://img.shields.io/sensiolabs/i/1fdfee9c-839a-4209-a2f2-42dadc859621.svg)](https://insight.sensiolabs.com/projects/1fdfee9c-839a-4209-a2f2-42dadc859621)[![Minimum PHP Version](http://img.shields.io/badge/php-%3E%3D%205.5-8892BF.svg)](https://php.net/)
[![PHP Version](https://img.shields.io/badge/php-%3E%3D%208.2-8892BF.svg)](https://php.net/)
[![License](https://img.shields.io/packagist/l/goaop/parser-reflection.svg)](https://packagist.org/packages/goaop/parser-reflection)

Installation
@@ -29,46 +30,48 @@ Usage

### Initialization

Prior to first use library can be optionally initialized.

Following example uses the Composer autoloader from the project, where library is used, as a dependency:

```php
$locator = new \Go\ParserReflection\Locator\ComposerLocator();
\Go\ParserReflection\ReflectionEngine::init($locator);
```

Following example uses Composer's autoloader located at a given path:

```php
$composerLoader = require_once '/path/to/vendor/autoload.php';
$composerLoader->unregister();

$locator = new \Go\ParserReflection\Locator\ComposerLocator($composerLoader);
\Go\ParserReflection\ReflectionEngine::init($locator);
```
Prior to the first use library can be optionally initialized. If you use Composer for installing packages and loading classes,
then you shouldn't worry about initialization, library will be initialized automatically.

If project uses a custom autoloader then you should follow the next steps:

1. Create a class, that implements `\Go\ParserReflection\LocatorInterface`
1. Create a new class that implements `\Go\ParserReflection\LocatorInterface`
2. Create an instance of that class and pass it to the `ReflectionEngine::init()` method for initial configuration

### Actual Usage
### Reflecting concrete classes/methods/properties without loading them

Just use `Go\ParserReflection` package reflection classes like traditional ones:

```php
$parsedClass = new \Go\ParserReflection\ReflectionClass(SomeClass::class);
var_dump($parsedClass->getMethods());

$parsedMethod = new \Go\ParserReflection\ReflectionMethod(SomeClass::class, 'someMethod');
echo (string)$parsedMethod;
```

Or you can use an additional classes [`ReflectionFile`][0] and [`ReflectionFileNamespace`][1] to analyse a raw PHP files:

```php
$parsedFile = new \Go\ParserReflection\ReflectionFile('SomeClass.php');
$fileNameSpaces = $parsedFile->getFileNamespaces();
var_dump($fileNameSpaces);
var_dump($fileNameSpaces[0]->getClass(SomeClass::class)->getMethods());
// We can iterate over namespaces in the file
foreach ($fileNameSpaces as $namespace) {
$classes = $namespace->getClasses();
// Iterate over the classes in the namespace
foreach ($classes as $class) {
echo "Found class: ", $class->getName(), PHP_EOL;
// Now let's show all methods in the class
foreach ($class->getMethods() as $method) {
echo "Found class method: ", $class->getName(), '::', $method->getName(), PHP_EOL;
}

// ...all properties in the class
foreach ($class->getProperties() as $property) {
echo "Found class property: ", $class->getName(), '->', $property->getName(), PHP_EOL;
}
}
}
```

How it works?
@@ -81,12 +84,12 @@ To understand how library works let's look at what happens during the call to th
* `ComposerLocator` instance asks the Composer to find a filename for the given class and returns this result back to the reflection engine
* Reflection engine loads the content of file and passes it to the [PHP-Parser](https://github.com/nikic/PHP-Parser) for tokenization and processing
* PHP-Parser returns an AST (Abstract Syntax Tree)
* Reflection engine then analyse this AST to extract specific nodes an wrap them into corresponding reflection classes.
* Reflection engine then analyse this AST to extract specific nodes and wrap them into corresponding reflection classes.

Compatibility
------------

All parser reflection classes extend PHP internal reflection classes, this means that you can use `\Go\ParserReflection\ReflectionClass` instance in any place that asks for `\ReflectionClass` instance. All reflection methods should be compatible with original ones, providing an except methods that requires object manipulation, such as `invoke()`, `invokeArgs()`, `setAccessible()`, etc. These methods will trigger the autoloading of class and switching to the internal reflection.
All parser reflection classes extend PHP internal reflection classes, this means that you can use `\Go\ParserReflection\ReflectionClass` instance in any place that asks for `\ReflectionClass` instance. All reflection methods should be compatible with original ones, providing an except methods that requires object manipulation, such as `invoke()`, `invokeArgs()`, `setAccessible()`, etc. These methods will trigger the process of class loading and switching to the internal reflection.

[0]: docs/reflection_file.md
[1]: docs/reflection_file_namespace.md
11 changes: 7 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
@@ -22,15 +22,18 @@
}
},
"require": {
"php": ">=5.5.0",
"nikic/php-parser": "^1.2|^2.0"
"php": ">=8.2",
"nikic/php-parser": "^5.0"
},
"require-dev": {
"phpunit/phpunit": "~4.0"
"phpunit/phpunit": "^11.0.7",
"tracy/tracy": "^2.10",
"rector/rector": "^1.0",
"rector/rector-php-parser": "^0.14.0"
},
"extra": {
"branch-alias": {
"dev-master": "1.x-dev"
"dev-master": "4.x-dev"
}
}
}
4 changes: 2 additions & 2 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -5,9 +5,9 @@ Introduction
--------
PHP comes with a complete reflection API that adds the ability to reverse-engineer classes, interfaces, functions, methods and extensions. Additionally, the reflection API offers ways to retrieve doc comments for functions, classes and methods.

But this reflection API requires concrete element to be loaded into the memory. Once element is loaded, it can not be changed, modified or updated without special extensions.
However, this reflection API requires concrete element to be loaded into the memory. Once element is loaded, it cannot be changed, modified or updated without special extensions.

`goaop\parser-reflection` packet is a userland implementation of reflection API that is fully compatible with internal one, but doesn't require element (e.g. class or function) to be loaded into the PHP. Only the source code is required for performing the raw analysis.
`goaop\parser-reflection` packet is a user-land implementation of reflection API that is fully compatible with internal one, but doesn't require an element (e.g. class or function) to be loaded into the PHP. Only the source code is required for performing the raw analysis.

Reference
---------
5 changes: 4 additions & 1 deletion docs/reflection_file.md
Original file line number Diff line number Diff line change
@@ -14,6 +14,7 @@ class ReflectionFile
public function getFileNamespaces() {}
public function getName() {}
public function hasFileNamespace($namespaceName) {}
public function isStrictMode() {}
}
```

@@ -40,5 +41,7 @@ Methods

Checks if requested namespace is present in the file or not. Returns `true` if present.


- `ReflectionFile::isStrictMode()`

Checks if current file has enabled strict mode via `declare(strict_types=1)` for PHP>=7.0
[0]: reflection_file_namespace.md
7 changes: 7 additions & 0 deletions nitpick.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"ignore": [
"src/*",
"tests/*",
"docs/*"
]
}
48 changes: 14 additions & 34 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,36 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit backupGlobals="false"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="./tests/bootstrap.php"
>
<php>
<!--Path to the autoload file that should be used. Use a composer autoloader by default-->
<const name="AUTOLOAD_PATH" value="./vendor/autoload.php"/>
</php>

<testsuites>
<testsuite name="Parser Reflection Test Suite">
<directory>./tests/</directory>
</testsuite>
</testsuites>

<filter>
<whitelist>
<directory>./src/</directory>
</whitelist>
</filter>

<groups>
<exclude>
<group>performance</group>
</exclude>
</groups>
<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="Parser Reflection Test Suite">
<directory>./tests/</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory>./src/</directory>
</include>
</source>
<php>
<ini name="memory_limit" value="1536M" />
</php>
</phpunit>
32 changes: 32 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

declare(strict_types=1);

use Rector\Config\RectorConfig;
use Rector\DeadCode\Rector\ClassMethod\RemoveUselessParamTagRector;
use Rector\DeadCode\Rector\ClassMethod\RemoveUselessReturnTagRector;
use Rector\Php71\Rector\ClassConst\PublicConstantVisibilityRector;
use Rector\Php74\Rector\Closure\ClosureToArrowFunctionRector;
use Rector\PhpParser\Set\PhpParserSetList;
use Rector\PHPUnit\Set\PHPUnitSetList;
use Rector\TypeDeclaration\Rector\ClassMethod\AddVoidReturnTypeWhereNoReturnRector;

return RectorConfig::configure()
->withPaths([
__DIR__ . '/src',
__DIR__ . '/tests',
])
// uncomment to reach your current PHP version
// ->withPhpSets()
->withRules([
AddVoidReturnTypeWhereNoReturnRector::class,
RemoveUselessParamTagRector::class,
RemoveUselessReturnTagRector::class,
PublicConstantVisibilityRector::class,
ClosureToArrowFunctionRector::class,
])
->withSets([
PHPUnitSetList::ANNOTATIONS_TO_ATTRIBUTES,
PHPUnitSetList::PHPUNIT_CODE_QUALITY,
PhpParserSetList::PHP_PARSER_50
]);
Loading