1- <?php declare (strict_types=1 );
1+ <?php
2+
3+ declare (strict_types=1 );
4+
25/**
36 * This file is part of phpDocumentor.
47 *
58 * For the full copyright and license information, please view the LICENSE
69 * file that was distributed with this source code.
710 *
8- * @copyright 2010-2018 Mike van Riel<[email protected] > 9- * @license http://www.opensource.org/licenses/mit-license.php MIT
1011 * @link http://phpdoc.org
1112 */
1213
1314namespace phpDocumentor \Reflection ;
1415
16+ use InvalidArgumentException ;
1517use phpDocumentor \Reflection \Types \Context ;
18+ use function explode ;
19+ use function implode ;
20+ use function strpos ;
1621
1722class FqsenResolver
1823{
1924 /** @var string Definition of the NAMESPACE operator in PHP */
2025 private const OPERATOR_NAMESPACE = '\\' ;
2126
22- public function resolve (string $ fqsen , Context $ context = null ): Fqsen
27+ public function resolve (string $ fqsen , ? Context $ context = null ) : Fqsen
2328 {
2429 if ($ context === null ) {
2530 $ context = new Context ('' );
@@ -34,12 +39,8 @@ public function resolve(string $fqsen, Context $context = null): Fqsen
3439
3540 /**
3641 * Tests whether the given type is a Fully Qualified Structural Element Name.
37- *
38- * @param string $type
39- *
40- * @return bool
4142 */
42- private function isFqsen (string $ type ): bool
43+ private function isFqsen (string $ type ) : bool
4344 {
4445 return strpos ($ type , self ::OPERATOR_NAMESPACE ) === 0 ;
4546 }
@@ -48,11 +49,9 @@ private function isFqsen(string $type): bool
4849 * Resolves a partial Structural Element Name (i.e. `Reflection\DocBlock`) to its FQSEN representation
4950 * (i.e. `\phpDocumentor\Reflection\DocBlock`) based on the Namespace and aliases mentioned in the Context.
5051 *
51- * @param string $type
52- * @return Fqsen
53- * @throws \InvalidArgumentException when type is not a valid FQSEN.
52+ * @throws InvalidArgumentException When type is not a valid FQSEN.
5453 */
55- private function resolvePartialStructuralElementName (string $ type , Context $ context ): Fqsen
54+ private function resolvePartialStructuralElementName (string $ type , Context $ context ) : Fqsen
5655 {
5756 $ typeParts = explode (self ::OPERATOR_NAMESPACE , $ type , 2 );
5857
@@ -61,7 +60,7 @@ private function resolvePartialStructuralElementName(string $type, Context $cont
6160 // if the first segment is not an alias; prepend namespace name and return
6261 if (!isset ($ namespaceAliases [$ typeParts [0 ]])) {
6362 $ namespace = $ context ->getNamespace ();
64- if ('' !== $ namespace ) {
63+ if ($ namespace !== '' ) {
6564 $ namespace .= self ::OPERATOR_NAMESPACE ;
6665 }
6766
0 commit comments