Showing 3,272 of 4,939 total issues
Method fromTypeInSignature
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function fromTypeInSignature(Node $node): UnionType
{
$is_nullable = $node->kind === ast\AST_NULLABLE_TYPE;
if ($is_nullable) {
$node = $node->children['type'];
Method getOrCreateVariableForReferenceParameter
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function getOrCreateVariableForReferenceParameter(Parameter $parameter, ?Parameter $real_parameter): Variable
{
// Return the original variable if it existed
try {
$variable = $this->getVariable();
Method getEquivalentPHPArrayElements
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function getEquivalentPHPArrayElements(Node $node, int $flags): ?array
{
$elements = [];
foreach ($node->children as $child_node) {
if (!($child_node instanceof Node)) {
Method streamPutContents
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private static function streamPutContents($stream, string $file_contents): void
{
try {
while (strlen($file_contents) > 0) {
$bytes_written = fwrite($stream, $file_contents);
Method updateFunctionSignaturesParamNames
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function updateFunctionSignaturesParamNames(): void
{
$phan_signatures = static::readSignatureMap();
$new_signatures = [];
foreach ($phan_signatures as $method_name => $arguments) {
Method afterAnalyzeFile
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function afterAnalyzeFile(
CodeBase $code_base,
Context $context,
string $file_contents,
Node $node
Method __construct
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
string $name,
UnionType $type,
int $lineno = 0,
bool $is_variadic = false,
bool $has_default_value = false,
Method emitPluginIssue
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
CodeBase $code_base,
Context $context,
string $issue_type,
string $issue_message_fmt,
array $issue_message_args = [],
Method addConstant
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
CodeBase $code_base,
Context $context,
int $lineno,
string $name,
$value,
Method addProperty
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
private function addProperty(Clazz $class, string $property_name, $default_node, UnionType $real_union_type, ?Comment\Parameter $variable, int $lineno, int $flags, ?string $doc_comment, Comment $property_comment): ?Property
Method analyzeParameterStrict
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
private static function analyzeParameterStrict(CodeBase $code_base, Context $context, FunctionInterface $method, $argument_node, UnionType $argument_type, Variable $alternate_parameter, UnionType $parameter_type, int $lineno, int $i): void
Method astDeclClosure
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
bool $by_ref,
bool $static,
ast\Node $params,
?\ast\Node $uses,
ast\Node $stmts,
Method suggestSimilarGlobalFunctionInNewerVersion
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function suggestSimilarGlobalFunctionInNewerVersion(
string $namespace,
string $function_name,
Context $context,
bool $suggest_in_global_namespace
Method recomputeFileList
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function recomputeFileList(): void
{
$this->file_list = $this->file_list_in_config;
if (!$this->file_list_only) {
Method toStub
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function toStub(bool $class_is_interface = false): string
{
$string = ' ';
if ($this->isFinal()) {
$string .= 'final ';
Method functionListFromReflectionFunction
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function functionListFromReflectionFunction(
FullyQualifiedFunctionName $fqsen,
\ReflectionFunction $reflection_function
): array {
Method fromStringInContext
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function fromStringInContext(
string $fqsen_string,
Context $context
) {
$parts = \explode('::', $fqsen_string);
Method canCastToNonNullableTypeHandlingTemplates
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function canCastToNonNullableTypeHandlingTemplates(Type $type, CodeBase $code_base): bool
{
if (parent::canCastToNonNullableTypeHandlingTemplates($type, $code_base)) {
return true;
}
Method getTemplateTypeExtractorClosure
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function getTemplateTypeExtractorClosure(CodeBase $code_base, TemplateType $template_type): ?Closure
{
// Create a closure to extract types for the template type from the return type and param types.
$closure = $this->getReturnTemplateTypeExtractorClosure($code_base, $template_type);
foreach ($this->params as $i => $param) {
Method applyUnaryBitwiseNotOperatorToList
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private static function applyUnaryBitwiseNotOperatorToList(array $type_set, bool $is_real): array
{
if (!$type_set) {
// Can be int|string
return UnionType::typeSetFromString($is_real ? 'int|string' : 'int');