1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-26 20:34:47 +01:00

Deprecate Codebase::$php_major_version and Codebase::$php_minor_version properties

Removed in #6898 (Psalm 5)
This commit is contained in:
Bruce Weirdan 2022-01-02 13:22:37 +02:00
parent 36d5a2a83c
commit 5362f3be91
No known key found for this signature in database
GPG Key ID: CFC3AAB181751B0D
3 changed files with 158 additions and 1 deletions

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="dev-master@16a61a758e44158c19c779c8b0a1c2143e40d83e">
<files psalm-version="dev-master@1c078136273a669d52d234251ddbae4cd0507d38">
<file src="examples/TemplateChecker.php">
<PossiblyUndefinedIntArrayOffset occurrences="2">
<code>$comment_block-&gt;tags['variablesfrom'][0]</code>
@ -13,10 +13,27 @@
</PossiblyUndefinedIntArrayOffset>
</file>
<file src="src/Psalm/Codebase.php">
<DeprecatedProperty occurrences="2">
<code>$this-&gt;php_major_version</code>
<code>$this-&gt;php_minor_version</code>
</DeprecatedProperty>
<PossiblyUndefinedIntArrayOffset occurrences="2">
<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">
<DeprecatedProperty occurrences="6">
<code>$codebase-&gt;php_major_version</code>
<code>$codebase-&gt;php_major_version</code>
<code>$codebase-&gt;php_major_version</code>
<code>$codebase-&gt;php_major_version</code>
<code>$codebase-&gt;php_minor_version</code>
<code>$codebase-&gt;php_minor_version</code>
</DeprecatedProperty>
</file>
<file src="src/Psalm/Config/FileFilter.php">
<PossiblyUndefinedIntArrayOffset occurrences="1">
@ -31,6 +48,15 @@
</PossiblyUndefinedIntArrayOffset>
</file>
<file src="src/Psalm/Internal/Analyzer/ClassAnalyzer.php">
<DeprecatedProperty occurrences="7">
<code>$codebase-&gt;php_major_version</code>
<code>$codebase-&gt;php_major_version</code>
<code>$codebase-&gt;php_major_version</code>
<code>$codebase-&gt;php_major_version</code>
<code>$codebase-&gt;php_minor_version</code>
<code>$codebase-&gt;php_minor_version</code>
<code>$codebase-&gt;php_minor_version</code>
</DeprecatedProperty>
<PossiblyUndefinedIntArrayOffset occurrences="3">
<code>$comments[0]</code>
<code>$stmt-&gt;props[0]</code>
@ -42,7 +68,44 @@
<code>$line_parts[1]</code>
</PossiblyUndefinedIntArrayOffset>
</file>
<file src="src/Psalm/Internal/Analyzer/FunctionLike/ReturnTypeAnalyzer.php">
<DeprecatedProperty occurrences="5">
<code>$codebase-&gt;php_major_version</code>
<code>$codebase-&gt;php_major_version</code>
<code>$codebase-&gt;php_major_version</code>
<code>$codebase-&gt;php_minor_version</code>
<code>$codebase-&gt;php_minor_version</code>
</DeprecatedProperty>
</file>
<file src="src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php">
<DeprecatedProperty occurrences="3">
<code>$codebase-&gt;php_major_version</code>
<code>$project_analyzer-&gt;getCodebase()-&gt;php_major_version</code>
<code>$project_analyzer-&gt;getCodebase()-&gt;php_minor_version</code>
</DeprecatedProperty>
</file>
<file src="src/Psalm/Internal/Analyzer/MethodComparator.php">
<DeprecatedProperty occurrences="9">
<code>$codebase-&gt;php_major_version</code>
<code>$codebase-&gt;php_major_version</code>
<code>$codebase-&gt;php_major_version</code>
<code>$codebase-&gt;php_major_version</code>
<code>$codebase-&gt;php_major_version</code>
<code>$codebase-&gt;php_major_version</code>
<code>$codebase-&gt;php_major_version</code>
<code>$codebase-&gt;php_minor_version</code>
<code>$codebase-&gt;php_minor_version</code>
</DeprecatedProperty>
</file>
<file src="src/Psalm/Internal/Analyzer/ProjectAnalyzer.php">
<DeprecatedProperty occurrences="6">
<code>$codebase-&gt;php_major_version</code>
<code>$codebase-&gt;php_minor_version</code>
<code>$this-&gt;codebase-&gt;php_major_version</code>
<code>$this-&gt;codebase-&gt;php_major_version</code>
<code>$this-&gt;codebase-&gt;php_minor_version</code>
<code>$this-&gt;codebase-&gt;php_minor_version</code>
</DeprecatedProperty>
<PossiblyUndefinedIntArrayOffset occurrences="4">
<code>$destination_parts[1]</code>
<code>$destination_parts[1]</code>
@ -82,6 +145,16 @@
<code>$catch_context-&gt;assigned_var_ids += $old_catch_assigned_var_ids</code>
</InvalidPropertyAssignmentValue>
</file>
<file src="src/Psalm/Internal/Analyzer/Statements/Expression/ArrayAnalyzer.php">
<DeprecatedProperty occurrences="6">
<code>$codebase-&gt;php_major_version</code>
<code>$codebase-&gt;php_major_version</code>
<code>$codebase-&gt;php_major_version</code>
<code>$codebase-&gt;php_major_version</code>
<code>$codebase-&gt;php_minor_version</code>
<code>$codebase-&gt;php_minor_version</code>
</DeprecatedProperty>
</file>
<file src="src/Psalm/Internal/Analyzer/Statements/Expression/AssertionFinder.php">
<PossiblyUndefinedIntArrayOffset occurrences="34">
<code>$assertion-&gt;rule[0]</code>
@ -138,6 +211,12 @@
</PossiblyUndefinedIntArrayOffset>
</file>
<file src="src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArgumentAnalyzer.php">
<DeprecatedProperty occurrences="4">
<code>$codebase-&gt;php_major_version</code>
<code>$codebase-&gt;php_major_version</code>
<code>$codebase-&gt;php_major_version</code>
<code>$codebase-&gt;php_major_version</code>
</DeprecatedProperty>
<PossiblyUndefinedIntArrayOffset occurrences="3">
<code>$non_existent_method_ids[0]</code>
<code>$parts[1]</code>
@ -174,6 +253,11 @@
<DeprecatedMethod occurrences="1">
<code>Type::getEmpty()</code>
</DeprecatedMethod>
<DeprecatedProperty occurrences="3">
<code>$codebase-&gt;php_major_version</code>
<code>$codebase-&gt;php_major_version</code>
<code>$codebase-&gt;php_minor_version</code>
</DeprecatedProperty>
</file>
<file src="src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/AtomicMethodCallAnalyzer.php">
<DeprecatedClass occurrences="1">
@ -184,6 +268,11 @@
<DeprecatedMethod occurrences="1">
<code>Type::getEmpty()</code>
</DeprecatedMethod>
<DeprecatedProperty occurrences="3">
<code>$codebase-&gt;php_major_version</code>
<code>$codebase-&gt;php_major_version</code>
<code>$codebase-&gt;php_minor_version</code>
</DeprecatedProperty>
</file>
<file src="src/Psalm/Internal/Analyzer/Statements/Expression/Call/MethodCallAnalyzer.php">
<PossiblyUndefinedIntArrayOffset occurrences="6">
@ -204,6 +293,11 @@
<DeprecatedMethod occurrences="1">
<code>Type::getEmpty()</code>
</DeprecatedMethod>
<DeprecatedProperty occurrences="3">
<code>$codebase-&gt;php_major_version</code>
<code>$codebase-&gt;php_major_version</code>
<code>$codebase-&gt;php_minor_version</code>
</DeprecatedProperty>
</file>
<file src="src/Psalm/Internal/Analyzer/Statements/Expression/CallAnalyzer.php">
<PossiblyUndefinedIntArrayOffset occurrences="3">
@ -217,6 +311,9 @@
<code>Type::getEmpty()</code>
<code>Type::getEmpty()</code>
</DeprecatedMethod>
<DeprecatedProperty occurrences="1">
<code>$statements_analyzer-&gt;getCodebase()-&gt;php_major_version</code>
</DeprecatedProperty>
</file>
<file src="src/Psalm/Internal/Analyzer/Statements/Expression/ExitAnalyzer.php">
<DeprecatedMethod occurrences="1">
@ -247,6 +344,12 @@
<code>$atomic_return_type-&gt;type_params[2]</code>
</PossiblyUndefinedIntArrayOffset>
</file>
<file src="src/Psalm/Internal/Analyzer/Statements/ExpressionAnalyzer.php">
<DeprecatedProperty occurrences="2">
<code>$statements_analyzer-&gt;getCodebase()-&gt;php_major_version</code>
<code>$statements_analyzer-&gt;getCodebase()-&gt;php_minor_version</code>
</DeprecatedProperty>
</file>
<file src="src/Psalm/Internal/Analyzer/Statements/ReturnAnalyzer.php">
<DeprecatedMethod occurrences="1">
<code>Type::getEmpty()</code>
@ -289,6 +392,10 @@
</DeprecatedMethod>
</file>
<file src="src/Psalm/Internal/Codebase/InternalCallMapHandler.php">
<DeprecatedProperty occurrences="2">
<code>$codebase-&gt;php_major_version</code>
<code>$codebase-&gt;php_minor_version</code>
</DeprecatedProperty>
<PossiblyUndefinedIntArrayOffset occurrences="2">
<code>$callables[0]</code>
<code>$callables[0]</code>
@ -347,6 +454,10 @@
</PossiblyUndefinedIntArrayOffset>
</file>
<file src="src/Psalm/Internal/PhpVisitor/Reflector/ClassLikeDocblockParser.php">
<DeprecatedProperty occurrences="2">
<code>$codebase-&gt;php_major_version</code>
<code>$codebase-&gt;php_minor_version</code>
</DeprecatedProperty>
<PossiblyUndefinedIntArrayOffset occurrences="4">
<code>$doc_line_parts[1]</code>
<code>$matches[0]</code>
@ -355,6 +466,10 @@
</PossiblyUndefinedIntArrayOffset>
</file>
<file src="src/Psalm/Internal/PhpVisitor/Reflector/ClassLikeNodeScanner.php">
<DeprecatedProperty occurrences="2">
<code>$this-&gt;codebase-&gt;php_major_version</code>
<code>$this-&gt;codebase-&gt;php_minor_version</code>
</DeprecatedProperty>
<PossiblyUndefinedIntArrayOffset occurrences="4">
<code>$imported_type_data[3]</code>
<code>$l[4]</code>
@ -362,6 +477,12 @@
<code>$var_line_parts[0]</code>
</PossiblyUndefinedIntArrayOffset>
</file>
<file src="src/Psalm/Internal/PhpVisitor/Reflector/ExpressionResolver.php">
<DeprecatedProperty occurrences="2">
<code>$codebase-&gt;php_major_version</code>
<code>$codebase-&gt;php_minor_version</code>
</DeprecatedProperty>
</file>
<file src="src/Psalm/Internal/PhpVisitor/Reflector/ExpressionScanner.php">
<PossiblyUndefinedIntArrayOffset occurrences="2">
<code>$node-&gt;getArgs()[0]</code>
@ -383,21 +504,50 @@
</PossiblyUndefinedIntArrayOffset>
</file>
<file src="src/Psalm/Internal/PhpVisitor/Reflector/FunctionLikeNodeScanner.php">
<DeprecatedProperty occurrences="11">
<code>$this-&gt;codebase-&gt;php_major_version</code>
<code>$this-&gt;codebase-&gt;php_major_version</code>
<code>$this-&gt;codebase-&gt;php_major_version</code>
<code>$this-&gt;codebase-&gt;php_major_version</code>
<code>$this-&gt;codebase-&gt;php_major_version</code>
<code>$this-&gt;codebase-&gt;php_major_version</code>
<code>$this-&gt;codebase-&gt;php_major_version</code>
<code>$this-&gt;codebase-&gt;php_minor_version</code>
<code>$this-&gt;codebase-&gt;php_minor_version</code>
<code>$this-&gt;codebase-&gt;php_minor_version</code>
<code>$this-&gt;codebase-&gt;php_minor_version</code>
</DeprecatedProperty>
<PossiblyUndefinedIntArrayOffset occurrences="1">
<code>$stmt-&gt;stmts[0]</code>
</PossiblyUndefinedIntArrayOffset>
</file>
<file src="src/Psalm/Internal/PhpVisitor/ReflectorVisitor.php">
<DeprecatedProperty occurrences="1">
<code>$this-&gt;codebase-&gt;php_major_version</code>
</DeprecatedProperty>
</file>
<file src="src/Psalm/Internal/PhpVisitor/SimpleNameResolver.php">
<PossiblyUndefinedIntArrayOffset occurrences="1">
<code>$cs[0]</code>
</PossiblyUndefinedIntArrayOffset>
</file>
<file src="src/Psalm/Internal/Scanner/FileScanner.php">
<DeprecatedProperty occurrences="2">
<code>$codebase-&gt;php_major_version</code>
<code>$codebase-&gt;php_minor_version</code>
</DeprecatedProperty>
</file>
<file src="src/Psalm/Internal/Type/Comparator/ArrayTypeComparator.php">
<DeprecatedClass occurrences="2">
<code>new TEmpty()</code>
<code>new TEmpty()</code>
</DeprecatedClass>
</file>
<file src="src/Psalm/Internal/Type/Comparator/AtomicTypeComparator.php">
<DeprecatedProperty occurrences="1">
<code>$codebase-&gt;php_major_version</code>
</DeprecatedProperty>
</file>
<file src="src/Psalm/Internal/Type/SimpleAssertionReconciler.php">
<DeprecatedClass occurrences="2">
<code>new TEmpty()</code>

View File

@ -92,6 +92,7 @@ use function substr_count;
use const PHP_MAJOR_VERSION;
use const PHP_MINOR_VERSION;
use const PHP_VERSION_ID;
class Codebase
{
@ -306,14 +307,19 @@ class Codebase
/**
* @var int
* @deprecated Removed in Psalm 5, use Codebase::$analysis_php_version_id
*/
public $php_major_version = PHP_MAJOR_VERSION;
/**
* @var int
* @deprecated Removed in Psalm 5, use Codebase::$analysis_php_version_id
*/
public $php_minor_version = PHP_MINOR_VERSION;
/** @var int */
public $analysis_php_version_id = PHP_VERSION_ID;
/** @var 'cli'|'config'|'composer'|'tests'|'runtime' */
public $php_version_source = 'runtime';

View File

@ -1307,6 +1307,7 @@ class ProjectAnalyzer
$this->codebase->php_major_version = $php_major_version;
$this->codebase->php_minor_version = $php_minor_version;
$this->codebase->analysis_php_version_id = $php_major_version * 10000 + $php_minor_version * 100;
$this->codebase->php_version_source = $source;
}