Skip to content

Commit

Permalink
More subpackages validation.
Browse files Browse the repository at this point in the history
  • Loading branch information
dereuromark authored and mscherer committed Jan 23, 2024
1 parent 8f577b8 commit 848bf92
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .gitattributes
@@ -0,0 +1,10 @@
# Define the line ending behavior of the different file extensions
# Set default behavior, in case users don't have core.autocrlf set.
* text text=auto eol=lf

.php diff=php

# Remove files for archives generated using `git archive`
.gitattributes export-ignore
phpstan.neon.dist export-ignore
tests/ export-ignore
6 changes: 6 additions & 0 deletions composer.json
Expand Up @@ -37,5 +37,11 @@
"psr-4": {
"Cake\\Datasource\\": "."
}
},
"require-dev": {
"cakephp/cache": "^5.0",
"cakephp/collection": "^5.0",
"cakephp/utility": "^5.0",
"phpstan/phpstan": "^1.10"
}
}
15 changes: 15 additions & 0 deletions phpstan.neon.dist
@@ -0,0 +1,15 @@
parameters:
level: 8
checkMissingIterableValueType: false
checkGenericClassInNonGenericObjectType: false
treatPhpDocTypesAsCertain: false
bootstrapFiles:
- tests/phpstan-bootstrap.php
paths:
- ./
excludePaths:
- vendor/
ignoreErrors:
- "#^Template type T of method Cake\\\\Datasource\\\\QueryInterface\\:\\:all\\(\\) is not referenced in a parameter\\.$#"
- '#Class Cake\\Database\\Driver\\.+ not found.#'
- '#Class Cake\\Database\\Connection not found.#'
60 changes: 60 additions & 0 deletions tests/phpstan-bootstrap.php
@@ -0,0 +1,60 @@
<?php
declare(strict_types=1);

/**
* CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link https://cakephp.org CakePHP(tm) Project
* @license https://opensource.org/licenses/mit-license.php MIT License
*/

use Cake\Core\Configure;

if (is_file('vendor/autoload.php')) {
require_once 'vendor/autoload.php';
} else {
require_once dirname(__DIR__) . '/vendor/autoload.php';
}

if (!defined('DS')) {
define('DS', DIRECTORY_SEPARATOR);
}
define('ROOT', dirname(__DIR__));
define('APP_DIR', 'TestApp');

define('TMP', sys_get_temp_dir() . DS);
define('LOGS', TMP . 'logs' . DS);
define('CACHE', TMP . 'cache' . DS);
define('SESSIONS', TMP . 'sessions' . DS);

define('CAKE_CORE_INCLUDE_PATH', ROOT);
define('CORE_PATH', CAKE_CORE_INCLUDE_PATH . DS);
define('CAKE', CORE_PATH . 'src' . DS);
define('CORE_TESTS', CORE_PATH . 'tests' . DS);
define('CORE_TEST_CASES', CORE_TESTS . 'TestCase');
define('TEST_APP', CORE_TESTS . 'test_app' . DS);

// Point app constants to the test app.
define('APP', TEST_APP . 'TestApp' . DS);
define('WWW_ROOT', TEST_APP . 'webroot' . DS);
define('CONFIG', TEST_APP . 'config' . DS);

require_once ROOT . DS . 'vendor/cakephp/core/functions.php';

date_default_timezone_set('UTC');
mb_internal_encoding('UTF-8');

Configure::write('debug', true);
Configure::write('App', [
'namespace' => 'App',
'encoding' => 'UTF-8',
]);

ini_set('intl.default_locale', 'en_US');
ini_set('session.gc_divisor', '1');
ini_set('assert.exception', '1');

0 comments on commit 848bf92

Please sign in to comment.