End syntax for unbracketed namespace (to mix with bracketed namespace)
As we know, we can't use/mix namespaces in a single file like this:
namespace A;
...
...
namespace B{
...
}
does there exist any end
syntax for unbracketed namespace, so it would become available to mix two namespaces? (like it's endif;
for unbracketed if
) ?
p.s. please, don't suggest to use brackets, I know that already (hence, my question is not "how to mix two namespaces in single file"). but my question is what I ask - if there is an end
syntax for unbracketed NS.
php namespaces
|
show 1 more comment
As we know, we can't use/mix namespaces in a single file like this:
namespace A;
...
...
namespace B{
...
}
does there exist any end
syntax for unbracketed namespace, so it would become available to mix two namespaces? (like it's endif;
for unbracketed if
) ?
p.s. please, don't suggest to use brackets, I know that already (hence, my question is not "how to mix two namespaces in single file"). but my question is what I ask - if there is an end
syntax for unbracketed NS.
php namespaces
I would like to emphasise the comment in the answer However is strongly not recommended to declare two namespaces inside same php script
– Nigel Ren
Nov 18 '18 at 8:12
1
No, it's not possible. Hence the fatal error Cannot mix bracketed namespace declarations with unbracketed namespace declarations...
– revo
Nov 18 '18 at 8:13
@NigelRen are you sure that this is a duplicate question? please, re-read it -it is different.
– T.Todua
Nov 18 '18 at 8:16
I flagged the dupe as that is how is has to be done AFAIK. If you want me to remove it and see if anyone can come up with something else then I will. It would probably help if you added a specific use case so that it would explain why you want to do this to make the context clearer (IMHO).
– Nigel Ren
Nov 18 '18 at 8:22
The dupe I flagged was stackoverflow.com/questions/22606792/…, but see if anything else comes up.
– Nigel Ren
Nov 18 '18 at 8:24
|
show 1 more comment
As we know, we can't use/mix namespaces in a single file like this:
namespace A;
...
...
namespace B{
...
}
does there exist any end
syntax for unbracketed namespace, so it would become available to mix two namespaces? (like it's endif;
for unbracketed if
) ?
p.s. please, don't suggest to use brackets, I know that already (hence, my question is not "how to mix two namespaces in single file"). but my question is what I ask - if there is an end
syntax for unbracketed NS.
php namespaces
As we know, we can't use/mix namespaces in a single file like this:
namespace A;
...
...
namespace B{
...
}
does there exist any end
syntax for unbracketed namespace, so it would become available to mix two namespaces? (like it's endif;
for unbracketed if
) ?
p.s. please, don't suggest to use brackets, I know that already (hence, my question is not "how to mix two namespaces in single file"). but my question is what I ask - if there is an end
syntax for unbracketed NS.
php namespaces
php namespaces
edited Nov 18 '18 at 8:15
T.Todua
asked Nov 18 '18 at 8:02
T.ToduaT.Todua
29.8k12132130
29.8k12132130
I would like to emphasise the comment in the answer However is strongly not recommended to declare two namespaces inside same php script
– Nigel Ren
Nov 18 '18 at 8:12
1
No, it's not possible. Hence the fatal error Cannot mix bracketed namespace declarations with unbracketed namespace declarations...
– revo
Nov 18 '18 at 8:13
@NigelRen are you sure that this is a duplicate question? please, re-read it -it is different.
– T.Todua
Nov 18 '18 at 8:16
I flagged the dupe as that is how is has to be done AFAIK. If you want me to remove it and see if anyone can come up with something else then I will. It would probably help if you added a specific use case so that it would explain why you want to do this to make the context clearer (IMHO).
– Nigel Ren
Nov 18 '18 at 8:22
The dupe I flagged was stackoverflow.com/questions/22606792/…, but see if anything else comes up.
– Nigel Ren
Nov 18 '18 at 8:24
|
show 1 more comment
I would like to emphasise the comment in the answer However is strongly not recommended to declare two namespaces inside same php script
– Nigel Ren
Nov 18 '18 at 8:12
1
No, it's not possible. Hence the fatal error Cannot mix bracketed namespace declarations with unbracketed namespace declarations...
– revo
Nov 18 '18 at 8:13
@NigelRen are you sure that this is a duplicate question? please, re-read it -it is different.
– T.Todua
Nov 18 '18 at 8:16
I flagged the dupe as that is how is has to be done AFAIK. If you want me to remove it and see if anyone can come up with something else then I will. It would probably help if you added a specific use case so that it would explain why you want to do this to make the context clearer (IMHO).
– Nigel Ren
Nov 18 '18 at 8:22
The dupe I flagged was stackoverflow.com/questions/22606792/…, but see if anything else comes up.
– Nigel Ren
Nov 18 '18 at 8:24
I would like to emphasise the comment in the answer However is strongly not recommended to declare two namespaces inside same php script
– Nigel Ren
Nov 18 '18 at 8:12
I would like to emphasise the comment in the answer However is strongly not recommended to declare two namespaces inside same php script
– Nigel Ren
Nov 18 '18 at 8:12
1
1
No, it's not possible. Hence the fatal error Cannot mix bracketed namespace declarations with unbracketed namespace declarations...
– revo
Nov 18 '18 at 8:13
No, it's not possible. Hence the fatal error Cannot mix bracketed namespace declarations with unbracketed namespace declarations...
– revo
Nov 18 '18 at 8:13
@NigelRen are you sure that this is a duplicate question? please, re-read it -it is different.
– T.Todua
Nov 18 '18 at 8:16
@NigelRen are you sure that this is a duplicate question? please, re-read it -it is different.
– T.Todua
Nov 18 '18 at 8:16
I flagged the dupe as that is how is has to be done AFAIK. If you want me to remove it and see if anyone can come up with something else then I will. It would probably help if you added a specific use case so that it would explain why you want to do this to make the context clearer (IMHO).
– Nigel Ren
Nov 18 '18 at 8:22
I flagged the dupe as that is how is has to be done AFAIK. If you want me to remove it and see if anyone can come up with something else then I will. It would probably help if you added a specific use case so that it would explain why you want to do this to make the context clearer (IMHO).
– Nigel Ren
Nov 18 '18 at 8:22
The dupe I flagged was stackoverflow.com/questions/22606792/…, but see if anything else comes up.
– Nigel Ren
Nov 18 '18 at 8:24
The dupe I flagged was stackoverflow.com/questions/22606792/…, but see if anything else comes up.
– Nigel Ren
Nov 18 '18 at 8:24
|
show 1 more comment
1 Answer
1
active
oldest
votes
There is no alternative syntax and endnamespace
keyword, because there is no real need for it.
Using multiple namespaces in one file is a bad practice and should be avoided anyway, so one way to do this is more than enough. if
and endif
(and similar) was designed for using in templates since it increase readability when you mix HTML and PHP code. But views does not need to use namespaces at all, thus there is no pointless endnamespace
tag. Using brackets is the only way to mix two namespaces in one file*.
* I don't count some ugly hacks like using eval()
.
I don't agree withthere is no real need for it
. If there exists{}
for namespaces, to define its start and end, then that means there is a need to end the namespace. and if the namespaces can be declared with two different methods, both of them should have the endings.
– T.Todua
Nov 18 '18 at 16:37
@T.Todua You have two ways of declaring namespace: file-level (declares namespace for the whole file content) and custom-scope-level (declares namespace for content inside of{}
brackets). You don't need custom tag to end file-level namespace, because end of file is natural end for this scope.
– rob006
Nov 18 '18 at 17:34
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53358958%2fend-syntax-for-unbracketed-namespace-to-mix-with-bracketed-namespace%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
There is no alternative syntax and endnamespace
keyword, because there is no real need for it.
Using multiple namespaces in one file is a bad practice and should be avoided anyway, so one way to do this is more than enough. if
and endif
(and similar) was designed for using in templates since it increase readability when you mix HTML and PHP code. But views does not need to use namespaces at all, thus there is no pointless endnamespace
tag. Using brackets is the only way to mix two namespaces in one file*.
* I don't count some ugly hacks like using eval()
.
I don't agree withthere is no real need for it
. If there exists{}
for namespaces, to define its start and end, then that means there is a need to end the namespace. and if the namespaces can be declared with two different methods, both of them should have the endings.
– T.Todua
Nov 18 '18 at 16:37
@T.Todua You have two ways of declaring namespace: file-level (declares namespace for the whole file content) and custom-scope-level (declares namespace for content inside of{}
brackets). You don't need custom tag to end file-level namespace, because end of file is natural end for this scope.
– rob006
Nov 18 '18 at 17:34
add a comment |
There is no alternative syntax and endnamespace
keyword, because there is no real need for it.
Using multiple namespaces in one file is a bad practice and should be avoided anyway, so one way to do this is more than enough. if
and endif
(and similar) was designed for using in templates since it increase readability when you mix HTML and PHP code. But views does not need to use namespaces at all, thus there is no pointless endnamespace
tag. Using brackets is the only way to mix two namespaces in one file*.
* I don't count some ugly hacks like using eval()
.
I don't agree withthere is no real need for it
. If there exists{}
for namespaces, to define its start and end, then that means there is a need to end the namespace. and if the namespaces can be declared with two different methods, both of them should have the endings.
– T.Todua
Nov 18 '18 at 16:37
@T.Todua You have two ways of declaring namespace: file-level (declares namespace for the whole file content) and custom-scope-level (declares namespace for content inside of{}
brackets). You don't need custom tag to end file-level namespace, because end of file is natural end for this scope.
– rob006
Nov 18 '18 at 17:34
add a comment |
There is no alternative syntax and endnamespace
keyword, because there is no real need for it.
Using multiple namespaces in one file is a bad practice and should be avoided anyway, so one way to do this is more than enough. if
and endif
(and similar) was designed for using in templates since it increase readability when you mix HTML and PHP code. But views does not need to use namespaces at all, thus there is no pointless endnamespace
tag. Using brackets is the only way to mix two namespaces in one file*.
* I don't count some ugly hacks like using eval()
.
There is no alternative syntax and endnamespace
keyword, because there is no real need for it.
Using multiple namespaces in one file is a bad practice and should be avoided anyway, so one way to do this is more than enough. if
and endif
(and similar) was designed for using in templates since it increase readability when you mix HTML and PHP code. But views does not need to use namespaces at all, thus there is no pointless endnamespace
tag. Using brackets is the only way to mix two namespaces in one file*.
* I don't count some ugly hacks like using eval()
.
answered Nov 18 '18 at 11:25
rob006rob006
9,1843932
9,1843932
I don't agree withthere is no real need for it
. If there exists{}
for namespaces, to define its start and end, then that means there is a need to end the namespace. and if the namespaces can be declared with two different methods, both of them should have the endings.
– T.Todua
Nov 18 '18 at 16:37
@T.Todua You have two ways of declaring namespace: file-level (declares namespace for the whole file content) and custom-scope-level (declares namespace for content inside of{}
brackets). You don't need custom tag to end file-level namespace, because end of file is natural end for this scope.
– rob006
Nov 18 '18 at 17:34
add a comment |
I don't agree withthere is no real need for it
. If there exists{}
for namespaces, to define its start and end, then that means there is a need to end the namespace. and if the namespaces can be declared with two different methods, both of them should have the endings.
– T.Todua
Nov 18 '18 at 16:37
@T.Todua You have two ways of declaring namespace: file-level (declares namespace for the whole file content) and custom-scope-level (declares namespace for content inside of{}
brackets). You don't need custom tag to end file-level namespace, because end of file is natural end for this scope.
– rob006
Nov 18 '18 at 17:34
I don't agree with
there is no real need for it
. If there exists {}
for namespaces, to define its start and end, then that means there is a need to end the namespace. and if the namespaces can be declared with two different methods, both of them should have the endings.– T.Todua
Nov 18 '18 at 16:37
I don't agree with
there is no real need for it
. If there exists {}
for namespaces, to define its start and end, then that means there is a need to end the namespace. and if the namespaces can be declared with two different methods, both of them should have the endings.– T.Todua
Nov 18 '18 at 16:37
@T.Todua You have two ways of declaring namespace: file-level (declares namespace for the whole file content) and custom-scope-level (declares namespace for content inside of
{}
brackets). You don't need custom tag to end file-level namespace, because end of file is natural end for this scope.– rob006
Nov 18 '18 at 17:34
@T.Todua You have two ways of declaring namespace: file-level (declares namespace for the whole file content) and custom-scope-level (declares namespace for content inside of
{}
brackets). You don't need custom tag to end file-level namespace, because end of file is natural end for this scope.– rob006
Nov 18 '18 at 17:34
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53358958%2fend-syntax-for-unbracketed-namespace-to-mix-with-bracketed-namespace%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
I would like to emphasise the comment in the answer However is strongly not recommended to declare two namespaces inside same php script
– Nigel Ren
Nov 18 '18 at 8:12
1
No, it's not possible. Hence the fatal error Cannot mix bracketed namespace declarations with unbracketed namespace declarations...
– revo
Nov 18 '18 at 8:13
@NigelRen are you sure that this is a duplicate question? please, re-read it -it is different.
– T.Todua
Nov 18 '18 at 8:16
I flagged the dupe as that is how is has to be done AFAIK. If you want me to remove it and see if anyone can come up with something else then I will. It would probably help if you added a specific use case so that it would explain why you want to do this to make the context clearer (IMHO).
– Nigel Ren
Nov 18 '18 at 8:22
The dupe I flagged was stackoverflow.com/questions/22606792/…, but see if anything else comes up.
– Nigel Ren
Nov 18 '18 at 8:24