diff --git a/src/Psalm/Config.php b/src/Psalm/Config.php index 2633a8986..61f83ed61 100644 --- a/src/Psalm/Config.php +++ b/src/Psalm/Config.php @@ -451,11 +451,9 @@ class Config public $forbidden_functions = []; /** - * TODO: Psalm 6: Update default to be true and remove warning. - * * @var bool */ - public $find_unused_code = false; + public $find_unused_code = true; /** * @var bool @@ -467,10 +465,7 @@ class Config */ public $find_unused_psalm_suppress = false; - /** - * TODO: Psalm 6: Update default to be true and remove warning. - */ - public bool $find_unused_baseline_entry = false; + public bool $find_unused_baseline_entry = true; /** * @var bool @@ -994,9 +989,6 @@ class Config ): void { $config->config_issues = []; - // Attributes to be removed in Psalm 6 - $deprecated_attributes = []; - /** @var list */ $deprecated_elements = []; @@ -1004,12 +996,6 @@ class Config assert($psalm_element_item !== null); $attributes = $psalm_element_item->attributes; - foreach ($attributes as $attribute) { - if (in_array($attribute->name, $deprecated_attributes, true)) { - self::processDeprecatedAttribute($attribute, $file_contents, $config, $config_path); - } - } - foreach ($deprecated_elements as $deprecated_element) { $deprecated_elements_xml = $dom_document->getElementsByTagNameNS( self::CONFIG_NAMESPACE, @@ -1221,18 +1207,10 @@ class Config $config->compressor = 'deflate'; } - if (!isset($config_xml['findUnusedBaselineEntry'])) { - $config->config_warnings[] = '"findUnusedBaselineEntry" will default to "true" in Psalm 6.' - . ' You should explicitly enable or disable this setting.'; - } - if (isset($config_xml['findUnusedCode'])) { $attribute_text = (string) $config_xml['findUnusedCode']; $config->find_unused_code = $attribute_text === 'true' || $attribute_text === '1'; $config->find_unused_variables = $config->find_unused_code; - } else { - $config->config_warnings[] = '"findUnusedCode" will default to "true" in Psalm 6.' - . ' You should explicitly enable or disable this setting.'; } if (isset($config_xml['findUnusedVariablesAndParams'])) { @@ -2278,19 +2256,6 @@ class Config } } - /** @deprecated Will be removed in Psalm 6 */ - $extensions_to_load_stubs_using_deprecated_way = ['apcu', 'random', 'redis']; - foreach ($extensions_to_load_stubs_using_deprecated_way as $ext_name) { - $ext_stub_path = $ext_stubs_dir . DIRECTORY_SEPARATOR . "$ext_name.phpstub"; - $is_stub_already_loaded = in_array($ext_stub_path, $this->internal_stubs, true); - $is_ext_explicitly_disabled = ($this->php_extensions[$ext_name] ?? null) === false; - if (! $is_stub_already_loaded && ! $is_ext_explicitly_disabled && extension_loaded($ext_name)) { - $this->internal_stubs[] = $ext_stub_path; - $this->config_warnings[] = "Psalm 6 will not automatically load stubs for ext-$ext_name." - . " You should explicitly enable or disable this ext in composer.json or Psalm config."; - } - } - foreach ($this->internal_stubs as $stub_path) { if (!file_exists($stub_path)) { throw new UnexpectedValueException('Cannot locate ' . $stub_path); diff --git a/src/Psalm/ErrorBaseline.php b/src/Psalm/ErrorBaseline.php index 9a83b0a28..9615795d3 100644 --- a/src/Psalm/ErrorBaseline.php +++ b/src/Psalm/ErrorBaseline.php @@ -120,12 +120,6 @@ final class ErrorBaseline $files[$fileName][$issueType]['o'] += 1; $files[$fileName][$issueType]['s'][] = str_replace("\r\n", "\n", trim($codeSample->textContent)); } - - // TODO: Remove in Psalm 6 - $occurrencesAttr = $issue->getAttribute('occurrences'); - if ($occurrencesAttr !== '') { - $files[$fileName][$issueType]['o'] = (int) $occurrencesAttr; - } } } diff --git a/src/Psalm/Plugin/Shepherd.php b/src/Psalm/Plugin/Shepherd.php index d6b0f0dd5..5a8a30af2 100644 --- a/src/Psalm/Plugin/Shepherd.php +++ b/src/Psalm/Plugin/Shepherd.php @@ -63,21 +63,7 @@ final class Shepherd implements AfterAnalysisInterface $config = $event->getCodebase()->config; - /** - * Deprecated logic, in Psalm 6 just use $config->shepherd_endpoint - * '#' here is just a hack/marker to use a custom endpoint instead just a custom domain - * case 1: empty option (use https://shepherd.dev/hooks/psalm/) - * case 2: custom domain (/hooks/psalm should be appended) (use https://custom.domain/hooks/psalm) - * case 3: custom endpoint (/hooks/psalm should be appended) (use custom endpoint) - */ - if (substr_compare($config->shepherd_endpoint, '#', -1) === 0) { - $shepherd_endpoint = $config->shepherd_endpoint; - } else { - /** @psalm-suppress DeprecatedProperty, DeprecatedMethod */ - $shepherd_endpoint = self::buildShepherdUrlFromHost($config->shepherd_host); - } - - self::sendPayload($shepherd_endpoint, $rawPayload); + self::sendPayload($config->shepherd_endpoint, $rawPayload); } /** diff --git a/src/Psalm/Storage/FunctionLikeStorage.php b/src/Psalm/Storage/FunctionLikeStorage.php index d158b3d55..7da0a2cea 100644 --- a/src/Psalm/Storage/FunctionLikeStorage.php +++ b/src/Psalm/Storage/FunctionLikeStorage.php @@ -179,6 +179,11 @@ abstract class FunctionLikeStorage implements HasAttributesInterface public bool $has_undertyped_native_parameters = false; + /** + * @var bool + */ + public $is_static = false; + /** * @var bool */ diff --git a/src/Psalm/Storage/FunctionStorage.php b/src/Psalm/Storage/FunctionStorage.php index 813730f56..e39e7cc23 100644 --- a/src/Psalm/Storage/FunctionStorage.php +++ b/src/Psalm/Storage/FunctionStorage.php @@ -6,10 +6,4 @@ final class FunctionStorage extends FunctionLikeStorage { /** @var array */ public $byref_uses = []; - - /** - * @var bool - * @todo lift this property to FunctionLikeStorage in Psalm 6 - */ - public $is_static = false; }