I'm using "Eclipse" and with a simple test code like that one :
class Example {
public static function isStatic() {
return "808";
}
}
class App {
public static function isTest() {
return Example::isStatic();
}
}
But I dont know why but Eclipse still telling me that "Example" in "return Example::isStatic();" cannot be resolved as a type. Why ? It's like a gag.
I try to search a solution in the SO's website but i have not find any answer that work.
If you have any hint that could help, you are welcome :)
EDIT : I'm made a little change in my question because in my previous example, you could use self and that worked fine but in the end, that did not really solve my problem. That one is more accurate to my problem
For those looking for an answer, I find the problem by myself.
In fact, I was using Eclipse Photon and this software is still in beta... I download it thinking it was already release.
I try the same manipulation with Eclipse Oxygen and everything working fine :)
Thank all for your answer and have fun developping.
Related
Im trying to learn Laravel framework and having trouble with getURLList();
In the tutorial that im following it says.
class StudInsertController extends Controller
{
public function insert(){
$urlData = getURLList();
return view('stud_create');
}
But the getURLLIST(); comes back as
Call to undefined function App\Http\Controllers\getURLList()
And i dont find any information about that.
Is it because the tutorial is for older version of Laravel?
The link to the tutorial itself is here:
https://www.studentstutorial.com/laravel/insert-data-laravel
Can somebody point me in the right direction.
I would have written this as a comment, but I don't have enough reputation.
From what the tutorials says, there are just a few files that you need to touch which effectly means they are not adding a custom helper method.
After looking at the code, I don't see any use for the line of code getting the URLs. It would have been useful if you were to pass the data forward to your view.
So I would recommend you remove the line $urlData = getURLList();. It should work just fine. I don't know if the author left it there by error.
I am completely new to PHP and I am trying to teach myself here and play with the prospect of creating my very own WordPress theme - YAY!
Anyway, I am running into a roadblock here and I am not certain if this is just the IDE I am using (PhpStorm), or if it is something else.
Here is what I am seeing in PhpStorm:
When I use Kint, it shows that the namespace is defined as shown in the screenshot above (namespace SavvyPro\Sandbox):
Here is the complete code:
namespace SavvyPro\Sandbox;
add_action('loop_start', __NAMESPACE__ . '\process_the_string');
function process_the_string()
{
$current_user = wp_get_current_user();
render_user_message($current_user->user_firstname, get_the_ID());
}
function render_user_message($first_name, $post_id)
{
d("My name is {$first_name}.");
ddd("The post ID is {$post_id}.");
}
Here is the version of PhpStorm I am currently running:
I am certain it is something quite simple for you PHP gurus out there, but since I am such a noob, it's a bit of a brain twister for me.
Any help on this is of course greatly appreciated.
Thank you all!
I emailed JetBrains support and they got back to me with the fix and it is exactly what #LazyOne mentioned in the comments section above.
I simply deleted the following folder on my Mac and it resolved the issue:
~Library/Caches/JetBrains/PhpStorm2020.2
This is still an issue with later versions of PHPStorm. I just had to delete this folder to fix this very same issue with 2022.3.1 -
~Library/Caches/JetBrains/PhpStorm2022.3
I have a big system that needs to migrated from php5 to php7. I have found tool PHP Code Fixer that helped me finding all the deprecated function and I fixed them all. But there is another thing that causes problem. I have found in the code a lot of people were returning function call in a function, something like this.
function test($array) {
return reset(callSomeArray($array));
}
This will fail as reset function expects a variable as a parameter. In php5 this worked but not in php7. This is correct way:
function test($array) {
$callArray = callSomeArray($array);
return $callArray;
}
Since this is a big software, and I cannot read the all code and test everything. I found out that reset function is causing the problem, but how to find other function that are used the same. Is there some document, or checklist, what to check for migration. Like, list of functions that expect a variable?
I have read many entries and tried a lot (for example, viewhelpers), but unfortunately nothing works (which is definitely due to my little knowledge). We use the Zend Framework 2 internally with CdliTwoStageSignup (https://github.com/cdli/CdliTwoStageSignup). In this module i want to realize that you can only register if a specific date has not been exceeded. This is currently hardcoded, but should now work with a value from the sql database. This value is already used by other modules, but I do not get it in the module CdliTwoStageSignup. Otherwise, nothing is changed on the module. Unfortunately, I have little idea of php and Zend.
hardcoded looks like this: for submission_deadline a date is manually inserted at the moment
this is from module/CdliTwoStageSignup/view/email-verfication/form.phtml
<?php
if (time() < strtotime($this->submission_deadline)) {
print '<h2>Step 1: <small>Email Verification</small></h2>';
} else {
print '<h2>Step 1: <small>Email Verification (disabled)</small></h2>';
}
Because I have little idea of the framework, I searched in other modules and found that in a view/index.phtml:
<?php
//deadlines
if($this->activeSemester){
$submission_deadline = $this->activeSemester->getDtSubmissionDeadline();
}
Can I use that?
This is a public function in /otherModule/Entity/otherModule.php
public function getDtSubmissionDeadline() {
return $this->dtSubmissionDeadline;
}
So in conclusion is my question: How can I use the variable in this module, what is my problem? I have tried solutions from similar issues, but unfortunately nothing worked. If anything is missing, I'll be happy to complete it.
Thank you very much for your help!
I am seeking to learn how to implement a grid in an application I am working on and I figured I will use zfdatagrid as it seems to take care of some of the features I need. However there is not much by way of tutorial on the net. Probably because its easy to figure out, but thing is I need help to understand how use it. I will appreaciate any link that can help or if one will be kind to give me some pointers here.
Thanks.
I now get the following error:
Fatal error: Class 'Bvb_Grid' not
found in
D:\www\lab\zfdatagrid\application\controllers\IndexController.php
and below is my indexAction
public function indexAction()
{
//Zend_Config
$config = new Zend_Config_Ini(getcwd().'\..\application\grids\grid.ini', 'production');
var_dump($config);
//Grid Initialization
$grid = Bvb_Grid::factory('Bvb_Grid_Deploy_Table', $config, 'id');
//Setting grid source
$grid->setSource(new Bvb_Grid_Source_Zend_Table(new Bugs()));
//CRUD Configuration
$form = new Bvb_Grid_Form();
$form->setAdd(true)->setEdit(true)->setDelete(true);
$grid->setForm($form);
//Pass it to the view
$this->view->pages = $grid;
$this->render('index');
}
The Bvb library is located in the Library folder.
Well silly me I found the solution to the problem in another Stack Overflow thread Zend Framework 1.10 custom Class inside library folder not found
I thought of deleting the question then I thought this may save someone following this thread a google.