Error while declaring class handle in build_phase

I have the following code which is not getting compiled as the pkt handle is declared and instantiated on the same line:

class base_test extends uvm_test;
	
	`uvm_component_utils(base_test)

	router_tb tb;

	function new(string name = "router_tb", uvm_component parent = null);
		super.new(name, parent);
	endfunction : new
	
	function void build_phase(uvm_phase phase);
		super.build_phase(phase);
		`uvm_info("%m","Build phase",UVM_HIGH)
		tb = router_tb::type_id::create("tb", this);
                packet pkt = new();
	endfunction : build_phase

	function void end_of_elaboration_phase(uvm_phase phase);
		uvm_top.print_topology();
	endfunction : end_of_elaboration_phase

endclass : base_test

However, if I declare the pkt class handle separately, the compilation is clean. Any background on this restriction?

In reply to prashantg:

The LRM states “Variable declarations shall precede any statements within a procedural block”.

Your packet is being declared after procedural code.