64 Commits

Author SHA1 Message Date
1a74b3d4f8 [minor] SCA with Php Inspections (EA Ultimate) (#15871)
* Php Inspections (EA Ultimate): use type casting where applicable

* Php Inspections (EA Ultimate): use constants where applicable

* Php Inspections (EA Ultimate): CS

* Php Inspections (EA Ultimate): address some of one-time used variables

* Php Inspections (EA Ultimate): address some of performance-related findings

* Php Inspections (EA Ultimate): address some of performance-related findings

* Php Inspections (EA Ultimate): revert a constant usage

* Php Inspections (EA Ultimate): revert sequential assignments

* Php Inspections (EA Ultimate): build is green again

* Php Inspections (EA Ultimate): revert array_merge tweaks

* Php Inspections (EA Ultimate): revert BC-incompatible one-time used variable tweak

* Update description [skip ci]

* Php Inspections (EA Ultimate): CS
2018-03-12 01:37:19 +03:00
e6f5c46cdc Fixes #15633: Deprecate some things going away/changing in 2.1
- Deprecated `yii\base\BaseObject::className()` in favor of native PHP syntax `::class`, which does not trigger autoloading
- Deprecated XCache and Zend data cache support as caching backends
- Deprecated `yii\BaseYii::powered()` method
- Added `yii\base\InvalidArgumentException` and deprecated `yii\base\InvalidParamException`
- Added `yii\BaseYii::debug()` and deprecated `yii\BaseYii::trace()`
2018-02-11 01:48:29 +03:00
5a8c3d537b Enable phpdoc_summary rule in php-cs-fixer config (#14675)
* Enable `phpdoc_summary` rule in php-cs-fixer config.

* Fix case in "PHPDoc".
2017-08-21 11:19:35 +02:00
1501c659ac Add empty lines before return statements. (#14682) [skip ci] 2017-08-21 01:58:49 +03:00
1f26db9fb7 Applied code style fixes 2017-07-21 15:42:06 +03:00
69673c0c94 Rename Object -> BaseObject for PHP 7.2 compatibility
issue #7936
2017-07-19 10:51:46 +02:00
fe8a0a6a2e Enable no_useless_else rule in php-cs-fixer (#14420) 2017-07-10 11:26:21 +03:00
ba0ab403b5 Added php-cs-fixer coding standards validation to Travis CI (#14100)
* php-cs-fixer: PSR2 rule.

* php-cs-fixer: PSR2 rule - fix views.

* Travis setup refactoring.

* Add php-cs-fixer to travis cs tests.

* Fix tests on hhvm-3.12

* improve travis config

* composer update

* revert composer update

* improve travis config

* Fix CS.

* Extract config to separate classes.

* Extract config to separate classes.

* Add file header.

* Force short array syntax.

* binary_operator_spaces fixer

* Fix broken tests

* cast_spaces fixer

* concat_space fixer

* dir_constant fixer

* ereg_to_preg fixer

* function_typehint_space fixer

* hash_to_slash_comment fixer

* is_null fixer

* linebreak_after_opening_tag fixer

* lowercase_cast fixer

* magic_constant_casing fixer

* modernize_types_casting fixer

* native_function_casing fixer

* new_with_braces fixer

* no_alias_functions fixer

* no_blank_lines_after_class_opening fixer

* no_blank_lines_after_phpdoc fixer

* no_empty_comment fixer

* no_empty_phpdoc fixer

* no_empty_statement fixer

* no_extra_consecutive_blank_lines fixer

* no_leading_import_slash fixer

* no_leading_namespace_whitespace fixer

* no_mixed_echo_print fixer

* no_multiline_whitespace_around_double_arrow fixer

* no_multiline_whitespace_before_semicolons fixer

* no_php4_constructor fixer

* no_short_bool_cast fixer

* no_singleline_whitespace_before_semicolons fixer

* no_spaces_around_offset fixer

* no_trailing_comma_in_list_call fixer

* no_trailing_comma_in_singleline_array fixer

* no_unneeded_control_parentheses fixer

* no_unused_imports fixer

* no_useless_return fixer

* no_whitespace_before_comma_in_array fixer

* no_whitespace_in_blank_line fixer

* not_operator_with_successor_space fixer

* object_operator_without_whitespace fixer

* ordered_imports fixer

* php_unit_construct fixer

* php_unit_dedicate_assert fixer

* php_unit_fqcn_annotation fixer

* phpdoc_indent fixer

* phpdoc_no_access fixer

* phpdoc_no_empty_return fixer

* phpdoc_no_package fixer

* phpdoc_no_useless_inheritdoc fixer

* Fix broken tests

* phpdoc_return_self_reference fixer

* phpdoc_single_line_var_spacing fixer

* phpdoc_single_line_var_spacing fixer

* phpdoc_to_comment fixer

* phpdoc_trim fixer

* phpdoc_var_without_name fixer

* psr4 fixer

* self_accessor fixer

* short_scalar_cast fixer

* single_blank_line_before_namespace fixer

* single_quote fixer

* standardize_not_equals fixer

* ternary_operator_spaces fixer

* trailing_comma_in_multiline_array fixer

* trim_array_spaces fixer

* protected_to_private fixer

* unary_operator_spaces fixer

* whitespace_after_comma_in_array fixer

* `parent::setRules()` -> `$this->setRules()`

* blank_line_after_opening_tag fixer

* Update finder config.

* Revert changes for YiiRequirementChecker.

* Fix array formatting.

* Add missing import.

* Fix CS for new code merged from master.

* Fix some indentation issues.
2017-06-12 12:25:45 +03:00
be658f82bf release version 2.0.12 2017-06-05 16:33:41 +02:00
e5799da1c0 Remove unnecessary variable from UrlRule.php (#13948) 2017-05-10 12:31:05 +03:00
daa8b67c7b Fixes #13350, #14094, #11288
- Bug #13350: Fixed bug with incorrect caching of `yii\web\UrlRule::createUrl()` results in `yii\web\UrlManager`.
- Bug #14094: Fixed bug when single `yii\web\UrlManager::createUrl()` call my result multiple calls of `yii\web\UrlRule::createUrl()` for the same rule.
- Enh #11288: Added support for caching of `yii\web\UrlRule::createUrl()` results in `yii\web\UrlManager` for rules with defaults.
2017-05-10 12:30:43 +03:00
94eda9bd52 Add phpdoc. [skip ci] 2017-04-26 20:24:07 +02:00
c8a323af81 Remove UrlRule::$trailingSlashForDefaults property. 2017-03-01 12:12:37 +01:00
bf841b926d Additional tests. 2017-02-19 23:19:48 +01:00
8d4a197d19 Fix bug with creating URL in UrlRule with optional params at the beginning of pattern. 2017-02-19 22:51:02 +01:00
5d81af21fb Fix bug with optional params at the beginning of pattern in UrlRule. 2017-02-19 22:26:37 +01:00
c19b2f7dc8 release version 2.0.11 2017-02-01 17:46:29 +01:00
2c5ab1e07b Used non-regex solution for trimming slashes 2017-01-31 13:42:38 +01:00
f9e83008f4 Prefer strpos to substr 2017-01-31 13:42:37 +01:00
c641513583 Implementation of support UrlRule with relative host definition
close #12697
fixes #12691
2017-01-31 13:42:31 +01:00
8faedcbd7c Refactored UrlManagerTest to cover more use cases
UrlManager is a complex class with a large bunch of options that needs
to be tested
and we had a few regressions in the past even though there are already a
lot of tests
covering it. Test coverage measured by lines does not help us determine
how good it is tested,
we need test coverage for every major path through the code.

I have refactored the UrlManager tests to reflect the different options
and cases to
have a better overview of which cases are covered and which are not.

UrlManager has two main operation modes:

- "default" url format, which is the simple case. These are covered by
  methods in `UrlManagerTest`.

- "pretty" url format. This is the complex case, which involves UrlRules
  and url parsing.
  I have created two separate classes for this case:
  Url creation for "pretty" url format is covered by
`UrlManagerCreateUrlTest`.
  Url parsing for "pretty" url format is covered by
`UrlManagerParseUrlTest`.

Each of the test classes have a `getUrlManager` method that creates a
UrlManager instance
with a specific configuration and certain variations in options.
It is also tested that options that are not relevant in a certain
operation mode have no effect on the result.

To make sure to not remove tests that have existed before, here is a map
of where code has been moved.
The following test methods existed in the [old test
class](4187718c14/tests/framework/web/UrlManagerTest.php):

- `testCreateUrl()` split between UrlManagerTest and
  UrlManagerCreateUrlTest variations should all be covered by
`variationsProvider()`.
- `testCreateUrlWithNullParams()` covered by UrlManagerCreateUrlTest by
  `testWithNullParams()`
- `testCreateUrlWithEmptyPattern()`
- `testCreateAbsoluteUrl()` covered in UrlManagerCreateUrlTest by new
  tests via `variationsProvider()`.
- `testCreateAbsoluteUrlWithSuffix()` covered in UrlManagerCreateUrlTest
  by `testAbsolutePatterns`.

- `testParseRequest()` covered by UrlManagerParseUrlTest, UrlNormalizer
  related parts moved to UrlNormalizerTest.
- `testParseRESTRequest()` moved to UrlManagerParseUrlTest
- `testHash()` covered in different tests in UrlManagerCreateUrlTest.
- `testMultipleHostsRules($host)` kept as is.

Before:

    $ vendor/bin/phpunit tests/framework/web/UrlManagerTest.php
    ...
    OK (12 tests, 89 assertions)

After:

    $ vendor/bin/phpunit tests/framework/web/UrlManager*.php
    ...
    OK (72 tests, 648 assertions)
2017-01-31 02:38:35 +01:00
be4ebdd049 Fixes #13134: Added logging URL rules (bashkarev) 2017-01-27 19:03:45 +03:00
507cc52658 Allow omit default params on URL creation
Fixes #10970
2017-01-22 22:19:13 +02:00
4aa935e69e Fixes #12055: Changed boolean to bool and integer to int in phpdoc 2016-11-07 02:51:39 +03:00
8142de23d4 Improve normalizer for URL manager 2016-08-30 21:25:23 +02:00
a7f63b6da3 Add normalizer for URL manager. 2016-08-30 21:22:58 +02:00
9d327baa8b coding style fixes 2016-05-26 11:19:32 +02:00
3d719d057e review yii\web namespaces docs 2016-02-12 16:21:32 +01:00
f620f4de90 phpdoc fixes 2016-02-07 19:48:13 +01:00
cd87d67f34 Global DOCS update: ~~~ replaced with ``` 2015-12-02 23:15:28 +02:00
e3c49f243c UrlRule::placeholders, UrlRule::substitutePlaceholderNames are now protected. Updated PHPDoc and UPDATE.md 2015-11-09 19:22:51 +02:00
289b051c4a Bug #9999: Fixed yii\web\UrlRule to allow route parameter names with -, _, .characters 2015-10-31 09:45:53 +02:00
26e5b021a8 Fixes #9246: Added yii\web\UrlRule::getParamRules() 2015-07-29 17:10:51 +03:00
72c34cda1e Fixes #6871: Fixed the bug that using defaults and hostnames in URL rules may cause an out-of-range index issue 2015-03-27 22:52:01 -04:00
792746883e urlManager: ensure route is trimmed by / on empty pattern
fixes #6717
2015-01-01 17:06:12 +01:00
899b778994 Correct type declarations 2014-10-25 16:35:50 +03:00
50fd1f586c Bug: yii\web\UrlRule was unable to create URLs for rules containing unicode characters 2014-10-24 05:06:37 +04:00
be2828d593 Fixes #5484: Fixed potential string suffix detection failure on 5.5.11 2014-10-11 09:35:55 -04:00
f010fb57b4 Enh #4581: Added ability to disable url encoding in UrlRule. 2014-08-04 00:07:36 +03:00
07f01bcf2b Used substr_compare instead of substr when we don't care about result 2014-07-23 16:37:49 +04:00
435747cf98 apidoc and codestyle fixes 2014-03-26 23:03:18 +01:00
bf3c75147d reverted breaking PHPdoc codestyle changes
issue #2852
2014-03-23 20:51:09 +01:00
b5f8a4dc22 Reformat code te be PSR-2 compatible 2014-03-16 10:46:21 +06:00
21f2f38b35 Fixes #2691: Null parameters will not be included in the generated URLs by UrlManager 2014-03-12 20:26:20 -04:00
65bfd1633b Fixes #2646: Added support for specifying hostinfo in the pattern of a URL rule 2014-03-07 09:53:55 -05:00
48a12559b2 rest api WIP 2014-03-01 23:14:16 -05:00
24e086deaf Added yii\web\UrlRuleInterface and yii\web\CompositeUrlRule 2014-02-28 14:40:25 -05:00
462c50031a Fixes #1930: Fixed domain based URL matching for website root 2014-01-17 21:06:13 +04:00
0c38655217 psr-4 move 2014-01-10 21:41:43 -05:00
0d814fa523 Moved "framework" to "iii". 2013-05-09 12:00:15 -04:00