TypeResolver - A PSR-5 based resolver of Class names, Types and Structural Element Names

Overview

License: MIT Coveralls Coverage Scrutinizer Code Coverage Scrutinizer Code Quality Packagist Version Packagist Version

TypeResolver and FqsenResolver

The specification on types in DocBlocks (PSR-5) describes various keywords and special constructs but also how to statically resolve the partial name of a Class into a Fully Qualified Class Name (FQCN).

PSR-5 also introduces an additional way to describe deeper elements than Classes, Interfaces and Traits called the Fully Qualified Structural Element Name (FQSEN). Using this it is possible to refer to methods, properties and class constants but also functions and global constants.

This package provides two Resolvers that are capable of

  1. Returning a series of Value Object for given expression while resolving any partial class names, and
  2. Returning an FQSEN object after resolving any partial Structural Element Names into Fully Qualified Structural Element names.

Installing

The easiest way to install this library is with Composer using the following command:

$ composer require phpdocumentor/type-resolver

Examples

Ready to dive in and don't want to read through all that text below? Just consult the examples folder and check which type of action that your want to accomplish.

On Types and Element Names

This component can be used in one of two ways

  1. To resolve a Type or
  2. To resolve a Fully Qualified Structural Element Name

The big difference between these two is in the number of things it can resolve.

The TypeResolver can resolve:

  • a php primitive or pseudo-primitive such as a string or void (@var string or @return void).

  • a composite such as an array of string (@var string[]).

  • a compound such as a string or integer (@var string|integer).

  • an array expression (@var (string|TypeResolver)[])

  • an object or interface such as the TypeResolver class (@var TypeResolver or @var \phpDocumentor\Reflection\TypeResolver)

    please note that if you want to pass partial class names that additional steps are necessary, see the chapter Resolving partial classes and FQSENs for more information.

Where the FqsenResolver can resolve:

  • Constant expressions (i.e. @see \MyNamespace\MY_CONSTANT)
  • Function expressions (i.e. @see \MyNamespace\myFunction())
  • Class expressions (i.e. @see \MyNamespace\MyClass)
  • Interface expressions (i.e. @see \MyNamespace\MyInterface)
  • Trait expressions (i.e. @see \MyNamespace\MyTrait)
  • Class constant expressions (i.e. @see \MyNamespace\MyClass::MY_CONSTANT)
  • Property expressions (i.e. @see \MyNamespace\MyClass::$myProperty)
  • Method expressions (i.e. @see \MyNamespace\MyClass::myMethod())

Resolving a type

In order to resolve a type you will have to instantiate the class \phpDocumentor\Reflection\TypeResolver and call its resolve method like this:

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

In this example you will receive a Value Object of class \phpDocumentor\Reflection\Types\Compound that has two elements, one of type \phpDocumentor\Reflection\Types\String_ and one of type \phpDocumentor\Reflection\Types\Integer.

The real power of this resolver is in its capability to expand partial class names into fully qualified class names; but in order to do that we need an additional \phpDocumentor\Reflection\Types\Context class that will inform the resolver in which namespace the given expression occurs and which namespace aliases (or imports) apply.

Resolving nullable types

Php 7.1 introduced nullable types e.g. ?string. Type resolver will resolve the original type without the nullable notation ? just like it would do without the ?. After that the type is wrapped in a \phpDocumentor\Reflection\Types\Nullable object. The Nullable type has a method to fetch the actual type.

Resolving an FQSEN

A Fully Qualified Structural Element Name is a reference to another element in your code bases and can be resolved using the \phpDocumentor\Reflection\FqsenResolver class' resolve method, like this:

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

In this example we resolve a Fully Qualified Structural Element Name (meaning that it includes the full namespace, class name and element name) and receive a Value Object of type \phpDocumentor\Reflection\Fqsen.

The real power of this resolver is in its capability to expand partial element names into Fully Qualified Structural Element Names; but in order to do that we need an additional \phpDocumentor\Reflection\Types\Context class that will inform the resolver in which namespace the given expression occurs and which namespace aliases (or imports) apply.

Resolving partial Classes and Structural Element Names

Perhaps the best feature of this library is that it knows how to resolve partial class names into fully qualified class names.

For example, you have this file:

namespace My\Example;

use phpDocumentor\Reflection\Types;

