mirror of
https://github.com/danog/psalm.git
synced 2024-12-11 16:59:45 +01:00
Remove leftovers
This commit is contained in:
parent
35a11972d4
commit
f799b68a3c
@ -451,11 +451,9 @@ class Config
|
|||||||
public $forbidden_functions = [];
|
public $forbidden_functions = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO: Psalm 6: Update default to be true and remove warning.
|
|
||||||
*
|
|
||||||
* @var bool
|
* @var bool
|
||||||
*/
|
*/
|
||||||
public $find_unused_code = false;
|
public $find_unused_code = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var bool
|
* @var bool
|
||||||
@ -467,10 +465,7 @@ class Config
|
|||||||
*/
|
*/
|
||||||
public $find_unused_psalm_suppress = false;
|
public $find_unused_psalm_suppress = false;
|
||||||
|
|
||||||
/**
|
public bool $find_unused_baseline_entry = true;
|
||||||
* TODO: Psalm 6: Update default to be true and remove warning.
|
|
||||||
*/
|
|
||||||
public bool $find_unused_baseline_entry = false;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var bool
|
* @var bool
|
||||||
@ -994,9 +989,6 @@ class Config
|
|||||||
): void {
|
): void {
|
||||||
$config->config_issues = [];
|
$config->config_issues = [];
|
||||||
|
|
||||||
// Attributes to be removed in Psalm 6
|
|
||||||
$deprecated_attributes = [];
|
|
||||||
|
|
||||||
/** @var list<string> */
|
/** @var list<string> */
|
||||||
$deprecated_elements = [];
|
$deprecated_elements = [];
|
||||||
|
|
||||||
@ -1004,12 +996,6 @@ class Config
|
|||||||
assert($psalm_element_item !== null);
|
assert($psalm_element_item !== null);
|
||||||
$attributes = $psalm_element_item->attributes;
|
$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) {
|
foreach ($deprecated_elements as $deprecated_element) {
|
||||||
$deprecated_elements_xml = $dom_document->getElementsByTagNameNS(
|
$deprecated_elements_xml = $dom_document->getElementsByTagNameNS(
|
||||||
self::CONFIG_NAMESPACE,
|
self::CONFIG_NAMESPACE,
|
||||||
@ -1221,18 +1207,10 @@ class Config
|
|||||||
$config->compressor = 'deflate';
|
$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'])) {
|
if (isset($config_xml['findUnusedCode'])) {
|
||||||
$attribute_text = (string) $config_xml['findUnusedCode'];
|
$attribute_text = (string) $config_xml['findUnusedCode'];
|
||||||
$config->find_unused_code = $attribute_text === 'true' || $attribute_text === '1';
|
$config->find_unused_code = $attribute_text === 'true' || $attribute_text === '1';
|
||||||
$config->find_unused_variables = $config->find_unused_code;
|
$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'])) {
|
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) {
|
foreach ($this->internal_stubs as $stub_path) {
|
||||||
if (!file_exists($stub_path)) {
|
if (!file_exists($stub_path)) {
|
||||||
throw new UnexpectedValueException('Cannot locate ' . $stub_path);
|
throw new UnexpectedValueException('Cannot locate ' . $stub_path);
|
||||||
|
@ -120,12 +120,6 @@ final class ErrorBaseline
|
|||||||
$files[$fileName][$issueType]['o'] += 1;
|
$files[$fileName][$issueType]['o'] += 1;
|
||||||
$files[$fileName][$issueType]['s'][] = str_replace("\r\n", "\n", trim($codeSample->textContent));
|
$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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,21 +63,7 @@ final class Shepherd implements AfterAnalysisInterface
|
|||||||
|
|
||||||
$config = $event->getCodebase()->config;
|
$config = $event->getCodebase()->config;
|
||||||
|
|
||||||
/**
|
self::sendPayload($config->shepherd_endpoint, $rawPayload);
|
||||||
* 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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -179,6 +179,11 @@ abstract class FunctionLikeStorage implements HasAttributesInterface
|
|||||||
|
|
||||||
public bool $has_undertyped_native_parameters = false;
|
public bool $has_undertyped_native_parameters = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $is_static = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var bool
|
* @var bool
|
||||||
*/
|
*/
|
||||||
|
@ -6,10 +6,4 @@ final class FunctionStorage extends FunctionLikeStorage
|
|||||||
{
|
{
|
||||||
/** @var array<string, bool> */
|
/** @var array<string, bool> */
|
||||||
public $byref_uses = [];
|
public $byref_uses = [];
|
||||||
|
|
||||||
/**
|
|
||||||
* @var bool
|
|
||||||
* @todo lift this property to FunctionLikeStorage in Psalm 6
|
|
||||||
*/
|
|
||||||
public $is_static = false;
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user