Skip to content

Commit

Permalink
Merge pull request #7474 from orklah/removePositiveInt
Browse files Browse the repository at this point in the history
deprecate TPositiveInt
  • Loading branch information
orklah committed Jan 23, 2022
2 parents 64206d9 + 3649712 commit 8230efb
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 19 deletions.
73 changes: 54 additions & 19 deletions psalm-baseline.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="4.9999999.9999999.9999999-dev">
<files psalm-version="4.x-dev@64206d9c3a9723bba093beb7d1a77ee767332d8a">
<file src="examples/TemplateChecker.php">
<PossiblyUndefinedIntArrayOffset occurrences="2">
<code>$comment_block-&gt;tags['variablesfrom'][0]</code>
Expand All @@ -21,11 +21,13 @@
<code>$matches[0]</code>
<code>$symbol_parts[1]</code>
</PossiblyUndefinedIntArrayOffset>
<PossiblyUnusedProperty occurrences="1">
<code>$analysis_php_version_id</code>
</PossiblyUnusedProperty>
</file>
<file src="src/Psalm/Config.php">
<DeprecatedMethod occurrences="3">
<code>getAdditionalFileExtensions</code>
<code>getAdditionalFileTypeAnalyzers</code>
<code>getAdditionalFileTypeScanners</code>
</DeprecatedMethod>
<DeprecatedProperty occurrences="7">
<code>$codebase-&gt;php_major_version</code>
<code>$codebase-&gt;php_major_version</code>
Expand All @@ -35,11 +37,6 @@
<code>$codebase-&gt;php_minor_version</code>
<code>$this-&gt;load_xdebug_stub</code>
</DeprecatedProperty>
<DeprecatedMethod occurrences="3">
<code>getAdditionalFileExtensions</code>
<code>getAdditionalFileTypeScanners</code>
<code>getAdditionalFileTypeAnalyzers</code>
</DeprecatedMethod>
</file>
<file src="src/Psalm/Config/FileFilter.php">
<PossiblyUndefinedIntArrayOffset occurrences="1">
Expand Down Expand Up @@ -205,17 +202,26 @@
</DeprecatedMethod>
</file>
<file src="src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/ArithmeticOpAnalyzer.php">
<DeprecatedMethod occurrences="4">
<DeprecatedClass occurrences="1">
<code>new TPositiveInt()</code>
</DeprecatedClass>
<DeprecatedMethod occurrences="5">
<code>Type::getEmpty()</code>
<code>Type::getEmpty()</code>
<code>Type::getEmpty()</code>
<code>Type::getEmpty()</code>
<code>Type::getPositiveInt(true)</code>
</DeprecatedMethod>
<PossiblyUndefinedIntArrayOffset occurrences="2">
<code>$invalid_left_messages[0]</code>
<code>$invalid_right_messages[0]</code>
</PossiblyUndefinedIntArrayOffset>
</file>
<file src="src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/ConcatAnalyzer.php">
<DeprecatedMethod occurrences="1">
<code>Type::getPositiveInt()</code>
</DeprecatedMethod>
</file>
<file src="src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArgumentAnalyzer.php">
<DeprecatedProperty occurrences="4">
<code>$codebase-&gt;php_major_version</code>
Expand Down Expand Up @@ -256,6 +262,11 @@
</PossiblyUndefinedIntArrayOffset>
</file>
<file src="src/Psalm/Internal/Analyzer/Statements/Expression/Call/FunctionCallReturnTypeFetcher.php">
<DeprecatedClass occurrences="3">
<code>new TPositiveInt</code>
<code>new TPositiveInt</code>
<code>new TPositiveInt</code>
</DeprecatedClass>
<DeprecatedMethod occurrences="1">
<code>Type::getEmpty()</code>
</DeprecatedMethod>
Expand Down Expand Up @@ -337,6 +348,11 @@
<code>Type::getEmpty()</code>
</DeprecatedMethod>
</file>
<file src="src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/ConstFetchAnalyzer.php">
<DeprecatedMethod occurrences="1">
<code>Type::getPositiveInt()</code>
</DeprecatedMethod>
</file>
<file src="src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/InstancePropertyFetchAnalyzer.php">
<PossiblyUndefinedIntArrayOffset occurrences="1">
<code>$invalid_fetch_types[0]</code>
Expand Down Expand Up @@ -567,10 +583,21 @@
<code>$codebase-&gt;php_major_version</code>
</DeprecatedProperty>
</file>
<file src="src/Psalm/Internal/Type/Comparator/IntegerRangeComparator.php">
<DeprecatedClass occurrences="1">
<code>TPositiveInt::class</code>
</DeprecatedClass>
</file>
<file src="src/Psalm/Internal/Type/Comparator/ScalarTypeComparator.php">
<DeprecatedClass occurrences="1">
<code>TPositiveInt::class</code>
</DeprecatedClass>
</file>
<file src="src/Psalm/Internal/Type/SimpleAssertionReconciler.php">
<DeprecatedClass occurrences="2">
<DeprecatedClass occurrences="3">
<code>new TEmpty()</code>
<code>new TEmpty()</code>
<code>new TPositiveInt()</code>
</DeprecatedClass>
<DeprecatedMethod occurrences="13">
<code>Type::getEmpty()</code>
Expand Down Expand Up @@ -601,6 +628,9 @@
</DeprecatedMethod>
</file>
<file src="src/Psalm/Internal/Type/TypeCombiner.php">
<DeprecatedClass occurrences="1">
<code>new TPositiveInt()</code>
</DeprecatedClass>
<PossiblyUndefinedIntArrayOffset occurrences="6">
<code>$combination-&gt;array_type_params[1]</code>
<code>$combination-&gt;array_type_params[1]</code>
Expand All @@ -611,6 +641,9 @@
</PossiblyUndefinedIntArrayOffset>
</file>
<file src="src/Psalm/Internal/Type/TypeParser.php">
<DeprecatedClass occurrences="1">
<code>new TPositiveInt()</code>
</DeprecatedClass>
<PossiblyUndefinedIntArrayOffset occurrences="9">
<code>$intersection_types[0]</code>
<code>$parse_tree-&gt;children[0]</code>
Expand All @@ -623,12 +656,6 @@
<code>array_keys($template_type_map[$template_param_name])[0]</code>
</PossiblyUndefinedIntArrayOffset>
</file>
<file src="src/Psalm/PluginRegistrationSocket.php">
<DeprecatedMethod occurrences="2">
<code>addFileExtension</code>
<code>addFileExtension</code>
</DeprecatedMethod>
</file>
<file src="src/Psalm/Node/Stmt/VirtualClass.php">
<PropertyNotSetInConstructor occurrences="1">
<code>VirtualClass</code>
Expand All @@ -654,22 +681,30 @@
<code>VirtualConst</code>
</PropertyNotSetInConstructor>
</file>
<file src="src/Psalm/PluginRegistrationSocket.php">
<DeprecatedMethod occurrences="2">
<code>addFileExtension</code>
<code>addFileExtension</code>
</DeprecatedMethod>
</file>
<file src="src/Psalm/Storage/Assertion.php">
<PossiblyUndefinedIntArrayOffset occurrences="1">
<code>$rules[0]</code>
</PossiblyUndefinedIntArrayOffset>
</file>
<file src="src/Psalm/Type.php">
<DeprecatedClass occurrences="3">
<DeprecatedClass occurrences="4">
<code>new TEmpty</code>
<code>new TEmpty</code>
<code>new TEmpty()</code>
<code>new TPositiveInt()</code>
</DeprecatedClass>
</file>
<file src="src/Psalm/Type/Atomic.php">
<DeprecatedClass occurrences="2">
<DeprecatedClass occurrences="3">
<code>new TEmpty()</code>
<code>new THtmlEscapedString()</code>
<code>new TPositiveInt()</code>
</DeprecatedClass>
<PossiblyUndefinedIntArrayOffset occurrences="1">
<code>array_keys($template_type_map[$value])[0]</code>
Expand Down
1 change: 1 addition & 0 deletions src/Psalm/Type.php
Expand Up @@ -196,6 +196,7 @@ public static function getLowercaseString(): Union
return new Union([$type]);
}

/** @deprecated will be removed in Psalm 5 */
public static function getPositiveInt(bool $from_calculation = false): Union
{
$union = new Union([new TPositiveInt()]);
Expand Down
1 change: 1 addition & 0 deletions src/Psalm/Type/Atomic/TPositiveInt.php
Expand Up @@ -4,6 +4,7 @@

/**
* Denotes an int that is also positive (strictly > 0)
* @deprecated will be removed in Psalm 5
*/
class TPositiveInt extends TInt
{
Expand Down

0 comments on commit 8230efb

Please sign in to comment.