class Classy
{
    /**
     * @var Types\Context
     * @see Classy::otherFunction()
     */
    public function __construct($context) {}
    
    public function otherFunction(){}
}

Suppose that you would want to resolve (and expand) the type in the @var tag and the element name in the @see tag.

For the resolvers to know how to expand partial names you have to provide a bit of Context for them by instantiating a new class named \phpDocumentor\Reflection\Types\Context with the name of the namespace and the aliases that are in play.

Creating a Context

You can do this by manually creating a Context like this:

$context = new \phpDocumentor\Reflection\Types\Context(
    '\My\Example', 
    [ 'Types' => '\phpDocumentor\Reflection\Types']
);

Or by using the \phpDocumentor\Reflection\Types\ContextFactory to instantiate a new context based on a Reflector object or by providing the namespace that you'd like to extract and the source code of the file in which the given type expression occurs.

$contextFactory = new \phpDocumentor\Reflection\Types\ContextFactory();
$context = $contextFactory->createFromReflector(new ReflectionMethod('\My\Example\Classy', '__construct'));

or

$contextFactory = new \phpDocumentor\Reflection\Types\ContextFactory();
$context = $contextFactory->createForNamespace('\My\Example', file_get_contents('My/Example/Classy.php'));

Using the Context

After you have obtained a Context it is just a matter of passing it along with the resolve method of either Resolver class as second argument and the Resolvers will take this into account when resolving partial names.

To obtain the resolved class name for the @var tag in the example above you can do:

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

When you do this you will receive an object of class \phpDocumentor\Reflection\Types\Object_ for which you can call the getFqsen method to receive a Value Object that represents the complete FQSEN. So that would be phpDocumentor\Reflection\Types\Context.

Why is the FQSEN wrapped in another object Object_?

The resolve method of the TypeResolver only returns object with the interface Type and the FQSEN is a common type that does not represent a Type. Also: in some cases a type can represent an "Untyped Object", meaning that it is an object (signified by the object keyword) but does not refer to a specific element using an FQSEN.

Another example is on how to resolve the FQSEN of a method as can be seen with the @see tag in the example above. To resolve that you can do the following:

$fqsenResolver = new \phpDocumentor\Reflection\FqsenResolver();
$type = $fqsenResolver->resolve('Classy::otherFunction()', $context);

Because Classy is a Class in the current namespace its FQSEN will have the My\Example namespace and by calling the resolve method of the FQSEN Resolver you will receive an Fqsen object that refers to \My\Example\Classy::otherFunction().

