Completed
Pull Request — master (#13)
by
unknown
01:55
created
Severity

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
Plugin Name: wps
4
Plugin URI: https://github.com/Rarst/wps
5
Description: WordPress plugin for Whoops error handler.
6
Author: Andrey "Rarst" Savchenko
7
Version: 
8
Author URI: http://www.rarst.net/
9
License: MIT
10
11
Copyright (c) 2013 Andrey "Rarst" Savchenko
12
13
Permission is hereby granted, free of charge, to any person obtaining a copy of this
14
software and associated documentation files (the "Software"), to deal in the Software
15
without restriction, including without limitation the rights to use, copy, modify, merge,
16
publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
17
to whom the Software is furnished to do so, subject to the following conditions:
18
19
The above copyright notice and this permission notice shall be included in all copies
20
or substantial portions of the Software.
21
22
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
23
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
24
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
25
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
26
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27
DEALINGS IN THE SOFTWARE.
28
*/
29
30
if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ) {
31
	require __DIR__ . '/vendor/autoload.php';
32
}
33
34
if ( isset( $_GET['wps_disable'] ) ) {
35
	return;
36
}
37
38
$wps = new \Rarst\wps\Plugin();
39
$wps->skipNoticesAndWarnings(Rarst\wps\Except::pluginsDirectories('akismet'));
0 ignored issues
show
The call to the method Rarst\wps\Plugin::skipNoticesAndWarnings() seems un-needed as the method has no side-effects.

PHP Analyzer performs a side-effects analysis of your code. A side-effect is basically anything that might be visible after the scope of the method is left.

Let’s take a look at an example:

class User
{
    private $email;

    public function getEmail()
    {
        return $this->email;
    }

    public function setEmail($email)
    {
        $this->email = $email;
    }
}

If we look at the getEmail() method, we can see that it has no side-effect. Whether you call this method or not, no future calls to other methods are affected by this. As such code as the following is useless:

$user = new User();
$user->getEmail(); // This line could safely be removed as it has no effect.

On the hand, if we look at the setEmail(), this method _has_ side-effects. In the following case, we could not remove the method call:

$user = new User();
$user->setEmail('email@domain'); // This line has a side-effect (it changes an
                                 // instance variable).
Loading history...
40
$wps->run();
41