1 | <?php |
||
20 | class Laravel5JsonSerializerServiceProvider extends ServiceProvider |
||
21 | { |
||
22 | const PATH = '/../../../config/json.php'; |
||
23 | |||
24 | /** |
||
25 | * Indicates if loading of the provider is deferred. |
||
26 | * |
||
27 | * @var bool |
||
28 | */ |
||
29 | protected $defer = false; |
||
30 | |||
31 | /** |
||
32 | * Bootstrap the application events. |
||
33 | */ |
||
34 | public function boot() |
||
38 | |||
39 | /** |
||
40 | * Register the service provider. |
||
41 | */ |
||
42 | public function register() |
||
54 | |||
55 | /** |
||
56 | * @param Mapper $mapper |
||
57 | * |
||
58 | * @return Mapper |
||
59 | */ |
||
60 | private static function parseRoutes(Mapper $mapper) |
||
82 | |||
83 | /** |
||
84 | * @param Mapping $mapping |
||
85 | * @param ReflectionClass $mappingClass |
||
86 | * @param string $property |
||
87 | */ |
||
88 | private static function setUrlWithReflection(Mapping $mapping, ReflectionClass $mappingClass, $property) |
||
99 | /** |
||
100 | * Get the services provided by the provider. |
||
101 | * |
||
102 | * @return array |
||
103 | */ |
||
104 | public function provides() |
||
108 | } |
||
109 |
Let?s assume that you have the following
foreach
statement:$itemValue
is assigned by reference. This is possible because the expression (in the example$array
) can be used as a reference target.However, if we were to replace
$array
with something different like the result of a function call as inthen assigning by reference is not possible anymore as there is no target that could be modified.
Available Fixes
1. Do not assign by reference
2. Assign to a local variable first
3. Return a reference