Skip to content

Commit

Permalink
Merge pull request #277 from FriendsOfCake/updates
Browse files Browse the repository at this point in the history
Updates
  • Loading branch information
ADmad authored May 27, 2020
2 parents fe149ef + f14533e commit c3884f8
Show file tree
Hide file tree
Showing 7 changed files with 92 additions and 20 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ docs export-ignore
.github export-ignore
.coveralls.yml export-ignore
Makefile export-ignore
phpstan.neon export-ignore
phpstan-baseline.neon export-ignore
psalm.xml export-ignore
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ before_script:
- if [[ $LOWEST = 0 ]]; then composer install --prefer-dist --no-interaction; fi
- if [[ $LOWEST = 1 ]]; then composer update --prefer-lowest --prefer-dist --no-interaction; fi

- if [[ $PHPCS = 1 ]]; then composer require cakephp/cakephp-codesniffer:dev-next; fi
- if [[ $PHPCS = 1 ]]; then composer require cakephp/cakephp-codesniffer:^4.2; fi
- if [[ $STATIC_ANALYSIS = 1 ]]; then composer require phpstan/phpstan:^0.12 psalm/phar:^3.7; fi

script:
Expand Down
11 changes: 6 additions & 5 deletions config/asset_compress.ini
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
[crudview.css]
files[]=https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap.css
files[]=https://cdn.jsdelivr.net/npm/[email protected]/dist/flatpickr.min.css
files[]=https://cdn.jsdelivr.net/npm/@fortawesome/[email protected]/css/all.min.css
files[]=https://cdn.jsdelivr.net/npm/bootstrap@^4.5/dist/css/bootstrap.min.css
files[]=https://cdn.jsdelivr.net/npm/[email protected]/dist/flatpickr.min.css
files[]=https://cdn.jsdelivr.net/npm/[email protected]/dist/css/select2.min.css
files[]=https://cdn.jsdelivr.net/npm/@ttskch/[email protected]/dist/select2-bootstrap4.css
files[]=plugin:CrudView:css/local.css

[crudview_head.js]
files[]=https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js
files[]=https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/js/bootstrap.min.js
files[]=https://cdn.jsdelivr.net/npm/jquery@^3.4/dist/jquery.min.js
files[]=https://cdn.jsdelivr.net/npm/bootstrap@^4.5/dist/js/bootstrap.min.js
files[]=https://cdn.jsdelivr.net/npm/[email protected]
files[]=https://cdn.jsdelivr.net/npm/[email protected]
files[]=https://cdn.jsdelivr.net/jquery.dirtyforms/1.2.3/jquery.dirtyforms.min.js
files[]=https://cdn.jsdelivr.net/npm/jquery.dirtyforms@2/jquery.dirtyforms.min.js

[crudview.js]
files[]=plugin:CrudView:js/local.js
72 changes: 72 additions & 0 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
parameters:
ignoreErrors:
-
message: "#^Access to an undefined property object\\:\\:\\$query\\.$#"
count: 4
path: src/Listener/ViewListener.php

-
message: "#^Access to an undefined property object\\:\\:\\$params\\.$#"
count: 1
path: src/Listener/ViewListener.php

-
message: "#^Access to an undefined property object\\:\\:\\$element\\.$#"
count: 1
path: src/Listener/ViewListener.php

-
message: "#^Access to an undefined property object\\:\\:\\$type\\.$#"
count: 1
path: src/Listener/ViewListener.php

-
message: "#^Parameter \\#2 \\$arr2 of function array_diff_key expects array, array\\|false given\\.$#"
count: 1
path: src/Listener/ViewListener.php

-
message: "#^Result of \\|\\| is always false\\.$#"
count: 1
path: src/Listener/ViewListener.php

-
message: "#^Cannot unset offset mixed on array\\(\\)\\.$#"
count: 2
path: src/Listener/ViewListener.php

-
message: "#^Parameter \\#1 \\$field of method CrudView\\\\Listener\\\\ViewListener\\:\\:_deriveFieldFromContext\\(\\) expects string, array\\<string\\>\\|string\\|null given\\.$#"
count: 1
path: src/Listener/ViewListener.php

