diff --git a/UPGRADING.md b/UPGRADING.md index 15e991fd278..70bf8292114 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -36,7 +36,6 @@ - `Psalm\Type\Atomic\TEnumCase` - `Psalm\Type\Atomic\TFalse` - `Psalm\Type\Atomic\TGenericObject` - - `Psalm\Type\Atomic\THtmlEscapedString` - `Psalm\Type\Atomic\TIntMask` - `Psalm\Type\Atomic\TIntMaskOf` - `Psalm\Type\Atomic\TIntRange` @@ -156,3 +155,6 @@ - [BC] Method `Psalm\Issue\CodeIssue::getFileName()` was removed - [BC] Method `Psalm\Issue\CodeIssue::getMessage()` was removed - [BC] Method `Psalm\DocComment::parse()` was removed + - [BC] Class `Psalm\Type\Atomic\THtmlEscapedString` has been removed + + diff --git a/docs/running_psalm/plugins/plugins_type_system.md b/docs/running_psalm/plugins/plugins_type_system.md index 311bf37df56..031cb16ad09 100644 --- a/docs/running_psalm/plugins/plugins_type_system.md +++ b/docs/running_psalm/plugins/plugins_type_system.md @@ -139,7 +139,7 @@ if (true === $first) { `TCallableString` - denotes the `callable-string` type, used to represent an unknown string that is also `callable`. -`THtmlEscapedString`, `TSqlSelectString` - these are special types, specifically for consumption by plugins. +`TSqlSelectString` - this is a special type, specifically for consumption by plugins. `TLowercaseString` - denotes a string where every character is lowercased. (which can also result from a `strtolower` call). diff --git a/examples/plugins/composer-based/echo-checker/EchoChecker.php b/examples/plugins/composer-based/echo-checker/EchoChecker.php index c75eac76a56..a7255e4fd4a 100644 --- a/examples/plugins/composer-based/echo-checker/EchoChecker.php +++ b/examples/plugins/composer-based/echo-checker/EchoChecker.php @@ -1,16 +1,15 @@ getStmt(); $statements_source = $event->getStatementsSource(); if ($stmt instanceof PhpParser\Node\Stmt\Echo_) { @@ -46,7 +46,6 @@ public static function afterStatementAnalysis(AfterStatementAnalysisEvent $event foreach ($types as $type) { if ($type instanceof TString && !$type instanceof TLiteralString - && !$type instanceof THtmlEscapedString ) { if (IssueBuffer::accepts( new ArgumentTypeCoercion( diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 2c30710e499..85b6ca14f2b 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -353,9 +353,6 @@ - - new THtmlEscapedString() - array_keys($template_type_map[$value])[0] diff --git a/src/Psalm/Internal/Type/Comparator/ScalarTypeComparator.php b/src/Psalm/Internal/Type/Comparator/ScalarTypeComparator.php index a8fdce09fc3..c387835375e 100644 --- a/src/Psalm/Internal/Type/Comparator/ScalarTypeComparator.php +++ b/src/Psalm/Internal/Type/Comparator/ScalarTypeComparator.php @@ -16,7 +16,6 @@ use Psalm\Type\Atomic\TDependentListKey; use Psalm\Type\Atomic\TFalse; use Psalm\Type\Atomic\TFloat; -use Psalm\Type\Atomic\THtmlEscapedString; use Psalm\Type\Atomic\TInt; use Psalm\Type\Atomic\TIntRange; use Psalm\Type\Atomic\TLiteralClassString; @@ -536,8 +535,7 @@ public static function isContainedBy( } if ($container_type_part instanceof TString - && ($input_type_part instanceof TNumericString - || $input_type_part instanceof THtmlEscapedString) + && $input_type_part instanceof TNumericString ) { if ($container_type_part instanceof TLiteralString) { if (is_numeric($container_type_part->value) && $atomic_comparison_result) { @@ -551,8 +549,7 @@ public static function isContainedBy( } if ($input_type_part instanceof TString - && ($container_type_part instanceof TNumericString - || $container_type_part instanceof THtmlEscapedString) + && $container_type_part instanceof TNumericString ) { if ($input_type_part instanceof TLiteralString) { return is_numeric($input_type_part->value); diff --git a/src/Psalm/Internal/Type/TypeTokenizer.php b/src/Psalm/Internal/Type/TypeTokenizer.php index 8230990b978..846062c7fc3 100644 --- a/src/Psalm/Internal/Type/TypeTokenizer.php +++ b/src/Psalm/Internal/Type/TypeTokenizer.php @@ -54,8 +54,7 @@ class TypeTokenizer 'stringable-object' => true, 'pure-callable' => true, 'pure-Closure' => true, - 'mysql-escaped-string' => true, // deprecated - 'html-escaped-string' => true, // deprecated + 'mysql-escaped-string' => true, // deprecated, should be removed in Psalm 5 'literal-string' => true, 'non-empty-literal-string' => true, 'lowercase-string' => true, diff --git a/src/Psalm/Type/Atomic.php b/src/Psalm/Type/Atomic.php index 03dbc2eb7a2..e548df58219 100644 --- a/src/Psalm/Type/Atomic.php +++ b/src/Psalm/Type/Atomic.php @@ -32,7 +32,6 @@ use Psalm\Type\Atomic\TFalse; use Psalm\Type\Atomic\TFloat; use Psalm\Type\Atomic\TGenericObject; -use Psalm\Type\Atomic\THtmlEscapedString; use Psalm\Type\Atomic\TInt; use Psalm\Type\Atomic\TIntRange; use Psalm\Type\Atomic\TIterable; @@ -269,9 +268,6 @@ public static function create( case 'numeric-string': return new TNumericString(); - case 'html-escaped-string': - return new THtmlEscapedString(); - case 'literal-string': return new TNonspecificLiteralString(); diff --git a/src/Psalm/Type/Atomic/THtmlEscapedString.php b/src/Psalm/Type/Atomic/THtmlEscapedString.php deleted file mode 100644 index 6a291a84136..00000000000 --- a/src/Psalm/Type/Atomic/THtmlEscapedString.php +++ /dev/null @@ -1,25 +0,0 @@ -getKey(); - } - - public function canBeFullyExpressedInPhp(int $analysis_php_version_id): bool - { - return false; - } -} diff --git a/tests/Config/PluginTest.php b/tests/Config/PluginTest.php index 096d51bcdc8..2476d9be4ea 100644 --- a/tests/Config/PluginTest.php +++ b/tests/Config/PluginTest.php @@ -293,55 +293,6 @@ public function testEchoAnalyzerPluginWithUnescapedString(): void $this->analyzeFile($file_path, new Context()); } - public function testEchoAnalyzerPluginWithEscapedString(): void - { - $this->project_analyzer = $this->getProjectAnalyzerWithConfig( - TestConfig::loadFromXML( - dirname(__DIR__, 2) . DIRECTORY_SEPARATOR, - ' - - - - - - - - - - - - ' - ) - ); - - $this->project_analyzer->getCodebase()->config->initializePlugins($this->project_analyzer); - - $file_path = getcwd() . '/src/somefile.php'; - - $this->addFile( - $file_path, - ' - Some text - ' - ); - - $this->analyzeFile($file_path, new Context()); - } - public function testFileAnalyzerPlugin(): void { require_once __DIR__ . '/Plugin/FilePlugin.php';