From 2342219033186a28a3dbf1f97b8137d6fff8d65a Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Fri, 10 Aug 2018 08:35:21 +0200 Subject: [PATCH] [NodeTypeResolver] prepare for standalone release --- packages/NodeTypeResolver/README.md | 24 +++------------- packages/NodeTypeResolver/composer.json | 38 +++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 20 deletions(-) create mode 100644 packages/NodeTypeResolver/composer.json diff --git a/packages/NodeTypeResolver/README.md b/packages/NodeTypeResolver/README.md index 073644614cc..16ead174a9b 100644 --- a/packages/NodeTypeResolver/README.md +++ b/packages/NodeTypeResolver/README.md @@ -2,25 +2,10 @@ This package detects **class, interface and trait types** for classes, variables and properties. Those types are resolved by `NodeTypeResolver` service. -Anonymous classes are included, e.g.: +Includes also: -```php -$someAnonymousClass = new class extends SomeClass -{ -} -``` - -includes types: - -```php -['SomeClass'] -``` - -## How it works? - -1. Traverse all nodes -2. Detect variable assigns, property use, method arguments -3. Resolve types +- Anonymous classes +- Traits of parent classes ## How it helps you? @@ -78,5 +63,4 @@ final class SomeRector ### Inspiration -- https://github.com/Roave/BetterReflection/pull/224 -- https://github.com/phpactor/worse-reflection/blob/master/lib/Core/Inference/SymbolContextResolver.php \ No newline at end of file +@todo phpstan + silverstripe diff --git a/packages/NodeTypeResolver/composer.json b/packages/NodeTypeResolver/composer.json new file mode 100644 index 00000000000..e90c6a49d0b --- /dev/null +++ b/packages/NodeTypeResolver/composer.json @@ -0,0 +1,38 @@ +{ + "name": "rector/node-type-resolver", + "description": "This package detects class, interface and trait types for classes, variables and properties.", + "license": "MIT", + "authors": [ + { "name": "Tomas Votruba", "email": "tomas.vot@gmail.com", "homepage": "https://tomasvotruba.com" } + ], + "require": { + "php": "^7.1", + "nikic/php-parser": "^4.0.3", + "phpstan/phpstan": "^0.10.2", + "symfony/dependency-injection": "^3.4|^4.0", + "symfony/finder": "^3.4|^4.0", + "symplify/better-phpdoc-parser": "^4.7", + "symplify/package-builder": "^4.7" + }, + "require-dev": { + "phpunit/phpunit": "^7.1" + }, + "autoload": { + "psr-4": { + "Rector\\NodeTypeResolver\\": "src" + } + }, + "autoload-dev": { + "psr-4": { + "Rector\\NodeTypeResolver\\Tests\\": "tests" + }, + "classmap": [ + "tests" + ] + }, + "config": { + "sort-packages": true + }, + "minimum-stability": "dev", + "prefer-stable": true +}