I'm using ExtDoc [code.google.com/p/ext-doc/] to generate the Documentation associated to a Javascript Application.
The problem is that when I try to declare a Private Property, that Property will never appear in the generated documentation.
This is the used annotation
/**
* This is a Private Property
* #type String
* #property name
* #private
*/
ExtDoc is outdated and no more maintained. Instead use JSDuck, which is the new official docs generator of Ext JS.
Related
Currently, I'm using vaniall js with react. For the type checks, i'm defining the types in a separate folder called types. With this i can get code suggestion in vs code. However there are 2 problem i'm still facing with it:
Auto Import does not work with this.
If I use non-existence property on an json, it wont throw error. Due to this, sometimes we may end up deploying the code without realizing the issue. Is there a way to fail the build if the json structure does not match with the type defined ?
/**
* #typedef {Object} ListState
* #property {Boolean} loading
* #property {string} error
* #property {FetchResponse} data
*/
/**
* #typedef {Object} CreateFirmState
* #property {Boolean} loading
* #property {string} error
* #property {*} data
*/
/**
* #typedef {Object} UpdateFirmState
* #property {Boolean} loading
* #property {string} error
* #property {*} data
*/
/*
* #type {UpdateFirmState}
*/
const myObject = 'hello'
// This above line should throw error because I'm defined myObject to be a string
I want to replace the existing vanilla js with the typescript, but not all the files completely. IS there a way to replce file one by one as we move forward or do we have to replace all the files?
Working my way through the levels of PHPStan with a new applicaton, I got to level 3 and started getting error messages from all my test fixtures for models. The basic format is as follows:
------
Line tests/TestCase/Model/Table/UsersTableTest.php
------
43 Property Visualize\Test\TestCase\Model\Table\UsersTableTest::$Users (Visualize\Model\Table\UsersTable) does not accept Cake\ORM\Table.
------
The code that this error refers to is:
/**
* setUp method
*
* #return void
*/
public function setUp(): void
{
parent::setUp();
$config = $this->getTableLocator()->exists('Users') ? [] : ['className' => UsersTable::class];
$this->Users = $this->getTableLocator()->get('Users', $config);
}
This setup code was build using cake bake, so I'm not sure what it's looking for. Does anyone else know what will resolve this issue for me?
EDITED: I did a bit of further searching. The only version of the getTableLocator() function I could find associated with this stack was in the TableRegistry class. That class in turn has a function called get() and that function does indeed return an object of type \Cake\Orm\Table:
/**
* Get a table instance from the registry.
*
* See options specification in {#link TableLocator::get()}.
*
* #param string $alias The alias name you want to get.
* #param array $options The options you want to build the table with.
* #return \Cake\ORM\Table
* #deprecated 3.6.0 Use {#link \Cake\ORM\Locator\TableLocator::get()} instead. Will be removed in 5.0.
*/
public static function get(string $alias, array $options = []): Table
{
return static::getTableLocator()->get($alias, $options);
}
So does this mean my tests ought to expect the \Cake\ORM\Table class? TBH, I've yet to do much of anything in the way of testing Models (as you might have guessed), thus I'm not sure the consequences of doing that.
The question is how to deduce from $this->getTableLocator()->get('Users', $config); that it should be returning Visualize\Model\Table\UsersTable.
You can write a dynamic return type extension if you come up with logic that can deduce that from the abstract syntax tree and maybe other places like configuration.
It's possible that the extension https://github.com/CakeDC/cakephp-phpstan might already tackle that, this class definitely looks like that: https://github.com/CakeDC/cakephp-phpstan/blob/master/src/Type/TableLocatorDynamicReturnTypeExtension.php
I have problem with changing parent of document inside sonata admin.
My document has property like this:
/**
* #PHPCRODM\Children(filter="teaserimage*", cascade="persist")
* #var Image[]
*/
protected $teaserImages;
....
/**
* #Validation\PhpcrImage(maxWidth="1500", maxHeight="844", minWidth="600", minHeight="338", minRatio="1.77", maxRatio="1.78", nullable=false)
*
* #return Image|null
*/
public function getTeaserImage()
{
return $this->getLocalizedImage($this->teaserImages, 'teaserimage');
}
/**
* #param Image $image
*/
public function setTeaserImage($image)
{
$this->teaserImages->add(
self::setupImage($image, $this->getLocalizedImageNodeName('teaserimage'), $this->getTeaserImage())
);
}
When i tried to change parent of any article document i got error like
The server returned a "500 Internal Server Error".
The Id is immutable (/cms/content/blog/blog-post-for-12th-october/teaserimage_de.jpg !== /cms/content/blog/blog-post-for-12th-october). Please use DocumentManager::move to move the document: blog post for 12th October (/cms/content/blog/blog-post-for-12th-october)
Although this error occurs, my document has been moved to the right place with all subdocument.
this is how my document looks like
https://gist.github.com/milosnovi/a83f400c8ff06b4de6dd96e1f149a8dd
Check your preUpdated, prePersists methods. You shouldn't flush object in these methods while the change is a parent change.
Laravel Docs provide a way to add global patterns inside the before function inside RouteServiceProvider.php.
my question is : by default there is no such function, besides, after creating it, it's not working!
/**
* Define global rules for routes.
* more specially for regullar expressions.
*
* #param \Illuminate\Routing\Router $router
* #return void
*/
public function before(Router $router){
$router->pattern('id', '[1-9]+[0-9]*');
}
Just in case you're still interested (I dont have enough points to comment), you can still declare it inside boot() but just before the $route variable is passed to the parent parent::boot($router); function, like here:
/**
* Define your route model bindings, pattern filters, etc.
*
* #param \Illuminate\Routing\Router $router
* #return void
*/
public function boot(Router $router)
{
///////////////////////////
// route global patterns //
///////////////////////////
$router->pattern('id', '[0-9]+');
parent::boot($router);
}
This worked for me
I had the same problem and what I did was to append the before() method body into the map() method body. It worked for me. :)
I have developed a custom Maven plugin and it has two Mojos. I debug it from my IDE and with one of goals it works well however it can not find the other one. It says:
Unable to find the mojo 'replace' (or one of its required components)
Here are my mojos:
Working one:
/**
* Goal for process
*
* #goal process
* #phase compile
*
* #threadSafe
*/
public class ProcessMojo extends AbstractMojo {
Not working:
/**
* Goal for replace
*
* #goal replace
* #phase compile
*
* #threadSafe
*/
public class ReplaceMojo extends AbstractMojo {
What can be the reason, any ideas?
It was probably because of something within my mojo, I have recoded it and problem is fixed.