Comments (15)
Done: https://github.com/yiisoft/docs/blob/master/010-code-style.md#chain-calls
from form.
Great.
from form.
String length included all symbols (including prefix spaces).
from form.
Or so:
$this->assertFalse(
$validator
->validate($formModel)
->isValid()
);
from form.
@sankaest Do you want to do it and have time for this?
from form.
no problem, I'll do (will check all packages again) it by the end of this week :)
from form.
Any clues for me regarding style? What exactly should be changed and examples (from->to). @arogachev @rustamwin @darkdef
from form.
I think that reading one line of 80 characters is easier than winding two screens.
Nobody writes like this:
function tttt(
string $str
) {
from form.
@darkdef could you please copy here "bad" code style (real example, or give row number in the class) and how it should be restyled. It is always better to show how it should be, otherwise guessing a numbers with lottery will be easier, than writing a code what is good enough. :)
And is your example regarding chaining?
Also, @samdark should it be advised in some docs and/or accepted by the community?
I am confused right now, what is "correct" style.
from form.
Fo example:
example1
$this->getQuoter()->quoteTableName($table)
Vs example2
$this
->getQuoter()
->quoteTableName($table)
For me - example1 better.
And readable for human.
Example2 by codestyle, but better for pc (it's my opinion)
from form.
Yes, it should be documented. Main rules are:
- If it is a long chain that doesn't fit line length (120 characters) then each call should on a new line.
- It is is a short chain, it is alright to leave it as is.
from form.
that 120 characters is something new for me (is it final decision?) . In which yiisoft/docs/blob/master/*.md file is (or should this be) mentioned? At least I could not discover it. Need to create new one?
It seems to me, that there is quite a lot of different situations, so examples in *.md should help and clarify.
from form.
https://github.com/yiisoft/docs/blob/master/010-code-style.md is a good place to mention it. It wasn't written anywhere else yet.
from form.
@samdark what about such kind of chain? just and example (total length > 120 char).
$this->chain->withChain()->veryLongChain(['key1' => self::CONST_1, 'key2' => self::VALUE_2, 'key3' => self::CONST_VALUE_3]);
I mean we count length from $this->
till ;
with everything inside brackets of chains?
Without inside brackets it would be less, than 120 chars.
$this
->chain
->withChain()
->veryLongChain(['key1' => self::CONST_1, 'key2' => self::VALUE_2, 'key3' => self::CONST_VALUE_3]);
Just to be sure.
from form.
Related Issues (20)
- Wrong html input pattern for Url::rule HOT 11
- Allow null value for input id and label for attributes
- Widgets should not overwrite explicitly set options
- URL rule regex does not work in HTML field when IDN is enabled
- Use friendly exception for exception "Form model is not set."
- Implement template for each widget from factory. HOT 3
- Change FormModel::attributes as protected or add method like getAttributeNames HOT 6
- Use array_key_exists instead of isset on check value
- Adapt after removing result set in validator
- Rename FormErrors to FormErrorSet (and similar) - consistency, best practices HOT 1
- Nested::rule and nested forms validation fails
- Make use of PHP 8 attributes for labels, hints, etc.
- Nested rule - combine dot notation and nested structure
- Yiisoft\Form\Widget\Validator\FieldValidator::getValidatorAttributes() shouldn't apply required attribute for Required rule indiscriminately
- Remove filter of null values in methods for setting classes HOT 1
- Add `$content` parameter to `Field::*Button()` methods
- Yiisoft\Validator\DataSet\AttributeDataSet not found
- Dependency update/adjust to yiisoft/html HOT 2
- Nested array form with translations HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from form.