I think my eclipse's ctrl+clicking links might benefit greatly...
Edit: I'm using eclipse PDT.
Edit 2: I'm very happy with the solution of putting docblocks before functions (and variables) with an @return or @var statement, I've just updated the documentation of my app and now eclipse is showing me what functions are available to what...
Is there a way to hint WebIDE that a variable has some type?
I have to iterate an array of objects, and there's no auto-completion available.
This helps in ZendStudio:
/* @var ClassName $object */
I know there's a feature in JetBrains to declare an array of objects:
/**
* @return ClassName[]
*/
But this works only with function's...
Hello,
I am trying to implement Type Hinting of PHP5 on one of my class,
class ClassA {
public function method_a (ClassB $b)
{}
}
class ClassB {}
class ClassWrong{}
Correct usage:
$a = new ClassA;
$a->method_a(new ClassB);
producing error:
$a = new ClassA;
$a->method_a(new ClassWrong);
Catchable fatal error: Argu...
I'm studying Python after a lot of PHP experience and it would be handy to have type-hinting in Python. Looks like eclipse + pydev doesn't support this. Any suggestions?
For example, I want my IDE to show function docstrings and types, when I use it, like:
def f(x: int) -> int:
r"""Adds 3 to x"""
return x + 3
f( #and now IDE...
I'm working on some Java / Clojure interoperability and came across a reflection warning for the following code:
(defn load-image [resource-name]
(javax.imageio.ImageIO/read
(.getResource
(class javax.imageio.ImageIO)
resource-name)))
=> Reflection warning, clojure/repl.clj:37 - reference to field read can't be res...
I'm trying to resolve a reflection warning in Clojure that seems to result from the lack of type inference on function return values that are normal Java objects.
Trivial example code that demonstrates the issue:
(set! *warn-on-reflection* true)
(defn foo [#^Integer x] (+ 3 x))
(.equals (foo 2) (foo 2))
=> Reflection warning, NO...
In the code below I call a function (it happens to be a constructor) in which I have type hinting. When I run the code I get the following error:
Catchable fatal error: Argument 1 passed to Question::__construct() must be an instance of string, string given, called in run.php on line 3 and defined in question.php on line 15
From what...
I created a type using defrecord with type hints for the fields. However, I found that these type hints are not enforced in the constructors and I am able to do some strange things with them. Look at the snippet below for example:
user=> (defrecord Person [#^String name #^Integer age])
user.Person
user=> (seq (.getConstructors Person))
...
Hello there,
Type hinting helps the compiler to assume the type of the variable, but, as the PHP is a dynamic scripting interpreted language, the question came to my mind if it's possible that type hinting even makes the runtime faster or not?
...
I have a lot of functions that either have type hinting for arrays or use is_array() to check the array-ness of a variable.
Now I'm starting to use objects that are iterable. They implement Iterator or IteratorAggregate. Will these be accepted as arrays if they pass through type hinting, or undergo is_array()?
If I have to modify my ...
I have the following record:
(defrecord Signal [samples ^double sample-rate ^double scaling-factor])
How can I specify samples to be a double array?
I am using clojure 1.2.0
Edit:
@dreish I get the following output when I call (show Signal) after the changes from levand:
[35] <init> (Object,double,double)
[36] <init> (Object,doub...
I have a collection of custom objects (Podcast) in an array.
When I use a foreach loop to iterate through this collection, I don't have code completion on the variable that contains the object pulled out of the collection (as I would in C#/VisualStudio for instance).
Is there a way to give PHP a type hint so that Eclipse knows the type...
Is there a way to add more than one type hinting to a method? For example, foo(param) must receive a instance of string OR bar OR baz.
Thank you.
...