Issues (325)

Security Analysis    no request data  

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

Tests/Utils/FileCompare.php (8 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace Yoghi\Bundle\MaddaBundleTest\Utils;
4
5
use SLLH\StyleCIBridge\ConfigBridge;
6
use Symfony\CS\ConfigurationResolver;
7
use Symfony\CS\FileCacheManager;
8
use Symfony\CS\Fixer;
9
use Symfony\CS\LintManager;
10
11
trait FileCompare
12
{
13
    /**
14
     * Compare generated class with expected class into resource dir
15
     *
16
     * @param string         $resourcesDir     fullPath resources dir
17
     * @param string         $namespace        namespace of class
18
     * @param string         $className        class name
19
     * @param string         $directoryOutput  output directory to compare from
20
     * @param bool           $createIfNotExist generate file if not exist equals on genereted one
21
     */
22
    private function compareClassPhp($resourcesDir, $namespace, $className, $directoryOutput, $createIfNotExist = false)
23
    {
24
        $fileExpected = $resourcesDir.'/'.$className.'.php';
25
        $fileName = $className.'.php';
26
        $fileActual = $directoryOutput.'/'.$namespace.'/'.$fileName;
27
28
        // echo file_get_contents($fileActual);
0 ignored issues
show
Unused Code Comprehensibility introduced by
63% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
29
30
        /** @var \Symfony\CS\Config\Config $config */
31
        $config = ConfigBridge::create(__DIR__.'/../../');
32
33
        $config->setUsingCache(false);
34
35
        $fixer = new Fixer();
36
        $fixer->registerBuiltInFixers();
37
        $fixer->registerBuiltInConfigs();
38
        // $fixer->setLintManager(new LintManager());
0 ignored issues
show
Unused Code Comprehensibility introduced by
67% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
39
        $fixer->registerCustomFixers($config->getCustomFixers());
40
41
        $cresolver = new ConfigurationResolver();
42
        $cresolver->setConfig($config);
43
        $cresolver->setAllFixers($fixer->getFixers());
44
        $cresolver->setOption('level', 'symfony');
45
        // $cresolver->setOption('fixers', 'eof_ending,strict_param,short_array_syntax,trailing_spaces,indentation,line_after_namespace,php_closing_tag');
0 ignored issues
show
Unused Code Comprehensibility introduced by
73% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
46
        $cresolver->setOption('fixers', 'binary_operator_spaces,blank_line_after_namespace,blank_line_after_opening_tag,blank_line_before_return,
47
                                         braces,cast_spaces,class_definition,concat_without_spaces,declare_equal_normalize,elseif,encoding,
48
                                         full_opening_tag,function_declaration,function_typehint_space,hash_to_slash_comment,heredoc_to_nowdoc,
49
                                         include,lowercase_cast,lowercase_constants,lowercase_keywords,method_argument_space,method_separation,
50
                                         native_function_casing,new_with_braces,no_alias_functions,no_blank_lines_after_class_opening,
51
                                         no_blank_lines_after_phpdoc,no_closing_tag,no_empty_phpdoc,no_empty_statement,
52
                                         no_extra_consecutive_blank_lines,no_leading_import_slash,no_leading_namespace_whitespace,
53
                                         no_multiline_whitespace_around_double_arrow,no_short_bool_cast,no_singleline_whitespace_before_semicolons,
54
                                         no_spaces_after_function_name,no_spaces_inside_offset,no_spaces_inside_parenthesis,no_tab_indentation,
55
                                         no_trailing_comma_in_list_call,no_trailing_comma_in_singleline_array,no_trailing_whitespace,
56
                                         no_trailing_whitespace_in_comment,no_unneeded_control_parentheses,no_unreachable_default_argument_value,
57
                                         no_unused_imports,no_whitespace_before_comma_in_array,no_whitespace_in_blank_line,normalize_index_brace,
58
                                         object_operator_without_whitespace,phpdoc_align,phpdoc_annotation_without_dot,phpdoc_indent,
59
                                         phpdoc_inline_tag,phpdoc_no_access,phpdoc_no_empty_return,phpdoc_no_package,phpdoc_scalar,
60
                                         phpdoc_separation,phpdoc_single_line_var_spacing,phpdoc_to_comment,phpdoc_trim,
61
                                         phpdoc_type_to_var,phpdoc_types,phpdoc_var_without_name,pre_increment,print_to_echo,psr4,self_accessor,
62
                                         short_scalar_cast,simplified_null_return,single_blank_line_at_eof,single_blank_line_before_namespace,
63
                                         single_class_element_per_statement,single_import_per_statement,single_line_after_imports,single_quote,
64
                                         space_after_semicolon,standardize_not_equals,switch_case_semicolon_to_colon,switch_case_space,
65
                                         ternary_operator_spaces,trailing_comma_in_multiline_array,trim_array_spaces,unalign_double_arrow,
66
                                         unalign_equals,unary_operator_spaces,unix_line_endings,visibility_required,whitespace_after_comma_in_array,
67
                                         short_array_syntax,linebreak_after_opening_tag,ordered_imports,no_useless_return,phpdoc_order,ordered_use,
68
                                         -phpdoc_short_description');
69
70
        $cresolver->resolve();
71
72
        $config->fixers($cresolver->getFixers());
73
74
        // $fileCacheManager = new FileCacheManager(false, $directoryOutput, $cresolver->getFixers());
0 ignored issues
show
Unused Code Comprehensibility introduced by
60% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
75
        $iFile = new SplFileInfo($fileActual, $directoryOutput.'/'.$namespace, $fileName);
76
        // $fixer->fixFile($iFile, $cresolver->getFixers(), false, false, $fileCacheManager);
0 ignored issues
show
Unused Code Comprehensibility introduced by
71% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
77
78
        $config->finder(new \ArrayIterator([$iFile]));
79
80
        // $changed =
81
        $fixer->fix($config, false, false);
82
83
        $fileActualFixed = $iFile->getPathname();
84
        $actual = file_get_contents($fileActualFixed);
85
86
        if (!file_exists($fileExpected) && $createIfNotExist) {
87
            file_put_contents($fileExpected, $actual);
88
        }
89
90
        $expected = file_get_contents($fileExpected);
91
92
        $this->assertSame($expected, $actual, 'Classe '.$className.' invalid');
0 ignored issues
show
It seems like assertSame() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
93
    }
94
95
    private function compareFile($resourcesDir, $directoryOutput, $pathFie, $createIfNotExist = false)
0 ignored issues
show
This method is not used, and could be removed.
Loading history...
96
    {
97
        $fileInput = $resourcesDir.'/'.$pathFie;
98
        $actual = file_get_contents($directoryOutput.'/'.$pathFie);
99
100
        if (!file_exists($fileInput) && $createIfNotExist) {
101
            file_put_contents($fileInput, $actual);
102
        }
103
104
        $expected = file_get_contents($fileInput);
105
106
        $this->assertSame($expected, $actual, 'File '.$pathFie.' invalid');
0 ignored issues
show
It seems like assertSame() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
107
    }
108
}
109