Completed
Push — master ( 8e973a...811a95 )
by
unknown
03:40 queued 01:04
created
vendor/jetbrains/phpstorm-stubs/tests/Model/PHPDefineConstant.php 2 patches
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -11,47 +11,47 @@
 block discarded – undo
11 11
 
12 12
 class PHPDefineConstant extends PHPConst
13 13
 {
14
-    /**
15
-     * @param array $reflectionObject
16
-     * @return static
17
-     */
18
-    public function readObjectFromReflection($reflectionObject)
19
-    {
20
-        if (is_string($reflectionObject[0])) {
21
-            $this->name = utf8_encode($reflectionObject[0]);
22
-        } else {
23
-            $this->name = $reflectionObject[0];
24
-        }
25
-        $constantValue = $reflectionObject[1];
26
-        if ($constantValue !== null) {
27
-            if (is_resource($constantValue)) {
28
-                $this->value = 'PHPSTORM_RESOURCE';
29
-            } elseif (is_string($constantValue) || is_float($constantValue)) {
30
-                $this->value = utf8_encode((string)$constantValue);
31
-            } else {
32
-                $this->value = $constantValue;
33
-            }
34
-        } else {
35
-            $this->value = null;
36
-        }
37
-        $this->visibility = 'public';
38
-        return $this;
39
-    }
14
+	/**
15
+	 * @param array $reflectionObject
16
+	 * @return static
17
+	 */
18
+	public function readObjectFromReflection($reflectionObject)
19
+	{
20
+		if (is_string($reflectionObject[0])) {
21
+			$this->name = utf8_encode($reflectionObject[0]);
22
+		} else {
23
+			$this->name = $reflectionObject[0];
24
+		}
25
+		$constantValue = $reflectionObject[1];
26
+		if ($constantValue !== null) {
27
+			if (is_resource($constantValue)) {
28
+				$this->value = 'PHPSTORM_RESOURCE';
29
+			} elseif (is_string($constantValue) || is_float($constantValue)) {
30
+				$this->value = utf8_encode((string)$constantValue);
31
+			} else {
32
+				$this->value = $constantValue;
33
+			}
34
+		} else {
35
+			$this->value = null;
36
+		}
37
+		$this->visibility = 'public';
38
+		return $this;
39
+	}
40 40
 
41
-    /**
42
-     * @param FuncCall $node
43
-     * @return static
44
-     */
45
-    public function readObjectFromStubNode($node)
46
-    {
47
-        $constName = $this->getConstantFQN($node, $node->args[0]->value->value);
48
-        if (in_array($constName, ['null', 'true', 'false'])) {
49
-            $constName = strtoupper($constName);
50
-        }
51
-        $this->name = $constName;
52
-        $this->value = $this->getConstValue($node->args[1]);
53
-        $this->visibility = 'public';
54
-        $this->collectTags($node);
55
-        return $this;
56
-    }
41
+	/**
42
+	 * @param FuncCall $node
43
+	 * @return static
44
+	 */
45
+	public function readObjectFromStubNode($node)
46
+	{
47
+		$constName = $this->getConstantFQN($node, $node->args[0]->value->value);
48
+		if (in_array($constName, ['null', 'true', 'false'])) {
49
+			$constName = strtoupper($constName);
50
+		}
51
+		$this->name = $constName;
52
+		$this->value = $this->getConstValue($node->args[1]);
53
+		$this->visibility = 'public';
54
+		$this->collectTags($node);
55
+		return $this;
56
+	}
57 57
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,8 +9,7 @@
 block discarded – undo
9 9
 use function is_resource;
10 10
 use function is_string;
11 11
 
12
-class PHPDefineConstant extends PHPConst
13
-{
12
+class PHPDefineConstant extends PHPConst {
14 13
     /**
15 14
      * @param array $reflectionObject
16 15
      * @return static
Please login to merge, or discard this patch.
php-scoper/vendor/jetbrains/phpstorm-stubs/tests/Model/PHPConst.php 3 patches
Indentation   +107 added lines, -107 removed lines patch added patch discarded remove patch
@@ -15,117 +15,117 @@
 block discarded – undo
15 15
 
16 16
 class PHPConst extends BasePHPElement
17 17
 {
18
-    /**
19
-     * @var string|null
20
-     */
21
-    public $parentName;
22
-    /**
23
-     * @var bool|int|string|float|null
24
-     */
25
-    public $value;
26
-    /**
27
-     * @var string|null
28
-     */
29
-    public $visibility;
18
+	/**
19
+	 * @var string|null
20
+	 */
21
+	public $parentName;
22
+	/**
23
+	 * @var bool|int|string|float|null
24
+	 */
25
+	public $value;
26
+	/**
27
+	 * @var string|null
28
+	 */
29
+	public $visibility;
30 30
 
31
-    /**
32
-     * @param ReflectionClassConstant $reflectionObject
33
-     * @return static
34
-     */
35
-    public function readObjectFromReflection($reflectionObject)
36
-    {
37
-        $this->name = $reflectionObject->name;
38
-        $this->value = $reflectionObject->getValue();
39
-        if ($reflectionObject->isPrivate()) {
40
-            $this->visibility = 'private';
41
-        } elseif ($reflectionObject->isProtected()) {
42
-            $this->visibility = 'protected';
43
-        } else {
44
-            $this->visibility = 'public';
45
-        }
46
-        return $this;
47
-    }
31
+	/**
32
+	 * @param ReflectionClassConstant $reflectionObject
33
+	 * @return static
34
+	 */
35
+	public function readObjectFromReflection($reflectionObject)
36
+	{
37
+		$this->name = $reflectionObject->name;
38
+		$this->value = $reflectionObject->getValue();
39
+		if ($reflectionObject->isPrivate()) {
40
+			$this->visibility = 'private';
41
+		} elseif ($reflectionObject->isProtected()) {
42
+			$this->visibility = 'protected';
43
+		} else {
44
+			$this->visibility = 'public';
45
+		}
46
+		return $this;
47
+	}
48 48
 
49
-    /**
50
-     * @param Const_ $node
51
-     * @return static
52
-     */
53
-    public function readObjectFromStubNode($node)
54
-    {
55
-        $this->name = $this->getConstantFQN($node, $node->name->name);
56
-        $this->value = $this->getConstValue($node);
57
-        $this->collectTags($node);
58
-        $parentNode = $node->getAttribute('parent');
59
-        if (property_exists($parentNode, 'attrGroups')) {
60
-            $this->availableVersionsRangeFromAttribute = self::findAvailableVersionsRangeFromAttribute($parentNode->attrGroups);
61
-        }
62
-        if ($parentNode instanceof ClassConst) {
63
-            if ($parentNode->isPrivate()) {
64
-                $this->visibility = 'private';
65
-            } elseif ($parentNode->isProtected()) {
66
-                $this->visibility = 'protected';
67
-            } else {
68
-                $this->visibility = 'public';
69
-            }
70
-            $this->parentName = self::getFQN($parentNode->getAttribute('parent'));
71
-        }
72
-        return $this;
73
-    }
49
+	/**
50
+	 * @param Const_ $node
51
+	 * @return static
52
+	 */
53
+	public function readObjectFromStubNode($node)
54
+	{
55
+		$this->name = $this->getConstantFQN($node, $node->name->name);
56
+		$this->value = $this->getConstValue($node);
57
+		$this->collectTags($node);
58
+		$parentNode = $node->getAttribute('parent');
59
+		if (property_exists($parentNode, 'attrGroups')) {
60
+			$this->availableVersionsRangeFromAttribute = self::findAvailableVersionsRangeFromAttribute($parentNode->attrGroups);
61
+		}
62
+		if ($parentNode instanceof ClassConst) {
63
+			if ($parentNode->isPrivate()) {
64
+				$this->visibility = 'private';
65
+			} elseif ($parentNode->isProtected()) {
66
+				$this->visibility = 'protected';
67
+			} else {
68
+				$this->visibility = 'public';
69
+			}
70
+			$this->parentName = self::getFQN($parentNode->getAttribute('parent'));
71
+		}
72
+		return $this;
73
+	}
74 74
 
75
-    /**
76
-     * @param $node
77
-     * @return int|string|bool|float|null
78
-     */
79
-    protected function getConstValue($node)
80
-    {
81
-        if (in_array('value', $node->value->getSubNodeNames(), true)) {
82
-            return $node->value->value;
83
-        }
84
-        if (in_array('expr', $node->value->getSubNodeNames(), true)) {
85
-            if ($node->value instanceof UnaryMinus) {
86
-                return -$node->value->expr->value;
87
-            }
88
-            return $node->value->expr->value;
89
-        }
90
-        if (in_array('name', $node->value->getSubNodeNames(), true)) {
91
-            $value = $node->value->name->parts[0] ?? $node->value->name->name;
92
-            return $value === 'null' ? null : $value;
93
-        }
94
-        return null;
95
-    }
75
+	/**
76
+	 * @param $node
77
+	 * @return int|string|bool|float|null
78
+	 */
79
+	protected function getConstValue($node)
80
+	{
81
+		if (in_array('value', $node->value->getSubNodeNames(), true)) {
82
+			return $node->value->value;
83
+		}
84
+		if (in_array('expr', $node->value->getSubNodeNames(), true)) {
85
+			if ($node->value instanceof UnaryMinus) {
86
+				return -$node->value->expr->value;
87
+			}
88
+			return $node->value->expr->value;
89
+		}
90
+		if (in_array('name', $node->value->getSubNodeNames(), true)) {
91
+			$value = $node->value->name->parts[0] ?? $node->value->name->name;
92
+			return $value === 'null' ? null : $value;
93
+		}
94
+		return null;
95
+	}
96 96
 
97
-    protected function getConstantFQN(NodeAbstract $node, string $nodeName): string
98
-    {
99
-        $namespace = '';
100
-        $parentParentNode = $node->getAttribute('parent')->getAttribute('parent');
101
-        if ($parentParentNode instanceof Namespace_ && !empty($parentParentNode->name)) {
102
-            $namespace = '\\' . implode('\\', $parentParentNode->name->parts) . '\\';
103
-        }
97
+	protected function getConstantFQN(NodeAbstract $node, string $nodeName): string
98
+	{
99
+		$namespace = '';
100
+		$parentParentNode = $node->getAttribute('parent')->getAttribute('parent');
101
+		if ($parentParentNode instanceof Namespace_ && !empty($parentParentNode->name)) {
102
+			$namespace = '\\' . implode('\\', $parentParentNode->name->parts) . '\\';
103
+		}
104 104
 
105
-        return $namespace . $nodeName;
106
-    }
105
+		return $namespace . $nodeName;
106
+	}
107 107
 
108
-    /**
109
-     * @param stdClass|array $jsonData
110
-     * @throws Exception
111
-     */
112
-    public function readMutedProblems($jsonData): void
113
-    {
114
-        foreach ($jsonData as $constant) {
115
-            if ($constant->name === $this->name && !empty($constant->problems)) {
116
-                foreach ($constant->problems as $problem) {
117
-                    switch ($problem->description) {
118
-                        case 'wrong value':
119
-                            $this->mutedProblems[StubProblemType::WRONG_CONSTANT_VALUE] = $problem->versions;
120
-                            break;
121
-                        case 'missing constant':
122
-                            $this->mutedProblems[StubProblemType::STUB_IS_MISSED] = $problem->versions;
123
-                            break;
124
-                        default:
125
-                            throw new Exception("Unexpected value $problem->description");
126
-                    }
127
-                }
128
-            }
129
-        }
130
-    }
108
+	/**
109
+	 * @param stdClass|array $jsonData
110
+	 * @throws Exception
111
+	 */
112
+	public function readMutedProblems($jsonData): void
113
+	{
114
+		foreach ($jsonData as $constant) {
115
+			if ($constant->name === $this->name && !empty($constant->problems)) {
116
+				foreach ($constant->problems as $problem) {
117
+					switch ($problem->description) {
118
+						case 'wrong value':
119
+							$this->mutedProblems[StubProblemType::WRONG_CONSTANT_VALUE] = $problem->versions;
120
+							break;
121
+						case 'missing constant':
122
+							$this->mutedProblems[StubProblemType::STUB_IS_MISSED] = $problem->versions;
123
+							break;
124
+						default:
125
+							throw new Exception("Unexpected value $problem->description");
126
+					}
127
+				}
128
+			}
129
+		}
130
+	}
131 131
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -99,10 +99,10 @@
 block discarded – undo
99 99
         $namespace = '';
100 100
         $parentParentNode = $node->getAttribute('parent')->getAttribute('parent');
101 101
         if ($parentParentNode instanceof Namespace_ && !empty($parentParentNode->name)) {
102
-            $namespace = '\\' . implode('\\', $parentParentNode->name->parts) . '\\';
102
+            $namespace = '\\'.implode('\\', $parentParentNode->name->parts).'\\';
103 103
         }
104 104
 
105
-        return $namespace . $nodeName;
105
+        return $namespace.$nodeName;
106 106
     }
107 107
 
108 108
     /**
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,8 +13,7 @@
 block discarded – undo
13 13
 use stdClass;
14 14
 use function in_array;
15 15
 
16
-class PHPConst extends BasePHPElement
17
-{
16
+class PHPConst extends BasePHPElement {
18 17
     /**
19 18
      * @var string|null
20 19
      */
Please login to merge, or discard this patch.
php-scoper/vendor/jetbrains/phpstorm-stubs/tests/Model/StubProblemType.php 2 patches
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -5,31 +5,31 @@
 block discarded – undo
5 5
 
6 6
 interface StubProblemType
7 7
 {
8
-    public const STUB_IS_MISSED = 0;
9
-    public const FUNCTION_PARAMETER_MISMATCH = 1;
10
-    public const WRONG_PARENT = 2;
11
-    public const WRONG_CONSTANT_VALUE = 3;
12
-    public const FUNCTION_IS_DEPRECATED = 4;
13
-    public const WRONG_FINAL_MODIFIER = 5;
14
-    public const WRONG_STATIC_MODIFIER = 6;
15
-    public const FUNCTION_ACCESS = 7;
16
-    public const WRONG_INTERFACE = 8;
17
-    public const PARAMETER_TYPE_MISMATCH = 9;
18
-    public const PARAMETER_REFERENCE = 10;
19
-    public const PARAMETER_VARARG = 11;
20
-    public const ABSENT_IN_META = 12;
21
-    public const PROPERTY_IS_STATIC = 13;
22
-    public const PROPERTY_ACCESS = 14;
23
-    public const PROPERTY_TYPE = 15;
24
-    public const PARAMETER_HAS_SCALAR_TYPEHINT = 16;
25
-    public const FUNCTION_HAS_RETURN_TYPEHINT = 17;
26
-    public const PARAMETER_NAME_MISMATCH = 18;
27
-    public const HAS_NULLABLE_TYPEHINT = 19;
28
-    public const HAS_UNION_TYPEHINT = 20;
29
-    public const HAS_DUPLICATION = 21;
30
-    public const TYPE_IN_PHPDOC_DIFFERS_FROM_SIGNATURE = 22;
31
-    public const WRONG_PARAMETER_DEFAULT_VALUE = 23;
32
-    public const WRONG_RETURN_TYPEHINT = 24;
33
-    public const WRONG_OPTIONALLITY = 27;
34
-    public const PROPERTY_READONLY = 28;
8
+	public const STUB_IS_MISSED = 0;
9
+	public const FUNCTION_PARAMETER_MISMATCH = 1;
10
+	public const WRONG_PARENT = 2;
11
+	public const WRONG_CONSTANT_VALUE = 3;
12
+	public const FUNCTION_IS_DEPRECATED = 4;
13
+	public const WRONG_FINAL_MODIFIER = 5;
14
+	public const WRONG_STATIC_MODIFIER = 6;
15
+	public const FUNCTION_ACCESS = 7;
16
+	public const WRONG_INTERFACE = 8;
17
+	public const PARAMETER_TYPE_MISMATCH = 9;
18
+	public const PARAMETER_REFERENCE = 10;
19
+	public const PARAMETER_VARARG = 11;
20
+	public const ABSENT_IN_META = 12;
21
+	public const PROPERTY_IS_STATIC = 13;
22
+	public const PROPERTY_ACCESS = 14;
23
+	public const PROPERTY_TYPE = 15;
24
+	public const PARAMETER_HAS_SCALAR_TYPEHINT = 16;
25
+	public const FUNCTION_HAS_RETURN_TYPEHINT = 17;
26
+	public const PARAMETER_NAME_MISMATCH = 18;
27
+	public const HAS_NULLABLE_TYPEHINT = 19;
28
+	public const HAS_UNION_TYPEHINT = 20;
29
+	public const HAS_DUPLICATION = 21;
30
+	public const TYPE_IN_PHPDOC_DIFFERS_FROM_SIGNATURE = 22;
31
+	public const WRONG_PARAMETER_DEFAULT_VALUE = 23;
32
+	public const WRONG_RETURN_TYPEHINT = 24;
33
+	public const WRONG_OPTIONALLITY = 27;
34
+	public const PROPERTY_READONLY = 28;
35 35
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -3,8 +3,7 @@
 block discarded – undo
3 3
 
4 4
 namespace StubTests\Model;
5 5
 
6
-interface StubProblemType
7
-{
6
+interface StubProblemType {
8 7
     public const STUB_IS_MISSED = 0;
9 8
     public const FUNCTION_PARAMETER_MISMATCH = 1;
10 9
     public const WRONG_PARENT = 2;
Please login to merge, or discard this patch.
php-scoper/vendor/jetbrains/phpstorm-stubs/tests/Model/CommonUtils.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -8,8 +8,8 @@
 block discarded – undo
8 8
 
9 9
 class CommonUtils
10 10
 {
11
-    public static function flattenArray(array $array, bool $group): array
12
-    {
13
-        return iterator_to_array(new RecursiveIteratorIterator(new RecursiveArrayIterator($array)), $group);
14
-    }
11
+	public static function flattenArray(array $array, bool $group): array
12
+	{
13
+		return iterator_to_array(new RecursiveIteratorIterator(new RecursiveArrayIterator($array)), $group);
14
+	}
15 15
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,8 +6,7 @@
 block discarded – undo
6 6
 use RecursiveArrayIterator;
7 7
 use RecursiveIteratorIterator;
8 8
 
9
-class CommonUtils
10
-{
9
+class CommonUtils {
11 10
     public static function flattenArray(array $array, bool $group): array
12 11
     {
13 12
         return iterator_to_array(new RecursiveIteratorIterator(new RecursiveArrayIterator($array)), $group);
Please login to merge, or discard this patch.
php-scoper/vendor/jetbrains/phpstorm-stubs/tests/Model/PHPFunction.php 3 patches
Indentation   +161 added lines, -161 removed lines patch added patch discarded remove patch
@@ -19,177 +19,177 @@
 block discarded – undo
19 19
 
20 20
 class PHPFunction extends BasePHPElement
21 21
 {
22
-    /**
23
-     * @var bool
24
-     */
25
-    public $is_deprecated;
26
-    /**
27
-     * @var PHPParameter[]
28
-     */
29
-    public $parameters = [];
22
+	/**
23
+	 * @var bool
24
+	 */
25
+	public $is_deprecated;
26
+	/**
27
+	 * @var PHPParameter[]
28
+	 */
29
+	public $parameters = [];
30 30
 
31
-    /** @var string[] */
32
-    public $returnTypesFromPhpDoc = [];
31
+	/** @var string[] */
32
+	public $returnTypesFromPhpDoc = [];
33 33
 
34
-    /** @var string[][] */
35
-    public $returnTypesFromAttribute = [];
34
+	/** @var string[][] */
35
+	public $returnTypesFromAttribute = [];
36 36
 
37
-    /** @var string[] */
38
-    public $returnTypesFromSignature = [];
37
+	/** @var string[] */
38
+	public $returnTypesFromSignature = [];
39 39
 
40
-    /**
41
-     * @param ReflectionFunction|ReflectionFunctionAbstract $reflectionObject
42
-     * @return static
43
-     */
44
-    public function readObjectFromReflection($reflectionObject)
45
-    {
46
-        $this->name = $reflectionObject->name;
47
-        $this->is_deprecated = $reflectionObject->isDeprecated();
48
-        foreach ($reflectionObject->getParameters() as $parameter) {
49
-            $this->parameters[] = (new PHPParameter())->readObjectFromReflection($parameter);
50
-        }
51
-        $returnTypes = self::getReflectionTypeAsArray($reflectionObject->getReturnType());
52
-        if (!empty($returnTypes)) {
53
-            array_push($this->returnTypesFromSignature, ...$returnTypes);
54
-        }
55
-        return $this;
56
-    }
40
+	/**
41
+	 * @param ReflectionFunction|ReflectionFunctionAbstract $reflectionObject
42
+	 * @return static
43
+	 */
44
+	public function readObjectFromReflection($reflectionObject)
45
+	{
46
+		$this->name = $reflectionObject->name;
47
+		$this->is_deprecated = $reflectionObject->isDeprecated();
48
+		foreach ($reflectionObject->getParameters() as $parameter) {
49
+			$this->parameters[] = (new PHPParameter())->readObjectFromReflection($parameter);
50
+		}
51
+		$returnTypes = self::getReflectionTypeAsArray($reflectionObject->getReturnType());
52
+		if (!empty($returnTypes)) {
53
+			array_push($this->returnTypesFromSignature, ...$returnTypes);
54
+		}
55
+		return $this;
56
+	}
57 57
 
58
-    /**
59
-     * @param Function_ $node
60
-     * @return static
61
-     * @throws RuntimeException
62
-     */
63
-    public function readObjectFromStubNode($node)
64
-    {
65
-        $functionName = self::getFQN($node);
66
-        $this->name = $functionName;
67
-        $typesFromAttribute = self::findTypesFromAttribute($node->attrGroups);
68
-        $this->availableVersionsRangeFromAttribute = self::findAvailableVersionsRangeFromAttribute($node->attrGroups);
69
-        $this->returnTypesFromAttribute = $typesFromAttribute;
70
-        array_push($this->returnTypesFromSignature, ...self::convertParsedTypeToArray($node->getReturnType()));
71
-        $index = 0;
72
-        foreach ($node->getParams() as $parameter) {
73
-            $parsedParameter = (new PHPParameter())->readObjectFromStubNode($parameter);
74
-            if (self::entitySuitsCurrentPhpVersion($parsedParameter)) {
75
-                $parsedParameter->indexInSignature = $index;
76
-                $this->parameters[] = $parsedParameter;
77
-                $index++;
78
-            }
79
-        }
58
+	/**
59
+	 * @param Function_ $node
60
+	 * @return static
61
+	 * @throws RuntimeException
62
+	 */
63
+	public function readObjectFromStubNode($node)
64
+	{
65
+		$functionName = self::getFQN($node);
66
+		$this->name = $functionName;
67
+		$typesFromAttribute = self::findTypesFromAttribute($node->attrGroups);
68
+		$this->availableVersionsRangeFromAttribute = self::findAvailableVersionsRangeFromAttribute($node->attrGroups);
69
+		$this->returnTypesFromAttribute = $typesFromAttribute;
70
+		array_push($this->returnTypesFromSignature, ...self::convertParsedTypeToArray($node->getReturnType()));
71
+		$index = 0;
72
+		foreach ($node->getParams() as $parameter) {
73
+			$parsedParameter = (new PHPParameter())->readObjectFromStubNode($parameter);
74
+			if (self::entitySuitsCurrentPhpVersion($parsedParameter)) {
75
+				$parsedParameter->indexInSignature = $index;
76
+				$this->parameters[] = $parsedParameter;
77
+				$index++;
78
+			}
79
+		}
80 80
 
81
-        $this->collectTags($node);
82
-        foreach ($this->parameters as $parameter) {
83
-            $relatedParamTags = array_filter($this->paramTags, function (Param $tag) use ($parameter) {
84
-                return $tag->getVariableName() === $parameter->name;
85
-            });
86
-            /** @var Param $relatedParamTag */
87
-            $relatedParamTag = array_pop($relatedParamTags);
88
-            if ($relatedParamTag !== null) {
89
-                $parameter->isOptional = $parameter->isOptional || str_contains((string)$relatedParamTag->getDescription(), '[optional]');
90
-            }
91
-        }
81
+		$this->collectTags($node);
82
+		foreach ($this->parameters as $parameter) {
83
+			$relatedParamTags = array_filter($this->paramTags, function (Param $tag) use ($parameter) {
84
+				return $tag->getVariableName() === $parameter->name;
85
+			});
86
+			/** @var Param $relatedParamTag */
87
+			$relatedParamTag = array_pop($relatedParamTags);
88
+			if ($relatedParamTag !== null) {
89
+				$parameter->isOptional = $parameter->isOptional || str_contains((string)$relatedParamTag->getDescription(), '[optional]');
90
+			}
91
+		}
92 92
 
93
-        $this->checkDeprecationTag($node);
94
-        $this->checkReturnTag($node);
95
-        return $this;
96
-    }
93
+		$this->checkDeprecationTag($node);
94
+		$this->checkReturnTag($node);
95
+		return $this;
96
+	}
97 97
 
98
-    protected function checkDeprecationTag(FunctionLike $node): void
99
-    {
100
-        try {
101
-            $this->is_deprecated = self::hasDeprecatedAttribute($node) || self::hasDeprecatedDocTag($node->getDocComment());
102
-        } catch (Exception $e) {
103
-            $this->parseError = $e;
104
-        }
105
-    }
98
+	protected function checkDeprecationTag(FunctionLike $node): void
99
+	{
100
+		try {
101
+			$this->is_deprecated = self::hasDeprecatedAttribute($node) || self::hasDeprecatedDocTag($node->getDocComment());
102
+		} catch (Exception $e) {
103
+			$this->parseError = $e;
104
+		}
105
+	}
106 106
 
107
-    protected function checkReturnTag(FunctionLike $node): void
108
-    {
109
-        if ($node->getDocComment() !== null) {
110
-            try {
111
-                $phpDoc = DocFactoryProvider::getDocFactory()->create($node->getDocComment()->getText());
112
-                $parsedReturnTag = $phpDoc->getTagsByName('return');
113
-                if (!empty($parsedReturnTag) && $parsedReturnTag[0] instanceof Return_) {
114
-                    $returnType = $parsedReturnTag[0]->getType();
115
-                    if ($returnType instanceof Compound) {
116
-                        foreach ($returnType as $nextType) {
117
-                            $this->returnTypesFromPhpDoc[] = (string)$nextType;
118
-                        }
119
-                    } else {
120
-                        $this->returnTypesFromPhpDoc[] = (string)$returnType;
121
-                    }
122
-                }
123
-            } catch (Exception $e) {
124
-                $this->parseError = $e;
125
-            }
126
-        }
127
-    }
107
+	protected function checkReturnTag(FunctionLike $node): void
108
+	{
109
+		if ($node->getDocComment() !== null) {
110
+			try {
111
+				$phpDoc = DocFactoryProvider::getDocFactory()->create($node->getDocComment()->getText());
112
+				$parsedReturnTag = $phpDoc->getTagsByName('return');
113
+				if (!empty($parsedReturnTag) && $parsedReturnTag[0] instanceof Return_) {
114
+					$returnType = $parsedReturnTag[0]->getType();
115
+					if ($returnType instanceof Compound) {
116
+						foreach ($returnType as $nextType) {
117
+							$this->returnTypesFromPhpDoc[] = (string)$nextType;
118
+						}
119
+					} else {
120
+						$this->returnTypesFromPhpDoc[] = (string)$returnType;
121
+					}
122
+				}
123
+			} catch (Exception $e) {
124
+				$this->parseError = $e;
125
+			}
126
+		}
127
+	}
128 128
 
129
-    /**
130
-     * @param stdClass|array $jsonData
131
-     * @throws Exception
132
-     */
133
-    public function readMutedProblems($jsonData): void
134
-    {
135
-        foreach ($jsonData as $function) {
136
-            if ($function->name === $this->name) {
137
-                if (!empty($function->problems)) {
138
-                    foreach ($function->problems as $problem) {
139
-                        switch ($problem->description) {
140
-                            case 'parameter mismatch':
141
-                                $this->mutedProblems[StubProblemType::FUNCTION_PARAMETER_MISMATCH] = $problem->versions;
142
-                                break;
143
-                            case 'missing function':
144
-                                $this->mutedProblems[StubProblemType::STUB_IS_MISSED] = $problem->versions;
145
-                                break;
146
-                            case 'deprecated function':
147
-                                $this->mutedProblems[StubProblemType::FUNCTION_IS_DEPRECATED] = $problem->versions;
148
-                                break;
149
-                            case 'absent in meta':
150
-                                $this->mutedProblems[StubProblemType::ABSENT_IN_META] = $problem->versions;
151
-                                break;
152
-                            case 'has return typehint':
153
-                                $this->mutedProblems[StubProblemType::FUNCTION_HAS_RETURN_TYPEHINT] = $problem->versions;
154
-                                break;
155
-                            case 'wrong return typehint':
156
-                                $this->mutedProblems[StubProblemType::WRONG_RETURN_TYPEHINT] = $problem->versions;
157
-                                break;
158
-                            case 'has duplicate in stubs':
159
-                                $this->mutedProblems[StubProblemType::HAS_DUPLICATION] = $problem->versions;
160
-                                break;
161
-                            case 'has type mismatch in signature and phpdoc':
162
-                                $this->mutedProblems[StubProblemType::TYPE_IN_PHPDOC_DIFFERS_FROM_SIGNATURE] = $problem->versions;
163
-                                break;
164
-                            default:
165
-                                throw new Exception("Unexpected value $problem->description");
166
-                        }
167
-                    }
168
-                }
169
-                if (!empty($function->parameters)) {
170
-                    foreach ($this->parameters as $parameter) {
171
-                        $parameter->readMutedProblems($function->parameters);
172
-                    }
173
-                }
174
-            }
175
-        }
176
-    }
129
+	/**
130
+	 * @param stdClass|array $jsonData
131
+	 * @throws Exception
132
+	 */
133
+	public function readMutedProblems($jsonData): void
134
+	{
135
+		foreach ($jsonData as $function) {
136
+			if ($function->name === $this->name) {
137
+				if (!empty($function->problems)) {
138
+					foreach ($function->problems as $problem) {
139
+						switch ($problem->description) {
140
+							case 'parameter mismatch':
141
+								$this->mutedProblems[StubProblemType::FUNCTION_PARAMETER_MISMATCH] = $problem->versions;
142
+								break;
143
+							case 'missing function':
144
+								$this->mutedProblems[StubProblemType::STUB_IS_MISSED] = $problem->versions;
145
+								break;
146
+							case 'deprecated function':
147
+								$this->mutedProblems[StubProblemType::FUNCTION_IS_DEPRECATED] = $problem->versions;
148
+								break;
149
+							case 'absent in meta':
150
+								$this->mutedProblems[StubProblemType::ABSENT_IN_META] = $problem->versions;
151
+								break;
152
+							case 'has return typehint':
153
+								$this->mutedProblems[StubProblemType::FUNCTION_HAS_RETURN_TYPEHINT] = $problem->versions;
154
+								break;
155
+							case 'wrong return typehint':
156
+								$this->mutedProblems[StubProblemType::WRONG_RETURN_TYPEHINT] = $problem->versions;
157
+								break;
158
+							case 'has duplicate in stubs':
159
+								$this->mutedProblems[StubProblemType::HAS_DUPLICATION] = $problem->versions;
160
+								break;
161
+							case 'has type mismatch in signature and phpdoc':
162
+								$this->mutedProblems[StubProblemType::TYPE_IN_PHPDOC_DIFFERS_FROM_SIGNATURE] = $problem->versions;
163
+								break;
164
+							default:
165
+								throw new Exception("Unexpected value $problem->description");
166
+						}
167
+					}
168
+				}
169
+				if (!empty($function->parameters)) {
170
+					foreach ($this->parameters as $parameter) {
171
+						$parameter->readMutedProblems($function->parameters);
172
+					}
173
+				}
174
+			}
175
+		}
176
+	}
177 177
 
178
-    private static function hasDeprecatedAttribute(FunctionLike $node): bool
179
-    {
180
-        foreach ($node->getAttrGroups() as $group) {
181
-            foreach ($group->attrs as $attr) {
182
-                if ((string)$attr->name === Deprecated::class) {
183
-                    return true;
184
-                }
185
-            }
186
-        }
187
-        return false;
188
-    }
178
+	private static function hasDeprecatedAttribute(FunctionLike $node): bool
179
+	{
180
+		foreach ($node->getAttrGroups() as $group) {
181
+			foreach ($group->attrs as $attr) {
182
+				if ((string)$attr->name === Deprecated::class) {
183
+					return true;
184
+				}
185
+			}
186
+		}
187
+		return false;
188
+	}
189 189
 
190
-    private static function hasDeprecatedDocTag(?Doc $docComment): bool
191
-    {
192
-        $phpDoc = $docComment !== null ? DocFactoryProvider::getDocFactory()->create($docComment->getText()) : null;
193
-        return $phpDoc !== null && !empty($phpDoc->getTagsByName('deprecated'));
194
-    }
190
+	private static function hasDeprecatedDocTag(?Doc $docComment): bool
191
+	{
192
+		$phpDoc = $docComment !== null ? DocFactoryProvider::getDocFactory()->create($docComment->getText()) : null;
193
+		return $phpDoc !== null && !empty($phpDoc->getTagsByName('deprecated'));
194
+	}
195 195
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@
 block discarded – undo
80 80
 
81 81
         $this->collectTags($node);
82 82
         foreach ($this->parameters as $parameter) {
83
-            $relatedParamTags = array_filter($this->paramTags, function (Param $tag) use ($parameter) {
83
+            $relatedParamTags = array_filter($this->paramTags, function(Param $tag) use ($parameter) {
84 84
                 return $tag->getVariableName() === $parameter->name;
85 85
             });
86 86
             /** @var Param $relatedParamTag */
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,8 +17,7 @@
 block discarded – undo
17 17
 use stdClass;
18 18
 use StubTests\Parsers\DocFactoryProvider;
19 19
 
20
-class PHPFunction extends BasePHPElement
21
-{
20
+class PHPFunction extends BasePHPElement {
22 21
     /**
23 22
      * @var bool
24 23
      */
Please login to merge, or discard this patch.
php-scoper/vendor/jetbrains/phpstorm-stubs/tests/StubsPhpDocTest.php 3 patches
Indentation   +191 added lines, -191 removed lines patch added patch discarded remove patch
@@ -21,213 +21,213 @@
 block discarded – undo
21 21
 
22 22
 class StubsPhpDocTest extends BaseStubsTest
23 23
 {
24
-    /**
25
-     * @dataProvider \StubTests\TestData\Providers\Stubs\StubConstantsProvider::classConstantProvider
26
-     * @throws Exception
27
-     */
28
-    public static function testClassConstantsPHPDocs(BasePHPClass $class, PHPConst $constant): void
29
-    {
30
-        self::assertNull($constant->parseError, $constant->parseError ?: '');
31
-        self::checkPHPDocCorrectness($constant, "constant $class->sourceFilePath/$class->name::$constant->name");
32
-    }
24
+	/**
25
+	 * @dataProvider \StubTests\TestData\Providers\Stubs\StubConstantsProvider::classConstantProvider
26
+	 * @throws Exception
27
+	 */
28
+	public static function testClassConstantsPHPDocs(BasePHPClass $class, PHPConst $constant): void
29
+	{
30
+		self::assertNull($constant->parseError, $constant->parseError ?: '');
31
+		self::checkPHPDocCorrectness($constant, "constant $class->sourceFilePath/$class->name::$constant->name");
32
+	}
33 33
 
34
-    /**
35
-     * @dataProvider \StubTests\TestData\Providers\Stubs\StubConstantsProvider::globalConstantProvider
36
-     * @throws Exception
37
-     */
38
-    public static function testConstantsPHPDocs(PHPConst $constant): void
39
-    {
40
-        self::assertNull($constant->parseError, $constant->parseError ?: '');
41
-        self::checkPHPDocCorrectness($constant, "constant $constant->name");
42
-    }
34
+	/**
35
+	 * @dataProvider \StubTests\TestData\Providers\Stubs\StubConstantsProvider::globalConstantProvider
36
+	 * @throws Exception
37
+	 */
38
+	public static function testConstantsPHPDocs(PHPConst $constant): void
39
+	{
40
+		self::assertNull($constant->parseError, $constant->parseError ?: '');
41
+		self::checkPHPDocCorrectness($constant, "constant $constant->name");
42
+	}
43 43
 
44
-    /**
45
-     * @dataProvider \StubTests\TestData\Providers\Stubs\StubsTestDataProviders::allFunctionsProvider
46
-     * @throws Exception
47
-     */
48
-    public static function testFunctionPHPDocs(PHPFunction $function): void
49
-    {
50
-        self::assertNull($function->parseError, $function->parseError ?: '');
51
-        self::checkPHPDocCorrectness($function, "function $function->name");
52
-    }
44
+	/**
45
+	 * @dataProvider \StubTests\TestData\Providers\Stubs\StubsTestDataProviders::allFunctionsProvider
46
+	 * @throws Exception
47
+	 */
48
+	public static function testFunctionPHPDocs(PHPFunction $function): void
49
+	{
50
+		self::assertNull($function->parseError, $function->parseError ?: '');
51
+		self::checkPHPDocCorrectness($function, "function $function->name");
52
+	}
53 53
 
54
-    /**
55
-     * @dataProvider \StubTests\TestData\Providers\Stubs\StubsTestDataProviders::allClassesProvider
56
-     * @throws Exception
57
-     */
58
-    public static function testClassesPHPDocs(BasePHPClass $class): void
59
-    {
60
-        self::assertNull($class->parseError, $class->parseError ?: '');
61
-        self::checkPHPDocCorrectness($class, "class $class->name");
62
-    }
54
+	/**
55
+	 * @dataProvider \StubTests\TestData\Providers\Stubs\StubsTestDataProviders::allClassesProvider
56
+	 * @throws Exception
57
+	 */
58
+	public static function testClassesPHPDocs(BasePHPClass $class): void
59
+	{
60
+		self::assertNull($class->parseError, $class->parseError ?: '');
61
+		self::checkPHPDocCorrectness($class, "class $class->name");
62
+	}
63 63
 
64
-    /**
65
-     * @dataProvider \StubTests\TestData\Providers\Stubs\StubMethodsProvider::allMethodsProvider
66
-     * @throws Exception
67
-     */
68
-    public static function testMethodsPHPDocs(PHPMethod $method): void
69
-    {
70
-        if ($method->name === '__construct') {
71
-            self::assertEmpty($method->returnTypesFromPhpDoc, '@return tag for __construct should be omitted');
72
-        }
73
-        self::assertNull($method->parseError, $method->parseError ?: '');
74
-        self::checkPHPDocCorrectness($method, "method $method->name");
75
-    }
64
+	/**
65
+	 * @dataProvider \StubTests\TestData\Providers\Stubs\StubMethodsProvider::allMethodsProvider
66
+	 * @throws Exception
67
+	 */
68
+	public static function testMethodsPHPDocs(PHPMethod $method): void
69
+	{
70
+		if ($method->name === '__construct') {
71
+			self::assertEmpty($method->returnTypesFromPhpDoc, '@return tag for __construct should be omitted');
72
+		}
73
+		self::assertNull($method->parseError, $method->parseError ?: '');
74
+		self::checkPHPDocCorrectness($method, "method $method->name");
75
+	}
76 76
 
77
-    //TODO IF: Add test to check that core stubs don't have psalm, phpstan etc typehints in phpdoc
78
-    //TODO IF: Add test to check that phpdocs contain only resource, object etc typehints or if contains type like Resource then Resource should be declared in stubs
77
+	//TODO IF: Add test to check that core stubs don't have psalm, phpstan etc typehints in phpdoc
78
+	//TODO IF: Add test to check that phpdocs contain only resource, object etc typehints or if contains type like Resource then Resource should be declared in stubs
79 79
 
80
-    private static function checkDeprecatedRemovedSinceVersionsMajor(BasePHPElement $element, string $elementName): void
81
-    {
82
-        /** @var PHPDocElement $element */
83
-        foreach ($element->sinceTags as $sinceTag) {
84
-            if ($sinceTag instanceof Since) {
85
-                $version = $sinceTag->getVersion();
86
-                if ($version !== null) {
87
-                    self::assertTrue(ParserUtils::tagDoesNotHaveZeroPatchVersion($sinceTag), "$elementName has 
80
+	private static function checkDeprecatedRemovedSinceVersionsMajor(BasePHPElement $element, string $elementName): void
81
+	{
82
+		/** @var PHPDocElement $element */
83
+		foreach ($element->sinceTags as $sinceTag) {
84
+			if ($sinceTag instanceof Since) {
85
+				$version = $sinceTag->getVersion();
86
+				if ($version !== null) {
87
+					self::assertTrue(ParserUtils::tagDoesNotHaveZeroPatchVersion($sinceTag), "$elementName has 
88 88
                     'since' version $version.'Since' version for PHP Core functionality for style consistency 
89 89
                     should have X.X format for the case when patch version is '0'.");
90
-                }
91
-            }
92
-        }
93
-        foreach ($element->deprecatedTags as $deprecatedTag) {
94
-            if ($deprecatedTag instanceof Deprecated) {
95
-                $version = $deprecatedTag->getVersion();
96
-                if ($version !== null) {
97
-                    self::assertTrue(ParserUtils::tagDoesNotHaveZeroPatchVersion($deprecatedTag), "$elementName has 
90
+				}
91
+			}
92
+		}
93
+		foreach ($element->deprecatedTags as $deprecatedTag) {
94
+			if ($deprecatedTag instanceof Deprecated) {
95
+				$version = $deprecatedTag->getVersion();
96
+				if ($version !== null) {
97
+					self::assertTrue(ParserUtils::tagDoesNotHaveZeroPatchVersion($deprecatedTag), "$elementName has 
98 98
                     'deprecated' version $version.'Deprecated' version for PHP Core functionality for style consistency 
99 99
                     should have X.X format for the case when patch version is '0'.");
100
-                }
101
-            }
102
-        }
103
-        foreach ($element->removedTags as $removedTag) {
104
-            if ($removedTag instanceof RemovedTag) {
105
-                $version = $removedTag->getVersion();
106
-                if ($version !== null) {
107
-                    self::assertTrue(ParserUtils::tagDoesNotHaveZeroPatchVersion($removedTag), "$elementName has 
100
+				}
101
+			}
102
+		}
103
+		foreach ($element->removedTags as $removedTag) {
104
+			if ($removedTag instanceof RemovedTag) {
105
+				$version = $removedTag->getVersion();
106
+				if ($version !== null) {
107
+					self::assertTrue(ParserUtils::tagDoesNotHaveZeroPatchVersion($removedTag), "$elementName has 
108 108
                     'removed' version $version.'Removed' version for PHP Core functionality for style consistency 
109 109
                     should have X.X format for the case when patch version is '0'.");
110
-                }
111
-            }
112
-        }
113
-    }
110
+				}
111
+			}
112
+		}
113
+	}
114 114
 
115
-    private static function checkHtmlTags(BasePHPElement $element, string $elementName): void
116
-    {
117
-        /** @var PHPDocElement $element */
118
-        $phpdoc = trim($element->phpdoc);
115
+	private static function checkHtmlTags(BasePHPElement $element, string $elementName): void
116
+	{
117
+		/** @var PHPDocElement $element */
118
+		$phpdoc = trim($element->phpdoc);
119 119
 
120
-        $phpdoc = preg_replace(
121
-            [
122
-                '#<br\s*/>#',
123
-                '#<br>#i',
124
-                '#->#',
125
-                '#=>#',
126
-                '#"->"#',
127
-                '# >= #',
128
-                '#\(>=#',
129
-                '#\'>\'#',
130
-                '# > #',
131
-                '#\?>#',
132
-                '#`<.*>`#U',
133
-                '#`.*<.*>`#U',
134
-                '#<pre>.*</pre>#sU',
135
-                '#<code>.*</code>#sU',
136
-                '#@author.*<.*>#U',
137
-                '#[\s,\|]array<[a-z,\s]+>#sU',
138
-                '#\s[A-Za-z]+<[A-Za-z,\s]+>[$\s]#sU'
139
-            ],
140
-            '',
141
-            $phpdoc
142
-        );
120
+		$phpdoc = preg_replace(
121
+			[
122
+				'#<br\s*/>#',
123
+				'#<br>#i',
124
+				'#->#',
125
+				'#=>#',
126
+				'#"->"#',
127
+				'# >= #',
128
+				'#\(>=#',
129
+				'#\'>\'#',
130
+				'# > #',
131
+				'#\?>#',
132
+				'#`<.*>`#U',
133
+				'#`.*<.*>`#U',
134
+				'#<pre>.*</pre>#sU',
135
+				'#<code>.*</code>#sU',
136
+				'#@author.*<.*>#U',
137
+				'#[\s,\|]array<[a-z,\s]+>#sU',
138
+				'#\s[A-Za-z]+<[A-Za-z,\s]+>[$\s]#sU'
139
+			],
140
+			'',
141
+			$phpdoc
142
+		);
143 143
 
144
-        $countTags = substr_count($phpdoc, '>');
145
-        self::assertSame(
146
-            0,
147
-            $countTags % 2,
148
-            "In $elementName phpdoc has a html error and the phpdoc maybe not displayed correctly in PhpStorm: " . print_r($phpdoc, true)
149
-        );
150
-    }
144
+		$countTags = substr_count($phpdoc, '>');
145
+		self::assertSame(
146
+			0,
147
+			$countTags % 2,
148
+			"In $elementName phpdoc has a html error and the phpdoc maybe not displayed correctly in PhpStorm: " . print_r($phpdoc, true)
149
+		);
150
+	}
151 151
 
152
-    private static function checkLinks(BasePHPElement $element, string $elementName): void
153
-    {
154
-        /** @var PHPDocElement $element */
155
-        foreach ($element->links as $link) {
156
-            if ($link instanceof Link) {
157
-                self::assertStringStartsWith(
158
-                    'https',
159
-                    $link->getLink(),
160
-                    "In $elementName @link doesn't start with https"
161
-                );
162
-                if (getenv('CHECK_LINKS') === 'true') {
163
-                    if ($element->stubBelongsToCore) {
164
-                        $request = curl_init($link->getLink());
165
-                        curl_setopt($request, CURLOPT_RETURNTRANSFER, 1);
166
-                        curl_exec($request);
167
-                        $response = curl_getinfo($request, CURLINFO_RESPONSE_CODE);
168
-                        curl_close($request);
169
-                        self::assertTrue($response < 400);
170
-                    }
171
-                }
172
-            }
173
-        }
174
-        foreach ($element->see as $see) {
175
-            if ($see instanceof See && $see->getReference() instanceof Url) {
176
-                $uri = (string)$see->getReference();
177
-                self::assertStringStartsWith('https', $uri, "In $elementName @see doesn't start with https");
178
-            }
179
-        }
180
-    }
152
+	private static function checkLinks(BasePHPElement $element, string $elementName): void
153
+	{
154
+		/** @var PHPDocElement $element */
155
+		foreach ($element->links as $link) {
156
+			if ($link instanceof Link) {
157
+				self::assertStringStartsWith(
158
+					'https',
159
+					$link->getLink(),
160
+					"In $elementName @link doesn't start with https"
161
+				);
162
+				if (getenv('CHECK_LINKS') === 'true') {
163
+					if ($element->stubBelongsToCore) {
164
+						$request = curl_init($link->getLink());
165
+						curl_setopt($request, CURLOPT_RETURNTRANSFER, 1);
166
+						curl_exec($request);
167
+						$response = curl_getinfo($request, CURLINFO_RESPONSE_CODE);
168
+						curl_close($request);
169
+						self::assertTrue($response < 400);
170
+					}
171
+				}
172
+			}
173
+		}
174
+		foreach ($element->see as $see) {
175
+			if ($see instanceof See && $see->getReference() instanceof Url) {
176
+				$uri = (string)$see->getReference();
177
+				self::assertStringStartsWith('https', $uri, "In $elementName @see doesn't start with https");
178
+			}
179
+		}
180
+	}
181 181
 
182
-    /**
183
-     * @throws Exception
184
-     */
185
-    private static function checkContainsOnlyValidTags(BasePHPElement $element, string $elementName): void
186
-    {
187
-        $VALID_TAGS = [
188
-            'author',
189
-            'copyright',
190
-            'deprecated',
191
-            'example', //temporary addition due to the number of existing cases
192
-            'inheritdoc',
193
-            'inheritDoc',
194
-            'internal',
195
-            'link',
196
-            'meta',
197
-            'method',
198
-            'mixin',
199
-            'package',
200
-            'param',
201
-            'property',
202
-            'property-read',
203
-            'removed',
204
-            'return',
205
-            'see',
206
-            'since',
207
-            'throws',
208
-            'template',
209
-            'template-implements', // https://github.com/JetBrains/phpstorm-stubs/pull/1212#issuecomment-907263735
210
-            'template-extends',
211
-            'uses',
212
-            'var',
213
-            'version',
214
-        ];
215
-        /** @var PHPDocElement $element */
216
-        foreach ($element->tagNames as $tagName) {
217
-            self::assertContains($tagName, $VALID_TAGS, "Element $elementName has invalid tag: @$tagName");
218
-        }
219
-    }
182
+	/**
183
+	 * @throws Exception
184
+	 */
185
+	private static function checkContainsOnlyValidTags(BasePHPElement $element, string $elementName): void
186
+	{
187
+		$VALID_TAGS = [
188
+			'author',
189
+			'copyright',
190
+			'deprecated',
191
+			'example', //temporary addition due to the number of existing cases
192
+			'inheritdoc',
193
+			'inheritDoc',
194
+			'internal',
195
+			'link',
196
+			'meta',
197
+			'method',
198
+			'mixin',
199
+			'package',
200
+			'param',
201
+			'property',
202
+			'property-read',
203
+			'removed',
204
+			'return',
205
+			'see',
206
+			'since',
207
+			'throws',
208
+			'template',
209
+			'template-implements', // https://github.com/JetBrains/phpstorm-stubs/pull/1212#issuecomment-907263735
210
+			'template-extends',
211
+			'uses',
212
+			'var',
213
+			'version',
214
+		];
215
+		/** @var PHPDocElement $element */
216
+		foreach ($element->tagNames as $tagName) {
217
+			self::assertContains($tagName, $VALID_TAGS, "Element $elementName has invalid tag: @$tagName");
218
+		}
219
+	}
220 220
 
221
-    /**
222
-     * @throws Exception
223
-     */
224
-    private static function checkPHPDocCorrectness(BasePHPElement $element, string $elementName): void
225
-    {
226
-        self::checkLinks($element, $elementName);
227
-        self::checkHtmlTags($element, $elementName);
228
-        if ($element->stubBelongsToCore) {
229
-            self::checkDeprecatedRemovedSinceVersionsMajor($element, $elementName);
230
-        }
231
-        self::checkContainsOnlyValidTags($element, $elementName);
232
-    }
221
+	/**
222
+	 * @throws Exception
223
+	 */
224
+	private static function checkPHPDocCorrectness(BasePHPElement $element, string $elementName): void
225
+	{
226
+		self::checkLinks($element, $elementName);
227
+		self::checkHtmlTags($element, $elementName);
228
+		if ($element->stubBelongsToCore) {
229
+			self::checkDeprecatedRemovedSinceVersionsMajor($element, $elementName);
230
+		}
231
+		self::checkContainsOnlyValidTags($element, $elementName);
232
+	}
233 233
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -145,7 +145,7 @@
 block discarded – undo
145 145
         self::assertSame(
146 146
             0,
147 147
             $countTags % 2,
148
-            "In $elementName phpdoc has a html error and the phpdoc maybe not displayed correctly in PhpStorm: " . print_r($phpdoc, true)
148
+            "In $elementName phpdoc has a html error and the phpdoc maybe not displayed correctly in PhpStorm: ".print_r($phpdoc, true)
149 149
         );
150 150
     }
151 151
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,8 +19,7 @@
 block discarded – undo
19 19
 use StubTests\Parsers\ParserUtils;
20 20
 use function trim;
21 21
 
22
-class StubsPhpDocTest extends BaseStubsTest
23
-{
22
+class StubsPhpDocTest extends BaseStubsTest {
24 23
     /**
25 24
      * @dataProvider \StubTests\TestData\Providers\Stubs\StubConstantsProvider::classConstantProvider
26 25
      * @throws Exception
Please login to merge, or discard this patch.
php-scoper/vendor/jetbrains/phpstorm-stubs/session/SessionHandler.php 3 patches
Indentation   +242 added lines, -242 removed lines patch added patch discarded remove patch
@@ -14,101 +14,101 @@  discard block
 block discarded – undo
14 14
  */
15 15
 interface SessionHandlerInterface
16 16
 {
17
-    /**
18
-     * Close the session
19
-     * @link https://php.net/manual/en/sessionhandlerinterface.close.php
20
-     * @return bool <p>
21
-     * The return value (usually TRUE on success, FALSE on failure).
22
-     * Note this value is returned internally to PHP for processing.
23
-     * </p>
24
-     * @since 5.4
25
-     */
26
-    #[TentativeType]
27
-    public function close(): bool;
17
+	/**
18
+	 * Close the session
19
+	 * @link https://php.net/manual/en/sessionhandlerinterface.close.php
20
+	 * @return bool <p>
21
+	 * The return value (usually TRUE on success, FALSE on failure).
22
+	 * Note this value is returned internally to PHP for processing.
23
+	 * </p>
24
+	 * @since 5.4
25
+	 */
26
+	#[TentativeType]
27
+	public function close(): bool;
28 28
 
29
-    /**
30
-     * Destroy a session
31
-     * @link https://php.net/manual/en/sessionhandlerinterface.destroy.php
32
-     * @param string $id The session ID being destroyed.
33
-     * @return bool <p>
34
-     * The return value (usually TRUE on success, FALSE on failure).
35
-     * Note this value is returned internally to PHP for processing.
36
-     * </p>
37
-     * @since 5.4
38
-     */
39
-    #[TentativeType]
40
-    public function destroy(#[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $id): bool;
29
+	/**
30
+	 * Destroy a session
31
+	 * @link https://php.net/manual/en/sessionhandlerinterface.destroy.php
32
+	 * @param string $id The session ID being destroyed.
33
+	 * @return bool <p>
34
+	 * The return value (usually TRUE on success, FALSE on failure).
35
+	 * Note this value is returned internally to PHP for processing.
36
+	 * </p>
37
+	 * @since 5.4
38
+	 */
39
+	#[TentativeType]
40
+	public function destroy(#[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $id): bool;
41 41
 
42
-    /**
43
-     * Cleanup old sessions
44
-     * @link https://php.net/manual/en/sessionhandlerinterface.gc.php
45
-     * @param int $max_lifetime <p>
46
-     * Sessions that have not updated for
47
-     * the last maxlifetime seconds will be removed.
48
-     * </p>
49
-     * @return int|false <p>
50
-     * Returns the number of deleted sessions on success, or false on failure. Prior to PHP version 7.1, the function returned true on success.
51
-     * Note this value is returned internally to PHP for processing.
52
-     * </p>
53
-     * @since 5.4
54
-     */
55
-    #[LanguageLevelTypeAware(['7.1' => 'int|false'], default: 'bool')]
56
-    #[TentativeType]
57
-    public function gc(#[LanguageLevelTypeAware(['8.0' => 'int'], default: '')] $max_lifetime): int|false;
42
+	/**
43
+	 * Cleanup old sessions
44
+	 * @link https://php.net/manual/en/sessionhandlerinterface.gc.php
45
+	 * @param int $max_lifetime <p>
46
+	 * Sessions that have not updated for
47
+	 * the last maxlifetime seconds will be removed.
48
+	 * </p>
49
+	 * @return int|false <p>
50
+	 * Returns the number of deleted sessions on success, or false on failure. Prior to PHP version 7.1, the function returned true on success.
51
+	 * Note this value is returned internally to PHP for processing.
52
+	 * </p>
53
+	 * @since 5.4
54
+	 */
55
+	#[LanguageLevelTypeAware(['7.1' => 'int|false'], default: 'bool')]
56
+	#[TentativeType]
57
+	public function gc(#[LanguageLevelTypeAware(['8.0' => 'int'], default: '')] $max_lifetime): int|false;
58 58
 
59
-    /**
60
-     * Initialize session
61
-     * @link https://php.net/manual/en/sessionhandlerinterface.open.php
62
-     * @param string $path The path where to store/retrieve the session.
63
-     * @param string $name The session name.
64
-     * @return bool <p>
65
-     * The return value (usually TRUE on success, FALSE on failure).
66
-     * Note this value is returned internally to PHP for processing.
67
-     * </p>
68
-     * @since 5.4
69
-     */
70
-    #[TentativeType]
71
-    public function open(
72
-        #[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $path,
73
-        #[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $name
74
-    ): bool;
59
+	/**
60
+	 * Initialize session
61
+	 * @link https://php.net/manual/en/sessionhandlerinterface.open.php
62
+	 * @param string $path The path where to store/retrieve the session.
63
+	 * @param string $name The session name.
64
+	 * @return bool <p>
65
+	 * The return value (usually TRUE on success, FALSE on failure).
66
+	 * Note this value is returned internally to PHP for processing.
67
+	 * </p>
68
+	 * @since 5.4
69
+	 */
70
+	#[TentativeType]
71
+	public function open(
72
+		#[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $path,
73
+		#[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $name
74
+	): bool;
75 75
 
76
-    /**
77
-     * Read session data
78
-     * @link https://php.net/manual/en/sessionhandlerinterface.read.php
79
-     * @param string $id The session id to read data for.
80
-     * @return string|false <p>
81
-     * Returns an encoded string of the read data.
82
-     * If nothing was read, it must return false.
83
-     * Note this value is returned internally to PHP for processing.
84
-     * </p>
85
-     * @since 5.4
86
-     */
87
-    #[TentativeType]
88
-    public function read(#[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $id): string|false;
76
+	/**
77
+	 * Read session data
78
+	 * @link https://php.net/manual/en/sessionhandlerinterface.read.php
79
+	 * @param string $id The session id to read data for.
80
+	 * @return string|false <p>
81
+	 * Returns an encoded string of the read data.
82
+	 * If nothing was read, it must return false.
83
+	 * Note this value is returned internally to PHP for processing.
84
+	 * </p>
85
+	 * @since 5.4
86
+	 */
87
+	#[TentativeType]
88
+	public function read(#[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $id): string|false;
89 89
 
90
-    /**
91
-     * Write session data
92
-     * @link https://php.net/manual/en/sessionhandlerinterface.write.php
93
-     * @param string $id The session id.
94
-     * @param string $data <p>
95
-     * The encoded session data. This data is the
96
-     * result of the PHP internally encoding
97
-     * the $_SESSION superglobal to a serialized
98
-     * string and passing it as this parameter.
99
-     * Please note sessions use an alternative serialization method.
100
-     * </p>
101
-     * @return bool <p>
102
-     * The return value (usually TRUE on success, FALSE on failure).
103
-     * Note this value is returned internally to PHP for processing.
104
-     * </p>
105
-     * @since 5.4
106
-     */
107
-    #[TentativeType]
108
-    public function write(
109
-        #[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $id,
110
-        #[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $data
111
-    ): bool;
90
+	/**
91
+	 * Write session data
92
+	 * @link https://php.net/manual/en/sessionhandlerinterface.write.php
93
+	 * @param string $id The session id.
94
+	 * @param string $data <p>
95
+	 * The encoded session data. This data is the
96
+	 * result of the PHP internally encoding
97
+	 * the $_SESSION superglobal to a serialized
98
+	 * string and passing it as this parameter.
99
+	 * Please note sessions use an alternative serialization method.
100
+	 * </p>
101
+	 * @return bool <p>
102
+	 * The return value (usually TRUE on success, FALSE on failure).
103
+	 * Note this value is returned internally to PHP for processing.
104
+	 * </p>
105
+	 * @since 5.4
106
+	 */
107
+	#[TentativeType]
108
+	public function write(
109
+		#[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $id,
110
+		#[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $data
111
+	): bool;
112 112
 }
113 113
 
114 114
 /**
@@ -118,15 +118,15 @@  discard block
 block discarded – undo
118 118
  */
119 119
 interface SessionIdInterface
120 120
 {
121
-    /**
122
-     * Create session ID
123
-     * @link https://php.net/manual/en/sessionidinterface.create-sid.php
124
-     * @return string <p>
125
-     * The new session ID. Note that this value is returned internally to PHP for processing.
126
-     * </p>
127
-     */
128
-    #[TentativeType]
129
-    public function create_sid(): string;
121
+	/**
122
+	 * Create session ID
123
+	 * @link https://php.net/manual/en/sessionidinterface.create-sid.php
124
+	 * @return string <p>
125
+	 * The new session ID. Note that this value is returned internally to PHP for processing.
126
+	 * </p>
127
+	 */
128
+	#[TentativeType]
129
+	public function create_sid(): string;
130 130
 }
131 131
 
132 132
 /**
@@ -138,32 +138,32 @@  discard block
 block discarded – undo
138 138
  */
139 139
 interface SessionUpdateTimestampHandlerInterface
140 140
 {
141
-    /**
142
-     * Validate session id
143
-     * @link https://www.php.net/manual/sessionupdatetimestamphandlerinterface.validateid
144
-     * @param string $id The session id
145
-     * @return bool <p>
146
-     * Note this value is returned internally to PHP for processing.
147
-     * </p>
148
-     */
149
-    #[TentativeType]
150
-    public function validateId(string $id): bool;
141
+	/**
142
+	 * Validate session id
143
+	 * @link https://www.php.net/manual/sessionupdatetimestamphandlerinterface.validateid
144
+	 * @param string $id The session id
145
+	 * @return bool <p>
146
+	 * Note this value is returned internally to PHP for processing.
147
+	 * </p>
148
+	 */
149
+	#[TentativeType]
150
+	public function validateId(string $id): bool;
151 151
 
152
-    /**
153
-     * Update timestamp of a session
154
-     * @link https://www.php.net/manual/sessionupdatetimestamphandlerinterface.updatetimestamp.php
155
-     * @param string $id The session id
156
-     * @param string $data <p>
157
-     * The encoded session data. This data is the
158
-     * result of the PHP internally encoding
159
-     * the $_SESSION superglobal to a serialized
160
-     * string and passing it as this parameter.
161
-     * Please note sessions use an alternative serialization method.
162
-     * </p>
163
-     * @return bool
164
-     */
165
-    #[TentativeType]
166
-    public function updateTimestamp(string $id, string $data): bool;
152
+	/**
153
+	 * Update timestamp of a session
154
+	 * @link https://www.php.net/manual/sessionupdatetimestamphandlerinterface.updatetimestamp.php
155
+	 * @param string $id The session id
156
+	 * @param string $data <p>
157
+	 * The encoded session data. This data is the
158
+	 * result of the PHP internally encoding
159
+	 * the $_SESSION superglobal to a serialized
160
+	 * string and passing it as this parameter.
161
+	 * Please note sessions use an alternative serialization method.
162
+	 * </p>
163
+	 * @return bool
164
+	 */
165
+	#[TentativeType]
166
+	public function updateTimestamp(string $id, string $data): bool;
167 167
 }
168 168
 
169 169
 /**
@@ -183,130 +183,130 @@  discard block
 block discarded – undo
183 183
  */
184 184
 class SessionHandler implements SessionHandlerInterface, SessionIdInterface
185 185
 {
186
-    /**
187
-     * Close the session
188
-     * @link https://php.net/manual/en/sessionhandler.close.php
189
-     * @return bool <p>
190
-     * The return value (usually TRUE on success, FALSE on failure).
191
-     * Note this value is returned internally to PHP for processing.
192
-     * </p>
193
-     * @since 5.4
194
-     */
195
-    #[TentativeType]
196
-    public function close(): bool {}
186
+	/**
187
+	 * Close the session
188
+	 * @link https://php.net/manual/en/sessionhandler.close.php
189
+	 * @return bool <p>
190
+	 * The return value (usually TRUE on success, FALSE on failure).
191
+	 * Note this value is returned internally to PHP for processing.
192
+	 * </p>
193
+	 * @since 5.4
194
+	 */
195
+	#[TentativeType]
196
+	public function close(): bool {}
197 197
 
198
-    /**
199
-     * Return a new session ID
200
-     * @link https://php.net/manual/en/sessionhandler.create-sid.php
201
-     * @return string <p>A session ID valid for the default session handler.</p>
202
-     * @since 5.5.1
203
-     */
204
-    #[TentativeType]
205
-    public function create_sid(): string {}
198
+	/**
199
+	 * Return a new session ID
200
+	 * @link https://php.net/manual/en/sessionhandler.create-sid.php
201
+	 * @return string <p>A session ID valid for the default session handler.</p>
202
+	 * @since 5.5.1
203
+	 */
204
+	#[TentativeType]
205
+	public function create_sid(): string {}
206 206
 
207
-    /**
208
-     * Destroy a session
209
-     * @link https://php.net/manual/en/sessionhandler.destroy.php
210
-     * @param string $id The session ID being destroyed.
211
-     * @return bool <p>
212
-     * The return value (usually TRUE on success, FALSE on failure).
213
-     * Note this value is returned internally to PHP for processing.
214
-     * </p>
215
-     * @since 5.4
216
-     */
217
-    #[TentativeType]
218
-    public function destroy(#[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $id): bool {}
207
+	/**
208
+	 * Destroy a session
209
+	 * @link https://php.net/manual/en/sessionhandler.destroy.php
210
+	 * @param string $id The session ID being destroyed.
211
+	 * @return bool <p>
212
+	 * The return value (usually TRUE on success, FALSE on failure).
213
+	 * Note this value is returned internally to PHP for processing.
214
+	 * </p>
215
+	 * @since 5.4
216
+	 */
217
+	#[TentativeType]
218
+	public function destroy(#[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $id): bool {}
219 219
 
220
-    /**
221
-     * Cleanup old sessions
222
-     * @link https://php.net/manual/en/sessionhandler.gc.php
223
-     * @param int $max_lifetime <p>
224
-     * Sessions that have not updated for
225
-     * the last maxlifetime seconds will be removed.
226
-     * </p>
227
-     * @return int|bool <p>
228
-     * The return value (usually TRUE on success, FALSE on failure).
229
-     * Note this value is returned internally to PHP for processing.
230
-     * </p>
231
-     * @since 5.4
232
-     */
233
-    #[TentativeType]
234
-    public function gc(#[LanguageLevelTypeAware(['8.0' => 'int'], default: '')] $max_lifetime): int|false {}
220
+	/**
221
+	 * Cleanup old sessions
222
+	 * @link https://php.net/manual/en/sessionhandler.gc.php
223
+	 * @param int $max_lifetime <p>
224
+	 * Sessions that have not updated for
225
+	 * the last maxlifetime seconds will be removed.
226
+	 * </p>
227
+	 * @return int|bool <p>
228
+	 * The return value (usually TRUE on success, FALSE on failure).
229
+	 * Note this value is returned internally to PHP for processing.
230
+	 * </p>
231
+	 * @since 5.4
232
+	 */
233
+	#[TentativeType]
234
+	public function gc(#[LanguageLevelTypeAware(['8.0' => 'int'], default: '')] $max_lifetime): int|false {}
235 235
 
236
-    /**
237
-     * Initialize session
238
-     * @link https://php.net/manual/en/sessionhandler.open.php
239
-     * @param string $path The path where to store/retrieve the session.
240
-     * @param string $name The session name.
241
-     * @return bool <p>
242
-     * The return value (usually TRUE on success, FALSE on failure).
243
-     * Note this value is returned internally to PHP for processing.
244
-     * </p>
245
-     * @since 5.4
246
-     */
247
-    #[TentativeType]
248
-    public function open(
249
-        #[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $path,
250
-        #[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $name
251
-    ): bool {}
236
+	/**
237
+	 * Initialize session
238
+	 * @link https://php.net/manual/en/sessionhandler.open.php
239
+	 * @param string $path The path where to store/retrieve the session.
240
+	 * @param string $name The session name.
241
+	 * @return bool <p>
242
+	 * The return value (usually TRUE on success, FALSE on failure).
243
+	 * Note this value is returned internally to PHP for processing.
244
+	 * </p>
245
+	 * @since 5.4
246
+	 */
247
+	#[TentativeType]
248
+	public function open(
249
+		#[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $path,
250
+		#[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $name
251
+	): bool {}
252 252
 
253
-    /**
254
-     * Read session data
255
-     * @link https://php.net/manual/en/sessionhandler.read.php
256
-     * @param string $id The session id to read data for.
257
-     * @return string|false <p>
258
-     * Returns an encoded string of the read data.
259
-     * If nothing was read, it must return an empty string.
260
-     * Note this value is returned internally to PHP for processing.
261
-     * </p>
262
-     * @since 5.4
263
-     */
264
-    #[TentativeType]
265
-    public function read(#[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $id): string|false {}
253
+	/**
254
+	 * Read session data
255
+	 * @link https://php.net/manual/en/sessionhandler.read.php
256
+	 * @param string $id The session id to read data for.
257
+	 * @return string|false <p>
258
+	 * Returns an encoded string of the read data.
259
+	 * If nothing was read, it must return an empty string.
260
+	 * Note this value is returned internally to PHP for processing.
261
+	 * </p>
262
+	 * @since 5.4
263
+	 */
264
+	#[TentativeType]
265
+	public function read(#[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $id): string|false {}
266 266
 
267
-    /**
268
-     * Write session data
269
-     * @link https://php.net/manual/en/sessionhandler.write.php
270
-     * @param string $id The session id.
271
-     * @param string $data <p>
272
-     * The encoded session data. This data is the
273
-     * result of the PHP internally encoding
274
-     * the $_SESSION superglobal to a serialized
275
-     * string and passing it as this parameter.
276
-     * Please note sessions use an alternative serialization method.
277
-     * </p>
278
-     * @return bool <p>
279
-     * The return value (usually TRUE on success, FALSE on failure).
280
-     * Note this value is returned internally to PHP for processing.
281
-     * </p>
282
-     * @since 5.4
283
-     */
284
-    #[TentativeType]
285
-    public function write(
286
-        #[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $id,
287
-        #[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $data
288
-    ): bool {}
267
+	/**
268
+	 * Write session data
269
+	 * @link https://php.net/manual/en/sessionhandler.write.php
270
+	 * @param string $id The session id.
271
+	 * @param string $data <p>
272
+	 * The encoded session data. This data is the
273
+	 * result of the PHP internally encoding
274
+	 * the $_SESSION superglobal to a serialized
275
+	 * string and passing it as this parameter.
276
+	 * Please note sessions use an alternative serialization method.
277
+	 * </p>
278
+	 * @return bool <p>
279
+	 * The return value (usually TRUE on success, FALSE on failure).
280
+	 * Note this value is returned internally to PHP for processing.
281
+	 * </p>
282
+	 * @since 5.4
283
+	 */
284
+	#[TentativeType]
285
+	public function write(
286
+		#[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $id,
287
+		#[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $data
288
+	): bool {}
289 289
 
290
-    /**
291
-     * Validate session id
292
-     * @param string $session_id The session id
293
-     * @return bool <p>
294
-     * Note this value is returned internally to PHP for processing.
295
-     * </p>
296
-     */
297
-    public function validateId($session_id) {}
290
+	/**
291
+	 * Validate session id
292
+	 * @param string $session_id The session id
293
+	 * @return bool <p>
294
+	 * Note this value is returned internally to PHP for processing.
295
+	 * </p>
296
+	 */
297
+	public function validateId($session_id) {}
298 298
 
299
-    /**
300
-     * Update timestamp of a session
301
-     * @param string $session_id The session id
302
-     * @param string $session_data <p>
303
-     * The encoded session data. This data is the
304
-     * result of the PHP internally encoding
305
-     * the $_SESSION superglobal to a serialized
306
-     * string and passing it as this parameter.
307
-     * Please note sessions use an alternative serialization method.
308
-     * </p>
309
-     * @return bool
310
-     */
311
-    public function updateTimestamp($session_id, $session_data) {}
299
+	/**
300
+	 * Update timestamp of a session
301
+	 * @param string $session_id The session id
302
+	 * @param string $session_data <p>
303
+	 * The encoded session data. This data is the
304
+	 * result of the PHP internally encoding
305
+	 * the $_SESSION superglobal to a serialized
306
+	 * string and passing it as this parameter.
307
+	 * Please note sessions use an alternative serialization method.
308
+	 * </p>
309
+	 * @return bool
310
+	 */
311
+	public function updateTimestamp($session_id, $session_data) {}
312 312
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
      */
55 55
     #[LanguageLevelTypeAware(['7.1' => 'int|false'], default: 'bool')]
56 56
     #[TentativeType]
57
-    public function gc(#[LanguageLevelTypeAware(['8.0' => 'int'], default: '')] $max_lifetime): int|false;
57
+    public function gc(#[LanguageLevelTypeAware(['8.0' => 'int'], default: '')] $max_lifetime): int | false;
58 58
 
59 59
     /**
60 60
      * Initialize session
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
      * @since 5.4
86 86
      */
87 87
     #[TentativeType]
88
-    public function read(#[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $id): string|false;
88
+    public function read(#[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $id): string | false;
89 89
 
90 90
     /**
91 91
      * Write session data
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
      * @since 5.4
232 232
      */
233 233
     #[TentativeType]
234
-    public function gc(#[LanguageLevelTypeAware(['8.0' => 'int'], default: '')] $max_lifetime): int|false {}
234
+    public function gc(#[LanguageLevelTypeAware(['8.0' => 'int'], default: '')] $max_lifetime): int | false {}
235 235
 
236 236
     /**
237 237
      * Initialize session
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
      * @since 5.4
263 263
      */
264 264
     #[TentativeType]
265
-    public function read(#[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $id): string|false {}
265
+    public function read(#[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $id): string | false {}
266 266
 
267 267
     /**
268 268
      * Write session data
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -12,8 +12,7 @@  discard block
 block discarded – undo
12 12
  * @link https://php.net/manual/en/class.sessionhandlerinterface.php
13 13
  * @since 5.4
14 14
  */
15
-interface SessionHandlerInterface
16
-{
15
+interface SessionHandlerInterface {
17 16
     /**
18 17
      * Close the session
19 18
      * @link https://php.net/manual/en/sessionhandlerinterface.close.php
@@ -116,8 +115,7 @@  discard block
 block discarded – undo
116 115
  * @link https://php.net/manual/en/class.sessionidinterface.php
117 116
  * @since 5.5.1
118 117
  */
119
-interface SessionIdInterface
120
-{
118
+interface SessionIdInterface {
121 119
     /**
122 120
      * Create session ID
123 121
      * @link https://php.net/manual/en/sessionidinterface.create-sid.php
@@ -136,8 +134,7 @@  discard block
 block discarded – undo
136 134
  * handler must implement this interface.
137 135
  * @since 7.0
138 136
  */
139
-interface SessionUpdateTimestampHandlerInterface
140
-{
137
+interface SessionUpdateTimestampHandlerInterface {
141 138
     /**
142 139
      * Validate session id
143 140
      * @link https://www.php.net/manual/sessionupdatetimestamphandlerinterface.validateid
Please login to merge, or discard this patch.
vendor-bin/php-scoper/vendor/jetbrains/phpstorm-stubs/session/session.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -322,8 +322,8 @@  discard block
 block discarded – undo
322 322
  * </table>
323 323
  * @return string|false the name of the current cache limiter.
324 324
  */
325
-#[LanguageLevelTypeAware(["8.0" => "string|false"], default: "string")]
326
-function session_cache_limiter(#[LanguageLevelTypeAware(['8.0' => 'null|string'], default: 'string')] $value) {}
325
+#[LanguageLevelTypeAware(["8.0" => "string|false"], default : "string")]
326
+function session_cache_limiter(#[LanguageLevelTypeAware(['8.0' => 'null|string'], default : 'string')] $value) {}
327 327
 
328 328
 /**
329 329
  * Return current cache expire
@@ -340,8 +340,8 @@  discard block
 block discarded – undo
340 340
  * @return int|false the current setting of session.cache_expire.
341 341
  * The value returned should be read in minutes, defaults to 180.
342 342
  */
343
-#[LanguageLevelTypeAware(["8.0" => "int|false"], default: "int")]
344
-function session_cache_expire(#[LanguageLevelTypeAware(['8.0' => 'null|int'], default: 'int')] $value) {}
343
+#[LanguageLevelTypeAware(["8.0" => "int|false"], default : "int")]
344
+function session_cache_expire(#[LanguageLevelTypeAware(['8.0' => 'null|int'], default : 'int')] $value) {}
345 345
 
346 346
 /**
347 347
  * Set the session cookie parameters
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
  * </p>
389 389
  * @return void|bool since 7.2.0 returns true on success or false on failure.
390 390
  */
391
-#[LanguageLevelTypeAware(["7.2" => "bool"], default: "void")]
391
+#[LanguageLevelTypeAware(["7.2" => "bool"], default : "void")]
392 392
 function session_set_cookie_params(int $lifetime_or_options, ?string $path = null, ?string $domain = null, ?bool $secure = null, ?bool $httponly = null) {}
393 393
 
394 394
 /**
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
  * @link https://php.net/manual/en/function.session-write-close.php
416 416
  * @return void|bool since 7.2.0 returns true on success or false on failure.
417 417
  */
418
-#[LanguageLevelTypeAware(["7.2" => "bool"], default: "void")]
418
+#[LanguageLevelTypeAware(["7.2" => "bool"], default : "void")]
419 419
 function session_write_close() {}
420 420
 
421 421
 /**
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
  * @link https://php.net/manual/en/function.session-commit.php
424 424
  * @return void|bool since 7.2.0 returns true on success or false on failure.
425 425
  */
426
-#[LanguageLevelTypeAware(["7.2" => "bool"], default: "void")]
426
+#[LanguageLevelTypeAware(["7.2" => "bool"], default : "void")]
427 427
 function session_commit() {}
428 428
 
429 429
 /**
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
  * @return void|bool since 7.2.0 returns true if a session was successfully reinitialized or false on failure.
445 445
  * @since 5.6
446 446
  */
447
-#[LanguageLevelTypeAware(["7.2" => "bool"], default: "void")]
447
+#[LanguageLevelTypeAware(["7.2" => "bool"], default : "void")]
448 448
 function session_abort() {}
449 449
 
450 450
 /**
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
  * @return void|bool since 7.2.0 returns true if a session was successfully reinitialized or false on failure.
455 455
  * @since 5.6
456 456
  */
457
-#[LanguageLevelTypeAware(["7.2" => "bool"], default: "void")]
457
+#[LanguageLevelTypeAware(["7.2" => "bool"], default : "void")]
458 458
 function session_reset() {}
459 459
 
460 460
 // End of session v.
Please login to merge, or discard this patch.
vendor-bin/php-scoper/vendor/jetbrains/phpstorm-stubs/v8js/v8js.php 2 patches
Indentation   +155 added lines, -155 removed lines patch added patch discarded remove patch
@@ -2,165 +2,165 @@
 block discarded – undo
2 2
 
3 3
 class V8Js
4 4
 {
5
-    /* Constants */
6
-
7
-    public const V8_VERSION = '';
8
-
9
-    public const FLAG_NONE = 1;
10
-    public const FLAG_FORCE_ARRAY = 2;
11
-    public const FLAG_PROPAGATE_PHP_EXCEPTIONS = 4;
12
-
13
-    /* Methods */
14
-
15
-    /**
16
-     * Initializes and starts V8 engine and returns new V8Js object with it's own V8 context.
17
-     * Snapshots are supported by V8 4.3.7 and higher.
18
-     * @param string $object_name
19
-     * @param array $variables
20
-     * @param array $extensions
21
-     * @param bool $report_uncaught_exceptions
22
-     * @param string $snapshot_blob
23
-     */
24
-    public function __construct($object_name = "PHP", array $variables = [], array $extensions = [], $report_uncaught_exceptions = true, $snapshot_blob = null) {}
25
-
26
-    /**
27
-     * Provide a function or method to be used to load required modules. This can be any valid PHP callable.
28
-     * The loader function will receive the normalised module path and should return Javascript code to be executed.
29
-     * @param callable $loader
30
-     */
31
-    public function setModuleLoader(callable $loader) {}
32
-
33
-    /**
34
-     * Provide a function or method to be used to normalise module paths. This can be any valid PHP callable.
35
-     * This can be used in combination with setModuleLoader to influence normalisation of the module path (which
36
-     * is normally done by V8Js itself but can be overriden this way).
37
-     * The normaliser function will receive the base path of the current module (if any; otherwise an empty string)
38
-     * and the literate string provided to the require method and should return an array of two strings (the new
39
-     * module base path as well as the normalised name).  Both are joined by a '/' and then passed on to the
40
-     * module loader (unless the module was cached before).
41
-     * @param callable $normaliser
42
-     */
43
-    public function setModuleNormaliser(callable $normaliser) {}
44
-
45
-    /**
46
-     * Compiles and executes script in object's context with optional identifier string.
47
-     * A time limit (milliseconds) and/or memory limit (bytes) can be provided to restrict execution. These options will throw a V8JsTimeLimitException or V8JsMemoryLimitException.
48
-     * @param string $script
49
-     * @param string $identifier
50
-     * @param int $flags
51
-     * @param int $time_limit in milliseconds
52
-     * @param int $memory_limit in bytes
53
-     * @return mixed
54
-     */
55
-    public function executeString($script, $identifier = '', $flags = V8Js::FLAG_NONE, $time_limit = 0, $memory_limit = 0) {}
56
-
57
-    /**
58
-     * Compiles a script in object's context with optional identifier string.
59
-     * @param $script
60
-     * @param string $identifier
61
-     * @return resource
62
-     */
63
-    public function compileString($script, $identifier = '') {}
64
-
65
-    /**
66
-     * Executes a precompiled script in object's context.
67
-     * A time limit (milliseconds) and/or memory limit (bytes) can be provided to restrict execution. These options will throw a V8JsTimeLimitException or V8JsMemoryLimitException.
68
-     * @param resource $script
69
-     * @param int $flags
70
-     * @param int $time_limit
71
-     * @param int $memory_limit
72
-     */
73
-    public function executeScript($script, $flags = V8Js::FLAG_NONE, $time_limit = 0, $memory_limit = 0) {}
74
-
75
-    /**
76
-     * Set the time limit (in milliseconds) for this V8Js object
77
-     * works similar to the set_time_limit php
78
-     * @param int $limit
79
-     */
80
-    public function setTimeLimit($limit) {}
81
-
82
-    /**
83
-     * Set the memory limit (in bytes) for this V8Js object
84
-     * @param int $limit
85
-     */
86
-    public function setMemoryLimit($limit) {}
87
-
88
-    /**
89
-     * Set the average object size (in bytes) for this V8Js object.
90
-     * V8's "amount of external memory" is adjusted by this value for every exported object.  V8 triggers a garbage collection once this totals to 192 MB.
91
-     * @param int $average_object_size
92
-     */
93
-    public function setAverageObjectSize($average_object_size) {}
94
-
95
-    /**
96
-     * Returns uncaught pending exception or null if there is no pending exception.
97
-     * @return V8JsScriptException|null
98
-     */
99
-    public function getPendingException() {}
100
-
101
-    /**
102
-     * Clears the uncaught pending exception
103
-     */
104
-    public function clearPendingException() {}
105
-
106
-    /* Static methods */
107
-
108
-    /**
109
-     * Registers persistent context independent global Javascript extension.
110
-     * NOTE! These extensions exist until PHP is shutdown and they need to be registered before V8 is initialized.
111
-     * For best performance V8 is initialized only once per process thus this call has to be done before any V8Js objects are created!
112
-     * @param string $extension_name
113
-     * @param string $code
114
-     * @param array $dependencies
115
-     * @param bool $auto_enable
116
-     * @return bool
117
-     */
118
-    public static function registerExtension($extension_name, $code, array $dependencies, $auto_enable = false) {}
119
-
120
-    /**
121
-     * Returns extensions successfully registered with V8Js::registerExtension().
122
-     * @return array|string[]
123
-     */
124
-    public static function getExtensions() {}
125
-
126
-    /**
127
-     * Creates a custom V8 heap snapshot with the provided JavaScript source embedded.
128
-     * Snapshots are supported by V8 4.3.7 and higher.  For older versions of V8 this
129
-     * extension doesn't provide this method.
130
-     * @param string $embed_source
131
-     * @return string|false
132
-     */
133
-    public static function createSnapshot($embed_source) {}
5
+	/* Constants */
6
+
7
+	public const V8_VERSION = '';
8
+
9
+	public const FLAG_NONE = 1;
10
+	public const FLAG_FORCE_ARRAY = 2;
11
+	public const FLAG_PROPAGATE_PHP_EXCEPTIONS = 4;
12
+
13
+	/* Methods */
14
+
15
+	/**
16
+	 * Initializes and starts V8 engine and returns new V8Js object with it's own V8 context.
17
+	 * Snapshots are supported by V8 4.3.7 and higher.
18
+	 * @param string $object_name
19
+	 * @param array $variables
20
+	 * @param array $extensions
21
+	 * @param bool $report_uncaught_exceptions
22
+	 * @param string $snapshot_blob
23
+	 */
24
+	public function __construct($object_name = "PHP", array $variables = [], array $extensions = [], $report_uncaught_exceptions = true, $snapshot_blob = null) {}
25
+
26
+	/**
27
+	 * Provide a function or method to be used to load required modules. This can be any valid PHP callable.
28
+	 * The loader function will receive the normalised module path and should return Javascript code to be executed.
29
+	 * @param callable $loader
30
+	 */
31
+	public function setModuleLoader(callable $loader) {}
32
+
33
+	/**
34
+	 * Provide a function or method to be used to normalise module paths. This can be any valid PHP callable.
35
+	 * This can be used in combination with setModuleLoader to influence normalisation of the module path (which
36
+	 * is normally done by V8Js itself but can be overriden this way).
37
+	 * The normaliser function will receive the base path of the current module (if any; otherwise an empty string)
38
+	 * and the literate string provided to the require method and should return an array of two strings (the new
39
+	 * module base path as well as the normalised name).  Both are joined by a '/' and then passed on to the
40
+	 * module loader (unless the module was cached before).
41
+	 * @param callable $normaliser
42
+	 */
43
+	public function setModuleNormaliser(callable $normaliser) {}
44
+
45
+	/**
46
+	 * Compiles and executes script in object's context with optional identifier string.
47
+	 * A time limit (milliseconds) and/or memory limit (bytes) can be provided to restrict execution. These options will throw a V8JsTimeLimitException or V8JsMemoryLimitException.
48
+	 * @param string $script
49
+	 * @param string $identifier
50
+	 * @param int $flags
51
+	 * @param int $time_limit in milliseconds
52
+	 * @param int $memory_limit in bytes
53
+	 * @return mixed
54
+	 */
55
+	public function executeString($script, $identifier = '', $flags = V8Js::FLAG_NONE, $time_limit = 0, $memory_limit = 0) {}
56
+
57
+	/**
58
+	 * Compiles a script in object's context with optional identifier string.
59
+	 * @param $script
60
+	 * @param string $identifier
61
+	 * @return resource
62
+	 */
63
+	public function compileString($script, $identifier = '') {}
64
+
65
+	/**
66
+	 * Executes a precompiled script in object's context.
67
+	 * A time limit (milliseconds) and/or memory limit (bytes) can be provided to restrict execution. These options will throw a V8JsTimeLimitException or V8JsMemoryLimitException.
68
+	 * @param resource $script
69
+	 * @param int $flags
70
+	 * @param int $time_limit
71
+	 * @param int $memory_limit
72
+	 */
73
+	public function executeScript($script, $flags = V8Js::FLAG_NONE, $time_limit = 0, $memory_limit = 0) {}
74
+
75
+	/**
76
+	 * Set the time limit (in milliseconds) for this V8Js object
77
+	 * works similar to the set_time_limit php
78
+	 * @param int $limit
79
+	 */
80
+	public function setTimeLimit($limit) {}
81
+
82
+	/**
83
+	 * Set the memory limit (in bytes) for this V8Js object
84
+	 * @param int $limit
85
+	 */
86
+	public function setMemoryLimit($limit) {}
87
+
88
+	/**
89
+	 * Set the average object size (in bytes) for this V8Js object.
90
+	 * V8's "amount of external memory" is adjusted by this value for every exported object.  V8 triggers a garbage collection once this totals to 192 MB.
91
+	 * @param int $average_object_size
92
+	 */
93
+	public function setAverageObjectSize($average_object_size) {}
94
+
95
+	/**
96
+	 * Returns uncaught pending exception or null if there is no pending exception.
97
+	 * @return V8JsScriptException|null
98
+	 */
99
+	public function getPendingException() {}
100
+
101
+	/**
102
+	 * Clears the uncaught pending exception
103
+	 */
104
+	public function clearPendingException() {}
105
+
106
+	/* Static methods */
107
+
108
+	/**
109
+	 * Registers persistent context independent global Javascript extension.
110
+	 * NOTE! These extensions exist until PHP is shutdown and they need to be registered before V8 is initialized.
111
+	 * For best performance V8 is initialized only once per process thus this call has to be done before any V8Js objects are created!
112
+	 * @param string $extension_name
113
+	 * @param string $code
114
+	 * @param array $dependencies
115
+	 * @param bool $auto_enable
116
+	 * @return bool
117
+	 */
118
+	public static function registerExtension($extension_name, $code, array $dependencies, $auto_enable = false) {}
119
+
120
+	/**
121
+	 * Returns extensions successfully registered with V8Js::registerExtension().
122
+	 * @return array|string[]
123
+	 */
124
+	public static function getExtensions() {}
125
+
126
+	/**
127
+	 * Creates a custom V8 heap snapshot with the provided JavaScript source embedded.
128
+	 * Snapshots are supported by V8 4.3.7 and higher.  For older versions of V8 this
129
+	 * extension doesn't provide this method.
130
+	 * @param string $embed_source
131
+	 * @return string|false
132
+	 */
133
+	public static function createSnapshot($embed_source) {}
134 134
 }
135 135
 
136 136
 final class V8JsScriptException extends Exception
137 137
 {
138
-    /**
139
-     * @return string
140
-     */
141
-    final public function getJsFileName() {}
142
-
143
-    /**
144
-     * @return int
145
-     */
146
-    final public function getJsLineNumber() {}
147
-    /**
148
-     * @return int
149
-     */
150
-    final public function getJsStartColumn() {}
151
-    /**
152
-     * @return int
153
-     */
154
-    final public function getJsEndColumn() {}
155
-
156
-    /**
157
-     * @return string
158
-     */
159
-    final public function getJsSourceLine() {}
160
-    /**
161
-     * @return string
162
-     */
163
-    final public function getJsTrace() {}
138
+	/**
139
+	 * @return string
140
+	 */
141
+	final public function getJsFileName() {}
142
+
143
+	/**
144
+	 * @return int
145
+	 */
146
+	final public function getJsLineNumber() {}
147
+	/**
148
+	 * @return int
149
+	 */
150
+	final public function getJsStartColumn() {}
151
+	/**
152
+	 * @return int
153
+	 */
154
+	final public function getJsEndColumn() {}
155
+
156
+	/**
157
+	 * @return string
158
+	 */
159
+	final public function getJsSourceLine() {}
160
+	/**
161
+	 * @return string
162
+	 */
163
+	final public function getJsTrace() {}
164 164
 }
165 165
 
166 166
 final class V8JsTimeLimitException extends Exception {}
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,7 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-class V8Js
4
-{
3
+class V8Js {
5 4
     /* Constants */
6 5
 
7 6
     public const V8_VERSION = '';
@@ -133,8 +132,7 @@  discard block
 block discarded – undo
133 132
     public static function createSnapshot($embed_source) {}
134 133
 }
135 134
 
136
-final class V8JsScriptException extends Exception
137
-{
135
+final class V8JsScriptException extends Exception {
138 136
     /**
139 137
      * @return string
140 138
      */
Please login to merge, or discard this patch.