|
| 1 | +<?php |
| 2 | + |
| 3 | +declare(strict_types=1); |
| 4 | + |
| 5 | +/** |
| 6 | + * This file is part of CodeIgniter 4 framework. |
| 7 | + * |
| 8 | + * (c) CodeIgniter Foundation <admin@codeigniter.com> |
| 9 | + * |
| 10 | + * For the full copyright and license information, please view |
| 11 | + * the LICENSE file that was distributed with this source code. |
| 12 | + */ |
| 13 | + |
| 14 | +/** |
| 15 | + * PHPStan exceptions for the PHP samples of the user guide. |
| 16 | + * |
| 17 | + * An entry is a page relative to the project root, for all of its samples, or `page:line`, for the sample |
| 18 | + * whose opening ```php fence is on that line. |
| 19 | + * |
| 20 | + * - `excludePaths`: samples that are skipped, for errors that PHPStan does not allow to be ignored. |
| 21 | + * - `ignoreErrors`: an error identifier, optionally narrowed by a `message` pattern, ignored in the samples of the |
| 22 | + * listed `paths` or, without them, in all samples. |
| 23 | + * |
| 24 | + * @return array{ |
| 25 | + * excludePaths: list<string>, |
| 26 | + * ignoreErrors: list<array{identifier: string, message?: string, paths?: list<string>}> |
| 27 | + * } |
| 28 | + */ |
| 29 | +return [ |
| 30 | + 'excludePaths' => [ |
| 31 | + 'docs/cli/cli_signals.md:201', |
| 32 | + 'docs/cli/cli_signals.md:413', |
| 33 | + 'docs/cli/cli_signals.md:608', |
| 34 | + 'docs/cli/cli_signals.md:654', |
| 35 | + 'docs/cli/cli_signals.md:700', |
| 36 | + 'docs/concepts/services.md:135', |
| 37 | + 'docs/dbmgmt/migration.md:78', |
| 38 | + 'docs/extending/core_classes.md:64', |
| 39 | + 'docs/guides/api/controller.md:21', |
| 40 | + 'docs/guides/first-app/static_pages.md:55', |
| 41 | + 'docs/incoming/filters.md:18', |
| 42 | + 'docs/incoming/filters.md:59', |
| 43 | + 'docs/installation/upgrade_412.md:37', |
| 44 | + 'docs/libraries/encryption.md:182', |
| 45 | + 'docs/models/entities.md:659', |
| 46 | + 'docs/models/model.md:73', |
| 47 | + 'docs/models/model.md:562', |
| 48 | + 'docs/testing/fabricator.md:9', |
| 49 | + ], |
| 50 | + 'ignoreErrors' => [ |
| 51 | + // Samples are fragments: they leave out code, and the classes and functions that they refer to. |
| 52 | + ['identifier' => 'class.notFound'], |
| 53 | + ['identifier' => 'codeigniter.configArgumentInstanceof'], |
| 54 | + ['identifier' => 'codeigniter.configArgumentType'], |
| 55 | + ['identifier' => 'codeigniter.modelArgumentType'], |
| 56 | + ['identifier' => 'codeigniter.unknownServiceMethod'], |
| 57 | + ['identifier' => 'expr.resultUnused'], |
| 58 | + ['identifier' => 'function.notFound'], |
| 59 | + ['identifier' => 'method.unused'], |
| 60 | + ['identifier' => 'variable.undefined'], |
| 61 | + |
| 62 | + // A class that a sample declares, and that several samples declare differently, is resolved to one of them. |
| 63 | + [ |
| 64 | + 'identifier' => 'method.notFound', |
| 65 | + 'message' => '#^Call to an undefined method (App\\\\|Tests\\\\|SampleCommand::|MyRules::|MyTestClass::)#', |
| 66 | + ], |
| 67 | + [ |
| 68 | + 'identifier' => 'property.notFound', |
| 69 | + 'message' => '#^Access to an undefined property (App\\\\|Config\\\\|SampleCommand::)#', |
| 70 | + ], |
| 71 | + |
| 72 | + // A value that PHP coerces, a function or class that the sample does not define, or the Session of CodeIgniter 3. |
| 73 | + [ |
| 74 | + 'identifier' => 'argument.type', |
| 75 | + 'paths' => [ |
| 76 | + 'docs/cli/cli_commands.md:78', |
| 77 | + 'docs/cli/cli_library.md:240', |
| 78 | + 'docs/extending/events.md:25', |
| 79 | + 'docs/extending/events.md:50', |
| 80 | + 'docs/extending/events.md:89', |
| 81 | + 'docs/outgoing/api_responses.md:510', |
| 82 | + 'docs/outgoing/api_transformers.md:118', |
| 83 | + 'docs/outgoing/api_transformers.md:415', |
| 84 | + 'docs/testing/controllers.md:285', |
| 85 | + ], |
| 86 | + ], |
| 87 | + [ |
| 88 | + 'identifier' => 'method.nonObject', |
| 89 | + 'paths' => [ |
| 90 | + 'docs/outgoing/api_transformers.md:235', |
| 91 | + 'docs/outgoing/api_transformers.md:309', |
| 92 | + 'docs/outgoing/api_transformers.md:684', |
| 93 | + 'docs/outgoing/view_cells.md:324', |
| 94 | + 'docs/outgoing/view_cells.md:347', |
| 95 | + ], |
| 96 | + ], |
| 97 | + [ |
| 98 | + 'identifier' => 'property.notFound', |
| 99 | + 'paths' => ['docs/installation/upgrade_sessions.md:39'], |
| 100 | + ], |
| 101 | + |
| 102 | + // Samples that write the array of CodeIgniter 3 or of a configuration in the way that the page describes. |
| 103 | + [ |
| 104 | + 'identifier' => 'variable.implicitArray', |
| 105 | + 'paths' => [ |
| 106 | + 'docs/general/configuration.md:245', |
| 107 | + 'docs/incoming/routing.md:621', |
| 108 | + 'docs/installation/upgrade_localization.md:45', |
| 109 | + ], |
| 110 | + ], |
| 111 | + |
| 112 | + // Samples that show alternatives one after the other, or code that a sample does not complete. |
| 113 | + [ |
| 114 | + 'identifier' => 'catch.neverThrown', |
| 115 | + 'paths' => ['docs/cli/cli_commands.md:144', 'docs/general/logging.md:125'], |
| 116 | + ], |
| 117 | + [ |
| 118 | + 'identifier' => 'deadCode.unreachable', |
| 119 | + 'paths' => [ |
| 120 | + 'docs/installation/upgrade_localization.md:61', |
| 121 | + 'docs/outgoing/localization.md:271', |
| 122 | + 'docs/outgoing/localization.md:310', |
| 123 | + 'docs/outgoing/localization.md:377', |
| 124 | + 'docs/outgoing/response.md:31', |
| 125 | + 'docs/outgoing/view_parser.md:273', |
| 126 | + ], |
| 127 | + ], |
| 128 | + [ |
| 129 | + 'identifier' => 'if.alwaysFalse', |
| 130 | + 'paths' => ['docs/cli/cli_signals.md:527'], |
| 131 | + ], |
| 132 | + [ |
| 133 | + 'identifier' => 'outOfClass.self', |
| 134 | + 'paths' => ['docs/testing/overview.md:293'], |
| 135 | + ], |
| 136 | + [ |
| 137 | + 'identifier' => 'property.onlyWritten', |
| 138 | + 'paths' => ['docs/installation/deployment.md:78'], |
| 139 | + ], |
| 140 | + |
| 141 | + // Samples that use a class that the samples declare differently, or a name that they do not define. |
| 142 | + [ |
| 143 | + 'identifier' => 'new.noConstructor', |
| 144 | + 'paths' => [ |
| 145 | + 'docs/concepts/services.md:150', |
| 146 | + 'docs/concepts/services.md:204', |
| 147 | + 'docs/extending/core_classes.md:81', |
| 148 | + 'docs/testing/fabricator.md:50', |
| 149 | + ], |
| 150 | + ], |
| 151 | + [ |
| 152 | + 'identifier' => 'parameterByRef.type', |
| 153 | + 'paths' => ['docs/libraries/validation.md:1041'], |
| 154 | + ], |
| 155 | + [ |
| 156 | + 'identifier' => 'return.type', |
| 157 | + 'paths' => [ |
| 158 | + 'docs/concepts/services.md:150', |
| 159 | + 'docs/concepts/services.md:204', |
| 160 | + 'docs/extending/core_classes.md:81', |
| 161 | + ], |
| 162 | + ], |
| 163 | + [ |
| 164 | + 'identifier' => 'property.defaultValue', |
| 165 | + 'paths' => ['docs/outgoing/view_parser.md:518', 'docs/testing/database.md:73'], |
| 166 | + ], |
| 167 | + [ |
| 168 | + 'identifier' => 'property.nonObject', |
| 169 | + 'paths' => ['docs/testing/fabricator.md:87'], |
| 170 | + ], |
| 171 | + [ |
| 172 | + 'identifier' => 'property.protected', |
| 173 | + 'paths' => ['docs/libraries/time.md:417'], |
| 174 | + ], |
| 175 | + ], |
| 176 | +]; |
0 commit comments