-
message: "#^Call to an undefined method Cake\\\\ORM\\\\Table\\:\\:searchManager\\(\\)\\.$#"
count: 1
path: src/Listener/ViewSearchListener.php

-
message: "#^Offset 'data\\-wrap' does not exist on array\\(\\?'data\\-enable\\-seconds' \\=\\> 'true', 'data\\-date\\-format' \\=\\> string, \\?'data\\-enable\\-time' \\=\\> 'true', \\?'data\\-alt\\-format' \\=\\> mixed, \\?'data\\-alt\\-input' \\=\\> 'true', \\?'data\\-no\\-calendar' \\=\\> 'true'\\)\\.$#"
count: 1
path: src/View/Widget/DateTimeWidget.php

-
message: "#^Binary operation \"\\+\\=\" between array\\<string\\>\\|string and array\\('data\\-date\\-format' \\=\\> string, \\?'data\\-alt\\-format' \\=\\> mixed, \\?'data\\-alt\\-input' \\=\\> 'true', \\?'data\\-no\\-calendar' \\=\\> 'true', \\?'data\\-enable\\-seconds' \\=\\> 'true', \\?'data\\-enable\\-time' \\=\\> 'true', 'data\\-wrap' \\=\\> mixed\\) results in an error\\.$#"
count: 1
path: src/View/Widget/DateTimeWidget.php

-
message: "#^Offset 'name' does not exist on array\\<string\\>\\|string\\.$#"
count: 1
path: src/View/Widget/DateTimeWidget.php

-
message: "#^Offset 'templateVars' does not exist on array\\<string\\>\\|string\\.$#"
count: 2
path: src/View/Widget/DateTimeWidget.php

-
message: "#^Parameter \\#1 \\$options of method Cake\\\\View\\\\StringTemplate\\:\\:formatAttributes\\(\\) expects array\\|null, array\\<string\\>\\|string given\\.$#"
count: 1
path: src/View/Widget/DateTimeWidget.php

14 changes: 3 additions & 11 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
includes:
- phpstan-baseline.neon

parameters:
level: 7
checkMissingIterableValueType: false
universalObjectCratesClasses:
- Crud\Event\Subject
ignoreErrors:
- '#Parameter \#1 $dateString of method Cake\\View\\Helper\\TimeHelper::nice() expects DateTime|int|string|null, DateTime|DateTimeImmutable|int|string given#'
-
message: '#Result of || is always false#'
path: 'src/Listener/ViewListener.php'
-
message: '#Call to an undefined method Cake\\ORM\\Table::searchManager\(\)#'
path: 'src/Listener/ViewSearchListener.php'
-
message: '#Method CrudView\\Action\\DashboardAction::_get\(\) should return Cake\\Http\\Response|void but return statement is missing#'
path: 'src/Action/DashboardAction.php'
5 changes: 2 additions & 3 deletions src/View/Widget/DateTimeWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,12 @@ public function render(array $data, ContextInterface $context): string

$iconClass = 'fa fa-calendar-alt';
if (isset($datetimePicker['iconClass'])) {
$iconClass = $data['iconClass'];
$iconClass = $datetimePicker['iconClass'];
unset($datetimePicker['iconClass']);
} elseif ($data['type'] === 'time') {
$iconClass = 'fa fa-clock';
}

unset($datetimePicker['iconClass']);

if ($this->_templates->get('datetimePicker') === null) {
// phpcs:disable
$this->_templates->add([
Expand Down
5 changes: 5 additions & 0 deletions webroot/js/local.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,18 @@ var CrudView = {
})
},

tooltip: function () {
$('[data-toggle="tooltip"]').tooltip();
},

initialize: function () {
this.bulkActionForm('.bulk-actions');
this.flatpickr('.flatpickr');
this.select2('select[multiple]:not(.no-select2), .select2');
this.autocomplete('input.autocomplete, select.autocomplete');
this.dirtyForms();
this.dropdown();
this.tooltip();
}
};

Expand Down

0 comments on commit c3884f8

Please sign in to comment.