Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on May 3, 2024 via composer

phpdocumentor/type-resolver 0.3.0

Package summary
Share
0
issues
1
license
2
MIT
Package created
12 Jun 2015
Version published
3 Jun 2017
Maintainers
2
Total deps
2
Direct deps
1
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
2 Packages, Including:
phpdocumentor/reflection-common@1.0.1
phpdocumentor/type-resolver@0.3.0
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

1
All Dependencies CSV
β“˜ This is a list of phpdocumentor/type-resolver 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
phpdocumentor/reflection-common1.0.16.37 kBMIT
prod

Visualizations

Frequently Asked Questions

What does phpdocumentor/type-resolver do?

The phpDocumentor/Type-Resolver is a powerful tool based on the PSR-5 specification used to resolve class names, types and structural element names in PHP. It involves the creation of two resolvers that are capable of returning value objects for given expressions while resolving any partial class names and returning an FQSEN (Fully Qualified Structural Element Name) object after resolving any partial structural element names into fully qualified ones. This proves to be highly effective in resolving class names in doc blocks, dealing with arrays, compounds and object interfaces and more.

How do you use phpdocumentor/type-resolver?

To use phpDocumentor/Type-Resolver, you first need to install the package via Composer using the command composer require phpdocumentor/type-resolver. When you want to deal with types, you instantiate the TypeResolver class and call its resolve method. For instance:

$typeResolver = new \phpDocumentor\Reflection\TypeResolver();
$type = $typeResolver->resolve('string|integer');

Here, the $type object represents a compound type consisting of the string and integer types.

Similarly, you can deal with FQSENs using the FqsenResolver class:

$fqsenResolver = new \phpDocumentor\Reflection\FqsenResolver();
$fqsen = $fqsenResolver->resolve('\phpDocumentor\Reflection\FqsenResolver::resolve()');

In this case, the $fqsen object represents a fully qualified structural element name.

One key strength of phpDocumentor/Type-Resolver is its ability to handle partial class names. This involves providing a bit of Context to the resolving actions. This is done by creating and using an instance of the Context class:

$context = new \phpDocumentor\Reflection\Types\Context('\My\Example',[ 'Types' => '\phpDocumentor\Reflection\Types']);
$typeResolver = new \phpDocumentor\Reflection\TypeResolver();
$type = $typeResolver->resolve('Types\Context', $context);

Here, a given type Types\Context is resolved into a fully qualified class name according to the provided namespace and aliases context.

Where are the phpdocumentor/type-resolver docs?

As for the documentation of phpDocumentor/Type-Resolver, the best source of reference is the GitHub page. The readme file of the repository provides a comprehensive guide on installation, usage, examples as well as understanding types and element names, resolving a type, resolving FQSEN areas and handling partial classes and structural element names.