Passed
Push — ashleyshaw-patch-1 ( d2adcf )
by Ashley
08:15
created

functions.php (1 issue)

Labels
Severity
1
<?php
2
use function Aws\serialize;
0 ignored issues
show
This use statement conflicts with another class in this namespace, serialize. Consider defining an alias.

Let?s assume that you have a directory layout like this:

.
|-- OtherDir
|   |-- Bar.php
|   `-- Foo.php
`-- SomeDir
    `-- Foo.php

and let?s assume the following content of Bar.php:

// Bar.php
namespace OtherDir;

use SomeDir\Foo; // This now conflicts the class OtherDir\Foo

If both files OtherDir/Foo.php and SomeDir/Foo.php are loaded in the same runtime, you will see a PHP error such as the following:

PHP Fatal error:  Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php

However, as OtherDir/Foo.php does not necessarily have to be loaded and the error is only triggered if it is loaded before OtherDir/Bar.php, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias:

// Bar.php
namespace OtherDir;

use SomeDir\Foo as SomeDirFoo; // There is no conflict anymore.
Loading history...
3
4
/**
5
 * LSX functions and definitions.
6
 *
7
 * @package lsx
8
 */
9
10
if ( ! defined( 'ABSPATH' ) ) {
11
	exit;
12
}
13
14
define( 'LSX_VERSION', '2.9.5' );
15
16
require get_template_directory() . '/includes/config.php';
17
require get_template_directory() . '/includes/deprecated.php';
18
require get_template_directory() . '/includes/classes/class-lsx-theme-customizer.php';
19
require get_template_directory() . '/includes/customizer.php';
20
require get_template_directory() . '/includes/sanitize.php';
21
require get_template_directory() . '/includes/layout.php';
22
require get_template_directory() . '/includes/hooks.php';
23
require get_template_directory() . '/includes/widgets.php';
24
require get_template_directory() . '/includes/scripts.php';
25
require get_template_directory() . '/includes/classes/class-lsx-nav-walker.php';
26
require get_template_directory() . '/includes/nav-navwalker.php';
27
require get_template_directory() . '/includes/classes/class-lsx-bootstrap-navwalker.php';
28
require get_template_directory() . '/includes/nav-bootstrap-navwalker.php';
29
require get_template_directory() . '/includes/classes/class-lsx-walker-comment.php';
30
require get_template_directory() . '/includes/walker-comment.php';
31
require get_template_directory() . '/includes/template-tags.php';
32
require get_template_directory() . '/includes/extras.php';
33
require get_template_directory() . '/includes/welcome.php';
34
require get_template_directory() . '/includes/404-widget.php';
35
require get_template_directory() . '/includes/gutenberg.php';
36
require get_template_directory() . '/includes/classes/class-lsx-schema-utils.php';
37
require get_template_directory() . '/includes/classes/class-lsx-schema-graph-piece.php';
38
require get_template_directory() . '/includes/classes/class-lsx-optimisation.php';
39
require get_template_directory() . '/includes/classes/class-lsx-rest-helper.php';
40
41
// Add block patterns
42
/**require get_template_directory() . '/includes/block-patterns.php'; */