{"record":{"id":"178df3596596ede2","repo":"sebastianbergmann/phpunit","slug":"unrecognized-order-by-option-s","errorCode":null,"errorMessage":"unrecognized --order-by option: %s","messagePattern":"unrecognized --order-by option: (.+?)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/TextUI/Configuration/Cli/Builder.php","lineNumber":903,"sourceCode":"\n                                EventFacade::emitter()->testRunnerTriggeredPhpunitDeprecation(\n                                    'Using \"size\" for --order-by is deprecated and will be removed in PHPUnit 14. Use \"size-ascending\" instead.',\n                                );\n\n                                break;\n\n                            case 'size-ascending':\n                                $executionOrder = TestSuiteSorter::ORDER_SIZE_ASCENDING;\n\n                                break;\n\n                            case 'size-descending':\n                                $executionOrder = TestSuiteSorter::ORDER_SIZE_DESCENDING;\n\n                                break;\n\n                            default:\n                                throw new Exception(\n                                    sprintf(\n                                        'unrecognized --order-by option: %s',\n                                        $order,\n                                    ),\n                                );\n                        }\n                    }\n\n                    break;\n\n                case '--process-isolation':\n                    $processIsolation = true;\n\n                    break;\n\n                case '--stderr':\n                    $stderr = true;\n","sourceCodeStart":885,"sourceCodeEnd":921,"githubUrl":"https://github.com/sebastianbergmann/phpunit/blob/f123cdb2a2d49f15025794166cfed8bda8627dd2/src/TextUI/Configuration/Cli/Builder.php#L885-L921","documentation":"Cli Builder::fromParameters() parses --order-by as a comma-separated list (explode(',', $option[1])) and each element must be one of: default, defects, depends, duration (deprecated), duration-ascending, duration-descending, no-depends, random, reverse, size (deprecated), size-ascending, size-descending. Any other element throws Exception('unrecognized --order-by option: %s') and aborts configuration building before tests run.","triggerScenarios":"Passing --order-by an unknown or misspelled value, e.g. --order-by=randome, --order-by=speed, or --order-by=default, defcts (a typo in one element of a list fails the whole option).","commonSituations":"Typos in CI pipeline flags; scripts written for other runners (e.g. --order-by=failed-first habits); using values removed or renamed between PHPUnit versions ('duration'/'size' still work but are deprecated in favor of duration-ascending/size-ascending).","solutions":["Use a valid value: default, defects, depends, duration-ascending, duration-descending, no-depends, random, reverse, size-ascending, size-descending.","When combining orders, check every comma-separated element for typos, e.g. --order-by defects,duration-ascending.","Replace deprecated aliases duration/size with duration-ascending/size-ascending to stay future-proof."],"exampleFix":"# before\nphpunit --order-by randome tests\n# => unrecognized --order-by option: randome\n\n# after\nphpunit --order-by random tests","handlingStrategy":"validation","validationCode":"$allowed = [\n    'default', 'defects', 'depends',\n    'duration', 'duration-ascending', 'duration-descending',\n    'no-depends', 'random', 'reverse',\n    'size', 'size-ascending', 'size-descending',\n];\n\nforeach (explode(',', $orderBy) as $value) {\n    if (!in_array(trim($value), $allowed, true)) {\n        throw new InvalidArgumentException(\"Invalid --order-by value '{$value}'; allowed: \" . implode(', ', $allowed));\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Centralize CLI flags in a CI template or composer script instead of repeating them per job, so typos surface once.","Validate user-supplied ordering options against the allow-list above before shelling out to phpunit.","Re-check flag values when upgrading PHPUnit; aliases like 'duration'/'size' are deprecated in favor of duration-ascending/size-ascending."],"tags":["phpunit","cli","order-by","configuration","invalid-option"],"backgroundTag":"invalid-cli-option-value","analyzedSha":"f123cdb2a2d49f15025794166cfed8bda8627dd2","analyzedAt":"2026-08-23T01:20:58.058Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}