Skip to content

Commit 1fc3b8a

Browse files
committed
Initial commit
0 parents  commit 1fc3b8a

36 files changed

+2028
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.idea
2+
composer.lock
3+
vendor

.scrutinizer.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
before_commands:
2+
- "composer install --no-dev --prefer-source"
3+
4+
tools:
5+
external_code_coverage:
6+
enabled: false
7+
timeout: 300
8+
filter:
9+
excluded_paths: ["tests", "vendor"]
10+
php_code_coverage:
11+
enabled: false
12+
test_command: phpunit -c phpunit.xml.dist
13+
php_code_sniffer:
14+
enabled: true
15+
config:
16+
standard: PSR2
17+
filter:
18+
paths: ["src/*", "tests/*"]
19+
php_cpd:
20+
enabled: true
21+
excluded_dirs: ["tests", "vendor"]
22+
php_cs_fixer:
23+
enabled: true
24+
config:
25+
level: all
26+
filter:
27+
paths: ["src/*", "tests/*"]
28+
php_loc:
29+
enabled: true
30+
excluded_dirs: ["tests", "vendor"]
31+
php_mess_detector:
32+
enabled: true
33+
config:
34+
ruleset: phpmd.xml.dist
35+
design_rules: { eval_expression: false }
36+
filter:
37+
paths: ["src/*"]
38+
php_pdepend:
39+
enabled: true
40+
excluded_dirs: ["tests", "vendor"]
41+
php_analyzer:
42+
enabled: true
43+
filter:
44+
paths: ["src/*", "tests/*"]
45+
sensiolabs_security_checker: true

.travis.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
language: php
2+
php:
3+
- 5.5
4+
- 5.6
5+
- 7.0
6+
- hhvm
7+
- hhvm-nightly
8+
9+
matrix:
10+
allow_failures:
11+
- php: hhvm
12+
- php: hhvm-nightly
13+
14+
script:
15+
- vendor/bin/phpunit
16+
17+
before_script:
18+
- sudo apt-get -qq update > /dev/null
19+
- phpenv rehash > /dev/null
20+
- composer selfupdate --quiet
21+
- composer install --no-interaction --prefer-source --dev
22+
23+
notifications:
24+
irc: "irc.freenode.org#phpdocumentor"
25+
email:
26+
27+

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2010 Mike van Riel
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

composer.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"name": "phpdocumentor/type-resolver",
3+
"type": "library",
4+
"license": "MIT",
5+
"authors": [
6+
{"name": "Mike van Riel", "email": "[email protected]"}
7+
],
8+
"require": {
9+
"php": ">=5.5",
10+
"phpdocumentor/reflection-common": "dev-master@dev"
11+
},
12+
"autoload": {
13+
"psr-4": {"phpDocumentor\\Reflection\\": ["src/"]}
14+
},
15+
"autoload-dev": {
16+
"psr-4": {"phpDocumentor\\Reflection\\": ["tests/unit"]}
17+
},
18+
"require-dev": {
19+
"phpunit/phpunit": "^4.6",
20+
"mockery/mockery": "^0.9.4"
21+
},
22+
"extra": {
23+
"branch-alias": {
24+
"dev-master": "1.0.x-dev"
25+
}
26+
}
27+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
use phpDocumentor\Reflection\Types\Resolver;
4+
5+
require '../vendor/autoload.php';
6+
7+
$typeResolver = new Resolver();
8+
9+
// Will yield an object of type phpDocumentor\Types\Compound
10+
var_export($typeResolver->resolveType('string|integer'));
11+
12+
// Will return the string "string|int"
13+
var_dump((string)$typeResolver->resolveType('string|integer'));

examples/02-resolving-classes.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
use phpDocumentor\Reflection\Types\Context;
4+
use phpDocumentor\Reflection\Types\Resolver;
5+
6+
require '../vendor/autoload.php';
7+
8+
$typeResolver = new Resolver();
9+
10+
// Will use the namespace and aliases to resolve to \phpDocumentor\Types\Resolver|Mockery\MockInterface
11+
$context = new Context('\phpDocumentor', [ 'm' => 'Mockery' ]);
12+
var_dump((string)$typeResolver->resolveType('Types\Resolver|m\MockInterface', $context));
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
use phpDocumentor\Reflection\Types\Context;
4+
use phpDocumentor\Reflection\Types\Resolver;
5+
6+
require '../vendor/autoload.php';
7+
8+
$typeResolver = new Resolver();
9+
10+
// Will use the namespace and aliases to resolve to a Fqsen object
11+
$context = new Context('\phpDocumentor\Types');
12+
13+
// Method named: \phpDocumentor\Types\Types\Resolver::resolveFqsen()
14+
var_dump((string)$typeResolver->resolveFqsen('Types\Resolver::resolveFqsen()', $context));
15+
16+
// Property named: \phpDocumentor\Types\Types\Resolver::$keyWords
17+
var_dump((string)$typeResolver->resolveFqsen('Types\Resolver::$keyWords', $context));
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
use phpDocumentor\Reflection\Types\ContextFactory;
4+
use phpDocumentor\Reflection\Types\Resolver;
5+
6+
require '../vendor/autoload.php';
7+
require 'Classy.php';
8+
9+
$typeResolver = new Resolver();
10+
$contextFactory = new ContextFactory();
11+
$context = $contextFactory->createFromClassReflector(new ReflectionClass('My\\Example\\Classy'));
12+
13+
// Class named: \phpDocumentor\Reflection\Types\Resolver
14+
var_dump((string)$typeResolver->resolveType('Types\Resolver', $context));
15+
16+
// String
17+
var_dump((string)$typeResolver->resolveType('string', $context));
18+
19+
// Property named: \phpDocumentor\Reflection\Types\Resolver::$keyWords
20+
var_dump((string)$typeResolver->resolveFqsen('Types\Resolver::$keyWords', $context));
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
use phpDocumentor\Reflection\Types\Context;
4+
use phpDocumentor\Reflection\Types\ContextFactory;
5+
use phpDocumentor\Reflection\Types\Resolver;
6+
7+
require '../vendor/autoload.php';
8+
9+
$typeResolver = new Resolver();
10+
$contextFactory = new ContextFactory();
11+
$context = $contextFactory->createForNamespace('My\Example', file_get_contents('Classy.php'));
12+
13+
// Class named: \phpDocumentor\Reflection\Types\Resolver
14+
var_dump((string)$typeResolver->resolveType('Types\Resolver', $context));
15+
16+
// String
17+
var_dump((string)$typeResolver->resolveType('string', $context));
18+
19+
// Property named: \phpDocumentor\Reflection\Types\Resolver::$keyWords
20+
var_dump((string)$typeResolver->resolveFqsen('Types\Resolver::$keyWords', $context));

0 commit comments

Comments
 (0)