Comments
  • Bump to PHP 7

    Bump to PHP 7

    opened by TomasVotruba 12
  • Fix file_get_contents warning in ContextFactory

    Fix file_get_contents warning in ContextFactory

    Currently, a warning like warning: file_get_contents(): Filename cannot be empty in [...]/prophecy/vendor/phpdocumentor/type-resolver/src/Types/ContextFactory.php line 48 is generated by the library if there is no filename associated with the reflector passed to ContextFactory.

    This PR fix this.

    opened by dunglas 10
  • Support more scalar types of psalm

    Support more scalar types of psalm

    Hey, would it be possible to support more scalar types of psalm? Some are already supported but those aren't:

    • array-key
    • trait-string
    • callable-string
    • numeric-string

    I got this as a feature request https://github.com/sensiolabs-de/deptrac/issues/329 but I think the best place would be here. So everyone can benefit.

    enhancement help wanted 
    opened by smoench 9
  • Use PHPUnit\Framework\TestCase instead of PHPUnit_Framework_TestCase

    Use PHPUnit\Framework\TestCase instead of PHPUnit_Framework_TestCase

    I use the PHPUnit\Framework\TestCase notation instead of PHPUnit_Framework_TestCase while extending our TestCases. This will help us migrate to PHPUnit 6, that no longer support snake case class names.

    I just need to bump PHPUnit version to ^4.8.35 and ^5.7, that support this namespace.

    opened by carusogabriel 9
  • BUG: extends final class Array_

    BUG: extends final class Array_

    phpdocumentor/type-resolver/src/PseudoTypes/List_.php27: final class List_ extends Array_ implements PseudoType

    I search bug: final class List_ extends final class Array_

    opened by gorskimarcin96 8
  • What does the underlyingType() represent?

    What does the underlyingType() represent?

    I'm looking at converting the previous ClassString types I added to psuedo-types. However, I'm not sure how PsuedoType is expected to be used.

    underlyingType() returns an empty instance of the type, but False_ and True_ already extend that type. What is the use case for underlyingType()? Is it always supposed to be an empty instance of a type? I'm curious why a type string isn't used instead.

    For ClassString which represents a string, but also provides an FQSEN if the class-string includes one, would underlyingType be new String()?

    Should psuedo-types always extend the underlying type?

    opened by othercorey 8
  • TypeResolver - Ignore whitespaces around tokens

    TypeResolver - Ignore whitespaces around tokens

    This is an attempt to fix issue #49. While fixing it it appeared simpler to update the preg split pattern to match (and ignore) whitespaces everywhere, which means following types will work :

    • array<int, string>
    • array < int , string >

    If it is too open, I can change that to only ignore one|all whitespace after the , token.

    I also updated the PREG comment.

    needs author update 
    opened by popy-dev 8
  • Return value parseTypes() is bad

    Return value parseTypes() is bad

    phpDocumentor v1.5.1 on TYPO3v10.4.21 with PHPv7.4.19

    Extbase Variable Dump
    
    array(1 item)
       0 => phpDocumentor\Reflection\Types\Object_prototype object
          fqsen => privatephpDocumentor\Reflection\Fqsenprototype object
    
    Extbase Variable Dump
    
    array(1 item)
        => phpDocumentor\Reflection\Types\Array_prototype object
          valueType => protectedphpDocumentor\Reflection\Types\Mixed_prototype object
          keyType => protected NULL
          defaultKeyType => protectedphpDocumentor\Reflection\Types\Compoundprototype object
    
    
    
    (1/1) TypeError
    
    Return value of phpDocumentor\Reflection\TypeResolver::parseTypes() must implement interface phpDocumentor\Reflection\Type, null returned
    in /var/webroot/vendor/phpdocumentor/type-resolver/src/TypeResolver.php line 320
    
                    );
                }
            } elseif (count($types) === 1) {
                return $types[0];
            }
    
            if ($compoundToken === '|') {
                return new Compound(array_values($types));
    
    at phpDocumentor\Reflection\TypeResolver->parseTypes()
    in /vendor/phpdocumentor/type-resolver/src/TypeResolver.php line 172
    
    
            /** @var ArrayIterator<int, string|null> $tokenIterator */
            $tokenIterator = new ArrayIterator($tokens);
    
            return $this->parseTypes($tokenIterator, $context, self::PARSER_IN_COMPOUND);
        }
    
        /**
         * Analyse each tokens and creates types
    
    at phpDocumentor\Reflection\TypeResolver->resolve()
    in /vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Var_.php line 68
    
            $variableName = '';
    
            // if the first item that is encountered is not a variable; it is a type
            if ($firstPart && $firstPart[0] !== '$') {
                $type = $typeResolver->resolve($firstPart, $context);
            } else {
                // first part is not a type; we should prepend it to the parts array for further processing
                array_unshift($parts, $firstPart);
            }
    
    at phpDocumentor\Reflection\DocBlock\Tags\Var_::create()
    in /vendor/phpdocumentor/reflection-docblock/src/DocBlock/StandardTagFactory.php line 217
    
            try {
                $callable = [$handlerClassName, 'create'];
                Assert::isCallable($callable);
                /** @phpstan-var callable(string): ?Tag $callable */
                $tag = call_user_func_array($callable, $arguments);
    
                return $tag ?? InvalidTag::create($body, $name);
            } catch (InvalidArgumentException $e) {
                return InvalidTag::create($body, $name)->withError($e);
    
    Index: src/TypeResolver.php
    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
    ===================================================================
    --- src/TypeResolver.php	(date 1615285713667)
    +++ src/TypeResolver.php	(date 1615285713667)
    @@ -217,7 +217,7 @@
                 }
             } elseif (count($types) === 1) {
    -            return $types[0];
    +            return $types[0] ? $types[0] : array_values($types)[0];
             }
    
             if ($compoundToken === '|') {
    
    bug 
    opened by TrueType 7
  • Missing type for array<string, mixed>

    Missing type for array

    I am getting

    'A type is missing in a collection expression'

    Which is cause by the doc block @var array<string, mixed> such as found at https://github.com/netgen-layouts/layouts-core/blob/7fbe0c1b0619fc8f33dacddeea2ada7af484a4b8/lib/API/Values/Block/BlockUpdateStruct.php#L76.

    array<string, mixed> is generated suing phpStan. I believe array<string, mixed> is a valid type.

    opened by wizhippo 5
  • ContextFactory incorrect namespace aliases

    ContextFactory incorrect namespace aliases

    Following the example below:

    namespace App;
    
    use Common\Domain\DayOfWeek;
    
    class Foo 
    {
        /**
         * @var DayOfWeek
         */
        private $dayOfWeek;
    }
    

    Unfortunately, instead of the typeCommon\Domain\DayOfWeek on the dayOfWeek property, its type is App\DayOfWeek.

    After a longer digging, I stumbled upon ContextFactory::extractUseStatements method. The problem here is how this method uses aliasing. For the example above the Context::getNamespaceAliases call will end up with

    array('Common\Domain\DayOfWeek' => 'Common\Domain\DayOfWeek')
    

    instead of

    array('DayOfWeek' => 'Common\Domain\DayOfWeek')
    

    Also, I noticed the tests testReadsAliasesFromClassReflection, testReadsAliasesFromProvidedNamespaceAndContent are incorrect for ContextFactory, that's why it looks like no one has been able to notice it all this time.

    opened by piku235 5
  • [0.5.0] Array Syntax

    [0.5.0] Array Syntax

    The following is accepted by the parser: array<string,float>, but this is not: array<string, float>. Is that intentional?

    RuntimeException: A type is missing in a collection expression
    
    phpdocumentor/type-resolver/src/TypeResolver.php:240
    phpdocumentor/type-resolver/src/TypeResolver.php:448
    phpdocumentor/type-resolver/src/TypeResolver.php:204
    phpdocumentor/type-resolver/src/TypeResolver.php:126
    
    opened by GrahamCampbell 5
  • Generics are always considered as Collection

    Generics are always considered as Collection

    Hello,

    whether on branch 1.x or on the last tagged version, generics are always considered as a collection although this is not always true.

    Is it made on purpose or are you planing to extend the method TypeResolver::createFromGeneric() to handle the cases where generics are something else than a collection?

    thanks for your answer!

    opened by nikophil 4
  • Adding getter for token in AggregatedType

    Adding getter for token in AggregatedType

    Needed for draft-PR in phpDocumentor: https://github.com/phpDocumentor/phpDocumentor/pull/3393

    Adds an getter for the token (seperator) in AggregatedType.

    opened by Mai-Lapyst 0
  • Legacy nullable type detected, please update your code as you are using nullable types in a docblock

    Legacy nullable type detected, please update your code as you are using nullable types in a docblock

    ------ ----------------------------------------------------------------------- 
      Line   src/Search.php                                                         
     ------ ----------------------------------------------------------------------- 
      43     16384: Legacy nullable type detected, please update your code as       
                      you are using nullable types in a docblock. support will be   
             removed in v2.0.0 in                                                   
             phar:///bin/doctum/vendor/phpdocumentor/type-resolver/src/TypeResolve  
             r.php line 578 on "Williamdes\MariaDBMySQLKBS\Search::loadData"        
      87     163[84](https://github.com/williamdes/mariadb-mysql-kbs/actions/runs/3547671604/jobs/5959164758#step:4:89): Legacy nullable type detected, please update your code as       
                      you are using nullable types in a docblock. support will be   
             removed in v2.0.0 in                                                   
             phar:///bin/doctum/vendor/phpdocumentor/type-resolver/src/TypeResolve  
             r.php line 578 on "Williamdes\MariaDBMySQLKBS\Search::getByName"       
      117    16384: Legacy nullable type detected, please update your code as       
                      you are using nullable types in a docblock. support will be   
             removed in v2.0.0 in                                                   
             phar:///bin/doctum/vendor/phpdocumentor/type-resolver/src/TypeResolve  
             r.php line 578 on "Williamdes\MariaDBMySQLKBS\Search::getVariable"     
      134    16384: Legacy nullable type detected, please update your code as       
                      you are using nullable types in a docblock. support will be   
             removed in v2.0.0 in                                                   
             phar:///bin/doctum/vendor/phpdocumentor/type-resolver/src/TypeResolve  
             r.php line 578 on                                                      
             "Williamdes\MariaDBMySQLKBS\Search::getVariableType"                   
     ------ -----------------------------------------------------------------------
    

    https://github.com/phpDocumentor/TypeResolver/blob/1.x/src/TypeResolver.php#L575-L579

    https://github.com/williamdes/mariadb-mysql-kbs/actions/runs/3547671604/jobs/5959164758

    There is no nullable types in the code 🤔 Source: https://github.com/williamdes/mariadb-mysql-kbs/blob/main/src/Search.php

    opened by williamdes 0
  • resolvePartialStructuralElementName gives wrong namespace

    resolvePartialStructuralElementName gives wrong namespace

    Hello, I have 2 classes in different namespaces, and trait connecting them, ex:

    namespace Command\Common\Traits;
    
    use Command\Model\Payment\UserAccountDetails;
    
    trait UserDetailsAwareTrait
    {
        /**
         * @var UserAccountDetails
         */
        protected $userAccountDetails;
    
        public function getUserAccountDetails(): UserAccountDetails
        {
            return $this->userAccountDetails;
        }
    
        public function setUserAccountDetails(UserAccountDetails $userAccountDetails): void
        {
            $this->userAccountDetails = $userAccountDetails;
        }
    }
    
    namespace Command\Bank;
    
    use Command\Common\Traits\UserDetailsAwareTrait;
    use Command\Model\Payment\UserData;
    use Money\Money;
    use Ramsey\Uuid\UuidInterface;
    
    class DepositCommand
    {
        use UserDetailsAwareTrait;
    }
    
    namespace Command\Model\Payment;
    
    class UserAccountDetails
    {
        /**
         * @var bool|null
         */
        private $accountVerified;
    
        public function isAccountVerified(): ?bool
        {
            return $this->accountVerified;
        }
    
        public function setAccountVerified(?bool $accountVerified): UserAccountDetails
        {
            $this->accountVerified = $accountVerified;
    
            return $this;
        }
    }
    

    And logic failure occurs in resolvePartialStructuralElementName.

    $context variable content: image and $type = "UserAccountDetails".

    So it cannot be just simple $namespace . $type, I guess it should check within trait namespace of UserAccountDetails, but I don't know where it cames from.

    It seems that another library have already resolved this issue, you can take a look and this one

    Maybe $context should include UserDetailsAwareTrait trait uses, so it would be resolved as $namespaceAliases[$typeParts[0]]

    opened by webmake 1
  • ContextFactory overwrites when multiple imports with same alias

    ContextFactory overwrites when multiple imports with same alias

    After some discussion with @nikic on https://github.com/phpDocumentor/TypeResolver/pull/9/files#r34962566 it looks like ContextFactory::getNamespaceAliases() doesn't cope with multiple imports with the same aliased name. For example:

    namespace Foo;
    use Foo\X;
    class A extends X {
        use Zap;
    }
    use Bar\X;
    class B extends X {
        use Baz;
    }
    

    If you call ::getNamespaceAliases() on this perfectly valid code, you'll see:

    [
        'X' => 'Bar\X'
    ]
    

    This is not correct, but because it is keyed by the alias name, it is too much of a simple representation to allow multiple named aliases. It's maybe quite an edge case, but it does indeed appear to be a bug.

    in discussion 
    opened by asgrim 9
Releases(1.6.2)
  • 1.6.2(Oct 14, 2022)

    Added

    • Upgrade to standardized phpdoc ci by @jaapio in https://github.com/phpDocumentor/TypeResolver/pull/170
    • Upgrade code to php 7.4 level by @jaapio in https://github.com/phpDocumentor/TypeResolver/pull/171
    • Build on php 8.2 by @jaapio in https://github.com/phpDocumentor/TypeResolver/pull/172

    Fixed

    • Fix parsing nullable collections by @hemberger in https://github.com/phpDocumentor/TypeResolver/pull/168
    • Update inaccurate docblock in AbstractList by @Prusias in https://github.com/phpDocumentor/TypeResolver/pull/174

    New Contributors

    • @hemberger made their first contribution in https://github.com/phpDocumentor/TypeResolver/pull/168
    • @Prusias made their first contribution in https://github.com/phpDocumentor/TypeResolver/pull/174

    Full Changelog: https://github.com/phpDocumentor/TypeResolver/compare/1.6.1...1.6.2

    Source code(tar.gz)
    Source code(zip)
  • 1.6.1(Mar 29, 2022)

    Fixed

    • fix for zero IntRange by @voku in https://github.com/phpDocumentor/TypeResolver/pull/153

    CI

    • GH Actions: version update for various predefined actions by @jrfnl in https://github.com/phpDocumentor/TypeResolver/pull/159

    Full Changelog: https://github.com/phpDocumentor/TypeResolver/compare/1.6.0...1.6.1

    Source code(tar.gz)
    Source code(zip)
  • 1.6.0(Jan 4, 2022)

    Added

    • Add list pseudo-type by @enumag in https://github.com/phpDocumentor/TypeResolver/pull/136
    • add support for "int<min,max>", "negative-int" and "numeric" by @voku in https://github.com/phpDocumentor/TypeResolver/pull/139

    Deprecated

    • Nothing

    Fixed

    • Throw exception on invalid array start by @jaapio in https://github.com/phpDocumentor/TypeResolver/pull/147
    • GH Actions: version update for ramsey/composer-install by @jrfnl in https://github.com/phpDocumentor/TypeResolver/pull/144

    Removed

    • Nothing

    Security

    • Nothing

    New Contributors

    • @enumag made their first contribution in https://github.com/phpDocumentor/TypeResolver/pull/136

    Full Changelog: https://github.com/phpDocumentor/TypeResolver/compare/1.5.1...1.6.0

    Source code(tar.gz)
    Source code(zip)
  • 1.5.1(Oct 2, 2021)

    Added

    • add support for literal-string, thanks to @voku
    • fix "PseudoType" for ArrayKey, thanks to @voku

    Deprecated

    • Nothing

    Fixed

    • fix "RuntimeException" for "array-key" and for "class-string", thanks to @voku

    Removed

    • Nothing

    Security

    • Nothing
    Source code(tar.gz)
    Source code(zip)
  • 1.5.0(Sep 17, 2021)

    This version contains various fixes, and adds support for php 8.1 including the new never return type. See the changelog below for details about this release.

    Added

    • support psalm scalar types #112, thanks to @smoench
    • support for never return type #130 thanks to @jaapio

    Deprecated

    • Nothing

    Fixed

    • Update .gitattributes #115, thanks to @KasperFranz
    • Do not include composer.lock in distribution #118 @kubawerlos
    • Allow manual trigger of github actions #120, thanks to @jrfnl
    • fix array-offset via "isset"-call #104, thanks to @voku
    • GH Actions: simplify Composer caching #121, thanks to @jrfnl
    • Tests/ArrayKeyTest: fix incorrect @uses tag #122 thanks to @jrfnl
    • GH Actions: actually run the tests on PHP 8.0 + 8.1 #123 thanks to @jrfnl
    • CS update after upstream changes #124, thanks to @jrfnl
    • GH Actions: don't allow builds against PHP 8.1 to fail #125 @jrfnl

    Removed

    • Nothing

    Security

    • Nothing
    Source code(tar.gz)
    Source code(zip)
  • 1.4.0(Sep 17, 2020)

    Added

    • Improved Pseudo type support #113, thanks to @mvriel

    Deprecated

    • phpDocumentor\Reflection\Types\False_ is replaced by \phpDocumentor\Reflection\PseudoTypes\False_ will be removed in v2
    • phpDocumentor\Reflection\Types\True_ is replaced by \phpDocumentor\Reflection\PseudoTypes\True_ will be removed in v2

    Fixed

    • fix parsing tokens #114, thanks to @xabbuh

    Removed

    • Nothing

    Security

    • Nothing
    Source code(tar.gz)
    Source code(zip)
  • 1.3.0(Jun 27, 2020)

  • 1.2.0(Jun 19, 2020)

    Added

    • Add support for True and False pseudo-types #14, thanks to @jaapio

    Deprecated

    • Nothing

    Fixed

    • Nothing

    Removed

    • Nothing

    Security

    • Nothing
    Source code(tar.gz)
    Source code(zip)
  • 1.1.0(Feb 28, 2020)

    Added

    • Add collection syntax support for iterable, #80 thanks to @julienfalque
    • Added support for class-string and class-string types, #90 thanks to @othercorey
    • Deduplicate double entries in a compound thanks to @mvriel
    • Type coverage improvements, thanks to @orklah
    • BC check in ci, thanks to @jaapio

    Deprecated

    • Nothing

    Fixed

    • Infinite loop could occur when no closing use token found, thanks to @mvriel

    Removed

    • Nothing

    Security

    • Nothing
    Source code(tar.gz)
    Source code(zip)
  • 1.0.1(Aug 22, 2019)

    This version contains a fixed regression regarding namespace alias interpretation.

    Added

    • Nothing

    Deprecated

    • Nothing

    Fixed

    • Fixed #76 ContextFactory incorrect namespace aliases, thanks to @piku235

    Removed

    • Nothing

    Security

    • Nothing
    Source code(tar.gz)
    Source code(zip)
  • 0.7.2(Aug 22, 2019)

    This version contains a fixed regression regarding namespace alias interpretation.

    Added

    • Nothing

    Deprecated

    • Nothing

    Fixed

    • Fixed #76 ContextFactory incorrect namespace aliases, thanks to @piku235

    Removed

    • Nothing

    Security

    • Nothing
    Source code(tar.gz)
    Source code(zip)
  • 1.0.0(Jul 8, 2019)

    This release doesn't contain any new features since the previous release. All methods do have the correct typehints and return types now. The codebase is fully checked with phpstan and psaml.

    Added

    • QA pipeline

    Deprecated

    • Nothing

    Fixed

    • Nothing

    Removed

    • Nothing

    Security

    • Nothing
    Source code(tar.gz)
    Source code(zip)
  • 0.7.1(Oct 12, 2018)

  • 0.7.0(Aug 22, 2018)

  • 0.6.3(Aug 9, 2018)

  • 0.6.2(Jun 14, 2018)

  • 0.6.1(Feb 13, 2018)

  • 0.6.0(Jan 26, 2018)

  • 0.5.1(Jan 26, 2018)

  • 0.5.0(Dec 28, 2017)

    Added

    • Support of array expression of PSR-5
    • Support of collections
    • Improved php 7.0 code
    • phpstan max level.

    Deprecated

    • Nothing

    Fixed

    • Nothing

    Removed

    • Nothing

    Security

    • Nothing
    Source code(tar.gz)
    Source code(zip)
  • 0.4.0(Jul 14, 2017)

    Added

    • Renamed Mixed to Mixed_
    • Renamed Resource to Resource_

    Deprecated

    • Nothing

    Fixed

    • HHVM build on travis

    Removed

    • Nothing

    Security

    • Nothing
    Source code(tar.gz)
    Source code(zip)
  • 0.3.0(Jun 4, 2017)

    Added

    • Support for iterable type.
    • Support for Nullable type
    • Support for parent type
    • Travis build for php 7.1

    Deprecated

    • Nothing

    Fixed

    • Code highlighting in readme.

    Removed

    • Nothing

    Security

    • Nothing
    Source code(tar.gz)
    Source code(zip)
Owner
phpDocumentor
phpDocumentor
A full-scale PHP sandbox class that utilizes PHP-Parser to prevent sandboxed code from running unsafe code

A full-scale PHP 7.4+ sandbox class that utilizes PHP-Parser to prevent sandboxed code from running unsafe code. It also utilizes FunctionParser to di

Corveda 192 Dec 10, 2022
A generic content parser based on the devto markdown + frontmatter format, with liquid tag support

Parsed A generic content parser based on the devto post format, with front matter and liquid tag support. Parsed uses league/commonmark as base markdo

null 18 Dec 28, 2022
A toolbar for Laravel Telescope, based on the Symfony Web Profiler.

Laravel Telescope Toolbar Extends Laravel Telescope to show a powerful Toolbar See https://github.com/laravel/telescope Install First install Telescop

Fruitcake 733 Dec 30, 2022
PHP_CodeSniffer tokenizes PHP files and detects violations of a defined set of coding standards.

About PHP_CodeSniffer is a set of two PHP scripts; the main phpcs script that tokenizes PHP, JavaScript and CSS files to detect violations of a define

Squiz Labs 9.9k Jan 4, 2023
Phan is a static analyzer for PHP. Phan prefers to avoid false-positives and attempts to prove incorrectness rather than correctness.

Phan is a static analyzer for PHP that prefers to minimize false-positives. Phan attempts to prove incorrectness rather than correctness. Phan looks f

null 5.4k Jan 7, 2023
Beautiful and understandable static analysis tool for PHP

PhpMetrics PhpMetrics provides metrics about PHP project and classes, with beautiful and readable HTML report. Documentation | Twitter | Contributing

PhpMetrics 2.3k Dec 22, 2022
PHPMD is a spin-off project of PHP Depend and aims to be a PHP equivalent of the well known Java tool PMD. PHPMD can be seen as an user friendly frontend application for the raw metrics stream measured by PHP Depend.

PHPMD PHPMD is a spin-off project of PHP Depend and aims to be a PHP equivalent of the well known Java tool PMD. PHPMD can be seen as an user friendly

PHP Mess Detector 2.1k Jan 8, 2023
:crystal_ball: Better Reflection is a reflection API that aims to improve and provide more features than PHP's built-in reflection API.

Better Reflection Better Reflection is a reflection API that aims to improve and provide more features than PHP's built-in reflection API. Why is it b

Roave, LLC 1.1k Dec 15, 2022
Compares two source sets and determines the appropriate semantic versioning to apply.

PHP Semantic Versioning Checker PHP Semantic Versioning Checker is a console/library which allows you to inspect a set of before and after source code

Tom Rochette 418 Dec 30, 2022
A set of tools for lexical and syntactical analysis written in pure PHP.

Welcome to Dissect! master - this branch always contains the last stable version. develop - the unstable development branch. Dissect is a set of tools

Jakub Lédl 221 Nov 29, 2022
PHP completion, refactoring, introspection tool and language server.

Phpactor This project aims to provide heavy-lifting refactoring and introspection tools which can be used standalone or as the backend for a text edit

Phpactor 882 Jan 1, 2023
Instant Upgrades and Instant Refactoring of any PHP 5.3+ code

Rector - Speedup Your PHP Development Rector helps you with 2 areas - major code changes and in daily work. Do you have a legacy code base? Do you wan

RectorPHP 6.5k Jan 8, 2023
PHP Functional Programming library. Monads and common use functions.

Functional PHP PHP Functional Programming library. Monads and common use functions. Documentation Functions Monads Installation Composer $ composer re

Alexander Sv. 169 Dec 27, 2022
Search PHP source code for function & method calls, variables, and more from PHP.

Searching PHP source code made easy Search PHP source code for function & method calls, variable assignments, classes and more directly from PHP. Inst

Permafrost Software 22 Nov 24, 2022
Deptrac is a static code analysis tool for PHP that helps you communicate, visualize and enforce architectural decisions in your projects

Deptrac is a static code analysis tool for PHP that helps you communicate, visualize and enforce architectural decisions in your projects. You can freely define your architectural layers over classes and which rules should apply to them.

QOSSMIC GmbH 2.2k Dec 30, 2022
Symfony kafka bundle to produce and consume messages.

Technology stack Quick start Example project Basic Configuration Consuming messages Retrying failed messages Handling offsets Decoders Denormalizers V

STS Gaming Group 25 Oct 3, 2022
phpcs-security-audit is a set of PHP_CodeSniffer rules that finds vulnerabilities and weaknesses related to security in PHP code

phpcs-security-audit v3 About phpcs-security-audit is a set of PHP_CodeSniffer rules that finds vulnerabilities and weaknesses related to security in

Floe design + technologies 655 Jan 3, 2023
Best FlexForm based content elements since 2012. With TCA mapping feature, simple backend view and much more features which makes it super easy to create own content element types.

DCE-Extension for TYPO3 What is DCE? DCE is an extension for TYPO3 CMS, which creates easily and fast dynamic content elements. Based on Extbase, Flui

Armin Vieweg 10 Nov 2, 2022
A simple and flexible PHP middleware dispatcher based on PSR-7, PSR-11, and PSR-15

Woohoo Labs. Harmony Woohoo Labs. Harmony is a PSR-15 compatible middleware dispatcher. Harmony was born to be a totally flexible and almost invisible

Woohoo Labs. 153 Sep 5, 2022
📦 "PHP type names" contains the list of constants for the available PHP data types.

PHP type names PHP type names ?? Description Simple library containing the list of constants for the available PHP data types. Use those constant type

♚ PH⑦ de Soria™♛ 4 Dec 15, 2022