1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-13 01:37:23 +01:00

Remove leftovers

This commit is contained in:
Daniil Gentili 2023-07-24 10:06:46 +02:00
parent 35a11972d4
commit f799b68a3c
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7
5 changed files with 8 additions and 64 deletions

View File

@ -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<string> */
$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);

View File

@ -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;
}
}
}

View File

@ -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);
}
/**

View File

@ -179,6 +179,11 @@ abstract class FunctionLikeStorage implements HasAttributesInterface
public bool $has_undertyped_native_parameters = false;
/**
* @var bool
*/
public $is_static = false;
/**
* @var bool
*/

View File

@ -6,10 +6,4 @@ final class FunctionStorage extends FunctionLikeStorage
{
/** @var array<string, bool> */
public $byref_uses = [];
/**
* @var bool
* @todo lift this property to FunctionLikeStorage in Psalm 6
*/
public $is_static = false;
}