Skip to content

Commit 6ca40e1

Browse files
committed
add twig-view constraint: fixes twig complitation errors on twig <= 3.4.0
1 parent d75a4c3 commit 6ca40e1

File tree

5 files changed

+18
-13
lines changed

5 files changed

+18
-13
lines changed

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"psr/log": "^3.0"
2828
},
2929
"require-dev": {
30+
"cakephp/twig-view": "^2.0.2",
3031
"cakephp/bake": "^3.0.0",
3132
"cakephp/cakephp-codesniffer": "^5.0",
3233
"enqueue/fs": "^0.10",

templates/bake/job.twig

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313
* @license https://opensource.org/licenses/MIT MIT License
1414
*/
1515
#}
16-
<?php
17-
declare(strict_types=1);
18-
19-
namespace {{ namespace }}\Job;
20-
21-
use Cake\Queue\Job\JobInterface;
22-
use Cake\Queue\Job\Message;
23-
use Interop\Queue\Processor;
16+
{{ element('Bake.file_header', {
17+
namespace: "#{namespace}\\Job",
18+
classImports: [
19+
'Cake\\Queue\\Job\\JobInterface',
20+
'Cake\\Queue\\Job\\Message',
21+
'Interop\\Queue\\Processor',
22+
],
23+
}) }}
2424

2525
/**
2626
* {{ name }} job
@@ -30,7 +30,7 @@ class {{ name }}Job implements JobInterface
3030
{% if maxAttempts %}
3131
/**
3232
* The maximum number of times the job may be attempted.
33-
*
33+
*
3434
* @var int|null
3535
*/
3636
public static $maxAttempts = {{ maxAttempts }};
@@ -39,7 +39,7 @@ class {{ name }}Job implements JobInterface
3939
{% if isUnique %}
4040
/**
4141
* Whether there should be only one instance of a job on the queue at a time. (optional property)
42-
*
42+
*
4343
* @var bool
4444
*/
4545
public static $shouldBeUnique = true;

tests/bootstrap.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,12 @@
5454
@mkdir(CACHE . 'models');
5555
// phpcs:enable
5656

57+
$cache_key = '_cake_translations_';
58+
if (Configure::version() <= '5.1.0') {
59+
$cache_key = '_cake_core_';
60+
}
5761
Cache::setConfig([
58-
'_cake_translations_' => [
62+
$cache_key => [
5963
'engine' => 'File',
6064
'prefix' => '_cake_translations_',
6165
'serialize' => true,

tests/comparisons/JobTaskWithMaxAttempts.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class UploadJob implements JobInterface
1414
{
1515
/**
1616
* The maximum number of times the job may be attempted.
17-
*
17+
*
1818
* @var int|null
1919
*/
2020
public static $maxAttempts = 3;

tests/comparisons/JobTaskWithUnique.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class UploadJob implements JobInterface
1414
{
1515
/**
1616
* Whether there should be only one instance of a job on the queue at a time. (optional property)
17-
*
17+
*
1818
* @var bool
1919
*/
2020
public static $shouldBeUnique = true;

0 commit comments

Comments
 (0)