allebb / netbeans-psr-formatting Goto Github PK
View Code? Open in Web Editor NEWNetBeans configuration settings for PSR 1&2
License: MIT License
NetBeans configuration settings for PSR 1&2
License: MIT License
I've followed the steps how you have suggested in Netbeans 8.1 and 8.2 in Ubuntu 14.04 but formatting styles are not applying.
This issue persists for both this config, and native Netbeans. Native Netbeans controls do not allow distinction between class method brackets and lone function closures. (So I'm not even sure this is fixable with a config file alone)
Current behavior:
function current_behavior()
{
// code
}
Desired behavior:
function desired_behavior() {
// code
}
hello!
nice to see that you've opened a git repo for this.
I am trying to figure out which settings you've adopted within you zip.
Perhabs you could elaborate in your readme for this?
This would also enable others to do suggestions for improvements / updates.
thanks!
Hi @bobsta63.
Could you provide a Netbeans zip ready to import in the release v1.0.1 as you did in v1.0.0?
If not, please add some information in the Installation section about the differences in import.
Please, fix this.
Example:
/**
* Constructor
*
* @param \Magento\Framework\App\Helper\Context $context
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
* @param \Magento\Customer\Model\Session $customerSession
*/
public function __construct(
\Magento\Framework\App\Helper\Context $context, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Customer\Model\Session $customerSession
)
{
$this->_scopeConfig = $scopeConfig;
$this->customerSession = $customerSession;
$this->isEnabled = $this->_scopeConfig->getValue(self::XML_CONFIG_ENABLE);
parent::__construct($context);
}
โ
/**
* Constructor
*
* @param \Magento\Framework\App\Helper\Context $context
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
* @param \Magento\Customer\Model\Session $customerSession
*/
public function __construct(
\Magento\Framework\App\Helper\Context $context,
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
\Magento\Customer\Model\Session $customerSession
) {
$this->_scopeConfig = $scopeConfig;
$this->customerSession = $customerSession;
$this->isEnabled = $this->_scopeConfig->getValue(self::XML_CONFIG_ENABLE);
parent::__construct($context);
}
PSR:
<?php
namespace Vendor\Package;
class ClassName
{
public function aVeryLongMethodName(
ClassTypeHint $arg1,
&$arg2,
array $arg3 = []
) {
// method body
}
}
When the argument list is split across multiple lines, the closing parenthesis and opening brace MUST be placed together on their own line with one space between them.
There already is a repo doing just the same:
https://github.com/maniaplanet/netbeans-psr
I suggest contacting that author and see how both repo's can be combined to one awesome one. This will make it more clear for the users to know which one they should use.
Their issue: maniaplanet/netbeans-psr#6
When the argument list is split across multiple lines, the closing parenthesis
and opening brace MUST be placed together on their own line with one space
between them.
https://www.php-fig.org/psr/psr-2/#44-method-arguments
Bug:
class ClassName
{
public function aVeryLongMethodName(
ClassTypeHint $arg1,
&$arg2,
array $arg3 = []
)
{ // <--- should be on the above line, ) {
// method body
}
}
I formatted a php file in PHP sotrm, and it looked like this:
I then opened it in netbeans with thsi plugin and formatted it and it looked like this:
This then has the problem of making the end of my file look like this:
Is there any way I can prevent this? I tried reducing the continuation indentation to 0, but it doesnt seem the right thing to do.
Thanks
Just a hint: https://www.php-fig.org/psr/psr-12/ ๐
Hope netbeans will be able to support it
Deleted
"The latest release" in the readme doesn't point to the latest release. Should be 1.0.1
Although technically the current implementation that is configured in release 1.0.0 of this Netbeans extension does not violate the PSR standards (as discussed here: PHP-CS-Fixer/PHP-CS-Fixer#641) it has now been noted by a couple of people that it would be better to add it on a new line following the opening PHP tag <?php
So instead of:
<?php namespace MyNamespace;
It should be changed to:
<?php
namespace MyNamespace;
At present following my investigation there is a bug since Netbeans 8.0 which prevents this from being added, the bug is described here: https://netbeans.org/bugzilla/show_bug.cgi?id=243744
I will keep track on this bug and will implement this enhancement as soon as technically possible (when NetBeans implemented this functionality)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.