mirror of
https://github.com/danog/psalm.git
synced 2024-11-26 20:34:47 +01:00
psalm-internal - refactor - use snake_case not camelCase
This commit is contained in:
parent
ade7815f0c
commit
cd673538f1
@ -211,12 +211,12 @@ class ClassAnalyzer extends ClassLikeAnalyzer
|
||||
}
|
||||
}
|
||||
|
||||
if ($parent_class_storage->psalmInternal &&
|
||||
strpos($fq_class_name, trim($parent_class_storage->psalmInternal, '\\') . '\\') !== 0
|
||||
if ($parent_class_storage->psalm_internal &&
|
||||
strpos($fq_class_name, trim($parent_class_storage->psalm_internal, '\\') . '\\') !== 0
|
||||
) {
|
||||
if (IssueBuffer::accepts(
|
||||
new InternalClass(
|
||||
$parent_fq_class_name . ' is internal to ' . $parent_class_storage->psalmInternal,
|
||||
$parent_fq_class_name . ' is internal to ' . $parent_class_storage->psalm_internal,
|
||||
$code_location
|
||||
),
|
||||
array_merge($storage->suppressed_issues, $this->getSuppressedIssues())
|
||||
|
@ -126,13 +126,13 @@ class CommentAnalyzer
|
||||
$var_comment->deprecated = isset($comments['specials']['deprecated']);
|
||||
$var_comment->internal = isset($comments['specials']['internal']);
|
||||
if (isset($comments['specials']['psalm-internal'])) {
|
||||
$psalmInternal = reset($comments['specials']['psalm-internal']);
|
||||
if ($psalmInternal) {
|
||||
$var_comment->psalmInternal = $psalmInternal;
|
||||
$psalm_internal = reset($comments['specials']['psalm-internal']);
|
||||
if ($psalm_internal) {
|
||||
$var_comment->psalm_internal = $psalm_internal;
|
||||
} else {
|
||||
throw new DocblockParseException('psalm-internal annotation used without specifying namespace');
|
||||
}
|
||||
$var_comment->psalmInternal = reset($comments['specials']['psalm-internal']);
|
||||
$var_comment->psalm_internal = reset($comments['specials']['psalm-internal']);
|
||||
}
|
||||
|
||||
$var_comments[] = $var_comment;
|
||||
@ -382,13 +382,13 @@ class CommentAnalyzer
|
||||
}
|
||||
|
||||
if (isset($comments['specials']['psalm-internal'])) {
|
||||
$psalmInternal = reset($comments['specials']['psalm-internal']);
|
||||
if ($psalmInternal) {
|
||||
$info->psalmInternal = $psalmInternal;
|
||||
$psalm_internal = reset($comments['specials']['psalm-internal']);
|
||||
if ($psalm_internal) {
|
||||
$info->psalm_internal = $psalm_internal;
|
||||
} else {
|
||||
throw new DocblockParseException('psalm-internal annotation used without specifying namespace');
|
||||
}
|
||||
$info->psalmInternal = reset($comments['specials']['psalm-internal']);
|
||||
$info->psalm_internal = reset($comments['specials']['psalm-internal']);
|
||||
}
|
||||
|
||||
if (isset($comments['specials']['psalm-suppress'])) {
|
||||
@ -684,9 +684,9 @@ class CommentAnalyzer
|
||||
}
|
||||
|
||||
if (isset($comments['specials']['psalm-internal'])) {
|
||||
$psalmInternal = reset($comments['specials']['psalm-internal']);
|
||||
if ($psalmInternal) {
|
||||
$info->psalmInternal = $psalmInternal;
|
||||
$psalm_internal = reset($comments['specials']['psalm-internal']);
|
||||
if ($psalm_internal) {
|
||||
$info->psalm_internal = $psalm_internal;
|
||||
} else {
|
||||
throw new DocblockParseException('psalm-internal annotation used without specifying namespace');
|
||||
}
|
||||
|
@ -207,16 +207,16 @@ class MethodAnalyzer extends FunctionLikeAnalyzer
|
||||
}
|
||||
}
|
||||
|
||||
if ($storage->psalmInternal
|
||||
if ($storage->psalm_internal
|
||||
&& $context->self
|
||||
&& !$context->collect_initializations
|
||||
&& !$context->collect_mutations
|
||||
) {
|
||||
if (strpos($context->self, trim($storage->psalmInternal, '\\') . '\\') !== 0) {
|
||||
if (strpos($context->self, trim($storage->psalm_internal, '\\') . '\\') !== 0) {
|
||||
if (IssueBuffer::accepts(
|
||||
new InternalMethod(
|
||||
'The method ' . $codebase_methods->getCasedMethodId($method_id) .
|
||||
' has been marked as internal to ' . $storage->psalmInternal,
|
||||
' has been marked as internal to ' . $storage->psalm_internal,
|
||||
$code_location,
|
||||
$method_id
|
||||
),
|
||||
|
@ -496,11 +496,11 @@ class PropertyAssignmentAnalyzer
|
||||
}
|
||||
}
|
||||
|
||||
if ($property_storage->psalmInternal && $context->self) {
|
||||
if (strpos($context->self, trim($property_storage->psalmInternal, '\\') . '\\') !== 0) {
|
||||
if ($property_storage->psalm_internal && $context->self) {
|
||||
if (strpos($context->self, trim($property_storage->psalm_internal, '\\') . '\\') !== 0) {
|
||||
if (IssueBuffer::accepts(
|
||||
new InternalProperty(
|
||||
$property_id . ' is marked internal to ' . $property_storage->psalmInternal,
|
||||
$property_id . ' is marked internal to ' . $property_storage->psalm_internal,
|
||||
new CodeLocation($statements_analyzer->getSource(), $stmt),
|
||||
$property_id
|
||||
),
|
||||
|
@ -309,11 +309,11 @@ class NewAnalyzer extends \Psalm\Internal\Analyzer\Statements\Expression\CallAna
|
||||
}
|
||||
|
||||
|
||||
if ($storage->psalmInternal && $context->self) {
|
||||
if (strpos($context->self, trim($storage->psalmInternal, '\\') . '\\') !== 0) {
|
||||
if ($storage->psalm_internal && $context->self) {
|
||||
if (strpos($context->self, trim($storage->psalm_internal, '\\') . '\\') !== 0) {
|
||||
if (IssueBuffer::accepts(
|
||||
new InternalClass(
|
||||
$fq_class_name . ' is marked internal to ' . $storage->psalmInternal,
|
||||
$fq_class_name . ' is marked internal to ' . $storage->psalm_internal,
|
||||
new CodeLocation($statements_analyzer->getSource(), $stmt)
|
||||
),
|
||||
$statements_analyzer->getSuppressedIssues()
|
||||
|
@ -579,13 +579,13 @@ class StaticCallAnalyzer extends \Psalm\Internal\Analyzer\Statements\Expression\
|
||||
}
|
||||
}
|
||||
|
||||
if ($class_storage->psalmInternal
|
||||
if ($class_storage->psalm_internal
|
||||
&& $context->self
|
||||
&& strpos($context->self, trim($class_storage->psalmInternal, '\\') . '\\') !== 0
|
||||
&& strpos($context->self, trim($class_storage->psalm_internal, '\\') . '\\') !== 0
|
||||
) {
|
||||
if (IssueBuffer::accepts(
|
||||
new InternalClass(
|
||||
$fq_class_name . ' is marked internal to ' . $class_storage->psalmInternal,
|
||||
$fq_class_name . ' is marked internal to ' . $class_storage->psalm_internal,
|
||||
new CodeLocation($statements_analyzer->getSource(), $stmt)
|
||||
),
|
||||
$statements_analyzer->getSuppressedIssues()
|
||||
|
@ -594,11 +594,11 @@ class PropertyFetchAnalyzer
|
||||
}
|
||||
}
|
||||
|
||||
if ($property_storage->psalmInternal && $context->self) {
|
||||
if (strpos($context->self, trim($property_storage->psalmInternal, '\\') . '\\') !== 0) {
|
||||
if ($property_storage->psalm_internal && $context->self) {
|
||||
if (strpos($context->self, trim($property_storage->psalm_internal, '\\') . '\\') !== 0) {
|
||||
if (IssueBuffer::accepts(
|
||||
new InternalProperty(
|
||||
$property_id . ' is marked internal to ' . $property_storage->psalmInternal,
|
||||
$property_id . ' is marked internal to ' . $property_storage->psalm_internal,
|
||||
new CodeLocation($statements_analyzer->getSource(), $stmt),
|
||||
$property_id
|
||||
),
|
||||
|
@ -25,7 +25,7 @@ class ClassLikeDocblockComment
|
||||
*
|
||||
* @var null|string
|
||||
*/
|
||||
public $psalmInternal = null;
|
||||
public $psalm_internal = null;
|
||||
|
||||
/**
|
||||
* @var array<int, array{string, ?string, ?string, bool}>
|
||||
|
@ -43,7 +43,7 @@ class FunctionDocblockComment
|
||||
*
|
||||
* @var null|string
|
||||
*/
|
||||
public $psalmInternal = null;
|
||||
public $psalm_internal = null;
|
||||
|
||||
/**
|
||||
* Whether or not the function is internal
|
||||
|
@ -47,5 +47,5 @@ class VarDocblockComment
|
||||
*
|
||||
* @var null|string
|
||||
*/
|
||||
public $psalmInternal = null;
|
||||
public $psalm_internal = null;
|
||||
}
|
||||
|
@ -972,7 +972,7 @@ class ReflectorVisitor extends PhpParser\NodeVisitorAbstract implements PhpParse
|
||||
|
||||
$storage->deprecated = $docblock_info->deprecated;
|
||||
$storage->internal = $docblock_info->internal;
|
||||
$storage->psalmInternal = $docblock_info->psalmInternal;
|
||||
$storage->psalm_internal = $docblock_info->psalm_internal;
|
||||
|
||||
$storage->sealed_properties = $docblock_info->sealed_properties;
|
||||
$storage->sealed_methods = $docblock_info->sealed_methods;
|
||||
@ -1721,8 +1721,8 @@ class ReflectorVisitor extends PhpParser\NodeVisitorAbstract implements PhpParse
|
||||
$storage->internal = true;
|
||||
}
|
||||
|
||||
if ($docblock_info->psalmInternal) {
|
||||
$storage->psalmInternal = $docblock_info->psalmInternal;
|
||||
if ($docblock_info->psalm_internal) {
|
||||
$storage->psalm_internal = $docblock_info->psalm_internal;
|
||||
}
|
||||
|
||||
if ($docblock_info->variadic) {
|
||||
@ -2557,7 +2557,7 @@ class ReflectorVisitor extends PhpParser\NodeVisitorAbstract implements PhpParse
|
||||
$property_storage->has_default = $property->default ? true : false;
|
||||
$property_storage->deprecated = $var_comment ? $var_comment->deprecated : false;
|
||||
$property_storage->internal = $var_comment ? $var_comment->internal : false;
|
||||
$property_storage->psalmInternal = $var_comment ? $var_comment->psalmInternal : null;
|
||||
$property_storage->psalm_internal = $var_comment ? $var_comment->psalm_internal : null;
|
||||
|
||||
if (!$signature_type && !$doc_var_group_type) {
|
||||
if ($property->default) {
|
||||
|
@ -87,7 +87,7 @@ class ClassLikeStorage
|
||||
/**
|
||||
* @var null|string
|
||||
*/
|
||||
public $psalmInternal = null;
|
||||
public $psalm_internal = null;
|
||||
|
||||
/**
|
||||
* @var array<string, bool>
|
||||
|
@ -77,7 +77,7 @@ class FunctionLikeStorage
|
||||
/**
|
||||
* @var null|string
|
||||
*/
|
||||
public $psalmInternal;
|
||||
public $psalm_internal;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
|
@ -72,7 +72,7 @@ class PropertyStorage
|
||||
/**
|
||||
* @var null|string
|
||||
*/
|
||||
public $psalmInternal = null;
|
||||
public $psalm_internal = null;
|
||||
|
||||
public function getInfo() : string
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user