Showing 3,272 of 4,939 total issues
Method createClosureForUnionTypeExtractorAndAssertionType
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function createClosureForUnionTypeExtractorAndAssertionType(Closure $union_type_extractor, int $assertion_type, int $i): ?Closure
{
switch ($assertion_type) {
case Assertion::IS_OF_TYPE:
/**
Method getKeyTypeOfArrayNode
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function getKeyTypeOfArrayNode(CodeBase $code_base, Context $context, Node $node, bool $should_catch_issue_exception = true): int
{
$key_type_enum = GenericArrayType::KEY_EMPTY;
// Check the all elements for key types.
foreach ($node->children as $child) {
Method asExpandedTypesPreservingTemplate
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function asExpandedTypesPreservingTemplate(
CodeBase $code_base,
int $recursion_depth = 0
): UnionType {
// We're going to assume that if the type hierarchy
Method isStrictSubtypeOf
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function isStrictSubtypeOf(CodeBase $code_base, UnionType $target): bool
{
// Fast-track most common cases first
$type_set = $this->type_set;
// If either type is unknown, we can't call it
Method canStrictCastToUnionType
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function canStrictCastToUnionType(CodeBase $code_base, UnionType $target): bool
{
// Fast-track most common cases first
$type_set = $this->type_set;
// If either type is unknown, we can't call it
Method visitCall
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function visitCall(Node $node): void
{
[$parent, $used] = $this->findNonUnaryParentNode($node);
if (!$parent) {
//fwrite(STDERR, "No parent in " . __METHOD__ . "\n");
Method addParametersAndUseVariablesToGraph
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private static function addParametersAndUseVariablesToGraph(
Node $node,
VariableGraph $graph,
VariableTrackingScope $scope
): array {
Method visitEmpty
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function visitEmpty(Node $node): void
{
$var_node = $node->children['expr'];
try {
$type = UnionTypeVisitor::unionTypeFromNode($this->code_base, $this->context, $var_node, false);
Method emitTypeMismatchPropertyIssue
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function emitTypeMismatchPropertyIssue(
Node $node,
Property $property,
UnionType $resolved_right_type,
UnionType $warn_type,
Method checkForInvalidNewType
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function checkForInvalidNewType(Node $node, array $class_list): void
{
// This is either a string (new 'something'()) or a class name (new something())
$class_node = $node->children['class'];
if (!$class_node instanceof Node) {
Method visitAssign
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function visitAssign(Node $node): Context
{
// Get the type of the right side of the
// assignment
$right_type = UnionTypeVisitor::unionTypeFromNode(
Method checkPassingPropertyByReference
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private static function checkPassingPropertyByReference(CodeBase $code_base, Context $context, FunctionInterface $method, Parameter $parameter, Node $argument, Property $property, int $parameter_offset): void
{
$parameter_type = $parameter->getNonVariadicUnionType();
$expr_node = $argument->children['expr'] ?? null;
if ($expr_node instanceof Node &&
Method handleJSONResponseFromWorker
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function handleJSONResponseFromWorker(array $uris_to_analyze, array $response_data): void
{
$most_recent_node_info_request = $this->most_recent_node_info_request;
if ($most_recent_node_info_request) {
if ($most_recent_node_info_request instanceof GoToDefinitionRequest) {
Method toStubSignature
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function toStubSignature(CodeBase $code_base): string
{
$string = '';
if ($this->isFinal()) {
Method canNodeKindBeNull
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private static function canNodeKindBeNull($node): bool
{
if (!$node instanceof Node) {
return false;
}
Method computeIssueSuppressionList
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private static function computeIssueSuppressionList(
string $file_contents
): array {
if (!\preg_match(self::SUPPRESS_ISSUE_REGEX, $file_contents)) {
// If the **file** doesn't contain the regex we're looking for,
Method generateClosure
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private static function generateClosure(array $callable_params, array $class_params): Closure
{
$key = \json_encode([$callable_params, $class_params]);
static $cache = [];
$closure = $cache[$key] ?? null;
Method checkSingleDefinitionReferenceOrGlobalOrStatic
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function checkSingleDefinitionReferenceOrGlobalOrStatic(
VariableGraph $graph,
string $variable_name,
array $issue_overrides_for_definition_ids
): void {
Method initPhanConfig
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function initPhanConfig(array $opts): void
{
Config::setValue('use_polyfill_parser', true);
$cwd = \getcwd();
Method visitSwitchList
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function visitSwitchList(Node $node): VariableTrackingScope
{
$outer_scope = $this->scope;
$inner_scope_list = [];